예제 #1
0
        private void btn_Delete_Click(object sender, RoutedEventArgs e)
        {
            dynamic           row  = lvTaxs.SelectedItem;
            ConfirmationPopup form = new ConfirmationPopup((string)Application.Current.Resources["confirm_message_Tax"], header, true);

            form.ShowDialog();
            if (Common._isChecked)
            {
                controller.DeleteTax(row.TaxCode);
                ResponseVm responce = controller.GetTax();
                _taxs = responce.Response.Cast <TaxModel>().ToList();
                lvTaxs.ItemsSource = _taxs;
                Common.Notification((string)Application.Current.Resources["success_message_Tax"], header, false);
                DisableButtons();
                //ConfirmationPopup form1 = new ConfirmationPopup(msg, header, false);
                //form1.ShowDialog();
            }
        }
        public void GetAccountInfo_10000_RUB_User_Has_Other_Currencies()
        {
            //3 d. Получить состояние своего кошелька (сумму денег в каждой из валют)
            var user             = uniqueUsers.FirstOrDefault(user => user.Id == 100104);
            var accountUnderTest = user.Account;
            var expected         = new ResponseVm
            {
                Amount   = accountUnderTest.Balance.Amount,
                Currency = accountUnderTest.Balance.SelectedCurrency,
                Message  = $"Основной баланс кошелька: {user.Account.Balance}. Баланс кошелька в других валютах: 153,08 USD, 141,51 EUR."
            };
            //Act
            ResponseVm result = accountService.GetAccountInfo(user.Id);

            Assert.AreEqual(expected.Amount, result.Amount);
            Assert.AreEqual(expected.Currency, result.Currency);
            Assert.IsTrue(result.Message.Contains($"Основной баланс кошелька: {user.Account.Balance}"));
        }
예제 #3
0
        private void BindProduct()
        {
            ResponseVm responce = productController.GetProductsByCompanyAndBranch();

            if (responce.FaultData == null)
            {
                _products = responce.Response.Cast <ProductModel>().ToList();
                if (_products != null && _products.Count > 0)
                {
                    dgProducts.ItemsSource = _products;
                    dgProducts.Visibility  = Visibility.Visible;
                }
                else
                {
                    dgProducts.Visibility = Visibility.Collapsed;
                    brd_exp.Visibility    = Visibility.Visible;
                }
            }
        }
예제 #4
0
        public EditTax(dynamic row)
        {
            InitializeComponent();
            ChangeHeightWidth();
            ResponseVm responce = controller.GetTax();///.ToList();

            if (responce.FaultData == null)
            {
                _taxs = responce.Response.Cast <TaxModel>().ToList();
            }
            else
            {
                ConfirmationPopup form = new ConfirmationPopup(responce.FaultData.Detail.ErrorDetails, "Fault", false);
                form.ShowDialog();
            }
            tax_Detail.Text = row.TaxDetail;
            tax_Rate.Text   = Convert.ToString(row.Rate);
            RowId           = row.TaxCode;
        }
        public static async Task <ResponseVm> ForgotPassword(string email)
        {
            var response = new ResponseVm();

            try
            {
                var user = await UserManager.FindByNameAsync(email);

                var controller = new UrlHelper(HttpContext.Current.Request.RequestContext);
                var code       = await UserManager.GeneratePasswordResetTokenAsync(user.Id);

                var callbackUrl = controller.Action("ResetPassword", "Home", new { userId = user.Id, code },
                                                    HttpContext.Current.Request.Url.Scheme);

                var replacement = new Dictionary <string, string>
                {
                    { "#name#", user.UserName },
                    { "#link-reset-password#", callbackUrl }
                };

                var emailTemplate =
                    await CommonFunctions.GetEmailTemplate((int)EnumList.EmailTemplate.ResetPassword, true,
                                                           replacement);

                var emailService = new EmailService();
                await emailService.SendAsync(new IdentityMessage
                {
                    Body        = emailTemplate.Body,
                    Destination = user.Email,
                    Subject     = emailTemplate.Subject
                });

                response.Code = (int)EnumList.Response.Success;
            }
            catch (Exception e)
            {
                response.Code    = (int)EnumList.Response.Exception;
                response.Message = e.Message;
            }

            return(response);
        }
        public void Withdraw_Valid_Amount_100_Valid_Currency_Rub()
        {
            //3 b. Снять деньги в одной из валют
            var user             = uniqueUsers.FirstOrDefault(user => user.Id == 100104);
            var accountUnderTest = user.Account;
            var before_Withdraw_Account_Balance = new Money(accountUnderTest.Balance.Amount,
                                                            accountUnderTest.Balance.SelectedCurrency);
            var money_100Rub = new Money(100, Currency.RUB);
            var after_Withdraw_Account_Balance = before_Withdraw_Account_Balance - money_100Rub;
            var expected = new ResponseVm
            {
                Amount   = after_Withdraw_Account_Balance.Amount,
                Currency = after_Withdraw_Account_Balance.SelectedCurrency,
                Message  = "Кошелек пополнен на:  100,00 RUB."
            };
            //Act
            ResponseVm result = accountService.Withdraw(user.Id, money_100Rub.Amount);

            Assert.AreEqual(expected.Amount, result.Amount);
            Assert.AreEqual(expected.Currency, result.Currency);
        }
