예제 #1
0
		///<summary></summary>
		private static long Insert(Printer cur) {
			if(RemotingClient.RemotingRole==RemotingRole.ClientWeb) {
				cur.PrinterNum=Meth.GetLong(MethodBase.GetCurrentMethod(),cur);
				return cur.PrinterNum;
			}
			return Crud.PrinterCrud.Insert(cur);
		}
예제 #2
0
		///<summary></summary>
		private static void Update(Printer cur){
			if(RemotingClient.RemotingRole==RemotingRole.ClientWeb) {
				Meth.GetVoid(MethodBase.GetCurrentMethod(),cur);
				return;
			}
			Crud.PrinterCrud.Update(cur);
		}
예제 #3
0
		///<summary></summary>
		private static void Delete(Printer cur){
			if(RemotingClient.RemotingRole==RemotingRole.ClientWeb) {
				Meth.GetVoid(MethodBase.GetCurrentMethod(),cur);
				return;
			}
			string command="DELETE FROM printer "
				+"WHERE PrinterNum = "+POut.Long(cur.PrinterNum);
			Db.NonQ(command);
		}
예제 #4
0
		///<summary>Either does an insert or an update to the database if need to create a Printer object.  Or it also deletes a printer object if needed.</summary>
		public static void PutForSit(PrintSituation sit,string computerName, string printerName,bool displayPrompt){
			if(RemotingClient.RemotingRole==RemotingRole.ClientWeb) {
				Meth.GetVoid(MethodBase.GetCurrentMethod(),sit,computerName,printerName,displayPrompt);
				return;
			}
			//Computer[] compList=Computers.Refresh();
			//Computer compCur=Computers.GetCur();
			string command="SELECT ComputerNum FROM computer "
				+"WHERE CompName = '"+POut.String(computerName)+"'";
 			DataTable table=Db.GetTable(command);
			if(table.Rows.Count==0){
				return;//computer not yet entered in db.
			}
			long compNum=PIn.Long(table.Rows[0][0].ToString());
			//only called from PrinterSetup window. Get info directly from db, then refresh when closing window. 
			Printer existing=GetOnePrinter(sit,compNum);   //GetForSit(sit);
			if(printerName=="" && !displayPrompt){//then should not be an entry in db
				if(existing!=null){//need to delete Printer
					Delete(existing);
				}
			}
			else if(existing==null){
				Printer cur=new Printer();
				cur.ComputerNum=compNum;
				cur.PrintSit=sit;
				cur.PrinterName=printerName;
				cur.DisplayPrompt=displayPrompt;
				Insert(cur);
			}
			else{
				existing.PrinterName=printerName;
				existing.DisplayPrompt=displayPrompt;
				Update(existing);
			}
		}
예제 #5
0
		///<summary>Called from FormPrinterSetup if user selects the easy option.  Since the other options will be hidden, we have to clear them.  User should be sternly warned before this happens.</summary>
		public static void ClearAll(){
			if(RemotingClient.RemotingRole==RemotingRole.ClientWeb) {
				Meth.GetVoid(MethodBase.GetCurrentMethod());
				return;
			}
			//first, delete all entries
			string command="DELETE FROM printer";
 			Db.NonQ(command);
			//then, add one printer for each computer. Default and show prompt
			Computers.RefreshCache();
			Printer cur;
			for(int i=0;i<Computers.List.Length;i++){
				cur=new Printer();
				cur.ComputerNum=Computers.List[i].ComputerNum;
				cur.PrintSit=PrintSituation.Default;
				cur.PrinterName="";
				cur.DisplayPrompt=true;
				Insert(cur);
			}
		}