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