예제 #7
0
        public Wastage()
        {
            InitializeComponent();
            ChangeHeightWidth();
            AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
            ResponseVm responce = controller.GetWastage();

            startDate_Search.Text = CommonFunctions.ParseDateToFinclaveString(DateTime.Now.ToShortDateString());
            endDate_search.Text   = CommonFunctions.ParseDateToFinclaveString(DateTime.Now.ToShortDateString());
            if (responce.FaultData == null)
            {
                if (UserModelVm.BranchId != null)
                {
                    _wastage = responce.Response.Cast <WastageModel>().ToList().Where(x => x.CompanyCode == UserModelVm.CompanyId && x.BranchCode == UserModelVm.BranchId).OrderByDescending(x => x.Date).Where(x => CommonFunctions.ParseDateToFinclave(x.Date) >= CommonFunctions.ParseDateToFinclave(Settings.FinalYearStartDate) && CommonFunctions.ParseDateToFinclave(x.Date) <= CommonFunctions.ParseDateToFinclave(Settings.FinalYearEndDate)).ToList <WastageModel>();
                }
                else
                {
                    _wastage = responce.Response.Cast <WastageModel>().ToList().Where(x => x.CompanyCode == UserModelVm.CompanyId).OrderByDescending(x => x.Date).Where(x => CommonFunctions.ParseDateToFinclave(x.Date) >= CommonFunctions.ParseDateToFinclave(Settings.FinalYearStartDate) && CommonFunctions.ParseDateToFinclave(x.Date) <= CommonFunctions.ParseDateToFinclave(Settings.FinalYearEndDate)).ToList <WastageModel>();
                }

                //_wastage = responce.Response.Cast<DomainContracts.DataContracts.WastageModel>().OrderByDescending(x => x.Date).Where(x=>Convert.ToDateTime(x.Date)>=Convert.ToDateTime(Settings.FinalYearStartDate) && Convert.ToDateTime(x.Date)<=Convert.ToDateTime(Settings.FinalYearEndDate)).ToList();
                lvWastage.ItemsSource = _wastage;
                //if (lvWastage.Items.Count == 0)
                //     lvWastage.Items.Add("no record found");
                btn_addWastage.IsEnabled = true;
                edit_Wastage.IsEnabled   = false;
                edit_Wastage.Background  = Brushes.Gray;
                btn_Delete.IsEnabled     = false;
                btn_Delete.Background    = Brushes.Gray;
                btn_clear.IsEnabled      = false;
                btn_clear.Background     = Brushes.Gray;
            }
            else
            {
                ConfirmationPopup form = new ConfirmationPopup(responce.FaultData.Detail.ErrorDetails, header, false);
                form.ShowDialog();
                //  Common.ErrorNotification(responce.FaultData.Detail.ErrorDetails, header, false);
            }
        }
        public static async Task <ResponseVm> ResetPassword(string code, string email, string password)
        {
            var response = new ResponseVm();

            try
            {
                var user = await UserManager.FindByNameAsync(email);

                if (user != null)
                {
                    var result = await UserManager.ResetPasswordAsync(user.Id, code, password);

                    if (result.Succeeded)
                    {
                        response.Code = (int)EnumList.Response.Success;
                    }
                    else
                    {
                        response.Message = string.Join(",", result.Errors);
                    }
                }
                else
                {
                    // Don't reveal that the user does not exist
                    response.Message = ErrorMessage.SomethingWentWrong;
                }


                response.Code = (int)EnumList.Response.Error;
            }
            catch (Exception e)
            {
                response.Code    = (int)EnumList.Response.Exception;
                response.Message = e.Message;
            }

            return(response);
        }
