///<summary></summary> public static long Insert(Laboratory laboratory) { if(RemotingClient.RemotingRole==RemotingRole.ClientWeb) { laboratory.LaboratoryNum=Meth.GetLong(MethodBase.GetCurrentMethod(),laboratory); return laboratory.LaboratoryNum; } return Crud.LaboratoryCrud.Insert(laboratory); }
///<summary></summary> public static void Update(Laboratory laboratory) { if(RemotingClient.RemotingRole==RemotingRole.ClientWeb) { Meth.GetVoid(MethodBase.GetCurrentMethod(),laboratory); return; } Crud.LaboratoryCrud.Update(laboratory); }
public static string LabCaseWithInvalidLaboratory(bool verbose,bool isCheck) { if(RemotingClient.RemotingRole==RemotingRole.ClientWeb) { return Meth.GetString(MethodBase.GetCurrentMethod(),verbose,isCheck); } string log=""; if(isCheck) { command="SELECT COUNT(*) FROM labcase WHERE laboratoryNum NOT IN(SELECT laboratoryNum FROM laboratory)"; int numFound=PIn.Int(Db.GetCount(command)); if(numFound>0 || verbose) { log+=Lans.g("FormDatabaseMaintenance","Lab cases found with invalid laboratories")+": "+numFound+"\r\n"; } } else { command="SELECT COUNT(*) FROM labcase WHERE laboratoryNum NOT IN(SELECT laboratoryNum FROM laboratory)"; long numberFixed=long.Parse(Db.GetCount(command)); command="SELECT * FROM labcase WHERE laboratoryNum NOT IN(SELECT laboratoryNum FROM laboratory) GROUP BY LaboratoryNum"; table=Db.GetTable(command); long labnum; for(int i=0;i<table.Rows.Count;i++) { Laboratory lab=new Laboratory(); lab.LaboratoryNum=PIn.Long(table.Rows[i]["LaboratoryNum"].ToString()); lab.Description="Laboratory "+table.Rows[i]["LaboratoryNum"].ToString(); //laboratoryNum is not allowed to be zero labnum=Crud.LaboratoryCrud.Insert(lab); command="UPDATE labcase SET LaboratoryNum="+POut.Long(labnum)+" WHERE LaboratoryNum="+table.Rows[i]["LaboratoryNum"].ToString(); Db.NonQ(command); } if(numberFixed>0 || verbose) { log+=Lans.g("FormDatabaseMaintenance","Lab cases fixed with invalid laboratories")+": "+numberFixed.ToString()+"\r\n"; } } return log; }