protected void btnAddPrinter_Click(object sender, EventArgs e)
        {
            int           printerId   = Convert.ToInt32(Session["EngenPrintersID"]);
            PrinterUpdate printer     = new PrinterUpdate();
            DateTime      createddate = (DateTime)Session["CreatedDate"];

            printer.PrinterName          = txtprintername1.Text;
            printer.FolderToMonitor      = txtfoldertomonitor1.Text;
            printer.OutputType           = txtoutputtype1.Text;
            printer.FileOutput           = txtfileoutput1.Text;
            printer.PrinterMakeID        = Convert.ToInt32(cbprintermake1.SelectedValue);
            printer.Status               = 1;
            printer.CreatedDate          = createddate;
            printer.LastModificationDate = DateTime.Now;



            if (radactive.Checked)
            {
                printer.Active = 1;
            }
            else
            {
                printer.Active = 0;
            }

            UserDA userDA = new UserDA();

            userDA.UpdatePrinter(printer, printerId);
            //Response.Write(ExtraFunctions.)
            //Page.Response.Redirect(Page.Request.Url.ToString(), true);
        }
Example #2
0
 public int UpdatePrinter(PrinterUpdate printer, int printid)
 {
     try
     {
         con.Open();
         SqlCommand cmd = new SqlCommand("dbo.UpdatePrinters", con);
         cmd.CommandType = CommandType.StoredProcedure;
         cmd.Parameters.AddWithValue("@PrintersID", printid);
         cmd.Parameters.AddWithValue("@PrinterName", printer.PrinterName);
         cmd.Parameters.AddWithValue("@FolderToMonitor", printer.FolderToMonitor);
         cmd.Parameters.AddWithValue("@OutputType", printer.OutputType);
         cmd.Parameters.AddWithValue("@FileOutput", printer.FileOutput);
         cmd.Parameters.AddWithValue("@PrinterMakeID", printer.PrinterMakeID);
         cmd.Parameters.AddWithValue("@Active", printer.Active);
         cmd.Parameters.AddWithValue("@Status", printer.Status);
         cmd.Parameters.AddWithValue("@CreatedDate", printer.CreatedDate);
         cmd.Parameters.AddWithValue("@LastModificationDate", printer.LastModificationDate);
         int Result = cmd.ExecuteNonQuery();
         cmd.Dispose();
         return(Result);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
 protected virtual void OnPrinterUpdate(PrinterEventArgs e)
 {
     PrinterUpdate?.Invoke(this, e);
 }