예제 #9
0
        public MasterLabelSetting()
        {
            InitializeComponent();
            btn_remove.IsEnabled  = false;
            btn_remove.Background = Brushes.Gray;
            ResponseVm responce = productController.GetProductsByCompanyAndBranch();

            _masterLabel = productController.GetMasaterLabelSetting();
            BindPrinters();

            GridLengthConverter gridLengthConverter = new GridLengthConverter();

            if (responce.FaultData == null)
            {
                _products = responce.Response.Cast <ProductModel>().ToList();
                dgPurchases.ItemsSource = _products;
                dgPurchases.Visibility  = Visibility.Visible;
            }
            if (_masterLabel != null)
            {
                List <ProductLabelSettingModel> productLabel = productController.GetProductLabelSettings(_masterLabel.Id.Value);
                _productLabelSetting        = productLabel?.Select(x => new ProductLabelSettingModel(x.Id, x.MasterLabelCode, x.ProductCode, x.Quantity, _products.Any(j => j.Id == x.ProductCode) == true ? _products.Where(z => z.Id == x.ProductCode).FirstOrDefault().ItemName : string.Empty)).ToList();
                purchaseStocks              = new ObservableCollection <ProductLabelSettingModel>(_productLabelSetting);
                print_item_code.IsChecked   = _masterLabel.PrintItemCode ? true : false;
                print_item_price.IsChecked  = _masterLabel.PrintItemPrice ? true : false;
                chk_print_barcode.IsChecked = _masterLabel.PrintBarCode ? true : false;
                chk_item_detail.IsChecked   = _masterLabel.PrintItemDetail ? true : false;
                if (_masterLabel.BarCodeHeight != "")
                {
                    //bar_code_height.SelectedItem = (Common.barcodeHeight)Enum.Parse(typeof(Common.barcodeHeight), _masterLabel.BarCodeHeight); //;Enum.GetValues(typeof(CommonFunction.Common.barcodeHeight));
                }
            }
            if (purchaseStocks == null)
            {
                additems();
            }
            lstPurchase.ItemsSource = purchaseStocks;
        }
