///<summary>Updates one Recallm in the database.</summary> internal static void Update(Recallm recallm) { string command = "UPDATE recallm SET " + "PatNum = " + POut.Long(recallm.PatNum) + ", " + "DateDue = " + POut.Date(recallm.DateDue) + ", " + "DatePrevious = " + POut.Date(recallm.DatePrevious) + ", " + "RecallStatus = " + POut.Long(recallm.RecallStatus) + ", " + "Note = '" + POut.String(recallm.Note) + "', " + "IsDisabled = " + POut.Bool(recallm.IsDisabled) + ", " + "DisableUntilBalance= '" + POut.Double(recallm.DisableUntilBalance) + "', " + "DisableUntilDate = " + POut.Date(recallm.DisableUntilDate) + " " + "WHERE CustomerNum = " + POut.Long(recallm.CustomerNum) + " AND RecallNum = " + POut.Long(recallm.RecallNum); Db.NonQ(command); }
///<summary>Converts one Recall object to its mobile equivalent. Warning! CustomerNum will always be 0.</summary> internal static Recallm ConvertToM(Recall recall) { Recallm recallm = new Recallm(); //CustomerNum cannot be set. Remains 0. recallm.RecallNum = recall.RecallNum; recallm.PatNum = recall.PatNum; recallm.DateDue = recall.DateDue; recallm.DatePrevious = recall.DatePrevious; recallm.RecallStatus = recall.RecallStatus; recallm.Note = recall.Note; recallm.IsDisabled = recall.IsDisabled; recallm.DisableUntilBalance = recall.DisableUntilBalance; recallm.DisableUntilDate = recall.DisableUntilDate; return(recallm); }
///<summary>Converts a DataTable to a list of objects.</summary> internal static List<Recallm> TableToList(DataTable table){ List<Recallm> retVal=new List<Recallm>(); Recallm recallm; for(int i=0;i<table.Rows.Count;i++) { recallm=new Recallm(); recallm.CustomerNum = PIn.Long (table.Rows[i]["CustomerNum"].ToString()); recallm.RecallNum = PIn.Long (table.Rows[i]["RecallNum"].ToString()); recallm.PatNum = PIn.Long (table.Rows[i]["PatNum"].ToString()); recallm.DateDue = PIn.Date (table.Rows[i]["DateDue"].ToString()); recallm.DatePrevious = PIn.Date (table.Rows[i]["DatePrevious"].ToString()); recallm.RecallStatus = PIn.Long (table.Rows[i]["RecallStatus"].ToString()); recallm.Note = PIn.String(table.Rows[i]["Note"].ToString()); recallm.IsDisabled = PIn.Bool (table.Rows[i]["IsDisabled"].ToString()); recallm.DisableUntilBalance= PIn.Double(table.Rows[i]["DisableUntilBalance"].ToString()); recallm.DisableUntilDate = PIn.Date (table.Rows[i]["DisableUntilDate"].ToString()); retVal.Add(recallm); } return retVal; }
///<summary>Usually set useExistingPK=true. Inserts one Recallm into the database.</summary> internal static long Insert(Recallm recallm,bool useExistingPK){ if(!useExistingPK) { recallm.RecallNum=ReplicationServers.GetKey("recallm","RecallNum"); } string command="INSERT INTO recallm ("; command+="RecallNum,"; command+="CustomerNum,PatNum,DateDue,DatePrevious,RecallStatus,Note,IsDisabled,DisableUntilBalance,DisableUntilDate) VALUES("; command+=POut.Long(recallm.RecallNum)+","; command+= POut.Long (recallm.CustomerNum)+"," + POut.Long (recallm.PatNum)+"," + POut.Date (recallm.DateDue)+"," + POut.Date (recallm.DatePrevious)+"," + POut.Long (recallm.RecallStatus)+"," +"'"+POut.String(recallm.Note)+"'," + POut.Bool (recallm.IsDisabled)+"," +"'"+POut.Double(recallm.DisableUntilBalance)+"'," + POut.Date (recallm.DisableUntilDate)+")"; Db.NonQ(command);//There is no autoincrement in the mobile server. return recallm.RecallNum; }
///<summary>Converts a DataTable to a list of objects.</summary> internal static List <Recallm> TableToList(DataTable table) { List <Recallm> retVal = new List <Recallm>(); Recallm recallm; for (int i = 0; i < table.Rows.Count; i++) { recallm = new Recallm(); recallm.CustomerNum = PIn.Long(table.Rows[i]["CustomerNum"].ToString()); recallm.RecallNum = PIn.Long(table.Rows[i]["RecallNum"].ToString()); recallm.PatNum = PIn.Long(table.Rows[i]["PatNum"].ToString()); recallm.DateDue = PIn.Date(table.Rows[i]["DateDue"].ToString()); recallm.DatePrevious = PIn.Date(table.Rows[i]["DatePrevious"].ToString()); recallm.RecallStatus = PIn.Long(table.Rows[i]["RecallStatus"].ToString()); recallm.Note = PIn.String(table.Rows[i]["Note"].ToString()); recallm.IsDisabled = PIn.Bool(table.Rows[i]["IsDisabled"].ToString()); recallm.DisableUntilBalance = PIn.Double(table.Rows[i]["DisableUntilBalance"].ToString()); recallm.DisableUntilDate = PIn.Date(table.Rows[i]["DisableUntilDate"].ToString()); retVal.Add(recallm); } return(retVal); }
///<summary>Usually set useExistingPK=true. Inserts one Recallm into the database.</summary> internal static long Insert(Recallm recallm, bool useExistingPK) { if (!useExistingPK) { recallm.RecallNum = ReplicationServers.GetKey("recallm", "RecallNum"); } string command = "INSERT INTO recallm ("; command += "RecallNum,"; command += "CustomerNum,PatNum,DateDue,DatePrevious,RecallStatus,Note,IsDisabled,DisableUntilBalance,DisableUntilDate) VALUES("; command += POut.Long(recallm.RecallNum) + ","; command += POut.Long(recallm.CustomerNum) + "," + POut.Long(recallm.PatNum) + "," + POut.Date(recallm.DateDue) + "," + POut.Date(recallm.DatePrevious) + "," + POut.Long(recallm.RecallStatus) + "," + "'" + POut.String(recallm.Note) + "'," + POut.Bool(recallm.IsDisabled) + "," + "'" + POut.Double(recallm.DisableUntilBalance) + "'," + POut.Date(recallm.DisableUntilDate) + ")"; Db.NonQ(command); //There is no autoincrement in the mobile server. return(recallm.RecallNum); }
///<summary>Updates one Recallm in the database.</summary> internal static void Update(Recallm recallm){ string command="UPDATE recallm SET " +"PatNum = "+POut.Long (recallm.PatNum)+", " +"DateDue = "+POut.Date (recallm.DateDue)+", " +"DatePrevious = "+POut.Date (recallm.DatePrevious)+", " +"RecallStatus = "+POut.Long (recallm.RecallStatus)+", " +"Note = '"+POut.String(recallm.Note)+"', " +"IsDisabled = "+POut.Bool (recallm.IsDisabled)+", " +"DisableUntilBalance= '"+POut.Double(recallm.DisableUntilBalance)+"', " +"DisableUntilDate = "+POut.Date (recallm.DisableUntilDate)+" " +"WHERE CustomerNum = "+POut.Long(recallm.CustomerNum)+" AND RecallNum = "+POut.Long(recallm.RecallNum); Db.NonQ(command); }
///<summary>Converts one Recall object to its mobile equivalent. Warning! CustomerNum will always be 0.</summary> internal static Recallm ConvertToM(Recall recall){ Recallm recallm=new Recallm(); //CustomerNum cannot be set. Remains 0. recallm.RecallNum =recall.RecallNum; recallm.PatNum =recall.PatNum; recallm.DateDue =recall.DateDue; recallm.DatePrevious =recall.DatePrevious; recallm.RecallStatus =recall.RecallStatus; recallm.Note =recall.Note; recallm.IsDisabled =recall.IsDisabled; recallm.DisableUntilBalance=recall.DisableUntilBalance; recallm.DisableUntilDate =recall.DisableUntilDate; return recallm; }