public static int addSalesmanDetails(SalesmanDetails salesm) { try { int i = SalesmanProvider.addSalesmanDetails(salesm); return(i); } catch (Exception ex) { throw ex; } }
public static int addSalesmanDetails(SalesmanDetails salesm) { try { List <KeyValuePair <string, object> > parameter = new List <KeyValuePair <string, object> >(); parameter.Add(new KeyValuePair <string, object>("@SalesmanId", salesm.SalesmanId)); parameter.Add(new KeyValuePair <string, object>("@SalesmanName", salesm.SalesmanName)); parameter.Add(new KeyValuePair <string, object>("@Address", salesm.Address)); parameter.Add(new KeyValuePair <string, object>("@DOB", salesm.DOB)); parameter.Add(new KeyValuePair <string, object>("@GenderId", salesm.GenderId)); parameter.Add(new KeyValuePair <string, object>("@MobileNo", salesm.MobileNo)); parameter.Add(new KeyValuePair <string, object>("@EmailId", salesm.EmailId)); parameter.Add(new KeyValuePair <string, object>("@addedBy", salesm.addedBy)); parameter.Add(new KeyValuePair <string, object>("@addedOn", salesm.addedOn)); parameter.Add(new KeyValuePair <string, object>("@isDelete", salesm.isDelete)); SqlHandler sqlH = new SqlHandler(); int i = sqlH.ExecuteNonQueryI("[dbo].[Usp_addSalesmanDetails]", parameter); return(i); } catch (Exception ae) { throw ae; } }
private void btnDelete_Click(object sender, EventArgs e) { try { if (salesmanId == 0) { if (Utility.Langn == "English") { MessageBox.Show("Please Select Salesman from list..!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { MessageBox.Show("कृपया लिस्ट मधून सेल्समन निवडा ..!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); } return; } SalesmanDetails sales = new SalesmanDetails(); sales.SalesmanId = salesmanId; sales.SalesmanName = txtSalesmanName.Text.Trim(); sales.Address = txtAdd1.Text.Trim(); if (txtMobileNo.Text == string.Empty) { sales.MobileNo = ""; } else { sales.MobileNo = Utility.ParseValueI(txtMobileNo.Text).ToString(); } sales.DOB = dtpDOB.Value; sales.GenderId = cmbGender.Text; sales.EmailId = txtEmailID.Text.Trim(); sales.addedOn = Utility.firstDate; sales.addedBy = Utility.LoginID; sales.isDelete = 1; DialogResult ShowReport = DialogResult.No; if (Utility.Langn == "English") { ShowReport = MessageBox.Show("Do you want to delete this Record..?", "Delete", MessageBoxButtons.YesNo); } else { ShowReport = MessageBox.Show("माहिती डिलीट करायची का ..?", "डिलीट", MessageBoxButtons.YesNo); } if (ShowReport == DialogResult.Yes) { int i = SalesManDetailsController.addSalesmanDetails(sales); if (i > 0) { if (Utility.Langn == "English") { MessageBox.Show("Deleted Record Successfully ..!", "Deleted", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("माहिती डिलीट झाली ..!", "Deleted", MessageBoxButtons.OK, MessageBoxIcon.Information); } btnnew_Click(sender, e); } else { if (Utility.Langn == "English") { MessageBox.Show("Please You can't delete this salesman ", "Deleted", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("कृपया हा सेल्समन डिलीट करता येत नाही ", "Deleted", MessageBoxButtons.OK, MessageBoxIcon.Information); } return; } } else { ShowReport = DialogResult.No; btnnew_Click(sender, e); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void btnSave_Click(object sender, EventArgs e) { try { SalesmanDetails sales = new SalesmanDetails(); if (txtSalesmanName.Text == string.Empty) { if (Utility.Langn == "English") { MessageBox.Show("Please Add Salesman name ...!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { MessageBox.Show("कृपया सेल्समन नाव भरा ...!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); } txtSalesmanName.Focus(); return; } sales.SalesmanId = salesmanId; sales.SalesmanName = txtSalesmanName.Text.Trim(); sales.Address = txtAdd1.Text.Trim(); if (txtMobileNo.Text == string.Empty) { sales.MobileNo = ""; } else { sales.MobileNo = Utility.ParseValueI(txtMobileNo.Text).ToString(); } sales.DOB = dtpDOB.Value; sales.GenderId = cmbGender.Text; sales.EmailId = txtEmailID.Text.Trim(); sales.addedOn = Utility.firstDate; sales.addedBy = Utility.LoginID; sales.isDelete = 0; if (sales.SalesmanId > 0) { DialogResult ShowReport = DialogResult.No; if (Utility.Langn == "English") { ShowReport = MessageBox.Show("Do you want to update....?", "", MessageBoxButtons.YesNo); } else { ShowReport = MessageBox.Show("तु्म्हाला अपडेट करायचं का ....?", "", MessageBoxButtons.YesNo); } if (ShowReport == DialogResult.Yes) { int i = SalesManDetailsController.addSalesmanDetails(sales); if (i > 0) { if (Utility.Langn == "English") { MessageBox.Show("Information updated successfully ..!", "update", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("माहिती यशस्वीरित्या अपडेट केली गेली ..!", "Update", MessageBoxButtons.OK, MessageBoxIcon.Information); } btnnew_Click(sender, e); } if (i < 0) { if (Utility.Langn == "English") { MessageBox.Show("Customer Name already exists in list..!", "Information", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { MessageBox.Show("सेल्समनचे नाव आधीच उपलब्ध आहे ..!", "Information", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } } else { ShowReport = DialogResult.No; btnnew_Click(sender, e); } } else { int i = SalesManDetailsController.addSalesmanDetails(sales); if (i > 0) { if (Utility.Langn == "English") { MessageBox.Show("Information saved successfully ..!", "Save", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("माहिती यशस्वीरित्या साठवली गेली ..!", "Save", MessageBoxButtons.OK, MessageBoxIcon.Information); } btnnew_Click(sender, e); } if (i < 0) { if (Utility.Langn == "English") { MessageBox.Show("Customer Name already exists in list..!", "Information", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { MessageBox.Show("सेल्समनचे नाव आधीच उपलब्ध आहे ..!", "Information", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } } } catch (Exception ex) { MessageBox.Show(ex.Message); } }