private void FillFormForUpdate()
        {
            SupplierLedgerMaster supplier = applicationFacade.GetSupplierLedgerById(this.SupplierId);

            if (supplier != null)
            {
                txtCode.Text                = supplier.SupplierLedgerCode;
                txtCustSupplierName.Text    = supplier.SupplierLedgerName;
                txtShortName.Text           = supplier.SupplierLedgerShortName;
                txtAddress.Text             = supplier.Address;
                txtContactPerson.Text       = supplier.ContactPerson;
                txtEmailAddress.Text        = supplier.EmailAddress;
                txtMobile.Text              = supplier.Mobile;
                txtPhoneO.Text              = supplier.OfficePhone;
                txtPhoneR.Text              = supplier.ResidentPhone;
                cbxTaxRetail.SelectedItem   = supplier.TaxRetail == "R" ? Enums.TaxRetail.R : Enums.TaxRetail.T;
                cbxStatus.SelectedItem      = supplier.Status ? Enums.Status.Active : Enums.Status.Inactive;
                cbxCreditDebit.SelectedItem = supplier.CreditDebit == "C" ? Enums.TransType.C : Enums.TransType.D;
                txtOpeningBal.Text          = supplier.OpeningBal.ToString();


                tbxArea.Tag        = supplier.AreaId;
                tbxArea.Text       = supplier.AreaName;
                tbxDL.Text         = supplier.DLNo;
                tbxGST.Text        = supplier.GSTNo;
                tbxCIN.Text        = supplier.CINNo;
                tbxLIN.Text        = supplier.LINNo;
                tbxServiceTax.Text = supplier.ServiceTaxNo;
                tbxPAN.Text        = supplier.PANNo;

                //todo ADD SUPPLIER PURCHASE TYPE iD
                //cbxPurchaseType.SelectedValue = supplier.
            }
        }
