Exemple #1
0
 public bool SaveUpdateProductCorrection(mdlProductCorrection obj_mdlProductCorrection, string Operation)
 {
     return obj_dalProductCorrection.SaveUpdateProductCorrection(obj_mdlProductCorrection, Operation);
 }
Exemple #2
0
 public bool SaveUpdateProductCorrection(mdlProductCorrection obj_mdlProductCorrection, string Operation)
 {
     bool Inserted = false;
     try
     {
         SqlCommand cmd = new SqlCommand("stp_ERP_ProductCorrection_CRUD", con);
         cmd.CommandType = CommandType.StoredProcedure;
         cmd.Parameters.Add("@ProductID", SqlDbType.VarChar, 6).Value = obj_mdlProductCorrection.OriginalProductID;
         cmd.Parameters.Add("@ReplacedProductID", SqlDbType.VarChar, 6).Value = obj_mdlProductCorrection.ReplacedProductID;
         cmd.Parameters.Add("@StartDate", SqlDbType.DateTime).Value = obj_mdlProductCorrection.StartDate;
         cmd.Parameters.Add("@EndDate", SqlDbType.DateTime).Value = obj_mdlProductCorrection.EndDate;
         cmd.Parameters.Add("@AddUser", SqlDbType.VarChar, 16).Value = obj_mdlProductCorrection.AddUser;
         cmd.Parameters.Add("@LockUser", SqlDbType.VarChar, 16).Value = obj_mdlProductCorrection.LockUser;
         cmd.Parameters.Add("@Auto", SqlDbType.Bit).Value = obj_mdlProductCorrection.Auto;
         if(Operation == "Save")
         {
             cmd.Parameters.Add("@Operation", SqlDbType.VarChar, 20).Value = "Save";
         }
         if (Operation == "Update")
         {
             cmd.Parameters.Add("@Operation", SqlDbType.VarChar, 20).Value = "Update";
         }
         if (con.State == ConnectionState.Open)
         {
             con.Close();
         }
         con.Open();
         cmd.ExecuteNonQuery();
         if (con.State == ConnectionState.Open)
         {
             con.Close();
             Inserted = true;
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "ERP - Babar Medicine Company Lahore", MessageBoxButtons.OK, MessageBoxIcon.Error);
         if (con.State == ConnectionState.Open)
         {
             con.Close();
         }
     }
     return Inserted;
 }