2024-03-28 15:04:52 -04:00
|
|
|
|
using System;
|
2024-03-29 09:47:23 -04:00
|
|
|
|
using System.Data;
|
2024-03-28 15:04:52 -04:00
|
|
|
|
using System.Web.UI.WebControls;
|
|
|
|
|
|
|
|
|
|
namespace FWA_MAIN
|
|
|
|
|
{
|
|
|
|
|
public class Val
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
public static string varchar(TextBox box, int length)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
if (box.Text.Length <= length)
|
|
|
|
|
{
|
|
|
|
|
return box.Text.Trim();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
return "";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static int IntType(TextBox box)
|
|
|
|
|
{
|
|
|
|
|
|
2024-03-28 15:21:56 -04:00
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
return int.Parse(box.Text.Trim());
|
|
|
|
|
}
|
|
|
|
|
catch (Exception e)
|
|
|
|
|
{
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
2024-03-28 15:04:52 -04:00
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static short SmallIntType(TextBox box)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
if (box.Text.Length > 0)
|
|
|
|
|
{
|
|
|
|
|
if (double.Parse(box.Text) < 65535 && double.Parse(box.Text) >= 0)
|
|
|
|
|
{
|
|
|
|
|
return short.Parse(box.Text.Trim());
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception e)
|
|
|
|
|
{
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-03-29 09:47:23 -04:00
|
|
|
|
public static string PatID(TextBox box)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
string word = box.Text.Trim();
|
|
|
|
|
|
|
|
|
|
while (word.Length < 8)
|
|
|
|
|
{
|
|
|
|
|
word = "0" + word;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DataSet ds = PharmacyDataTier.PatientInfoSearch(word);
|
|
|
|
|
|
|
|
|
|
if (ds.Tables[0].Rows.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
return word;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
return "00000000";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
public static string MedID(TextBox box)
|
|
|
|
|
{
|
|
|
|
|
string word = box.Text.Trim();
|
|
|
|
|
|
|
|
|
|
while (word.Length < 7)
|
|
|
|
|
{
|
|
|
|
|
word = "0" + word;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DataSet ds = PharmacyDataTier.MedicationInfoSearch(word);
|
|
|
|
|
|
|
|
|
|
if (ds.Tables[0].Rows.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
return word;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
return "0000000";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public static string PhyID(TextBox box)
|
|
|
|
|
{
|
|
|
|
|
string word = box.Text.Trim();
|
|
|
|
|
|
|
|
|
|
while (word.Length < 8)
|
|
|
|
|
{
|
|
|
|
|
word = "0" + word;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DataSet ds = PharmacyDataTier.PhysicianInfoSearch(word);
|
|
|
|
|
|
|
|
|
|
if (ds.Tables[0].Rows.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
return word;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
return "00000000";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-03-28 15:04:52 -04:00
|
|
|
|
public static DateTime Date(TextBox box)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
DateTime date = DateTime.Parse(box.Text.Trim());
|
|
|
|
|
|
2024-03-28 19:23:49 -04:00
|
|
|
|
if (date < new DateTime(1753,1,1) || date > new DateTime(9999,12,31))
|
|
|
|
|
{
|
|
|
|
|
throw new Exception();
|
|
|
|
|
}
|
|
|
|
|
|
2024-03-28 15:04:52 -04:00
|
|
|
|
return date;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
catch (Exception e)
|
|
|
|
|
{
|
|
|
|
|
return new DateTime(3000, 1, 1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|