Пример #2
0
 public int UpdateSupplierLedger(SupplierLedgerMaster p)
 {
     try
     {
         return(new SupplierLedgerMasterBiz(this.LoggedInUser).UpdateSupplierLedger(p));
     }
     catch (Exception)
     {
         throw;
     }
 }
        private void FormSupplierLedgerMaster_FormClosed(object sender, FormClosedEventArgs e)
        {
            try
            {
                ExtensionMethods.RemoveChildFormToPanel(this, (Control)sender, ExtensionMethods.MainPanel);
                SupplierLedgerMaster selectedSupplier = (sender as frmSupplierLedger).LastSelectedSupplier;
                if (selectedSupplier != null)
                {
                    ReceiptPaymentItem receiptPaymentForSelectedCust = new ReceiptPaymentItem()
                    {
                        VoucherTypeCode           = Constants.VoucherTypeCode.PAYMENTTOSUPPLIER,
                        VoucherDate               = ExtensionMethods.ConvertToSystemDateFormat(dtReceiptPayment.Text),
                        LedgerType                = Constants.TransactionEntityType.SupplierLedger,
                        LedgerTypeCode            = selectedSupplier.SupplierLedgerCode,
                        LedgerTypeName            = selectedSupplier.SupplierLedgerName,
                        PaymentMode               = Constants.PaymentMode.CASH,
                        BankAccountLedgerTypeCode = Convert.ToString(txtTransactAccount.Tag),
                        BankAccountLedgerTypeName = Convert.ToString(txtTransactAccount.Text),
                        ChequeDate                = DateTime.Now
                    };

                    TransactionEntity transactionEntity = new TransactionEntity()
                    {
                        EntityType = Constants.TransactionEntityType.SupplierLedger,
                        EntityCode = selectedSupplier.SupplierLedgerCode
                    };

                    UpdateReceiptPaymentRow(receiptPaymentForSelectedCust);
                    LoadGridBillOutstanding(transactionEntity);

                    dgvPaymentToSupplier.Focus();
                    dgvPaymentToSupplier.CurrentCell = dgvPaymentToSupplier.Rows[dgvPaymentToSupplier.SelectedCells[0].RowIndex].Cells["ChequeNumber"];
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Пример #4
0
        private void StartMigration()
        {
            CompanyMaster        companyMaster        = new CompanyMaster();
            ItemMaster           itemMaster           = new ItemMaster();
            PersonRouteMaster    personRouteMaster    = new PersonRouteMaster();
            PersonalLedgerMaster personalLedgerMaster = new PersonalLedgerMaster();
            AccountLedgerMaster  accountLedgerMaster  = new AccountLedgerMaster();
            SupplierLedgerMaster supplierLedgerMaster = new SupplierLedgerMaster();
            CustomerLedgerMaster customerLedgerMaster = new CustomerLedgerMaster();
            BillOutstanding      billOutstanding      = new BillOutstanding();
            FIFO fifo = new FIFO();

            int result;

            grdDataMigration.Rows.Add("Company Master", "Processing", 0);
            result = 0;

            result = companyMaster.InsertCompanyMasterData();

            grdDataMigration.Rows[0].Cells[1].Value = "Completed";
            grdDataMigration.Rows[0].Cells[2].Value = result;

            grdDataMigration.Rows.Add("A.S.M.", "Processing", 0);
            result = 0;

            result = personRouteMaster.InsertASMData();

            grdDataMigration.Rows[1].Cells[1].Value = "Completed";
            grdDataMigration.Rows[1].Cells[2].Value = result;

            grdDataMigration.Rows.Add("R.S.M.", "Processing", 0);
            result = 0;

            result = personRouteMaster.InsertRSMData();

            grdDataMigration.Rows[2].Cells[1].Value = "Completed";
            grdDataMigration.Rows[2].Cells[2].Value = result;

            grdDataMigration.Rows.Add("Z.S.M.", "Processing", 0);
            result = 0;

            result = personRouteMaster.InsertZSMData();

            grdDataMigration.Rows[3].Cells[1].Value = "Completed";
            grdDataMigration.Rows[3].Cells[2].Value = result;

            grdDataMigration.Rows.Add("Sales Man", "Processing", 0);
            result = 0;

            result = personRouteMaster.InsertSalesManData();

            grdDataMigration.Rows[4].Cells[1].Value = "Completed";
            grdDataMigration.Rows[4].Cells[2].Value = result;

            grdDataMigration.Rows.Add("Area", "Processing", 0);
            result = 0;

            result = personRouteMaster.InsertAreaData();

            grdDataMigration.Rows[5].Cells[1].Value = "Completed";
            grdDataMigration.Rows[5].Cells[2].Value = result;

            grdDataMigration.Rows.Add("Route", "Processing", 0);
            result = 0;

            result = personRouteMaster.InsertRouteData();

            grdDataMigration.Rows[6].Cells[1].Value = "Completed";
            grdDataMigration.Rows[6].Cells[2].Value = result;

            grdDataMigration.Rows.Add("Personal Details", "Processing", 0);
            result = 0;

            result = personalLedgerMaster.InsertPersonalLedgerMasterData();

            grdDataMigration.Rows[7].Cells[1].Value = "Completed";
            grdDataMigration.Rows[7].Cells[2].Value = result;

            grdDataMigration.Rows.Add("Control Codes", "Processing", 0);
            result = 0;

            result = accountLedgerMaster.InsertControlCodesData();

            grdDataMigration.Rows[8].Cells[1].Value = "Completed";
            grdDataMigration.Rows[8].Cells[2].Value = result;

            grdDataMigration.Rows.Add("Income Ledger", "Processing", 0);
            result = 0;

            result = accountLedgerMaster.InsertIncomeLedgerData();

            grdDataMigration.Rows[9].Cells[1].Value = "Completed";
            grdDataMigration.Rows[9].Cells[2].Value = result;

            grdDataMigration.Rows.Add("Expenditure Ledger", "Processing", 0);
            result = 0;

            result = accountLedgerMaster.InsertExpenditureLedgerData();

            grdDataMigration.Rows[10].Cells[1].Value = "Completed";
            grdDataMigration.Rows[10].Cells[2].Value = result;

            grdDataMigration.Rows.Add("Transaction Books", "Processing", 0);
            result = 0;

            result = accountLedgerMaster.InsertTransactionLedgerData();

            grdDataMigration.Rows[11].Cells[1].Value = "Completed";
            grdDataMigration.Rows[11].Cells[2].Value = result;

            grdDataMigration.Rows.Add("General Ledger", "Processing", 0);
            result = 0;

            result = accountLedgerMaster.InsertGeneralLedgerData();

            grdDataMigration.Rows[12].Cells[1].Value = "Completed";
            grdDataMigration.Rows[12].Cells[2].Value = result;

            grdDataMigration.Rows.Add("Purchase Ledger", "Processing", 0);
            result = 0;

            result = accountLedgerMaster.InsertPurchaseLedgerData();

            grdDataMigration.Rows[13].Cells[1].Value = "Completed";
            grdDataMigration.Rows[13].Cells[2].Value = result;

            grdDataMigration.Rows.Add("Sale Ledger", "Processing", 0);
            result = 0;

            result = accountLedgerMaster.InsertSaleLedgerData();

            grdDataMigration.Rows[14].Cells[1].Value = "Completed";
            grdDataMigration.Rows[14].Cells[2].Value = result;

            grdDataMigration.Rows.Add("Item Master", "Processing", 0);
            result = 0;

            result = itemMaster.InsertItemMasterData();

            grdDataMigration.Rows[15].Cells[1].Value = "Completed";
            grdDataMigration.Rows[15].Cells[2].Value = result;

            grdDataMigration.Rows.Add("FIFO", "Processing", 0);
            result = 0;

            result = fifo.InsertFIFOData();

            grdDataMigration.Rows[16].Cells[1].Value = "Completed";
            grdDataMigration.Rows[16].Cells[2].Value = result;


            grdDataMigration.Rows.Add("Supplier Ledger", "Processing", 0);
            result = 0;

            result = supplierLedgerMaster.InsertSupplierLedgerMasterData();

            grdDataMigration.Rows[17].Cells[1].Value = "Completed";
            grdDataMigration.Rows[17].Cells[2].Value = result;

            grdDataMigration.Rows.Add("Customer Ledger", "Processing", 0);
            result = 0;

            result = customerLedgerMaster.InsertCustomerLedgerMasterData(); //confirm mapping columns for columns having comments in CustomerLedgerMaster

            grdDataMigration.Rows[18].Cells[1].Value = "Completed";
            grdDataMigration.Rows[18].Cells[2].Value = result;

            //For below method check comments in CustomerLedgerMaster
            grdDataMigration.Rows.Add("Customer Company Discount", "Processing", 0);
            result = 0;

            result = customerLedgerMaster.InsertCustomerCompanyReferenceData();

            grdDataMigration.Rows[19].Cells[1].Value = "Completed";
            grdDataMigration.Rows[19].Cells[2].Value = result;


            //For below method check comments in CustomerLedgerMaster
            grdDataMigration.Rows.Add("Supplier Company Discount", "Processing", 0);
            result = 0;

            result = supplierLedgerMaster.InsertSupplierCompanyReferenceData();

            grdDataMigration.Rows[20].Cells[1].Value = "Completed";
            grdDataMigration.Rows[20].Cells[2].Value = result;

            grdDataMigration.Rows.Add("Bill Oustanding", "Processing", 0);
            result = 0;

            result = billOutstanding.InsertBillOutstandingData();

            grdDataMigration.Rows[21].Cells[1].Value = "Completed";
            grdDataMigration.Rows[21].Cells[2].Value = result;


            MessageBox.Show("Process Completed");
        }
Пример #5
0
        private void StartMigration()
        {
            CompanyMaster        companyMaster        = new CompanyMaster();
            ItemMaster           itemMaster           = new ItemMaster();
            PersonRouteMaster    personRouteMaster    = new PersonRouteMaster();
            PersonalLedgerMaster personalLedgerMaster = new PersonalLedgerMaster();
            AccountLedgerMaster  accountLedgerMaster  = new AccountLedgerMaster();
            SupplierLedgerMaster supplierLedgerMaster = new SupplierLedgerMaster();
            CustomerLedgerMaster customerLedgerMaster = new CustomerLedgerMaster();
            BillOutstanding      billOutstanding      = new BillOutstanding();
            FIFO fifo = new FIFO();
            PurchaseSaleBookHeaderMigration   purchaseSaleBookHeaderMigration   = new PurchaseSaleBookHeaderMigration();
            PurchaseSaleBookLineItemMigration purchaseSaleBookLineItemMigration = new PurchaseSaleBookLineItemMigration();
            TRN trn = new TRN();
            ReceiptPaymentMigration receiptPayment = new ReceiptPaymentMigration();
            BillOutStandingsAudjustmentMigration billOsAdjustment = new BillOutStandingsAudjustmentMigration();


            int result   = 0;
            int rowIndex = 0;

            SetProcessingText(grdDataMigration, "Company Master", rowIndex, "Processing", result, true);
            result = companyMaster.InsertCompanyMasterData();
            SetProcessingText(grdDataMigration, "Company Master", rowIndex, "Completed", result, false);

            result    = 0;
            rowIndex += 1;
            SetProcessingText(grdDataMigration, "ASM", rowIndex, "Processing", result, true);
            result = personRouteMaster.InsertASMData();
            SetProcessingText(grdDataMigration, "ASM", rowIndex, "Completed", result, false);

            result    = 0;
            rowIndex += 1;
            SetProcessingText(grdDataMigration, "RSM", rowIndex, "Processing", result, true);
            result = personRouteMaster.InsertRSMData();
            SetProcessingText(grdDataMigration, "RSM", rowIndex, "Completed", result, false);

            result    = 0;
            rowIndex += 1;
            SetProcessingText(grdDataMigration, "ZSM", rowIndex, "Processing", result, true);
            result = personRouteMaster.InsertZSMData();
            SetProcessingText(grdDataMigration, "ZSM", rowIndex, "Completed", result, false);

            result    = 0;
            rowIndex += 1;
            SetProcessingText(grdDataMigration, "Sales Man", rowIndex, "Processing", result, true);
            result = personRouteMaster.InsertSalesManData();
            SetProcessingText(grdDataMigration, "Sales Man", rowIndex, "Completed", result, false);

            result    = 0;
            rowIndex += 1;
            SetProcessingText(grdDataMigration, "Area", rowIndex, "Processing", result, true);
            result = personRouteMaster.InsertAreaData();
            SetProcessingText(grdDataMigration, "Area", rowIndex, "Completed", result, false);

            result    = 0;
            rowIndex += 1;
            SetProcessingText(grdDataMigration, "Route", rowIndex, "Processing", result, true);
            result = personRouteMaster.InsertRouteData();
            SetProcessingText(grdDataMigration, "Route", rowIndex, "Completed", result, false);

            result    = 0;
            rowIndex += 1;
            SetProcessingText(grdDataMigration, "Personal Ledger", rowIndex, "Processing", result, true);
            result = personalLedgerMaster.InsertPersonalLedgerMasterData();
            SetProcessingText(grdDataMigration, "Personal Ledger", rowIndex, "Completed", result, false);

            result    = 0;
            rowIndex += 1;
            SetProcessingText(grdDataMigration, "Control Codes", rowIndex, "Processing", result, true);
            result = accountLedgerMaster.InsertControlCodesData();
            SetProcessingText(grdDataMigration, "Control Codes", rowIndex, "Completed", result, false);

            result    = 0;
            rowIndex += 1;
            SetProcessingText(grdDataMigration, "Income Ledger", rowIndex, "Processing", result, true);
            result = accountLedgerMaster.InsertIncomeLedgerData();
            SetProcessingText(grdDataMigration, "Income Ledger", rowIndex, "Completed", result, false);

            result    = 0;
            rowIndex += 1;
            SetProcessingText(grdDataMigration, "Expenditure Ledger", rowIndex, "Processing", result, true);
            result = accountLedgerMaster.InsertExpenditureLedgerData();
            SetProcessingText(grdDataMigration, "Expenditure Ledger", rowIndex, "Completed", result, false);

            result    = 0;
            rowIndex += 1;
            SetProcessingText(grdDataMigration, "Transaction Ledger", rowIndex, "Processing", result, true);
            result = accountLedgerMaster.InsertTransactionLedgerData();
            SetProcessingText(grdDataMigration, "Transaction Ledger", rowIndex, "Completed", result, false);

            result    = 0;
            rowIndex += 1;
            SetProcessingText(grdDataMigration, "General Ledger", rowIndex, "Processing", result, true);
            result = accountLedgerMaster.InsertGeneralLedgerData();
            SetProcessingText(grdDataMigration, "General Ledger", rowIndex, "Completed", result, false);

            result    = 0;
            rowIndex += 1;
            SetProcessingText(grdDataMigration, "Purchase Ledger", rowIndex, "Processing", result, true);
            result = accountLedgerMaster.InsertPurchaseLedgerData();
            SetProcessingText(grdDataMigration, "Purchase Ledger", rowIndex, "Completed", result, false);

            result    = 0;
            rowIndex += 1;
            SetProcessingText(grdDataMigration, "Sale Ledger", rowIndex, "Processing", result, true);
            result = accountLedgerMaster.InsertSaleLedgerData();
            SetProcessingText(grdDataMigration, "Sale Ledger", rowIndex, "Completed", result, false);

            result    = 0;
            rowIndex += 1;
            SetProcessingText(grdDataMigration, "Item Master", rowIndex, "Processing", result, true);
            result = itemMaster.InsertItemMasterData();
            SetProcessingText(grdDataMigration, "Item Master", rowIndex, "Completed", result, false);

            result    = 0;
            rowIndex += 1;
            SetProcessingText(grdDataMigration, "Supplier Ledger", rowIndex, "Processing", result, true);
            result = supplierLedgerMaster.InsertSupplierLedgerMasterData();
            SetProcessingText(grdDataMigration, "Supplier Ledger", rowIndex, "Completed", result, false);

            result    = 0;
            rowIndex += 1;
            SetProcessingText(grdDataMigration, "Customer Ledger", rowIndex, "Processing", result, true);
            result = customerLedgerMaster.InsertCustomerLedgerMasterData(); //confirm mapping columns for columns having comments in CustomerLedgerMaster
            SetProcessingText(grdDataMigration, "Customer Ledger", rowIndex, "Completed", result, false);

            //result = 0;
            //rowIndex += 1;
            //SetProcessingText(grdDataMigration, "Customer Compnay Discount Ref", rowIndex, "Processing", result, true);
            //result = customerLedgerMaster.InsertCustomerCompanyReferenceData();
            //SetProcessingText(grdDataMigration, "Customer Compnay Discount Ref", rowIndex, "Completed", result, false);

            //result = 0;
            //rowIndex += 1;
            //SetProcessingText(grdDataMigration, "Suppiier Compnay Discount Ref", rowIndex, "Processing", result, true);
            //result = supplierLedgerMaster.InsertSupplierCompanyReferenceData();
            //SetProcessingText(grdDataMigration, "Suppiier Compnay Discount Ref", rowIndex, "Completed", result, false);

            /*------------------------------------------------------------*/

            result    = 0;
            rowIndex += 1;
            SetProcessingText(grdDataMigration, "PurchaseSaleBookHeaderData", rowIndex, "Processing", result, true);
            result = purchaseSaleBookHeaderMigration.InsertPurchaseSaleBookHeaderData();
            SetProcessingText(grdDataMigration, "PurchaseSaleBookHeaderData", rowIndex, "Completed", result, false);

            result    = 0;
            rowIndex += 1;
            SetProcessingText(grdDataMigration, "PurchaseSaleBookLineItemData", rowIndex, "Processing", result, true);
            result = purchaseSaleBookLineItemMigration.InsertPurchaseSaleBookLineItemData();
            SetProcessingText(grdDataMigration, "PurchaseSaleBookLineItemData", rowIndex, "Completed", result, false);

            result    = 0;
            rowIndex += 1;
            SetProcessingText(grdDataMigration, "Fifo", rowIndex, "Processing", result, true);
            result = fifo.InsertFIFOData();
            SetProcessingText(grdDataMigration, "Fifo", rowIndex, "Completed", result, false);

            result    = 0;
            rowIndex += 1;
            SetProcessingText(grdDataMigration, "Bill Outstanding", rowIndex, "Processing", result, true);
            result = billOutstanding.InsertBillOutstandingData();
            SetProcessingText(grdDataMigration, "Bill Outstanding", rowIndex, "Completed", result, false);


            result    = 0;
            rowIndex += 1;
            SetProcessingText(grdDataMigration, "TRN", rowIndex, "Processing", result, true);
            trn.InsertTRNData();
            SetProcessingText(grdDataMigration, "TRN", rowIndex, "Completed", 0, false);

            result    = 0;
            rowIndex += 1;
            SetProcessingText(grdDataMigration, "ReceiptPayment", rowIndex, "Processing", result, true);
            result = receiptPayment.InsertReceiptPaymentData();
            SetProcessingText(grdDataMigration, "ReceiptPayment", rowIndex, "Completed", 0, false);

            result    = 0;
            rowIndex += 1;
            SetProcessingText(grdDataMigration, "BillOutStandingsAudjustment", rowIndex, "Processing", result, true);
            result = billOsAdjustment.InsertBillOutStandingsAudjustmentData();
            SetProcessingText(grdDataMigration, "BillOutStandingsAudjustment", rowIndex, "Completed", 0, false);

            /* ---------------------------------------  ---------------------------------------*/

            MessageBox.Show("Process Completed");
        }
        internal SupplierLedgerMaster GetSupplierLedgerByName(string name)
        {
            SupplierLedgerMaster master = GetSupplierLedgers(string.Empty).Where(p => p.SupplierLedgerCode.ToLower() == name.ToLower()).FirstOrDefault();

            return(master);
        }
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                if (string.IsNullOrEmpty(txtCustSupplierName.Text))
                {
                    throw new Exception("Supplier Name can not be blank");
                }

                //Set the cursor to appear as busy
                Cursor.Current = Cursors.WaitCursor;

                Status status;
                //  int areaId = 0;
                decimal openingBal = 0.00M;

                SupplierLedgerMaster supplier = new SupplierLedgerMaster();
                supplier.SupplierLedgerCode      = txtCode.Text;
                supplier.SupplierLedgerName      = txtCustSupplierName.Text;
                supplier.SupplierLedgerShortName = txtShortName.Text;
                supplier.Address       = txtAddress.Text;
                supplier.ContactPerson = txtContactPerson.Text;
                Enum.TryParse <Status>(cbxStatus.SelectedItem.ToString(), out status);
                supplier.Status      = status == Status.Active;
                supplier.CreditDebit = (Enums.TransType)cbxCreditDebit.SelectedItem == Enums.TransType.C ? "C" : "D";

                supplier.AreaId       = Convert.ToInt32(tbxArea.Tag);
                supplier.EmailAddress = txtEmailAddress.Text;
                supplier.Mobile       = txtMobile.Text;
                supplier.OfficePhone  = txtPhoneO.Text;

                int purchaseTypeId = 0;
                Int32.TryParse(Convert.ToString(cbxPurchaseType.SelectedValue), out purchaseTypeId);
                supplier.PurchaseTypeId = purchaseTypeId;

                decimal.TryParse(txtOpeningBal.Text, out openingBal);
                supplier.OpeningBal       = openingBal;
                supplier.ResidentPhone    = txtPhoneR.Text;
                supplier.TaxRetail        = (Enums.TaxRetail)cbxTaxRetail.SelectedItem == TaxRetail.R ? "R" : "T";
                supplier.SupplierLedgerId = SupplierId;

                supplier.DLNo         = tbxDL.Text;
                supplier.GSTNo        = tbxGST.Text;
                supplier.CINNo        = tbxCIN.Text;
                supplier.LINNo        = tbxLIN.Text;
                supplier.ServiceTaxNo = tbxServiceTax.Text;
                supplier.PANNo        = tbxPAN.Text;

                ///Get All the mapping for Company discount
                ///
                supplier.SupplierCompanyDiscountList = dgvCompanyDiscount.Rows
                                                       .Cast <DataGridViewRow>()
                                                       .Where(r => !String.IsNullOrWhiteSpace(Convert.ToString(r.Cells["Normal"].Value)) ||
                                                              !String.IsNullOrWhiteSpace(Convert.ToString(r.Cells["Breakage"].Value)) ||
                                                              !String.IsNullOrWhiteSpace(Convert.ToString(r.Cells["Expired"].Value))
                                                              ).Select(x => new SupplierCompanyDiscount()
                {
                    CompanyID = (x.DataBoundItem as SupplierCompanyDiscount).CompanyID,
                    Normal    = (x.DataBoundItem as SupplierCompanyDiscount).Normal,
                    Breakage  = (x.DataBoundItem as SupplierCompanyDiscount).Breakage,
                    Expired   = (x.DataBoundItem as SupplierCompanyDiscount).Expired,
                    SupplierItemDiscountMapping = (x.DataBoundItem as SupplierCompanyDiscount).SupplierItemDiscountMapping
                }).ToList();


                int result = SupplierId > 0 ? applicationFacade.UpdateSupplierLedger(supplier) : applicationFacade.AddSupplierLedger(supplier);

                //Make the Cursor to default
                Cursor.Current = Cursors.Default;

                //Close this form if operation is successful
                if (result > 0)
                {
                    this.Close();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }