private void btn_back_Click(object sender, RoutedEventArgs e)
        {
            new ObservableCollection <PurchaseStockModel>();
            DirectPurchase form = new DirectPurchase();

            NavigationService.Navigate(form);
        }
        private void btn_Save_Click(object sender, RoutedEventArgs e)


        {
            List <StockModel>         newStocks = new List <StockModel>();
            List <PurchaseStockModel> Stocks    = lstPurchase.Items.Cast <PurchaseStockModel>().Select(x => x).ToList();

            if (Stocks.Any(x => x.ProductCode > 0 && x.Quantity > 0))
            {
                decimal? nullval  = null;
                DateTime?nulldate = null;
                dynamic  row      = new PurchaseModel(_purchaseData.PurchaseId, _purchaseData.PurchaseDate, string.IsNullOrEmpty(supplier_name.Text) ? null : _supplierCode, string.IsNullOrEmpty(purchase_cashdiscount.Text) ? nullval : Convert.ToDecimal(purchase_cashdiscount.Text), string.IsNullOrEmpty(purchase_cashdiscountDoller.Text) ? nullval : Convert.ToDecimal(purchase_cashdiscountDoller.Text), string.IsNullOrEmpty(purchase_deliveryDate.Text) ? nulldate : CommonFunctions.ParseDateToFinclave(purchase_deliveryDate.Text), string.IsNullOrEmpty(purchase_expiryDate.Text) ? nulldate : CommonFunctions.ParseDateToFinclave(purchase_expiryDate.Text)
                                                      , string.IsNullOrEmpty(purchase_cashSubChargeAmo.Text) ? nullval : Convert.ToDecimal(purchase_cashSubChargeAmo.Text)
                                                      , string.IsNullOrEmpty(_taxValue) ? nullval : Convert.ToDecimal(_taxValue), _purchaseData.CreatedBy, _purchaseData.CreatedDate, _purchaseData.CompanyCode, _purchaseData.BranchCode, _purchaseData.SuplierName);
                var result = purchaseController.SaveUpdateDirectPurchase(row);
                newStocks.AddRange(Stocks.Where(z => z.ProductCode > 0 && z.Quantity > 0).Select(x =>
                {
                    return(new StockModel(x.StockId == null ? 0 : x.StockId, _purchaseData.PurchaseId.Value, x.Quantity, x.CostPrice, x.SellingPrice, x.MRP, x.Discount, x.BatchNo, x.ProductCode, null));
                    // newStocks.Add(stock);
                }).ToList());

                purchaseController.UpdateStocks(newStocks, _deletestocks);
                //  ConfirmationPopup form = new ConfirmationPopup((string)myResourceDictionary["purchase_updated"], header, false);
                // form.ShowDialog();
                Common.Notification((string)Application.Current.Resources["purchase_updated"], header, false);
                ClearData();
                DirectPurchase form1 = new DirectPurchase();
                NavigationService.Navigate(form1);
            }
            else
            {
                ConfirmationPopup form = new ConfirmationPopup((string)Application.Current.Resources["purchase_requiredFields"], header, false);
                form.ShowDialog();
                // Common.ErrorNotification((string)myResourceDictionary["purchase_requiredFields"], header, false);
            }
        }
Exemple #3
0
        private void btn_back_Click(object sender, RoutedEventArgs e)
        {
            DirectPurchase form = new DirectPurchase();

            NavigationService.Navigate(form);
        }
Exemple #4
0
        public void NavigateToBackPage()
        {
            DirectPurchase form = new DirectPurchase();

            NavigationService.Navigate(form);
        }