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); } }