Esempio n. 1
0
        /// <summary>GetFieldName returns the field name identified by the field definition number passed as a parameter.</summary>
        public static string GetFieldName(long patFieldDefNum)
        {
            //No need to check RemotingRole; no call to db.
            PatFieldDef patFieldDef = GetFirstOrDefault(x => x.PatFieldDefNum == patFieldDefNum, true);

            return(patFieldDef == null ? "" : patFieldDef.FieldName);
        }
Esempio n. 2
0
        /// <summary>GetPickListByFieldName returns the pick list identified by the field name passed as a parameter.</summary>
        public static string GetPickListByFieldName(string FieldName)
        {
            //No need to check RemotingRole; no call to db.
            PatFieldDef patFieldDef = GetFirstOrDefault(x => x.FieldName == FieldName, true);

            return(patFieldDef == null ? "" : patFieldDef.PickList);
        }
Esempio n. 3
0
		///<summary></summary>
		public static long Insert(PatFieldDef patFieldDef) {
			if(RemotingClient.RemotingRole==RemotingRole.ClientWeb) {
				patFieldDef.PatFieldDefNum=Meth.GetLong(MethodBase.GetCurrentMethod(),patFieldDef);
				return patFieldDef.PatFieldDefNum;
			}
			return Crud.PatFieldDefCrud.Insert(patFieldDef);
		}
Esempio n. 4
0
        ///<summary>Surround with try/catch, because it will throw an exception if any patient is using this def.</summary>
        public static void Delete(PatFieldDef patFieldDef)
        {
            if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
            {
                Meth.GetVoid(MethodBase.GetCurrentMethod(), patFieldDef);
                return;
            }
            string command = "SELECT LName,FName FROM patient,patfield WHERE "
                             + "patient.PatNum=patfield.PatNum "
                             + "AND FieldName='" + POut.String(patFieldDef.FieldName) + "'";
            DataTable table = Db.GetTable(command);

            if (table.Rows.Count > 0)
            {
                string s = Lans.g("PatFieldDef", "Not allowed to delete. Already in use by ") + table.Rows.Count.ToString()
                           + " " + Lans.g("PatFieldDef", "patients, including") + " \r\n";
                for (int i = 0; i < table.Rows.Count; i++)
                {
                    if (i > 5)
                    {
                        break;
                    }
                    s += table.Rows[i][0].ToString() + ", " + table.Rows[i][1].ToString() + "\r\n";
                }
                throw new ApplicationException(s);
            }
            command = "DELETE FROM patfielddef WHERE PatFieldDefNum =" + POut.Long(patFieldDef.PatFieldDefNum);
            Db.NonQ(command);
        }
Esempio n. 5
0
        ///<summary></summary>
        public PatFieldDef Copy()
        {
            PatFieldDef p = new PatFieldDef();

            p.PatFieldDefNum = PatFieldDefNum;
            p.FieldName      = FieldName;
            return(p);
        }
Esempio n. 6
0
 ///<summary></summary>
 public static long Insert(PatFieldDef patFieldDef)
 {
     if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
     {
         patFieldDef.PatFieldDefNum = Meth.GetLong(MethodBase.GetCurrentMethod(), patFieldDef);
         return(patFieldDef.PatFieldDefNum);
     }
     return(Crud.PatFieldDefCrud.Insert(patFieldDef));
 }
Esempio n. 7
0
		///<summary></summary>
		public FormPatFieldDefEdit(PatFieldDef fieldDef)
		{
			//
			// Required for Windows Form Designer support
			//
			InitializeComponent();
			Lan.F(this);
			FieldDef=fieldDef;
		}
Esempio n. 8
0
		///<summary>Must supply the old field name so that the patient lists can be updated.</summary>
		public static void Update(PatFieldDef patFieldDef, string oldFieldName) {
			if(RemotingClient.RemotingRole==RemotingRole.ClientWeb) {
				Meth.GetVoid(MethodBase.GetCurrentMethod(),patFieldDef,oldFieldName);
				return;
			}
			Crud.PatFieldDefCrud.Update(patFieldDef);
			string command="UPDATE patfield SET FieldName='"+POut.String(patFieldDef.FieldName)+"' "
				+"WHERE FieldName='"+POut.String(oldFieldName)+"'";
			Db.NonQ(command);
		}
