private void InitializeLabels(PurchaseGet purchase)
        {
            if (purchase.Vendor == null)
            {
                m_UIControl.lbl_VendorName.Text = "--";
            }
            else
            {
                m_UIControl.lbl_VendorName.Text = purchase.Vendor.CompanyName;
            }
            m_UIControl.lbl_PurchaseDate.Text = purchase.PurchaseDateTime.ToString();
            double totalPrice = 0.0;
            double amountPaid = 0.0;

            for (int i = 0; i < GetTable().Rows.Count; ++i)
            {
                totalPrice += double.Parse(GetTable().Rows[i].Cells["PurchaseTable_ActualPrice"].Value.ToString());
                amountPaid += double.Parse(GetTable().Rows[i].Cells["PurchaseTable_DiscountedPrice"].Value.ToString());
            }
            NumberFormatInfo indianCurrency = new CultureInfo("hi-IN", false).NumberFormat;

            indianCurrency.CurrencyPositivePattern = 2;
            var totalDiscount = totalPrice - amountPaid;

            m_UIControl.lbl_TotalDiscount.Text = String.Format(indianCurrency, "{0:c}", totalDiscount);
            m_UIControl.lbl_TotalPrice.Text    = String.Format(indianCurrency, "{0:c}", totalPrice);
            m_UIControl.lbl_amountPaid.Text    = String.Format(indianCurrency, "{0:c}", amountPaid);
        }
 private void InitializeProductDetailsTable(PurchaseGet purchase)
 {
     foreach (var productDetails in purchase.ProductDetails)
     {
         AddRowToTable(productDetails);
     }
     InitializeLabels(purchase);
 }
        public void OnPurchaseAdded(PurchaseGet purchase)
        {
            string[] ids = purchase.ProductIDs.Split(',');

            for (int i = 0; i < ids.Length; ++i)
            {
                int productID = int.Parse(ids[i]);
                UpdateStockInTable(productID);
            }
        }
        private void AddPurchaseToHistoryTable(PurchaseGet purchase)
        {
            var             Table  = GetPurchaseHistoryTable();
            int             Index  = Table.Rows.Add();
            DataGridViewRow NewRow = Table.Rows[Index];

            NewRow.Cells["Purchase_Date"].Value       = purchase.PurchaseDateTime;
            NewRow.Cells["Purchase_ID"].Value         = purchase.ID;
            NewRow.Cells["Purchase_VendorName"].Value = purchase.Vendor.CompanyName;
            double totalPrice = 0.0;

            foreach (var productDetails in purchase.ProductDetails)
            {
                totalPrice += productDetails.BuyingPrice;
            }
            NewRow.Cells["Purchase_TotalPrice"].Value = totalPrice;
        }