///<summary>Converts a DataTable to a list of objects.</summary> internal static List <LabCase> TableToList(DataTable table) { List <LabCase> retVal = new List <LabCase>(); LabCase labCase; for (int i = 0; i < table.Rows.Count; i++) { labCase = new LabCase(); labCase.LabCaseNum = PIn.Long(table.Rows[i]["LabCaseNum"].ToString()); labCase.PatNum = PIn.Long(table.Rows[i]["PatNum"].ToString()); labCase.LaboratoryNum = PIn.Long(table.Rows[i]["LaboratoryNum"].ToString()); labCase.AptNum = PIn.Long(table.Rows[i]["AptNum"].ToString()); labCase.PlannedAptNum = PIn.Long(table.Rows[i]["PlannedAptNum"].ToString()); labCase.DateTimeDue = PIn.DateT(table.Rows[i]["DateTimeDue"].ToString()); labCase.DateTimeCreated = PIn.DateT(table.Rows[i]["DateTimeCreated"].ToString()); labCase.DateTimeSent = PIn.DateT(table.Rows[i]["DateTimeSent"].ToString()); labCase.DateTimeRecd = PIn.DateT(table.Rows[i]["DateTimeRecd"].ToString()); labCase.DateTimeChecked = PIn.DateT(table.Rows[i]["DateTimeChecked"].ToString()); labCase.ProvNum = PIn.Long(table.Rows[i]["ProvNum"].ToString()); labCase.Instructions = PIn.String(table.Rows[i]["Instructions"].ToString()); labCase.LabFee = PIn.Double(table.Rows[i]["LabFee"].ToString()); retVal.Add(labCase); } return(retVal); }
public async Task <ActionResult <LabCase> > PostLabCase(LabCase labCase) { _context.LabCases.Add(labCase); await _context.SaveChangesAsync(); return(await _context.LabCases.Include(l => l.Lab).FirstOrDefaultAsync(l => l.LabCaseId == labCase.LabCaseId)); }
///<summary>Converts a DataTable to a list of objects.</summary> public static List <LabCase> TableToList(DataTable table) { List <LabCase> retVal = new List <LabCase>(); LabCase labCase; foreach (DataRow row in table.Rows) { labCase = new LabCase(); labCase.LabCaseNum = PIn.Long(row["LabCaseNum"].ToString()); labCase.PatNum = PIn.Long(row["PatNum"].ToString()); labCase.LaboratoryNum = PIn.Long(row["LaboratoryNum"].ToString()); labCase.AptNum = PIn.Long(row["AptNum"].ToString()); labCase.PlannedAptNum = PIn.Long(row["PlannedAptNum"].ToString()); labCase.DateTimeDue = PIn.DateT(row["DateTimeDue"].ToString()); labCase.DateTimeCreated = PIn.DateT(row["DateTimeCreated"].ToString()); labCase.DateTimeSent = PIn.DateT(row["DateTimeSent"].ToString()); labCase.DateTimeRecd = PIn.DateT(row["DateTimeRecd"].ToString()); labCase.DateTimeChecked = PIn.DateT(row["DateTimeChecked"].ToString()); labCase.ProvNum = PIn.Long(row["ProvNum"].ToString()); labCase.Instructions = PIn.String(row["Instructions"].ToString()); labCase.LabFee = PIn.Double(row["LabFee"].ToString()); labCase.DateTStamp = PIn.DateT(row["DateTStamp"].ToString()); retVal.Add(labCase); } return(retVal); }
///<summary>Updates one LabCase in the database.</summary> public static void Update(LabCase labCase) { string command = "UPDATE labcase SET " + "PatNum = " + POut.Long(labCase.PatNum) + ", " + "LaboratoryNum = " + POut.Long(labCase.LaboratoryNum) + ", " + "AptNum = " + POut.Long(labCase.AptNum) + ", " + "PlannedAptNum = " + POut.Long(labCase.PlannedAptNum) + ", " + "DateTimeDue = " + POut.DateT(labCase.DateTimeDue) + ", " + "DateTimeCreated= " + POut.DateT(labCase.DateTimeCreated) + ", " + "DateTimeSent = " + POut.DateT(labCase.DateTimeSent) + ", " + "DateTimeRecd = " + POut.DateT(labCase.DateTimeRecd) + ", " + "DateTimeChecked= " + POut.DateT(labCase.DateTimeChecked) + ", " + "ProvNum = " + POut.Long(labCase.ProvNum) + ", " + "Instructions = " + DbHelper.ParamChar + "paramInstructions, " + "LabFee = '" + POut.Double(labCase.LabFee) + "' " //DateTStamp can only be set by MySQL + "WHERE LabCaseNum = " + POut.Long(labCase.LabCaseNum); if (labCase.Instructions == null) { labCase.Instructions = ""; } OdSqlParameter paramInstructions = new OdSqlParameter("paramInstructions", OdDbType.Text, POut.StringParam(labCase.Instructions)); Db.NonQ(command, paramInstructions); }
///<summary>Inserts one LabCase into the database. Returns the new priKey.</summary> internal static long Insert(LabCase labCase) { if(DataConnection.DBtype==DatabaseType.Oracle) { labCase.LabCaseNum=DbHelper.GetNextOracleKey("labcase","LabCaseNum"); int loopcount=0; while(loopcount<100){ try { return Insert(labCase,true); } catch(Oracle.DataAccess.Client.OracleException ex){ if(ex.Number==1 && ex.Message.ToLower().Contains("unique constraint") && ex.Message.ToLower().Contains("violated")){ labCase.LabCaseNum++; loopcount++; } else{ throw ex; } } } throw new ApplicationException("Insert failed. Could not generate primary key."); } else { return Insert(labCase,false); } }
///<summary>Inserts one LabCase into the database. Provides option to use the existing priKey.</summary> internal static long Insert(LabCase labCase,bool useExistingPK) { if(!useExistingPK && PrefC.RandomKeys) { labCase.LabCaseNum=ReplicationServers.GetKey("labcase","LabCaseNum"); } string command="INSERT INTO labcase ("; if(useExistingPK || PrefC.RandomKeys) { command+="LabCaseNum,"; } command+="PatNum,LaboratoryNum,AptNum,PlannedAptNum,DateTimeDue,DateTimeCreated,DateTimeSent,DateTimeRecd,DateTimeChecked,ProvNum,Instructions,LabFee) VALUES("; if(useExistingPK || PrefC.RandomKeys) { command+=POut.Long(labCase.LabCaseNum)+","; } command+= POut.Long (labCase.PatNum)+"," + POut.Long (labCase.LaboratoryNum)+"," + POut.Long (labCase.AptNum)+"," + POut.Long (labCase.PlannedAptNum)+"," + POut.DateT (labCase.DateTimeDue)+"," + POut.DateT (labCase.DateTimeCreated)+"," + POut.DateT (labCase.DateTimeSent)+"," + POut.DateT (labCase.DateTimeRecd)+"," + POut.DateT (labCase.DateTimeChecked)+"," + POut.Long (labCase.ProvNum)+"," +"'"+POut.String(labCase.Instructions)+"'," +"'"+POut.Double(labCase.LabFee)+"')"; if(useExistingPK || PrefC.RandomKeys) { Db.NonQ(command); } else { labCase.LabCaseNum=Db.NonQ(command,true); } return labCase.LabCaseNum; }
public async Task <IActionResult> PutLabCase(int id, LabCase labCase) { if (id != labCase.LabCaseId) { return(BadRequest()); } _context.Entry(labCase).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!LabCaseExists(id)) { return(NotFound()); } else { throw; } } return(Ok(labCase)); }
///<summary>Inserts one LabCase into the database. Returns the new priKey.</summary> public static long Insert(LabCase labCase) { if (DataConnection.DBtype == DatabaseType.Oracle) { labCase.LabCaseNum = DbHelper.GetNextOracleKey("labcase", "LabCaseNum"); int loopcount = 0; while (loopcount < 100) { try { return(Insert(labCase, true)); } catch (Oracle.ManagedDataAccess.Client.OracleException ex) { if (ex.Number == 1 && ex.Message.ToLower().Contains("unique constraint") && ex.Message.ToLower().Contains("violated")) { labCase.LabCaseNum++; loopcount++; } else { throw ex; } } } throw new ApplicationException("Insert failed. Could not generate primary key."); } else { return(Insert(labCase, false)); } }
public static List <LabCase> FillFromCommand(string command) { DataTable table = General.GetTable(command); LabCase lab; List <LabCase> retVal = new List <LabCase>(); for (int i = 0; i < table.Rows.Count; i++) { lab = new LabCase(); lab.LabCaseNum = PIn.PInt(table.Rows[i][0].ToString()); lab.PatNum = PIn.PInt(table.Rows[i][1].ToString()); lab.LaboratoryNum = PIn.PInt(table.Rows[i][2].ToString()); lab.AptNum = PIn.PInt(table.Rows[i][3].ToString()); lab.PlannedAptNum = PIn.PInt(table.Rows[i][4].ToString()); lab.DateTimeDue = PIn.PDateT(table.Rows[i][5].ToString()); lab.DateTimeCreated = PIn.PDateT(table.Rows[i][6].ToString()); lab.DateTimeSent = PIn.PDateT(table.Rows[i][7].ToString()); lab.DateTimeRecd = PIn.PDateT(table.Rows[i][8].ToString()); lab.DateTimeChecked = PIn.PDateT(table.Rows[i][9].ToString()); lab.ProvNum = PIn.PInt(table.Rows[i][10].ToString()); lab.Instructions = PIn.PString(table.Rows[i][11].ToString()); retVal.Add(lab); } return(retVal); }
///<summary>Returns true if Update(LabCase,LabCase) would make changes to the database. ///Does not make any changes to the database and can be called before remoting role is checked.</summary> public static bool UpdateComparison(LabCase labCase, LabCase oldLabCase) { if (labCase.PatNum != oldLabCase.PatNum) { return(true); } if (labCase.LaboratoryNum != oldLabCase.LaboratoryNum) { return(true); } if (labCase.AptNum != oldLabCase.AptNum) { return(true); } if (labCase.PlannedAptNum != oldLabCase.PlannedAptNum) { return(true); } if (labCase.DateTimeDue != oldLabCase.DateTimeDue) { return(true); } if (labCase.DateTimeCreated != oldLabCase.DateTimeCreated) { return(true); } if (labCase.DateTimeSent != oldLabCase.DateTimeSent) { return(true); } if (labCase.DateTimeRecd != oldLabCase.DateTimeRecd) { return(true); } if (labCase.DateTimeChecked != oldLabCase.DateTimeChecked) { return(true); } if (labCase.ProvNum != oldLabCase.ProvNum) { return(true); } if (labCase.Instructions != oldLabCase.Instructions) { return(true); } if (labCase.LabFee != oldLabCase.LabFee) { return(true); } //DateTStamp can only be set by MySQL if (labCase.InvoiceNum != oldLabCase.InvoiceNum) { return(true); } return(false); }
///<summary>Inserts one LabCase into the database. Provides option to use the existing priKey. Doesn't use the cache.</summary> public static long InsertNoCache(LabCase labCase, bool useExistingPK) { bool isRandomKeys = Prefs.GetBoolNoCache(PrefName.RandomPrimaryKeys); string command = "INSERT INTO labcase ("; if (!useExistingPK && isRandomKeys) { labCase.LabCaseNum = ReplicationServers.GetKeyNoCache("labcase", "LabCaseNum"); } if (isRandomKeys || useExistingPK) { command += "LabCaseNum,"; } command += "PatNum,LaboratoryNum,AptNum,PlannedAptNum,DateTimeDue,DateTimeCreated,DateTimeSent,DateTimeRecd,DateTimeChecked,ProvNum,Instructions,LabFee,InvoiceNum) VALUES("; if (isRandomKeys || useExistingPK) { command += POut.Long(labCase.LabCaseNum) + ","; } command += POut.Long(labCase.PatNum) + "," + POut.Long(labCase.LaboratoryNum) + "," + POut.Long(labCase.AptNum) + "," + POut.Long(labCase.PlannedAptNum) + "," + POut.DateT(labCase.DateTimeDue) + "," + POut.DateT(labCase.DateTimeCreated) + "," + POut.DateT(labCase.DateTimeSent) + "," + POut.DateT(labCase.DateTimeRecd) + "," + POut.DateT(labCase.DateTimeChecked) + "," + POut.Long(labCase.ProvNum) + "," + DbHelper.ParamChar + "paramInstructions," + "'" + POut.Double(labCase.LabFee) + "'," //DateTStamp can only be set by MySQL + "'" + POut.String(labCase.InvoiceNum) + "')"; if (labCase.Instructions == null) { labCase.Instructions = ""; } OdSqlParameter paramInstructions = new OdSqlParameter("paramInstructions", OdDbType.Text, POut.StringParam(labCase.Instructions)); if (useExistingPK || isRandomKeys) { Db.NonQ(command, paramInstructions); } else { labCase.LabCaseNum = Db.NonQ(command, true, "LabCaseNum", "labCase", paramInstructions); } return(labCase.LabCaseNum); }
///<summary>Inserts one LabCase into the database. Returns the new priKey. Doesn't use the cache.</summary> public static long InsertNoCache(LabCase labCase) { if (DataConnection.DBtype == DatabaseType.MySql) { return(InsertNoCache(labCase, false)); } else { if (DataConnection.DBtype == DatabaseType.Oracle) { labCase.LabCaseNum = DbHelper.GetNextOracleKey("labcase", "LabCaseNum"); //Cacheless method } return(InsertNoCache(labCase, true)); } }
///<summary></summary> public static void Update(LabCase lab) { string command = "UPDATE labcase SET " + "PatNum = '" + POut.PInt(lab.PatNum) + "'" + ",LaboratoryNum = '" + POut.PInt(lab.LaboratoryNum) + "'" + ",AptNum = '" + POut.PInt(lab.AptNum) + "'" + ",PlannedAptNum = '" + POut.PInt(lab.PlannedAptNum) + "'" + ",DateTimeDue = " + POut.PDateT(lab.DateTimeDue) + ",DateTimeCreated = " + POut.PDateT(lab.DateTimeCreated) + ",DateTimeSent = " + POut.PDateT(lab.DateTimeSent) + ",DateTimeRecd = " + POut.PDateT(lab.DateTimeRecd) + ",DateTimeChecked = " + POut.PDateT(lab.DateTimeChecked) + ",ProvNum = '" + POut.PInt(lab.ProvNum) + "'" + ",Instructions = '" + POut.PString(lab.Instructions) + "'" + " WHERE LabCaseNum = '" + POut.PInt(lab.LabCaseNum) + "'"; General.NonQ(command); }
///<summary>Updates one LabCase in the database.</summary> internal static void Update(LabCase labCase) { string command = "UPDATE labcase SET " + "PatNum = " + POut.Long(labCase.PatNum) + ", " + "LaboratoryNum = " + POut.Long(labCase.LaboratoryNum) + ", " + "AptNum = " + POut.Long(labCase.AptNum) + ", " + "PlannedAptNum = " + POut.Long(labCase.PlannedAptNum) + ", " + "DateTimeDue = " + POut.DateT(labCase.DateTimeDue) + ", " + "DateTimeCreated= " + POut.DateT(labCase.DateTimeCreated) + ", " + "DateTimeSent = " + POut.DateT(labCase.DateTimeSent) + ", " + "DateTimeRecd = " + POut.DateT(labCase.DateTimeRecd) + ", " + "DateTimeChecked= " + POut.DateT(labCase.DateTimeChecked) + ", " + "ProvNum = " + POut.Long(labCase.ProvNum) + ", " + "Instructions = '" + POut.String(labCase.Instructions) + "', " + "LabFee = '" + POut.Double(labCase.LabFee) + "' " + "WHERE LabCaseNum = " + POut.Long(labCase.LabCaseNum); Db.NonQ(command); }
private void butAdd_Click(object sender, EventArgs e) { LabCase lab = new LabCase(); lab.PatNum = PatNum; Patient pat = Patients.GetPat(PatNum); lab.ProvNum = Patients.GetProvNum(pat); lab.DateTimeCreated = MiscData.GetNowDateTime(); FormLabCaseEdit FormL = new FormLabCaseEdit(); FormL.CaseCur = lab; FormL.IsNew = true; FormL.ShowDialog(); if (FormL.DialogResult != DialogResult.OK) { return; } SelectedLabCaseNum = FormL.CaseCur.LabCaseNum; DialogResult = DialogResult.OK; }
///<summary>Inserts one LabCase into the database. Provides option to use the existing priKey.</summary> internal static long Insert(LabCase labCase, bool useExistingPK) { if (!useExistingPK && PrefC.RandomKeys) { labCase.LabCaseNum = ReplicationServers.GetKey("labcase", "LabCaseNum"); } string command = "INSERT INTO labcase ("; if (useExistingPK || PrefC.RandomKeys) { command += "LabCaseNum,"; } command += "PatNum,LaboratoryNum,AptNum,PlannedAptNum,DateTimeDue,DateTimeCreated,DateTimeSent,DateTimeRecd,DateTimeChecked,ProvNum,Instructions,LabFee) VALUES("; if (useExistingPK || PrefC.RandomKeys) { command += POut.Long(labCase.LabCaseNum) + ","; } command += POut.Long(labCase.PatNum) + "," + POut.Long(labCase.LaboratoryNum) + "," + POut.Long(labCase.AptNum) + "," + POut.Long(labCase.PlannedAptNum) + "," + POut.DateT(labCase.DateTimeDue) + "," + POut.DateT(labCase.DateTimeCreated) + "," + POut.DateT(labCase.DateTimeSent) + "," + POut.DateT(labCase.DateTimeRecd) + "," + POut.DateT(labCase.DateTimeChecked) + "," + POut.Long(labCase.ProvNum) + "," + "'" + POut.String(labCase.Instructions) + "'," + "'" + POut.Double(labCase.LabFee) + "')"; if (useExistingPK || PrefC.RandomKeys) { Db.NonQ(command); } else { labCase.LabCaseNum = Db.NonQ(command, true); } return(labCase.LabCaseNum); }
///<summary></summary> public static void Insert(LabCase lab) { if (PrefB.RandomKeys) { lab.LabCaseNum = MiscData.GetKey("labcase", "LabCaseNum"); } string command = "INSERT INTO labcase ("; if (PrefB.RandomKeys) { command += "LabCaseNum,"; } command += "PatNum,LaboratoryNum,AptNum,PlannedAptNum,DateTimeDue,DateTimeCreated," + "DateTimeSent,DateTimeRecd,DateTimeChecked,ProvNum,Instructions) VALUES("; if (PrefB.RandomKeys) { command += "'" + POut.PInt(lab.LabCaseNum) + "', "; } command += "'" + POut.PInt(lab.PatNum) + "', " + "'" + POut.PInt(lab.LaboratoryNum) + "', " + "'" + POut.PInt(lab.AptNum) + "', " + "'" + POut.PInt(lab.PlannedAptNum) + "', " + POut.PDateT(lab.DateTimeDue) + ", " + POut.PDateT(lab.DateTimeCreated) + ", " + POut.PDateT(lab.DateTimeSent) + ", " + POut.PDateT(lab.DateTimeRecd) + ", " + POut.PDateT(lab.DateTimeChecked) + ", " + "'" + POut.PInt(lab.ProvNum) + "', " + "'" + POut.PString(lab.Instructions) + "')"; if (PrefB.RandomKeys) { General.NonQ(command); } else { lab.LabCaseNum = General.NonQ(command, true); } }
///<summary>Converts a DataTable to a list of objects.</summary> public static List<LabCase> TableToList(DataTable table){ List<LabCase> retVal=new List<LabCase>(); LabCase labCase; for(int i=0;i<table.Rows.Count;i++) { labCase=new LabCase(); labCase.LabCaseNum = PIn.Long (table.Rows[i]["LabCaseNum"].ToString()); labCase.PatNum = PIn.Long (table.Rows[i]["PatNum"].ToString()); labCase.LaboratoryNum = PIn.Long (table.Rows[i]["LaboratoryNum"].ToString()); labCase.AptNum = PIn.Long (table.Rows[i]["AptNum"].ToString()); labCase.PlannedAptNum = PIn.Long (table.Rows[i]["PlannedAptNum"].ToString()); labCase.DateTimeDue = PIn.DateT (table.Rows[i]["DateTimeDue"].ToString()); labCase.DateTimeCreated= PIn.DateT (table.Rows[i]["DateTimeCreated"].ToString()); labCase.DateTimeSent = PIn.DateT (table.Rows[i]["DateTimeSent"].ToString()); labCase.DateTimeRecd = PIn.DateT (table.Rows[i]["DateTimeRecd"].ToString()); labCase.DateTimeChecked= PIn.DateT (table.Rows[i]["DateTimeChecked"].ToString()); labCase.ProvNum = PIn.Long (table.Rows[i]["ProvNum"].ToString()); labCase.Instructions = PIn.String(table.Rows[i]["Instructions"].ToString()); labCase.LabFee = PIn.Double(table.Rows[i]["LabFee"].ToString()); retVal.Add(labCase); } return retVal; }
///<summary>Updates one LabCase in the database.</summary> public static void Update(LabCase labCase){ string command="UPDATE labcase SET " +"PatNum = "+POut.Long (labCase.PatNum)+", " +"LaboratoryNum = "+POut.Long (labCase.LaboratoryNum)+", " +"AptNum = "+POut.Long (labCase.AptNum)+", " +"PlannedAptNum = "+POut.Long (labCase.PlannedAptNum)+", " +"DateTimeDue = "+POut.DateT (labCase.DateTimeDue)+", " +"DateTimeCreated= "+POut.DateT (labCase.DateTimeCreated)+", " +"DateTimeSent = "+POut.DateT (labCase.DateTimeSent)+", " +"DateTimeRecd = "+POut.DateT (labCase.DateTimeRecd)+", " +"DateTimeChecked= "+POut.DateT (labCase.DateTimeChecked)+", " +"ProvNum = "+POut.Long (labCase.ProvNum)+", " +"Instructions = '"+POut.String(labCase.Instructions)+"', " +"LabFee = '"+POut.Double(labCase.LabFee)+"' " +"WHERE LabCaseNum = "+POut.Long(labCase.LabCaseNum); Db.NonQ(command); }
///<summary>Inserts one LabCase into the database. Returns the new priKey. Doesn't use the cache.</summary> public static long InsertNoCache(LabCase labCase) { return(InsertNoCache(labCase, false)); }
///<summary>Updates one LabCase in the database. Uses an old object to compare to, and only alters changed fields. This prevents collisions and concurrency problems in heavily used tables. Returns true if an update occurred.</summary> public static bool Update(LabCase labCase, LabCase oldLabCase) { string command = ""; if (labCase.PatNum != oldLabCase.PatNum) { if (command != "") { command += ","; } command += "PatNum = " + POut.Long(labCase.PatNum) + ""; } if (labCase.LaboratoryNum != oldLabCase.LaboratoryNum) { if (command != "") { command += ","; } command += "LaboratoryNum = " + POut.Long(labCase.LaboratoryNum) + ""; } if (labCase.AptNum != oldLabCase.AptNum) { if (command != "") { command += ","; } command += "AptNum = " + POut.Long(labCase.AptNum) + ""; } if (labCase.PlannedAptNum != oldLabCase.PlannedAptNum) { if (command != "") { command += ","; } command += "PlannedAptNum = " + POut.Long(labCase.PlannedAptNum) + ""; } if (labCase.DateTimeDue != oldLabCase.DateTimeDue) { if (command != "") { command += ","; } command += "DateTimeDue = " + POut.DateT(labCase.DateTimeDue) + ""; } if (labCase.DateTimeCreated != oldLabCase.DateTimeCreated) { if (command != "") { command += ","; } command += "DateTimeCreated = " + POut.DateT(labCase.DateTimeCreated) + ""; } if (labCase.DateTimeSent != oldLabCase.DateTimeSent) { if (command != "") { command += ","; } command += "DateTimeSent = " + POut.DateT(labCase.DateTimeSent) + ""; } if (labCase.DateTimeRecd != oldLabCase.DateTimeRecd) { if (command != "") { command += ","; } command += "DateTimeRecd = " + POut.DateT(labCase.DateTimeRecd) + ""; } if (labCase.DateTimeChecked != oldLabCase.DateTimeChecked) { if (command != "") { command += ","; } command += "DateTimeChecked = " + POut.DateT(labCase.DateTimeChecked) + ""; } if (labCase.ProvNum != oldLabCase.ProvNum) { if (command != "") { command += ","; } command += "ProvNum = " + POut.Long(labCase.ProvNum) + ""; } if (labCase.Instructions != oldLabCase.Instructions) { if (command != "") { command += ","; } command += "Instructions = " + DbHelper.ParamChar + "paramInstructions"; } if (labCase.LabFee != oldLabCase.LabFee) { if (command != "") { command += ","; } command += "LabFee = '" + POut.Double(labCase.LabFee) + "'"; } //DateTStamp can only be set by MySQL if (command == "") { return(false); } if (labCase.Instructions == null) { labCase.Instructions = ""; } OdSqlParameter paramInstructions = new OdSqlParameter("paramInstructions", OdDbType.Text, POut.StringParam(labCase.Instructions)); command = "UPDATE labcase SET " + command + " WHERE LabCaseNum = " + POut.Long(labCase.LabCaseNum); Db.NonQ(command, paramInstructions); return(true); }
///<summary>Updates one LabCase in the database. Uses an old object to compare to, and only alters changed fields. This prevents collisions and concurrency problems in heavily used tables.</summary> internal static void Update(LabCase labCase, LabCase oldLabCase) { string command = ""; if (labCase.PatNum != oldLabCase.PatNum) { if (command != "") { command += ","; } command += "PatNum = " + POut.Long(labCase.PatNum) + ""; } if (labCase.LaboratoryNum != oldLabCase.LaboratoryNum) { if (command != "") { command += ","; } command += "LaboratoryNum = " + POut.Long(labCase.LaboratoryNum) + ""; } if (labCase.AptNum != oldLabCase.AptNum) { if (command != "") { command += ","; } command += "AptNum = " + POut.Long(labCase.AptNum) + ""; } if (labCase.PlannedAptNum != oldLabCase.PlannedAptNum) { if (command != "") { command += ","; } command += "PlannedAptNum = " + POut.Long(labCase.PlannedAptNum) + ""; } if (labCase.DateTimeDue != oldLabCase.DateTimeDue) { if (command != "") { command += ","; } command += "DateTimeDue = " + POut.DateT(labCase.DateTimeDue) + ""; } if (labCase.DateTimeCreated != oldLabCase.DateTimeCreated) { if (command != "") { command += ","; } command += "DateTimeCreated = " + POut.DateT(labCase.DateTimeCreated) + ""; } if (labCase.DateTimeSent != oldLabCase.DateTimeSent) { if (command != "") { command += ","; } command += "DateTimeSent = " + POut.DateT(labCase.DateTimeSent) + ""; } if (labCase.DateTimeRecd != oldLabCase.DateTimeRecd) { if (command != "") { command += ","; } command += "DateTimeRecd = " + POut.DateT(labCase.DateTimeRecd) + ""; } if (labCase.DateTimeChecked != oldLabCase.DateTimeChecked) { if (command != "") { command += ","; } command += "DateTimeChecked = " + POut.DateT(labCase.DateTimeChecked) + ""; } if (labCase.ProvNum != oldLabCase.ProvNum) { if (command != "") { command += ","; } command += "ProvNum = " + POut.Long(labCase.ProvNum) + ""; } if (labCase.Instructions != oldLabCase.Instructions) { if (command != "") { command += ","; } command += "Instructions = '" + POut.String(labCase.Instructions) + "'"; } if (labCase.LabFee != oldLabCase.LabFee) { if (command != "") { command += ","; } command += "LabFee = '" + POut.Double(labCase.LabFee) + "'"; } if (command == "") { return; } command = "UPDATE labcase SET " + command + " WHERE LabCaseNum = " + POut.Long(labCase.LabCaseNum); Db.NonQ(command); }
///<summary>Updates one LabCase in the database. Uses an old object to compare to, and only alters changed fields. This prevents collisions and concurrency problems in heavily used tables.</summary> public static void Update(LabCase labCase,LabCase oldLabCase){ string command=""; if(labCase.PatNum != oldLabCase.PatNum) { if(command!=""){ command+=",";} command+="PatNum = "+POut.Long(labCase.PatNum)+""; } if(labCase.LaboratoryNum != oldLabCase.LaboratoryNum) { if(command!=""){ command+=",";} command+="LaboratoryNum = "+POut.Long(labCase.LaboratoryNum)+""; } if(labCase.AptNum != oldLabCase.AptNum) { if(command!=""){ command+=",";} command+="AptNum = "+POut.Long(labCase.AptNum)+""; } if(labCase.PlannedAptNum != oldLabCase.PlannedAptNum) { if(command!=""){ command+=",";} command+="PlannedAptNum = "+POut.Long(labCase.PlannedAptNum)+""; } if(labCase.DateTimeDue != oldLabCase.DateTimeDue) { if(command!=""){ command+=",";} command+="DateTimeDue = "+POut.DateT(labCase.DateTimeDue)+""; } if(labCase.DateTimeCreated != oldLabCase.DateTimeCreated) { if(command!=""){ command+=",";} command+="DateTimeCreated = "+POut.DateT(labCase.DateTimeCreated)+""; } if(labCase.DateTimeSent != oldLabCase.DateTimeSent) { if(command!=""){ command+=",";} command+="DateTimeSent = "+POut.DateT(labCase.DateTimeSent)+""; } if(labCase.DateTimeRecd != oldLabCase.DateTimeRecd) { if(command!=""){ command+=",";} command+="DateTimeRecd = "+POut.DateT(labCase.DateTimeRecd)+""; } if(labCase.DateTimeChecked != oldLabCase.DateTimeChecked) { if(command!=""){ command+=",";} command+="DateTimeChecked = "+POut.DateT(labCase.DateTimeChecked)+""; } if(labCase.ProvNum != oldLabCase.ProvNum) { if(command!=""){ command+=",";} command+="ProvNum = "+POut.Long(labCase.ProvNum)+""; } if(labCase.Instructions != oldLabCase.Instructions) { if(command!=""){ command+=",";} command+="Instructions = '"+POut.String(labCase.Instructions)+"'"; } if(labCase.LabFee != oldLabCase.LabFee) { if(command!=""){ command+=",";} command+="LabFee = '"+POut.Double(labCase.LabFee)+"'"; } if(command==""){ return; } command="UPDATE labcase SET "+command +" WHERE LabCaseNum = "+POut.Long(labCase.LabCaseNum); Db.NonQ(command); }
///<summary>Inserts one LabCase into the database. Returns the new priKey.</summary> public static long Insert(LabCase labCase) { return(Insert(labCase, false)); }