private void BtnLedgerSearch_Click(object sender, EventArgs e) { Common.PickList frmPickList = new Common.PickList("Generalledger", _SearchKey); if (Common.PickList.dt.Rows.Count > 0) { frmPickList.ShowDialog(); if (frmPickList.SelectedList.Count > 0) { TxtLedger.Text = frmPickList.SelectedList[0]["GlDesc"].ToString().Trim(); TxtLedger.Tag = Convert.ToInt32(frmPickList.SelectedList[0]["ledgerId"].ToString().Trim()); TxtLedger.SelectAll(); } frmPickList.Dispose(); } else { MessageBox.Show("No List Available in SalesMan !", "Mr. Solution", MessageBoxButtons.OK, MessageBoxIcon.Information); TxtLedger.Focus(); return; } TxtLedger.Focus(); }
private void BtnSave_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(TxtDescription.Text)) { MessageBox.Show("Term Description is Required..!!", "Mr Solution", MessageBoxButtons.OK, MessageBoxIcon.Information); TxtDescription.Focus(); return; } if (string.IsNullOrEmpty(TxtTermPosition.Text)) { MessageBox.Show("Term Position is Required..!!", "Mr Solution", MessageBoxButtons.OK, MessageBoxIcon.Information); TxtTermPosition.Focus(); return; } if (string.IsNullOrEmpty(TxtLedger.Text)) { MessageBox.Show("Ledger is Required..!!", "Mr Solution", MessageBoxButtons.OK, MessageBoxIcon.Information); TxtLedger.Focus(); return; } _objTerm.Model.Tag = _Tag; _objTerm.Model.TermId = Convert.ToInt32(TxtDescription.Tag.ToString()); _objTerm.Model.TermDesc = TxtDescription.Text; _objTerm.Model.TermPosition = Convert.ToInt32(TxtTermPosition.Text); _objTerm.Model.LedgerId = ((TxtLedger.Tag.ToString() == "") ? 0 : Convert.ToInt32(TxtLedger.Tag.ToString())); _objTerm.Model.Category = CmbCategory.Text; _objTerm.Model.Basis = CmbBasis.Text.ToString() == "Value" ? "V" : "Q"; _objTerm.Model.STSign = CmbSTSign.Text.ToString() == "+" ? "+" : "-"; _objTerm.Model.Billwise = CmbBillwise.Text.ToString() == "Bill Wise" ? "Y" : "N"; _objTerm.Model.TermType = CmbTermType.Text.ToString() == "Invoice" ? "I" : CmbTermType.Text.ToString() == "Return"? "R":"B"; _objTerm.Model.Formula = TxtFormula.Text; _objTerm.Model.TermRate = ((TxtTermRate.Text.Trim() == "") ? 0 : Convert.ToDecimal(TxtTermRate.Text)); _objTerm.Model.EnterBy = ClsGlobal.LoginUserCode; _objTerm.Model.SupressZero = ChkSupressZero.Checked == true ? true : false; _objTerm.Model.Profitability = ChkProfitability.Checked == true ? true : false; _objTerm.Model.Status = ChkActive.Checked == true ? true : false; _objTerm.Model.Gadget = "Desktop"; if (_Tag == "NEW") { if (ClsGlobal.ConfirmSave == 1) { var dialogResult = MessageBox.Show("Are you sure want to Save New Record..??", "Close Form", MessageBoxButtons.YesNo, MessageBoxIcon.Error); if (dialogResult == DialogResult.Yes) { result = _objTerm.SaveSalesBillingTerm(); } else { return; } } else { result = _objTerm.SaveSalesBillingTerm(); } } else { result = _objTerm.SaveSalesBillingTerm(); } if (!string.IsNullOrEmpty(result)) { MessageBox.Show("Data Submit Successfully", "Mr Solution"); ClearFld(); TxtDescription.Focus(); } else { MessageBox.Show("Error Occured During Data Submit", "Mr Solution"); } }