예제 #10
0
        public MasterPrintInvoice(MasterLabelSettingModel row, List <ProductLabelSettingModel> productlabel)
        {
            InitializeComponent();
            List <PrintMasterSettingModel> models = new List <PrintMasterSettingModel>();
            ResponseVm responce = productController.GetProductsByCompanyAndBranch();

            _products = responce.Response.Cast <ProductModel>().ToList();

            //for (var i = 0; i <= Convert.ToInt32(row.StartRow); i++)
            //{

            //if (i == Convert.ToInt32(row.StartRow))
            //{
            //for (var k = 0; k <= Convert.ToInt32(row.StartColumn); k++)
            //{
            //if (k == Convert.ToInt32(row.StartColumn))
            //{
            foreach (var data in productlabel)
            {
                var product = _products?.FirstOrDefault(x => x.Id == data.ProductCode);
                for (var j = 1; j <= data.Quantity; j++)
                {
                    PrintMasterSettingModel model = new PrintMasterSettingModel();
                    if (row.PrintBarCode)
                    {
                        model.Barcode = product.BarCode;
                    }
                    else
                    {
                        model.Barcode = string.Empty;
                    }
                    if (row.PrintItemCode)
                    {
                        model.ProductCode = Convert.ToString(product.Id);
                    }
                    else
                    {
                        model.ProductCode = string.Empty;
                    }
                    if (row.PrintItemDetail)
                    {
                        model.ProductName = product.ItemName;
                    }
                    else
                    {
                        model.ProductName = string.Empty;
                    }
                    if (row.PrintItemPrice)
                    {
                        model.Price = Convert.ToString(product.RetailPrice);
                    }
                    else
                    {
                        model.Price = string.Empty;
                    }
                    var content = model.Barcode;
                    var writer  = new BarcodeWriter
                    {
                        Format = BarcodeFormat.CODE_128
                    };
                    var bitmap = writer.Write(content);
                    bitmap.SetResolution(100, 150);
                    //Linear barcode = new Linear();
                    //barcode.Type = BarcodeType.CODE128;
                    //barcode.Data = model.Barcode;
                    //barcode.drawBarcodeAsBytes();
                    //Utility.CommonMethods.CommonFunctions.ByteToImage(barcode.drawBarcodeAsBytes());
                    model.ImageData = Common.ToBitmapImage(bitmap);
                    model.Barcode   = string.Empty;
                    models.Add(model);
                }
            }
            TvBox.ItemsSource = models;
        }
예제 #11
0
        private void ReusableCodeTemp(string callingMethod)
        {
            try
            {
                bool       found    = false;
                var        border   = (resultStack.Parent as ScrollViewer).Parent as Border;
                ResponseVm responce = controller.GetProductsByCompanyAndBranch();
                var        data     = responce.Response.Cast <ProductModel>().ToList();
                resultStack.Children.Clear();
                string query = (txtName as TextBox).Text;

                if (query.Length == 0)
                {
                    if (callingMethod == "arrow_Click")
                    {
                        foreach (var obj in data)
                        {
                            //if (obj.ItemName.ToLower().StartsWith(query.ToLower()))
                            //{
                            addProductName(obj.ItemName, obj.Id.Value);
                            found = true;
                            //}
                        }
                        //resultStack.Children.Clear();
                        border.Visibility      = Visibility.Visible;
                        resultStack.Visibility = Visibility.Visible;
                        resultStack.IsEnabled  = true;
                    }
                    else
                    {
                        border.Visibility     = Visibility.Collapsed;
                        resultStack.IsEnabled = false;
                    }
                }
                else
                {
                    foreach (var obj in data)
                    {
                        if (obj.ItemName.ToLower().StartsWith(query.ToLower()))
                        {
                            addProductName(obj.ItemName, obj.Id.Value);
                            found = true;
                        }
                    }
                    border.Visibility      = Visibility.Visible;
                    resultStack.Visibility = Visibility.Visible;
                    resultStack.IsEnabled  = true;
                }
                if (!found)
                {
                    resultStack.IsEnabled = false;
                    resultStack.Children.Add(new TextBlock()
                    {
                        Text = "No results found."
                    });
                }
            }
            catch (Exception ex)
            {
                throw;
            }
        }
