public bool SaveUpdateAddressBook(mdlEmailManager obj_mdlAddressBook, string Operation ) { return obj_dalAddressBook.SaveUpdateAddressBook(obj_mdlAddressBook, Operation); }
public bool SaveUpdateAddressBook(mdlEmailManager obj_mdlAddressBook, string Operation) { bool IsSaved = false; try { if (con.State == ConnectionState.Open) { con.Close(); } con.Open(); SqlCommand cmd = new SqlCommand("stp_ERP_AddressBook_CRUD", con); cmd.Parameters.Add("@EmailAddress", SqlDbType.VarChar, 50).Value = obj_mdlAddressBook.EmailAddress; cmd.Parameters.Add("@CompanyID", SqlDbType.VarChar, 3).Value = obj_mdlAddressBook.CompanyID; cmd.Parameters.Add("@Title", SqlDbType.VarChar, 10).Value = obj_mdlAddressBook.Title; cmd.Parameters.Add("@FirstName", SqlDbType.VarChar, 50).Value = obj_mdlAddressBook.FirstName; cmd.Parameters.Add("@LastName", SqlDbType.VarChar, 50).Value = obj_mdlAddressBook.LastName; cmd.Parameters.Add("@Disabled", SqlDbType.Bit).Value = obj_mdlAddressBook.Disabled; cmd.Parameters.Add("@MobileNo1", SqlDbType.VarChar, 20).Value = obj_mdlAddressBook.MobileNo1; cmd.Parameters.Add("@MobileNo2", SqlDbType.VarChar, 20).Value = obj_mdlAddressBook.MobileNo2; cmd.Parameters.Add("@OfficePhone", SqlDbType.VarChar, 20).Value = obj_mdlAddressBook.OfficePhone; cmd.Parameters.Add("@Extension", SqlDbType.VarChar, 10).Value = obj_mdlAddressBook.Extension; cmd.Parameters.Add("@HomePhone", SqlDbType.VarChar, 20).Value = obj_mdlAddressBook.HomePhone; cmd.Parameters.Add("@PostalAddress", SqlDbType.VarChar, 100).Value = obj_mdlAddressBook.PostalAddress; cmd.Parameters.Add("@OfficeAddress", SqlDbType.VarChar, 100).Value = obj_mdlAddressBook.OfficeAddress; cmd.Parameters.Add("@HomeAddress", SqlDbType.VarChar, 100).Value = obj_mdlAddressBook.HomeAddress; cmd.Parameters.Add("@AddUser", SqlDbType.VarChar, 16).Value = obj_mdlAddressBook.AddUser; cmd.Parameters.Add("@LockUser", SqlDbType.VarChar, 16).Value = obj_mdlAddressBook.LockUser; if (Operation == "Save") { cmd.Parameters.Add("@Operation", SqlDbType.VarChar, 12).Value = "Save"; } else if (Operation == "Update") { cmd.Parameters.Add("@Operation", SqlDbType.VarChar, 12).Value = "Update"; } cmd.CommandType = CommandType.StoredProcedure; cmd.ExecuteNonQuery(); IsSaved = true; if (con.State == ConnectionState.Open) { con.Close(); } } catch (Exception ex) { MessageBox.Show(ex.Message, "ERP - Babar Medicine Company Lahore", MessageBoxButtons.OK, MessageBoxIcon.Error); IsSaved = false; if (con.State == ConnectionState.Open) { con.Close(); } } return IsSaved; }
public bool SaveNewnavigatorSetUp(mdlEmailManager obj_mdlEmailManager, string Operation) { return obj_dalAddressBook.SaveNewnavigatorSetUp(obj_mdlEmailManager, Operation); }
public bool SaveNewnavigatorSetUp(mdlEmailManager obj_mdlEmailManager, string Operation) { bool IsSaved = false; try { if (con.State == ConnectionState.Open) { con.Close(); } con.Open(); SqlCommand cmd = new SqlCommand("stp_ERP_AddressBook_CRUD", con); cmd.Parameters.Add("@EmailID", SqlDbType.VarChar, 10).Value = obj_mdlEmailManager.EmailID; cmd.Parameters.Add("@EmailGroup", SqlDbType.VarChar, 50).Value = obj_mdlEmailManager.EmailGroup; cmd.Parameters.Add("@EmailType", SqlDbType.VarChar, 100).Value = obj_mdlEmailManager.EmailType; cmd.Parameters.Add("@ReportID", SqlDbType.VarChar, 10).Value = obj_mdlEmailManager.ReportID; cmd.Parameters.Add("@FileType", SqlDbType.VarChar, 50).Value = obj_mdlEmailManager.FileType; cmd.Parameters.Add("@ParameterValues", SqlDbType.VarChar, 150).Value = obj_mdlEmailManager.ParameterValues; cmd.Parameters.Add("@Disabled", SqlDbType.Bit).Value = obj_mdlEmailManager.Disabled; cmd.Parameters.Add("@AddUser", SqlDbType.VarChar, 16).Value = obj_mdlEmailManager.AddUser; if (Operation == "Save") { cmd.Parameters.Add("@Operation", SqlDbType.VarChar, 12).Value = "SaveNavSetup"; } //else if (Operation == "Update") //{ // cmd.Parameters.Add("@Operation", SqlDbType.VarChar, 12).Value = "Update"; //} cmd.CommandType = CommandType.StoredProcedure; cmd.ExecuteNonQuery(); IsSaved = true; if (con.State == ConnectionState.Open) { con.Close(); } } catch (Exception ex) { MessageBox.Show(ex.Message, "ERP - Babar Medicine Company Lahore", MessageBoxButtons.OK, MessageBoxIcon.Error); IsSaved = false; if (con.State == ConnectionState.Open) { con.Close(); } } return IsSaved; }