///<summary>Updates one Medicationm in the database.</summary> internal static void Update(Medicationm medicationm){ string command="UPDATE medicationm SET " +"MedName = '"+POut.String(medicationm.MedName)+"', " +"GenericNum = "+POut.Long (medicationm.GenericNum)+", " +"RxCui = "+POut.Long (medicationm.RxCui)+" " +"WHERE CustomerNum = "+POut.Long(medicationm.CustomerNum)+" AND MedicationNum = "+POut.Long(medicationm.MedicationNum); Db.NonQ(command); }
///<summary>Updates one Medicationm in the database.</summary> internal static void Update(Medicationm medicationm) { string command = "UPDATE medicationm SET " + "MedName = '" + POut.String(medicationm.MedName) + "', " + "GenericNum = " + POut.Long(medicationm.GenericNum) + ", " + "RxCui = " + POut.Long(medicationm.RxCui) + " " + "WHERE CustomerNum = " + POut.Long(medicationm.CustomerNum) + " AND MedicationNum = " + POut.Long(medicationm.MedicationNum); Db.NonQ(command); }
///<summary>Converts one Medication object to its mobile equivalent. Warning! CustomerNum will always be 0.</summary> internal static Medicationm ConvertToM(Medication medication) { Medicationm medicationm = new Medicationm(); //CustomerNum cannot be set. Remains 0. medicationm.MedicationNum = medication.MedicationNum; medicationm.MedName = medication.MedName; medicationm.GenericNum = medication.GenericNum; medicationm.RxCui = medication.RxCui; return(medicationm); }
///<summary>Converts a DataTable to a list of objects.</summary> internal static List<Medicationm> TableToList(DataTable table){ List<Medicationm> retVal=new List<Medicationm>(); Medicationm medicationm; for(int i=0;i<table.Rows.Count;i++) { medicationm=new Medicationm(); medicationm.CustomerNum = PIn.Long (table.Rows[i]["CustomerNum"].ToString()); medicationm.MedicationNum= PIn.Long (table.Rows[i]["MedicationNum"].ToString()); medicationm.MedName = PIn.String(table.Rows[i]["MedName"].ToString()); medicationm.GenericNum = PIn.Long (table.Rows[i]["GenericNum"].ToString()); medicationm.RxCui = PIn.Long (table.Rows[i]["RxCui"].ToString()); retVal.Add(medicationm); } return retVal; }
///<summary>Usually set useExistingPK=true. Inserts one Medicationm into the database.</summary> internal static long Insert(Medicationm medicationm,bool useExistingPK){ if(!useExistingPK) { medicationm.MedicationNum=ReplicationServers.GetKey("medicationm","MedicationNum"); } string command="INSERT INTO medicationm ("; command+="MedicationNum,"; command+="CustomerNum,MedName,GenericNum,RxCui) VALUES("; command+=POut.Long(medicationm.MedicationNum)+","; command+= POut.Long (medicationm.CustomerNum)+"," +"'"+POut.String(medicationm.MedName)+"'," + POut.Long (medicationm.GenericNum)+"," + POut.Long (medicationm.RxCui)+")"; Db.NonQ(command);//There is no autoincrement in the mobile server. return medicationm.MedicationNum; }
///<summary>Converts a DataTable to a list of objects.</summary> internal static List <Medicationm> TableToList(DataTable table) { List <Medicationm> retVal = new List <Medicationm>(); Medicationm medicationm; for (int i = 0; i < table.Rows.Count; i++) { medicationm = new Medicationm(); medicationm.CustomerNum = PIn.Long(table.Rows[i]["CustomerNum"].ToString()); medicationm.MedicationNum = PIn.Long(table.Rows[i]["MedicationNum"].ToString()); medicationm.MedName = PIn.String(table.Rows[i]["MedName"].ToString()); medicationm.GenericNum = PIn.Long(table.Rows[i]["GenericNum"].ToString()); medicationm.RxCui = PIn.Long(table.Rows[i]["RxCui"].ToString()); retVal.Add(medicationm); } return(retVal); }
///<summary>Usually set useExistingPK=true. Inserts one Medicationm into the database.</summary> internal static long Insert(Medicationm medicationm, bool useExistingPK) { if (!useExistingPK) { medicationm.MedicationNum = ReplicationServers.GetKey("medicationm", "MedicationNum"); } string command = "INSERT INTO medicationm ("; command += "MedicationNum,"; command += "CustomerNum,MedName,GenericNum,RxCui) VALUES("; command += POut.Long(medicationm.MedicationNum) + ","; command += POut.Long(medicationm.CustomerNum) + "," + "'" + POut.String(medicationm.MedName) + "'," + POut.Long(medicationm.GenericNum) + "," + POut.Long(medicationm.RxCui) + ")"; Db.NonQ(command); //There is no autoincrement in the mobile server. return(medicationm.MedicationNum); }
///<summary>Converts one Medication object to its mobile equivalent. Warning! CustomerNum will always be 0.</summary> internal static Medicationm ConvertToM(Medication medication){ Medicationm medicationm=new Medicationm(); //CustomerNum cannot be set. Remains 0. medicationm.MedicationNum=medication.MedicationNum; medicationm.MedName =medication.MedName; medicationm.GenericNum =medication.GenericNum; medicationm.RxCui =medication.RxCui; return medicationm; }