///<summary>ONLY use this if compname is not already present</summary> public static long Insert(Computer comp) { if(RemotingClient.RemotingRole==RemotingRole.ClientWeb) { comp.ComputerNum=Meth.GetLong(MethodBase.GetCurrentMethod(),comp); return comp.ComputerNum; } return Crud.ComputerCrud.Insert(comp); }
/* ///<summary></summary> public static void Update(){ string command= "UPDATE computer SET " +"compname = '" +POut.PString(CompName)+"' " //+"printername = '" +POut.PString(PrinterName)+"' " +"WHERE ComputerNum = '"+POut.PInt(ComputerNum)+"'"; //MessageBox.Show(string command); DataConnection dcon=new DataConnection(); Db.NonQ(command); }*/ ///<summary></summary> public static void Delete(Computer comp){ if(RemotingClient.RemotingRole==RemotingRole.ClientWeb) { Meth.GetVoid(MethodBase.GetCurrentMethod(),comp); return; } string command= "DELETE FROM computer WHERE computernum = '"+comp.ComputerNum.ToString()+"'"; Db.NonQ(command); }
public static void EnsureComputerInDB(string computerName){ if(RemotingClient.RemotingRole==RemotingRole.ClientWeb) { Meth.GetVoid(MethodBase.GetCurrentMethod(),computerName); return; } string command= "SELECT * from computer " +"WHERE compname = '"+computerName+"'"; DataTable table=Db.GetTable(command); if(table.Rows.Count==0) { Computer Cur=new Computer(); Cur.CompName=computerName; Computers.Insert(Cur); } }