public static int addDealerDetails(dealerDetails dealer) { try { int i = dealerProvider.addDealerDetails(dealer); return(i); } catch (Exception ex) { throw ex; } }
public static int addDealerDetails(dealerDetails dealerDetails) { try { List <KeyValuePair <string, object> > parameter = new List <KeyValuePair <string, object> >(); parameter.Add(new KeyValuePair <string, object>("@dealerId", dealerDetails.dealerId)); parameter.Add(new KeyValuePair <string, object>("@dealerName", dealerDetails.dealerName)); parameter.Add(new KeyValuePair <string, object>("@dealerFirmName", dealerDetails.dealerFirmName)); parameter.Add(new KeyValuePair <string, object>("@dealerAddress", dealerDetails.dealerAddress)); parameter.Add(new KeyValuePair <string, object>("@dealerFirmAddress", dealerDetails.dealerFirmAddress)); parameter.Add(new KeyValuePair <string, object>("@DOB", dealerDetails.DOB)); parameter.Add(new KeyValuePair <string, object>("@genderId", dealerDetails.genderId)); parameter.Add(new KeyValuePair <string, object>("@emailId", dealerDetails.emailId)); parameter.Add(new KeyValuePair <string, object>("@dealerContactNo", dealerDetails.dealerContactNo)); parameter.Add(new KeyValuePair <string, object>("@GSTNo", dealerDetails.GSTNo)); parameter.Add(new KeyValuePair <string, object>("@officeNo", dealerDetails.officeNo)); parameter.Add(new KeyValuePair <string, object>("@openigBalanace", dealerDetails.openigBalance)); parameter.Add(new KeyValuePair <string, object>("@isCreditDebit", dealerDetails.CreditDebit)); parameter.Add(new KeyValuePair <string, object>("@isCustomer", dealerDetails.isCustomer)); if (dealerDetails.CreditDebit == "जमा रक्कम") { dealerDetails.crAmount = 0; dealerDetails.drAmount = dealerDetails.openigBalance; } if (dealerDetails.CreditDebit == "नावे रक्कम") { dealerDetails.crAmount = dealerDetails.openigBalance; dealerDetails.drAmount = 0; } parameter.Add(new KeyValuePair <string, object>("@billDate", dealerDetails.fromDate)); parameter.Add(new KeyValuePair <string, object>("@crAmount", dealerDetails.crAmount)); parameter.Add(new KeyValuePair <string, object>("@drAmount", dealerDetails.drAmount)); parameter.Add(new KeyValuePair <string, object>("@naration", dealerDetails.orjName)); parameter.Add(new KeyValuePair <string, object>("@isActive", 1)); parameter.Add(new KeyValuePair <string, object>("@addedBy", dealerDetails.addedBy)); parameter.Add(new KeyValuePair <string, object>("@addedOn", dealerDetails.addedOn)); parameter.Add(new KeyValuePair <string, object>("@FinancialYearID", dealerDetails.FinancialYearID)); SqlHandler sqlH = new SqlHandler(); int i = sqlH.ExecuteNonQueryI("[dbo].[Usp_adddealerDetails]", parameter); return(i); } catch (Exception ae) { throw ae; } }
private void btnSave_Click(object sender, EventArgs e) { try { dealerDetails deleardetails = new dealerDetails(); if (txtDealerFirmName.Text == string.Empty) { if (Utility.Langn == "English") { MessageBox.Show("Please add dealer firm name ..!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { MessageBox.Show("कृपया व्यापाऱ्याचे दुकान नाव भरा ..!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); } txtDealerFirmName.Focus(); return; } deleardetails.dealerFirmName = txtDealerFirmName.Text.ToString(); if (txtdealerName.Text == string.Empty) { if (Utility.Langn == "English") { MessageBox.Show("Please add dealer name..!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { MessageBox.Show("कृपया व्यापाऱ्याचे नाव भरा..!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); } txtdealerName.Focus(); return; } deleardetails.dealerId = dealerId; deleardetails.dealerName = txtdealerName.Text.Trim(); deleardetails.DOB = Convert.ToDateTime(dtpDOB.Value); if (cmbGender.SelectedIndex <= 0 /*|| cmbGender.SelectedText == "-- Select --"*/) { if (Utility.Langn == "English") { MessageBox.Show("Please Select gender ..!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { MessageBox.Show("कृपया लिंग निवडा ..!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); } cmbGender.Focus(); return; } deleardetails.genderId = cmbGender.SelectedIndex; //if (txtDealerAddress.Text == string.Empty) //{ // MessageBox.Show("Please Insert Shop Address.....!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); // txtDealerAddress.Focus(); // return; //} deleardetails.dealerAddress = txtDealerAddress.Text.ToString(); //if (txtDealerFirmAddress.Text == string.Empty) //{ // MessageBox.Show("Please Insert Dealer Address.....!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); // txtDealerFirmAddress.Focus(); // return; //} deleardetails.dealerFirmAddress = txtDealerFirmAddress.Text.ToString(); if (txtMobileNo.Text == string.Empty) { deleardetails.dealerContactNo = ""; } else { deleardetails.dealerContactNo = Utility.ParseValueI(txtMobileNo.Text).ToString(); } deleardetails.officeNo = txtOfficeNo.Text.ToString(); if (txtOpeningBalance.Text == string.Empty) { deleardetails.openigBalance = 0; } else { deleardetails.openigBalance = Convert.ToDouble(Utility.ParseValue(txtOpeningBalance.Text).ToString()); } deleardetails.GSTNo = txtGSTNo.Text; deleardetails.CreditDebit = cmbCreditDebit.Text; deleardetails.fromDate = dateBill.Value; deleardetails.emailId = txtEmailId.Text.Trim(); deleardetails.orjName = txtOtherIformation.Text.Trim(); deleardetails.addedBy = Utility.LoginID; deleardetails.FinancialYearID = Utility.FinancilaYearId; deleardetails.addedOn = DateTime.Now; if (chkCustomer.Checked == true) { deleardetails.isCustomer = true; } else { deleardetails.isCustomer = false; } if (deleardetails.dealerId > 0) { DialogResult ShowReport = DialogResult.No; if (Utility.Langn == "English") { ShowReport = MessageBox.Show("Do you want to update this record..?", "update", MessageBoxButtons.YesNo); } else { ShowReport = MessageBox.Show("तु्म्हाला अपडेट करायचं का ..?", "अपडेट", MessageBoxButtons.YesNo); } if (ShowReport == DialogResult.Yes) { int i = DealerController.addDealerDetails(deleardetails); if (i > 0) { if (Utility.Langn == "English") { MessageBox.Show("Record saved successfully ..!", "Save", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("माहिती यशस्वीरित्या साठवली गेली ..!", "जतन", MessageBoxButtons.OK, MessageBoxIcon.Information); } //Utility.ClearSpace(this); //Utility.enableFields(this); //btnSave.Enabled = false; //btnUpdate.Enabled = false; //btnDelete.Enabled = false; //BinDealerGrid(); //BindComboBoxgetGender(); //dealerId = 0; btnnew_Click(sender, e); // BindComboBoxCategoryDetails(); } if (i < 0) { if (Utility.Langn == "English") { MessageBox.Show("Dealer Firm name already exists ..!", "Information", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { MessageBox.Show("व्यापाऱ्याच्या दुकानचे नाव आधीच उपलब्ध आहे ..!", "Information", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } } else { ShowReport = DialogResult.No; //Utility.ClearSpace(this); //Utility.enableFields(this); //btnSave.Enabled = true; //btnUpdate.Enabled = false; //btnDelete.Enabled = false; //BinDealerGrid(); //dealerId = 0; btnnew_Click(sender, e); } } else { int i = DealerController.addDealerDetails(deleardetails); if (i > 0) { if (Utility.Langn == "English") { MessageBox.Show("Record Saved Successfully..!", "Save", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("माहिती यशस्वीरित्या साठवली गेली ..!", "जतन", MessageBoxButtons.OK, MessageBoxIcon.Information); } //Utility.ClearSpace(this); //Utility.enableFields(this); //btnSave.Enabled = false; //btnUpdate.Enabled = false; //btnDelete.Enabled = false; //BinDealerGrid(); //dealerId = 0; btnnew_Click(sender, e); } if (i < 0) { if (Utility.Langn == "English") { MessageBox.Show("Dealer Name Already exists..!", "Information", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { MessageBox.Show("व्यापाऱ्याचे नाव आधीच उपलब्ध आहे ..!", "Information", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } } } catch (Exception ex) { MessageBox.Show(ex.Message); } }