private void FrmSubSalesMan_Load(object sender, EventArgs e) { NavMenuDataList = _objSalesman.GetDataSalesman(0); ControlEnableDisable(true, false); ClearFld(); if (_IsNew == 'Y') { BtnEdit.Enabled = false; BtnDelete.Enabled = false; BtnFirstData.Enabled = false; BtnNextData.Enabled = false; BtnPreviousData.Enabled = false; BtnLastData.Enabled = false; } }
private void BtnSave_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(TxtDescription.Text.Trim())) { MessageBox.Show("Membership Description is Required..!!", "Mr Solution", MessageBoxButtons.OK, MessageBoxIcon.Information); TxtDescription.Focus(); return; } if (string.IsNullOrEmpty(TxtShortName.Text.Trim())) { MessageBox.Show("Membership ShortName is Required..!!", "Mr Solution", MessageBoxButtons.OK, MessageBoxIcon.Information); TxtShortName.Focus(); return; } _objSalesman.Model.Tag = _Tag; _objSalesman.Model.SalesmanId = Convert.ToInt32(TxtDescription.Tag.ToString()); if ((_Tag == "EDIT" || _Tag == "DELETE") && Convert.ToInt32(TxtDescription.Tag.ToString()) == 0) { ClearFld(); return; } _objSalesman.Model.SalesmanDesc = TxtDescription.Text; _objSalesman.Model.SalesmanShortName = TxtShortName.Text; _objSalesman.Model.Address = TxtAddress.Text; _objSalesman.Model.PhoneNo = TxtPhoneNo.Text; _objSalesman.Model.MobileNo = TxtMobileNo.Text; _objSalesman.Model.EmailId = TxtEmail.Text; _objSalesman.Model.Fax = ""; _objSalesman.Model.Country = TxtCountry.Text; _objSalesman.Model.CommissionRate = 0; _objSalesman.Model.CreditLimit = 0; _objSalesman.Model.CreditDays = 0; _objSalesman.Model.BranchId = ClsGlobal.BranchId; _objSalesman.Model.CompanyUnitId = ClsGlobal.CompanyUnitId; _objSalesman.Model.MemberTypeId = ((CmbMemberType.Text.ToString() == "") ? 0 : Convert.ToInt32(((KeyValuePair <string, string>)CmbMemberType.SelectedItem).Key)); _objSalesman.Model.MemberFromDate = Convert.ToDateTime(TxtFromDate.Text.ToString()); _objSalesman.Model.MemberToDate = Convert.ToDateTime(TxtToDate.Text.ToString()); _objSalesman.Model.MembershipId = TxtMembershipId.Text.ToString(); _objSalesman.Model.EnterBy = ClsGlobal.LoginUserCode; _objSalesman.Model.Status = CbActive.Checked == true ? true : false; _objSalesman.Model.Gadget = "Desktop"; _objSalesman.Model.CustomerType = "Normal"; _objSalesman.Model.SalesmanType = "Member"; _objSalesman.Model.GLShortName = _objCommon.GenerateShortName(TxtDescription.Text, "GlDesc", "GlShortName", "GeneralLedger"); if (_Tag == "NEW") { if (ClsGlobal.ConfirmSave == 1) { DialogResult dialogResult = MessageBox.Show("Are you sure want to Save New Record..??", "Close Form", MessageBoxButtons.YesNo, MessageBoxIcon.Error); if (dialogResult == DialogResult.Yes) { result = _objSalesman.SaveSalesman(); } else { return; } } else { result = _objSalesman.SaveSalesman(); } } else { result = _objSalesman.SaveSalesman(); } if (!string.IsNullOrEmpty(result)) { if (_IsNew == 'Y') { _NewSubSalesman = TxtDescription.Text.Trim(); _SalesmanId = Convert.ToInt32(result); Close(); } else { NavMenuDataList = _objSalesman.GetDataSalesman(0); ClearFld(); } _objSalesman.Model.GSalesmanId = Convert.ToInt32(result); if (_Tag == "NEW") { string Res = _objSalesman.SaveLedger(); if (string.IsNullOrEmpty(Res)) { _objSalesman.Model.Tag = "DELETE"; _objSalesman.Model.SalesmanId = Convert.ToInt32(result); _objSalesman.SaveSalesman(); MessageBox.Show("Error occured during data submit", "Mr Solution", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { MessageBox.Show("Data submit successfully", "Mr Solution", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { MessageBox.Show("Error occured during data submit", "Mr Solution", MessageBoxButtons.OK, MessageBoxIcon.Information); } }