예제 #12
0
        public invoice(dynamic row, string callingPage, string recieptType)
        {
            InitializeComponent();
            try
            {
                if (callingPage == "Purchase")
                {
                    if (recieptType == "Approved")
                    {
                        grdPrintPurchase.Visibility  = Visibility.Visible;
                        grdReturnProducts.Visibility = Visibility.Collapsed;
                        _supliers = controller.GetSuppliers().ToList();
                        SupplierModel suplier = _supliers?.FirstOrDefault(x => x.Id == row.SuplierCode);
                        _supplierCode = row.SuplierCode;
                        ResponseVm responce = productController.GetProductsByCompanyAndBranch();
                        _products                 = responce.Response.Cast <ProductModel>().ToList();
                        _orignalLstStocks         = purchaseController.GetStocksByPurchaseId(row.PurchaseId);
                        _orignalLstPurchaseRetrun = purchaseController.GetPurchaseReturns(row.PurchaseId);
                        if (row.Status == (int)CommonEnum.PurchaseStatus.WaitingForApproval)
                        {
                            BindItems(row, suplier);
                        }
                        else
                        {
                            txtFromPhone.Text   = string.Empty;
                            txtFromAddress.Text = "Any";
                            txtFromCity.Text    = "Mohali"; //Convert.ToString(suplier?.);
                                                            // txtFromEmail.Text = "*****@*****.**";
                            txtToPhone.Text   = Convert.ToString(suplier?.Mobile);
                            txtToAddress.Text = Convert.ToString(suplier?.Address);
                            txtToCity.Text    = string.Empty; //Convert.ToString(suplier?.);
                                                              // txtToEmail.Text = suplier?.Email;
                            List <PurchaseStockModel> purchaseStockDataWIthPurchaseStockModel = _orignalLstStocks.Select(x => new PurchaseStockModel(x.ProductCode, GetProductName(Convert.ToInt32(x.ProductCode)), x.Quantity, x.CostPrice, x.SellingPrice, x.MRP, Convert.ToInt32(x.ItemTaxPercentage), x.BatchNo, x.StockId)).ToList();
                            purchaseStocks = new ObservableCollection <PurchaseStockModel>(purchaseStockDataWIthPurchaseStockModel);
                            var retrunedPurchaseStocks = GetGroupOfPurchaseStocks(purchaseStocks);
                            List <PurchaseStockModel>      stocksofetrunedPurchased = new List <PurchaseStockModel>(retrunedPurchaseStocks);
                            ProductAmount                  retrunedAmount           = CommonFunctions.RetrunProductAmountWithReturnProduct(stocksofetrunedPurchased, Convert.ToString(row.DiscountPercentage), string.Empty, Convert.ToString(row.TaxPercentage), Convert.ToString(row.SurChargeAmount));
                            List <PrintPurchaseStockModel> purchaseStockData        = stocksofetrunedPurchased.Select(x => new PrintPurchaseStockModel(x.ProductCode, GetProductName(Convert.ToInt32(x.ProductCode)), x.Quantity, x.CostPrice, (x.Quantity - x.ReturnedQuantity) * x.CostPrice)).ToList();
                            //  _orignalLstStocks = purchaseController.GetStocks(row.PurchaseId);
                            //  List<PurchaseStockModel> purchaseStockDataWIthPurchaseStockModel = _orignalLstStocks.Select(x => new PurchaseStockModel(x.ProductCode, GetProductName(Convert.ToInt32(x.ProductCode)), x.Quantity, x.CostPrice, x.SellingPrice, x.MRP, Convert.ToInt32(x.ItemTaxPercentage), x.BatchNo, x.StockId)).ToList();
                            // List<PrintPurchaseStockModel> purchaseStockData = _orignalLstStocks.Select(x => new PrintPurchaseStockModel(x.ProductCode, GetProductName(Convert.ToInt32(x.ProductCode)), x.Quantity, x.CostPrice, x.Quantity * x.CostPrice)).ToList();
                            // purchaseStocks = new ObservableCollection<PurchaseStockModel>(purchaseStockData);
                            //ProductAmount amount = CommonFunctions.RetrunProductAmount(stocksofetrunedPurchased, Convert.ToString(row.DiscountPercentage), string.Empty, Convert.ToString(row.TaxPercentage), Convert.ToString(row.SurChargeAmount));
                            SetTextToTextBoxes(row, retrunedAmount);
                            lstPrintPurchase.ItemsSource = purchaseStockData;
                            Print();
                        }
                    }
                    else
                    {
                        List <DomainContracts.DataContracts.PrintPurchaseReturnModel> objPrintModel = new List <DomainContracts.DataContracts.PrintPurchaseReturnModel>();
                        grdPrintPurchase.Visibility  = Visibility.Collapsed;
                        grdReturnProducts.Visibility = Visibility.Visible;
                        _supliers = controller.GetSuppliers().ToList();
                        SupplierModel suplier = _supliers?.FirstOrDefault(x => x.Id == row.SuplierCode);
                        _supplierCode = row.SuplierCode;
                        ResponseVm responce = productController.GetProductsByCompanyAndBranch();
                        _products                 = responce.Response.Cast <ProductModel>().ToList();
                        _orignalLstStocks         = purchaseController.GetStocksByPurchaseId(row.PurchaseId);
                        _orignalLstPurchaseRetrun = purchaseController.GetPurchaseReturns(row.PurchaseId);
                        txtFromPhone.Text         = Convert.ToString(suplier?.Mobile);
                        txtFromAddress.Text       = Convert.ToString(suplier?.Address);
                        txtFromCity.Text          = string.Empty; //Convert.ToString(suplier?.);
                                                                  //txtFromEmail.Text = suplier?.Email;
                        txtToPhone.Text   = string.Empty;
                        txtToAddress.Text = "Any";
                        txtToCity.Text    = "Mohali"; //Convert.ToString(suplier?.);
                                                      //  txtToEmail.Text = "*****@*****.**";
                        List <PurchaseStockModel> purchaseStockDataWIthPurchaseStockModel = _orignalLstStocks.Select(x => new PurchaseStockModel(x.ProductCode, GetProductName(Convert.ToInt32(x.ProductCode)), x.Quantity, x.CostPrice, x.SellingPrice, x.MRP, Convert.ToInt32(x.ItemTaxPercentage), x.BatchNo, x.StockId)).ToList();
                        purchaseStocks = new ObservableCollection <PurchaseStockModel>(purchaseStockDataWIthPurchaseStockModel);
                        var retrunedPurchaseStocks = GetGroupOfPurchaseStocks(purchaseStocks);
                        List <PurchaseStockModel>      stocksofetrunedPurchased = new List <PurchaseStockModel>(retrunedPurchaseStocks);
                        ProductAmount                  retrunedAmount           = CommonFunctions.RetrunProductAmountOfReturnProduct(stocksofetrunedPurchased, Convert.ToString(row.DiscountPercentage), string.Empty, Convert.ToString(row.TaxPercentage), Convert.ToString(row.SurChargeAmount));
                        List <PrintPurchaseStockModel> purchaseStockData        = stocksofetrunedPurchased.Select(x => new PrintPurchaseStockModel(x.ProductCode, GetProductName(Convert.ToInt32(x.ProductCode)), x.Quantity, x.CostPrice, (x.ReturnedQuantity) * x.CostPrice)).ToList();
                        objPrintModel = purchaseStockData.Select(x => new DomainContracts.DataContracts.PrintPurchaseReturnModel(x.PrintProductCode, x.PrintProductName, x.PrintQuantity, x.PrintCostPrice, x.PrintTotal, _orignalLstPurchaseRetrun.Count > 0 ? _orignalLstPurchaseRetrun.FirstOrDefault(z => z.ProductCode == x.PrintProductCode).Reason : string.Empty, _orignalLstPurchaseRetrun.Count > 0 ? _orignalLstPurchaseRetrun.FirstOrDefault(z => z.ProductCode == x.PrintProductCode).Quantity : 0)).ToList();
                        SetTextToTextBoxes(row, retrunedAmount);
                        lstPrintReturnPurchase.ItemsSource = objPrintModel;
                        Print();
                        // BindItems(row, suplier);
                    }
                }
                else if (callingPage == "DirectPurchase")
                {
                    grdPrintPurchase.Visibility  = Visibility.Visible;
                    grdReturnProducts.Visibility = Visibility.Collapsed;
                    _supliers = controller.GetSuppliers().ToList();
                    SupplierModel suplier = _supliers?.FirstOrDefault(x => x.Id == row.SuplierCode);
                    _supplierCode = row.SuplierCode;
                    ResponseVm responce = productController.GetProductsByCompanyAndBranch();
                    _products           = responce.Response.Cast <ProductModel>().ToList();
                    _orignalLstStocks   = purchaseController.GetDirectStocks(row.PurchaseId);
                    txtFromPhone.Text   = string.Empty;
                    txtFromAddress.Text = "Any";
                    txtFromCity.Text    = "Mohali"; //Convert.ToString(suplier?.);
                                                    // txtFromEmail.Text = "*****@*****.**";
                    txtToPhone.Text   = Convert.ToString(suplier?.Mobile);
                    txtToAddress.Text = Convert.ToString(suplier?.Address);
                    txtToCity.Text    = string.Empty; //Convert.ToString(suplier?.);
                                                      // txtToEmail.Text = suplier?.Email;
                    List <PurchaseStockModel> purchaseStockDataWIthPurchaseStockModel = _orignalLstStocks.Select(x => new PurchaseStockModel(x.ProductCode, GetProductName(Convert.ToInt32(x.ProductCode)), x.Quantity, x.CostPrice, x.SellingPrice, x.MRP, Convert.ToInt32(x.ItemTaxPercentage), x.BatchNo, x.StockId)).ToList();



                    purchaseStocks = new ObservableCollection <PurchaseStockModel>(purchaseStockDataWIthPurchaseStockModel);
                    var retrunedPurchaseStocks = GetGroupOfPurchaseStocksForDirectPurchase(purchaseStocks);
                    List <PurchaseStockModel>      stocksofetrunedPurchased = new List <PurchaseStockModel>(retrunedPurchaseStocks);
                    ProductAmount                  retrunedAmount           = CommonFunctions.RetrunProductAmountWithReturnProduct(stocksofetrunedPurchased, Convert.ToString(row.DiscountPercentage), string.Empty, Convert.ToString(row.TaxPercentage), Convert.ToString(row.SurChargeAmount));
                    List <PrintPurchaseStockModel> purchaseStockData        = stocksofetrunedPurchased.Select(x => new PrintPurchaseStockModel(x.ProductCode, GetProductName(Convert.ToInt32(x.ProductCode)), x.Quantity, x.CostPrice, (x.Quantity - x.ReturnedQuantity) * x.CostPrice)).ToList();
                    //  _orignalLstStocks = purchaseController.GetStocks(row.PurchaseId);
                    //  List<PurchaseStockModel> purchaseStockDataWIthPurchaseStockModel = _orignalLstStocks.Select(x => new PurchaseStockModel(x.ProductCode, GetProductName(Convert.ToInt32(x.ProductCode)), x.Quantity, x.CostPrice, x.SellingPrice, x.MRP, Convert.ToInt32(x.ItemTaxPercentage), x.BatchNo, x.StockId)).ToList();
                    // List<PrintPurchaseStockModel> purchaseStockData = _orignalLstStocks.Select(x => new PrintPurchaseStockModel(x.ProductCode, GetProductName(Convert.ToInt32(x.ProductCode)), x.Quantity, x.CostPrice, x.Quantity * x.CostPrice)).ToList();
                    // purchaseStocks = new ObservableCollection<PurchaseStockModel>(purchaseStockData);
                    //ProductAmount amount = CommonFunctions.RetrunProductAmount(stocksofetrunedPurchased, Convert.ToString(row.DiscountPercentage), string.Empty, Convert.ToString(row.TaxPercentage), Convert.ToString(row.SurChargeAmount));
                    SetTextToTextBoxes(row, retrunedAmount);
                    lstPrintPurchase.ItemsSource = purchaseStockData;
                    Print();
                }
            }
            catch (Exception ex)
            {
            }
        }