Esempio n. 9
0
		///<summary></summary>
		public static void FillCache(DataTable table) {
			//No need to check RemotingRole; no call to db.
			List=new PatFieldDef[table.Rows.Count];
			for(int i=0;i<table.Rows.Count;i++) {
				List[i]=new PatFieldDef();
				List[i].PatFieldDefNum=PIn.Long(table.Rows[i][0].ToString());
				List[i].FieldName=PIn.String(table.Rows[i][1].ToString());
				List[i].FieldType=(PatFieldType)PIn.Int(table.Rows[i][2].ToString());
				List[i].PickList=PIn.String(table.Rows[i][3].ToString());
			}
		}
Esempio n. 10
0
        ///<summary>Must supply the old field name so that the patient lists can be updated.</summary>
        public static void Update(PatFieldDef patFieldDef, string oldFieldName)
        {
            if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
            {
                Meth.GetVoid(MethodBase.GetCurrentMethod(), patFieldDef, oldFieldName);
                return;
            }
            Crud.PatFieldDefCrud.Update(patFieldDef);
            string command = "UPDATE patfield SET FieldName='" + POut.String(patFieldDef.FieldName) + "' "
                             + "WHERE FieldName='" + POut.String(oldFieldName) + "'";

            Db.NonQ(command);
        }
Esempio n. 11
0
 ///<summary></summary>
 public static void FillCache(DataTable table)
 {
     //No need to check RemotingRole; no call to db.
     List = new PatFieldDef[table.Rows.Count];
     for (int i = 0; i < table.Rows.Count; i++)
     {
         List[i] = new PatFieldDef();
         List[i].PatFieldDefNum = PIn.Long(table.Rows[i][0].ToString());
         List[i].FieldName      = PIn.String(table.Rows[i][1].ToString());
         List[i].FieldType      = (PatFieldType)PIn.Int(table.Rows[i][2].ToString());
         List[i].PickList       = PIn.String(table.Rows[i][3].ToString());
     }
 }
Esempio n. 12
0
		///<summary>Surround with try/catch, because it will throw an exception if any patient is using this def.</summary>
		public static void Delete(PatFieldDef patFieldDef) {
			if(RemotingClient.RemotingRole==RemotingRole.ClientWeb) {
				Meth.GetVoid(MethodBase.GetCurrentMethod(),patFieldDef);
				return;
			}
			string command="SELECT LName,FName FROM patient,patfield WHERE "
				+"patient.PatNum=patfield.PatNum "
				+"AND FieldName='"+POut.String(patFieldDef.FieldName)+"'";
			DataTable table=Db.GetTable(command);
			if(table.Rows.Count>0){
				string s=Lans.g("PatFieldDef","Not allowed to delete. Already in use by ")+table.Rows.Count.ToString()
					+" "+Lans.g("PatFieldDef","patients, including")+" \r\n";
				for(int i=0;i<table.Rows.Count;i++){
					if(i>5){
						break;
					}
					s+=table.Rows[i][0].ToString()+", "+table.Rows[i][1].ToString()+"\r\n";
				}
				throw new ApplicationException(s);
			}
			command="DELETE FROM patfielddef WHERE PatFieldDefNum ="+POut.Long(patFieldDef.PatFieldDefNum);
			Db.NonQ(command);
		}
Esempio n. 13
0
		private void butAdd_Click(object sender, System.EventArgs e) {
			//Employers.Cur=new Employer();
			PatFieldDef def=new PatFieldDef();
			FormPatFieldDefEdit FormP=new FormPatFieldDefEdit(def);
			FormP.IsNew=true;
			FormP.ShowDialog();
			FillGrid();
		}