//Invoice Stock Info Load
        public void InvoiceStockInfoLoad(InvoiceList invoiceItems, TextBlock textboxproductID, TextBlock textBoxQuantity, TextBlock textBoxWaitAndAvarageRate, string ProductID)
        {
            StockInfoLoad(textboxproductID, textBoxQuantity, textBoxWaitAndAvarageRate, ProductID);
            IEnumerable <InvoiceItems> ProductChecker = from invoiceItem in invoiceItems where invoiceItem.ProductID.Equals(ProductID) select invoiceItem;

            if (ProductChecker.Count() > 0)
            {
                InvoiceItems quantity = ProductChecker.First();
                textBoxQuantity.Text = (Convert.ToInt32(textBoxQuantity.Text) - quantity.Quantity).ToString();
            }
        }
Пример #2
0
        //Grid view Chart Item Add
        public void ChartItemAdd(InvoiceList invoiceItems, string productID, string Description, string stockQuantity, string saleQuanty, string SaleAmount, string saleRate, TextBlock quantity)
        {
            if (Convert.ToInt32(saleQuanty) <= Convert.ToInt32(stockQuantity))
            {
                IEnumerable <InvoiceItems> invoiceitem = from tempInvoiceItem in invoiceItems where tempInvoiceItem.ProductID.Equals(productID) select tempInvoiceItem;
                if (invoiceitem.Count() > 0)
                {
                    MessageBoxResult errorCodeMessBoxResult = new MessageBoxResult();
                    errorCodeMessBoxResult = Microsoft.Windows.Controls.MessageBox.Show(Variables.ERROR_MESSAGES[1, 7], Variables.ERROR_MESSAGES[0, 0], MessageBoxButton.YesNoCancel, MessageBoxImage.Question);

                    switch (errorCodeMessBoxResult)
                    {
                    case MessageBoxResult.Yes:
                        invoiceitem.First().Quantity += Convert.ToInt32(saleQuanty);
                        invoiceitem.First().Amount   += Convert.ToDouble(SaleAmount);
                        break;

                    case MessageBoxResult.No:
                        invoiceitem.First().Quantity = Convert.ToInt32(saleQuanty);
                        invoiceitem.First().Amount   = Convert.ToDouble(SaleAmount);
                        break;

                    case MessageBoxResult.Cancel:
                        return;

                    default:
                        return;
                    }
                }
                else
                {
                    invoiceItems.Add(new InvoiceItems(productID, Description, Convert.ToInt32(saleQuanty), Convert.ToDouble(saleRate), Convert.ToDouble(SaleAmount)));
                }
                quantity.Text = Convert.ToString(Convert.ToDouble(stockQuantity) - Convert.ToDouble(saleQuanty));
                return;
            }
            else
            {
                Microsoft.Windows.Controls.MessageBox.Show(Variables.ERROR_MESSAGES[1, 0], Variables.ERROR_MESSAGES[0, 0], MessageBoxButton.OK, MessageBoxImage.Hand);
                return;
            }
        }