예제 #1
0
 /// <summary>
 /// edit function
 /// </summary>
 private void EditFunction()
 {
     try
     {
         AccountLedgerInfo infoAccountLedger = new AccountLedgerInfo();
         AccountLedgerSP spAccountLedger = new AccountLedgerSP();
         infoAccountLedger.LedgerName = txtSupplierName.Text.Trim();
         infoAccountLedger.MailingName = txtMailingName.Text.Trim();
         if (txtOpeningBalance.Text.Trim() != string.Empty)
         {
             infoAccountLedger.OpeningBalance = Convert.ToDecimal(txtOpeningBalance.Text.ToString());
         }
         else
         {
             infoAccountLedger.OpeningBalance = 0;
         }
         infoAccountLedger.CrOrDr = cmbDrOrCr.Text.ToString();
         infoAccountLedger.BankAccountNumber = txtAcNo.Text.Trim();
         infoAccountLedger.BranchName = txtBranchName.Text.Trim();
         infoAccountLedger.BranchCode = txtBranchCode.Text.Trim();
         infoAccountLedger.Mobile = txtMobile.Text.Trim();
         infoAccountLedger.Address = txtAddress.Text.Trim();
         if (cmbBillbyBill.Text == "Yes")
         {
             infoAccountLedger.BillByBill = true;
         }
         else
         {
             infoAccountLedger.BillByBill = false;
         }
         infoAccountLedger.Cst = txtCst.Text.Trim();
         infoAccountLedger.AreaId = Convert.ToDecimal(cmbArea.SelectedValue.ToString());
         infoAccountLedger.RouteId = Convert.ToDecimal(cmbRoute.SelectedValue.ToString());
         infoAccountLedger.MailingName = txtMailingName.Text.Trim();
         infoAccountLedger.Phone = txtPhone.Text.Trim();
         infoAccountLedger.Email = txtEmail.Text.Trim();
         infoAccountLedger.Tin = txtTin.Text.Trim();
         infoAccountLedger.Pan = txtPan.Text.Trim();
         infoAccountLedger.Narration = txtNarration.Text.Trim();
         infoAccountLedger.LedgerId = decLedger;
         if (spAccountLedger.AccountLedgerCheckExistenceForSalesman(txtSupplierName.Text.Trim().ToString(), decLedger) == false)
         {
             spAccountLedger.AccountLedgerEditForSalesman(infoAccountLedger);
             ledgerUpdate();
             if (cmbBillbyBill.Text == "Yes")
             {
                 partyBalanceUpdate();
             }
             else
             {
                 AccountLedgerSP spLedger = new AccountLedgerSP();
                 spLedger.PartyBalanceDeleteByVoucherTypeVoucherNoAndReferenceType(decLedger.ToString(), 1);
             }
             Messages.UpdatedMessage();
             Clear();
         }
         else
         {
             Messages.InformationMessage("Supplier name already exist");
             txtSupplierName.Focus();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("SUP10" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }