private void btn_save_click(object sender, RoutedEventArgs e)
 {
     if (string.IsNullOrEmpty(product_name.Text) || string.IsNullOrEmpty(retail_price.Text) || string.IsNullOrEmpty(trade_price.Text) || string.IsNullOrEmpty(itemType.Text) || item_Type.SelectedIndex == -1)
     {
         //  msg = "Please fill the required fields first";
         ConfirmationPopup form = new ConfirmationPopup((string)Application.Current.Resources["error_message_Tax"], header, false);
         form.ShowDialog();
     }
     else if (is_texinclusive.IsChecked.Value == false && string.IsNullOrEmpty(taxPercentage_.Text))
     {
         ConfirmationPopup form = new ConfirmationPopup((string)Application.Current.Resources["taxPercentage_ErrorMsg"], header, false);
         form.ShowDialog();
     }
     else
     {
         decimal?nullval     = null;
         int?    integernull = null;
         if (!string.IsNullOrEmpty(category_code.Text))
         {
             categoryId = _categories.FirstOrDefault(x => x.CategoryName.ToLower() == category_code.Text.ToLower()).Id;
         }
         //binaryImage = Utility.CommonMethods.CommonFunctions.ImageToByteArray((BitmapImage)CompanyLogo.Source);
         //string data = Convert.ToBase64String(binaryImage);
         ProductModel model = new ProductModel(0, product_name.Text, categoryId, string.IsNullOrEmpty(retail_price.Text) ? nullval : Convert.ToDecimal(retail_price.Text), string.IsNullOrEmpty(trade_price.Text) ? nullval : Convert.ToDecimal(trade_price.Text), string.IsNullOrEmpty(wholeseller_price.Text) ? nullval : Convert.ToDecimal(wholeseller_price.Text), string.IsNullOrEmpty(reseller_price.Text) ? nullval : Convert.ToDecimal(reseller_price.Text), Convert.ToInt32(item_Type.SelectedItem), string.IsNullOrEmpty(weight_.Text) ? nullval : Convert.ToDecimal(weight_.Text), barcode_.Text, string.IsNullOrEmpty(taxPercentage_.Text) ? nullval : Convert.ToDecimal(taxPercentage_.Text), string.IsNullOrEmpty(minimum_level.Text) ? integernull : Convert.ToInt32(minimum_level.Text), string.IsNullOrEmpty(reorder_level.Text) ? integernull : Convert.ToInt32(reorder_level.Text), null, is_texinclusive.IsChecked.Value, shortname_.Text, description_.Text, UserModelVm.BranchId, string.Empty, string.Empty, null, CompanyLogo.Source.ToString(), UserModelVm.CompanyId, null);
         int          id    = controller.SaveUpdateProduct(model);
         // msg = "Product saved successfully";
         // ConfirmationPopup form = new ConfirmationPopup(msg, header, false);
         // form.ShowDialog();
         Common.Notification((string)Application.Current.Resources["product_saveSuccessMsg"], header, false);
         ClearFields();
         inventory form1 = new inventory();
         NavigationService.Navigate(form1);
     }
 }
        private void btn_Delete_Click(object sender, RoutedEventArgs e)
        {
            dynamic           row  = lvPayments.SelectedItem;
            ConfirmationPopup form = new ConfirmationPopup((string)Application.Current.Resources["payment_delete_alert"], header, true);

            form.ShowDialog();
            if (Common._isChecked)
            {
                controller.DeletePayment(row.PaymentTosupplierId);
                // if (result.FaultData == null)
                // {
                ResponseVm response = controller.GetPaymentsByCompanyIdAndBranchId(UserModelVm.CompanyId, UserModelVm.BranchId);//.ToList();
                if (response.FaultData == null)
                {
                    _payments = response.Response.Cast <PaymentToSupplierModel>().ToList();
                    lvPayments.ItemsSource = _payments;
                    Common.Notification((string)Application.Current.Resources["deletePayment_success_alert"], header, false);
                    DisableIcons();
                }
                else
                {
                    Common.ErrorMessage(response.FaultData.Detail.ErrorDetails, header);
                }
                //  }
                // else
                //  {
                //    Common.ErrorMessage((string)Application.Current.Resources["product_exist_exeption"], header);
                //  }
            }
        }
Example #3
0
        private void btn_Delete_Click(object sender, RoutedEventArgs e)
        {
            dynamic row = lvWastage.SelectedItem;
            // msg = "Are you sure ? Do you want to delete Wastage ?";
            ConfirmationPopup form = new ConfirmationPopup((string)Application.Current.Resources["wastage_DeleteConformationMsg"], header, true);

            form.ShowDialog();

            if (Common._isChecked)
            {
                var result = controller.DeleteWastage(row.WastageId);
                //if (result == true)
                //{
                ResponseVm responce = controller.GetWastage();//.ToList();
                if (responce.FaultData == null)
                {
                    _wastage = responce.Response.Cast <DomainContracts.DataContracts.WastageModel>().ToList();
                    lvWastage.ItemsSource = _wastage;
                    // msg = "Wastage has been deleted Successfully.";
                    //  ConfirmationPopup form1 = new ConfirmationPopup(msg, header, false);
                    //  form1.ShowDialog();
                    Common.Notification((string)Application.Current.Resources["wastage_DeleteSuccessMsg"], header, false);
                    DisableButton();
                }
                else
                {
                    ConfirmationPopup form1 = new ConfirmationPopup(responce.FaultData.Detail.ErrorDetails, header, false);
                    form1.ShowDialog();
                }
            }
        }
Example #4
0
        public ViewBranch(dynamic companyId, string companyName)
        {
            InitializeComponent();
            ChangeHeightWidth();
            AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
            _compamnyName  = companyName;
            this.companyId = companyId;
            ResponseVm responce = controller.GetCompanyBranches(this.companyId);//.OrderByDescending(x => x.CreatedDate).ToList();

            if (responce.FaultData == null)
            {
                branches                  = responce.Response.Cast <BranchModel>().ToList();
                lvBranch.ItemsSource      = branches;
                btn_addBranch.IsEnabled   = true;
                btn_back.IsEnabled        = true;
                lblBranchHeading.Content  = "Branches (" + _compamnyName + ")";
                btn_editBranch.IsEnabled  = false;
                btn_editBranch.Background = Brushes.Gray;
                btn_clear.IsEnabled       = false;
                btn_clear.Background      = Brushes.Gray;
            }
            else
            {
                ConfirmationPopup form = new ConfirmationPopup(responce.FaultData.Detail.ErrorDetails, "Branch", false);
                form.ShowDialog();
                // Common.ErrorNotification(responce.FaultData.Detail.ErrorDetails, "Branch", false);
            }
        }
Example #5
0
        private void btn_Delete_Click(object sender, RoutedEventArgs e)
        {
            dynamic           row  = lvPurchase.SelectedItem;
            ConfirmationPopup form = new ConfirmationPopup((string)myResourceDictionary["purchase_confirmationmsg"], header, true);

            form.ShowDialog();
            if (Common._isChecked)
            {
                var result = controller.DeletePurchase(row.PurchaseId);
                //if (result == true)
                //{
                List <PurchaseOrderModel> lstPurchase = controller.GetPurchase().ToList();
                // if (lstPurchase.Any())
                //  {
                _purchase = lstPurchase;
                lvPurchase.ItemsSource = _purchase;
                // ConfirmationPopup form1 = new ConfirmationPopup((string)myResourceDictionary["purchase_deletedsuccessmsg"], header, false);
                // form1.ShowDialog();
                Common.Notification((string)myResourceDictionary["purchaseOrder_deletedsuccessmsg"], header, false);
                ButtonDisable();
                // }
                // else
                // {
                //  ConfirmationPopup form2 = new ConfirmationPopup(responce.FaultData.Detail.ErrorDetails, header, false);
                //    form2.ShowDialog();
                // }
            }
        }
Example #6
0
 private void btn_save_click(object sender, RoutedEventArgs e)
 {
     if (!supplireNameExists)
     {
         if (string.IsNullOrEmpty(supplier_name.Text) || string.IsNullOrEmpty(supplier_address.Text) || string.IsNullOrEmpty(supplier_contact_name.Text) || string.IsNullOrEmpty(supplier_mobile.Text) || string.IsNullOrEmpty(supplier_email.Text))
         {
             //   msg = "Please fill the required fields first";
             ConfirmationPopup form = new ConfirmationPopup((string)Application.Current.Resources["error_message_Tax"], header, false);
             form.ShowDialog();
             // Common.ErrorNotification((string)Application.Current.Resources["error_message_Tax"],header,false);
         }
         else
         {
             decimal?      nullval = null;
             SupplierModel model   = new SupplierModel(RowId, supplier_name.Text, sort_name.Text, supplier_address.Text, supplier_contact_name.Text, supplier_telephone.Text, supplier_mobile.Text, supplier_fax.Text, supplier_websiteUrl.Text, supplier_email.Text, supplier_note.Text, string.IsNullOrEmpty(supplier_discount.Text) ? nullval : Convert.ToDecimal(supplier_discount.Text), UserModelVm.CompanyId, UserModelVm.BranchId);
             controller.SaveUpdateSupplier(model);
             Common.Notification((string)Application.Current.Resources["supplier_UpdatedSuccessMsg"], header, false);
             navigatePage();
         }
     }
     else
     {
         Common.ErrorMessage((string)Application.Current.Resources["supplier_exists"], header);
     }
 }
Example #7
0
        public Tax()
        {
            InitializeComponent();

            ChangeHeightWidth();
            ResponseVm responce = controller.GetTax();///.ToList();

            if (responce.FaultData == null)
            {
                _taxs = responce.Response.Cast <TaxModel>().ToList();

                lvTaxs.ItemsSource = _taxs;
            }
            else
            {
                ConfirmationPopup form = new ConfirmationPopup(responce.FaultData.Detail.ErrorDetails, "Fault", false);
                form.ShowDialog();
            }
            edit_Tax.IsEnabled    = false;
            edit_Tax.Background   = Brushes.Gray;
            btn_clear.IsEnabled   = false;
            btn_clear.Background  = Brushes.Gray;
            btn_Delete.IsEnabled  = false;
            btn_Delete.Background = Brushes.Gray;
        }
Example #8
0
        private void dgProducts_PreviewMouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            ProductModel productItem = (ProductModel)dgProducts.SelectedItem;

            if (productItem != null)
            {
                productPopUp.IsOpen   = false;
                this.IsEnabled        = true;
                btn_remove.IsEnabled  = false;
                btn_remove.Background = Brushes.Gray;
                bool stockExists = StockAdjustmentController.CheckStockByProductCode(Convert.ToInt64(productItem.Id));
                if (stockExists)
                {
                    stock_AddItem(productItem);
                }
                else
                {
                    ResourceDictionary myResourceDictionary = new ResourceDictionary();
                    myResourceDictionary.Source =
                        new Uri("/ResourceFiles/En.xaml",
                                UriKind.RelativeOrAbsolute);
                    // string errorMessage = (string)myResourceDictionary["error_message_false_product_selection"];
                    // msg = errorMessage;
                    ConfirmationPopup form = new ConfirmationPopup((string)myResourceDictionary["error_message_false_product_selection"], header, false);
                    form.ShowDialog();
                    //   Common.ErrorNotification((string)myResourceDictionary["error_message_false_product_selection"], header, false);
                }
            }
        }
Example #9
0
        private void btn_save_Click(object sender, RoutedEventArgs e)
        {
            List <StockAdjustmentModel> Stocks = lvStockAdjustment.Items.Cast <StockAdjustmentModel>().Select(x => x).ToList();
            bool IsTrue = Stocks.Where(x => x.ProductCode == 0 || x.Quantity == 0).Any();

            if (IsTrue)
            {
                Common.ErrorMessage((string)Application.Current.Resources["stock_adjustmentRequiredFields"], header);
            }
            else
            {
                ObservableCollection <QuantityViewModel> listRemainings = new ObservableCollection <QuantityViewModel>();
                listRemainings.Clear();
                int reasonCount = 0;
                Stocks.ForEach(x =>
                {
                    if (x.Quantity < 0 && string.IsNullOrEmpty(x.Reason))
                    {
                        reasonCount++;
                    }
                });
                dgProQuant.ItemsSource = listRemainings;
                foreach (StockAdjustmentModel stock in Stocks)
                {
                    var currentStockByBatch = StockAdjustmentController.GetItemCurrentStockByBatchNo(stock.BatchNo, stock.productCode);
                    var observeDeduction    = currentStockByBatch + stock.Quantity;
                    var takePoint           = stock.Quantity.ToString().Substring(0, 1);
                    if (currentStockByBatch < stock.Quantity && currentStockByBatch != 0 && takePoint == "-" || observeDeduction < 0 && takePoint == "-")
                    {
                        listRemainings.Add(new QuantityViewModel
                        {
                            ProductName   = stock.ProductName,
                            AvailQuantity = currentStockByBatch
                        });
                    }
                    stock.CreatedDate = CommonFunctions.ParseDateToFinclaveString(DateTime.Now.ToShortDateString());
                    stock.CompanyCode = UserModelVm.CompanyId;
                    stock.BranchCode  = UserModelVm.BranchId;
                    stock.CreatedBy   = UserModelVm.UserId;
                }
                if (listRemainings.Count > 0)
                {
                    dgProQuant.ItemsSource    = listRemainings;
                    PopupQuantityAlert.IsOpen = true;
                    quantAlert.Text           = (string)Application.Current.Resources["quantity_exeed_exeption"];
                    return;
                }
                else if (reasonCount > 0)
                {
                    ConfirmationPopup form = new ConfirmationPopup((string)Application.Current.Resources["reason_forneagative_exeption"], header, false);
                    form.ShowDialog();
                    //  Common.ErrorNotification((string)Application.Current.Resources["reason_forneagative_exeption"], header, false);
                    return;
                }
                StockAdjustmentController.SaveStockAdjustment(Stocks);
                additems();
                lvStockAdjustment.ItemsSource = StockAdjustments;
                Common.Notification((string)Application.Current.Resources["stock_adjustmentSuccessMsg"], header, false);
            }
        }
Example #10
0
        private void dgProducts_PreviewMouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            // selectedBulkProduct = null;
            ProductModel productItem = (ProductModel)dgProducts.SelectedItem;

            productPopUp.IsOpen = false;
            this.IsEnabled      = true;
            bool stockExists = false;// OpeningStockController.CheckProductOpningStock(Convert.ToInt64(productItem.Id));

            if (!stockExists)
            {
                stock_AddItem(productItem);
            }
            else
            {
                ResourceDictionary myResourceDictionary = new ResourceDictionary();
                myResourceDictionary.Source =
                    new Uri("/ResourceFiles/En.xaml",
                            UriKind.RelativeOrAbsolute);
                string errorMessage = (string)myResourceDictionary["error_message_false_product_selection_Opening_Stock"];

                ConfirmationPopup form = new ConfirmationPopup(errorMessage, "Repack", false);
                form.ShowDialog();
                //  Common.ErrorNotification(errorMessage, header, false);
            }
        }
Example #11
0
        public Login()
        {
            InitializeComponent();
            AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;

            bool isExpired      = CommonFunctions.IsKeyExpired(Convert.ToString(CommonEnums.Edition.Server), Convert.ToString(CommonEnum.IndustryTypes.RS));
            bool IsLicenseExist = CommonFunctions.IsLicenseActivate(Convert.ToString(CommonEnums.Edition.Server), Convert.ToString(CommonEnum.IndustryTypes.RS));

            if (isExpired)
            {
                msg = "Your Key has been expired";
                ConfirmationPopup form = new ConfirmationPopup(msg, header);
                form.ShowDialog();
                this.Close();
            }
            else if (IsLicenseExist)
            {
                //string FinposBasePath = Directory.GetParent(Directory.GetParent(AppDomain.CurrentDomain.BaseDirectory).ToString()).FullName;

                string FinposBasePath = Directory.GetParent(AppDomain.CurrentDomain.BaseDirectory).FullName;
                //string clientApplicationPath = FinposBasePath + @"\Finpos Client\Finpos.Client.exe";
                //string clientApplicationPath = FinposBasePath + @"\Finpos.Client.exe";
                //Process process = Process.Start(clientApplicationPath);
                string  LocalPath = @"D:\Nishant\ProjectCode\FINPOS_Desktop_10_5_17\branches\FinPos.Desktop\FinPos.Client\FinPos.Desktop\bin\Debug\Finpos.Client.exe";
                Process process   = Process.Start(LocalPath);
                this.Close();
            }
            else
            {
                Uri uri     = new Uri("/ResourceFiles/uk.xaml", UriKind.RelativeOrAbsolute);
                var resDict = Application.LoadComponent(uri) as ResourceDictionary;
                this.Resources.MergedDictionaries.Add(resDict);
            }
        }
 public void stock_AddItem(ProductModel itemToAdd)
 {
     if (purchaseStocks.Any(x => x.ProductCode == itemToAdd.Id) && _selectedStock.ProductCode != itemToAdd.Id)
     {
         ConfirmationPopup form = new ConfirmationPopup((string)Application.Current.Resources["purchase_already"], header, true);
         form.ShowDialog();
         if (Common._isChecked)
         {
             PurchaseStockModel _purchaseStock = new PurchaseStockModel();
             _purchaseStock.ProductName = itemToAdd.ItemName;
             _purchaseStock.productCode = Convert.ToInt64(itemToAdd.Id);
             purchaseStocks[rowIndex]   = _purchaseStock;
             lstPurchase.ItemsSource    = purchaseStocks;
         }
     }
     else
     {
         // if (Common._isChecked)
         // {
         PurchaseStockModel _purchaseStock = new PurchaseStockModel();
         _purchaseStock.ProductName = itemToAdd.ItemName;
         _purchaseStock.productCode = Convert.ToInt64(itemToAdd.Id);
         purchaseStocks[rowIndex]   = _purchaseStock;
         lstPurchase.ItemsSource    = purchaseStocks;
         // }
     }
     if (_selectedStock.StockId != null)
     {
         _deletestocks.Add(new StockModel(_selectedStock.StockId, _purchaseData.PurchaseId.Value, _selectedStock.Quantity, _selectedStock.CostPrice, _selectedStock.SellingPrice, _selectedStock.MRP, _selectedStock.Discount, _selectedStock.BatchNo, _selectedStock.ProductCode, null));
     }
 }
Example #13
0
        private void btn_search_Click(object sender, RoutedEventArgs e)
        {
            if (string.IsNullOrEmpty(startDate_Search.Text) || string.IsNullOrEmpty(endDate_search.Text))
            {
                ConfirmationPopup form = new ConfirmationPopup((string)Application.Current.Resources["date_ErrorMsg"], header, false);
                form.ShowDialog();
                //  Common.ErrorNotification((string)Application.Current.Resources["date_ErrorMsg"], header, false);
                lvWastage.ItemsSource = _wastage;
                CollectionViewSource.GetDefaultView(lvWastage.ItemsSource).Refresh();
            }
            else if (CommonFunctions.ParseDateToFinclave(startDate_Search.Text).Date > CommonFunctions.ParseDateToFinclave(endDate_search.Text).Date)
            {
                ConfirmationPopup form = new ConfirmationPopup((string)Application.Current.Resources["date_ErrorMsgForGreater"], header, false);
                form.ShowDialog();
                //  Common.ErrorNotification((string)Application.Current.Resources["date_ErrorMsgForGreater"], header, false);
            }
            else
            {
                lvWastage.ItemsSource = _wastage.Where(x => CommonFunctions.ParseDateToFinclave(x.Date).Date >= CommonFunctions.ParseDateToFinclave(startDate_Search.Text).Date&& CommonFunctions.ParseDateToFinclave(x.Date).Date <= CommonFunctions.ParseDateToFinclave(endDate_search.Text).Date);
                //  lvWastage.ItemsSource = _wastage;
                //}
                //else
                //{
                //    lvUsers.ItemsSource = _companies.Where(x => x.Name.ToLower().Contains(text)).ToList();

                //}
                CollectionViewSource.GetDefaultView(lvWastage.ItemsSource).Refresh();


                //GridLengthConverter gridLengthConverter = new GridLengthConverter();
                //// SerachColumn.Width = (GridLength)gridLengthConverter.ConvertFrom((CommonFunction.Common._containerWidth - 210));  //(90 for Header + 20 for Footer = 110)
                ////lvProducts.MinWidth = (CommonFunction.Common._containerWidth - 210);
                ////lvProducts.MaxWidth = (CommonFunction.Common._containerWidth - 210);
                //SerachColumn.Width = (GridLength)gridLengthConverter.ConvertFrom((CommonFunction.Common._containerWidth - 210));
                //lvWastage.MinWidth = (CommonFunction.Common._containerWidth - 210);
                //lvWastage.MaxWidth = (CommonFunction.Common._containerWidth - 210);
                //lvWastage.Height = CommonFunction.Common._containerHeight - 275;
                //ActionPanelBorder.Width = (CommonFunction.Common._containerWidth - 210);
                //ResponceVm responce = controller.GetWastageWithDateFilter(Convert.ToDateTime(startDate_Search.Text), Convert.ToDateTime(endDate_search.Text));
                //if (responce.FaultData == null)
                //{
                //    _wastage = responce.Responce.Cast<WastageModel>().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;
                //    }

                //else
                //{
                //    ConfirmationPopup form = new ConfirmationPopup(responce.FaultData.Detail.ErrorDetails, header, false);
                //    form.ShowDialog();
                //}
            }
        }
Example #14
0
 private void check_IsDefault_Checked(object sender, RoutedEventArgs e)
 {
     if (check_IsDefault.IsChecked.Value)
     {
         ConfirmationPopup form = new ConfirmationPopup((string)Application.Current.Resources["branch_ConfirmationMsg"], header, true);
         form.ShowDialog();
         check_IsDefault.IsChecked = Common._isChecked;
     }
 }
Example #15
0
 private void tax_Detail_LostFocus(object sender, RoutedEventArgs e)
 {
     if (_taxs.Any(x => x.TaxDetail.ToLower() == tax_Detail.Text.ToLower()))
     {
         tax_Detail.Text = string.Empty;
         ConfirmationPopup form = new ConfirmationPopup((string)Application.Current.Resources["tax_DetailErrorMsg"], header, false);
         form.ShowDialog();
         // Common.ErrorNotification((string)Application.Current.Resources["tax_DetailErrorMsg"], header, false);
     }
 }
Example #16
0
        public inventory()
        {
            InitializeComponent();
            ChangeHeightWidth();
            product_search.Text = "Search";
            //AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
            ResponseVm responce = controller.GetProductsByCompanyAndBranch();///.ToList();

            if (responce.FaultData == null)
            {
                _products = responce.Response.Cast <ProductModel>().ToList();
                if (_products != null && _products.Count > 0)
                {
                    foreach (ProductModel item in _products)
                    {
                        if (item.ImageText != null && item.ImageText != "")
                        {
                            string FinposBasePath = Directory.GetParent(AppDomain.CurrentDomain.BaseDirectory).FullName;
                            string path           = FinposBasePath + @"\FinPosImageDocument";
                            if (Path.GetFileName(item.ImageText) != (string)Application.Current.Resources["add_Company_Image_Name"])
                            {
                                if (Directory.Exists(path))
                                {
                                    FileInfo file = new FileInfo(path + "\\" + item.ImageText);
                                    if (file.Exists)
                                    {
                                        BitmapImage logo = new BitmapImage();
                                        logo.BeginInit();
                                        logo.UriSource = new Uri(path + "\\" + item.ImageText);
                                        logo.EndInit();
                                        item.ItemImage = Utility.CommonMethods.CommonFunctions.ImageToByteArray(logo);
                                    }
                                }
                            }
                        }
                    }
                }
                lvProducts.ItemsSource = _products;
            }
            else
            {
                ConfirmationPopup form = new ConfirmationPopup(responce.FaultData.Detail.ErrorDetails, "Fault", false);
                form.ShowDialog();
            }
            edit_Product.IsEnabled  = false;
            edit_Product.Background = Brushes.Gray;
            btn_clear.IsEnabled     = false;
            btn_clear.Background    = Brushes.Gray;
            btn_Label.IsEnabled     = false;
            btn_Label.Background    = Brushes.Gray;
            btn_Delete.IsEnabled    = false;
            btn_Delete.Background   = Brushes.Gray;
        }
        private void barcodeLogo_lostFocus(object sender, RoutedEventArgs e)
        {
            var response = controller.GetProducts().Response.Cast <ProductModel>().ToList().Any(x => x.BarCode.ToLower() == barcode_.Text.ToLower() && !string.IsNullOrEmpty(x.BarCode));

            if (response)
            {
                ConfirmationPopup form = new ConfirmationPopup((string)Application.Current.Resources["barcodeExsist_Msg"], header, false);
                form.ShowDialog();
                // Common.ErrorNotification((string)Application.Current.Resources["barcodeExsist_Msg"], header, false);
                barcode_.Text = string.Empty;
            }
        }
Example #18
0
        public static ConfirmationType Show(string message)
        {
            ConfirmationPopup popup = new ConfirmationPopup
            {
                Body = message
            };

            if ((bool)popup.ShowDialog())
            {
                return(popup.Result ? ConfirmationType.Yes : ConfirmationType.No);
            }
            return(ConfirmationType.Canceled);
        }
 private void purchase_cashdiscount_KeyUp(object sender, KeyEventArgs e)
 {
     if (!string.IsNullOrEmpty(purchase_cashdiscount.Text))
     {
         if (Convert.ToDecimal(purchase_cashdiscount.Text) > 100)
         {
             ConfirmationPopup form = new ConfirmationPopup((string)Application.Current.Resources["invalid_DiscountSupplier"], header, false);
             form.ShowDialog();
             // Common.ErrorNotification((string)myResourceDictionary["invalid_DiscountSupplier"], header, false);
             purchase_cashdiscount.Text = string.Empty;
         }
     }
 }
Example #20
0
        private void btn_Save_Click(object sender, RoutedEventArgs e)
        {
            if (productCode != 0)
            {
                int currentStock = OpeningStockController.GetCurrentStockByProductCode(productCode);
                if (string.IsNullOrEmpty(txtName.Text) || string.IsNullOrEmpty(txtQuantity.Text) || string.IsNullOrEmpty(txtDate.Text))
                {
                    //  msg = "Fill all required fields";
                    ConfirmationPopup form = new ConfirmationPopup((string)Application.Current.Resources["error_message_Tax"], header, false);
                    form.ShowDialog();
                    // Common.ErrorNotification((string)Application.Current.Resources["error_message_Tax"], header, false);
                }
                else if (Convert.ToInt64(txtQuantity.Text) < 1)
                {
                    ConfirmationPopup form = new ConfirmationPopup((string)Application.Current.Resources["wastage_popupquantityerrormsgForZeroQuantity"], header, false);
                    form.ShowDialog();
                    //  Common.ErrorNotification((string)Application.Current.Resources["wastage_popupquantityerrormsg"], header, false);

                    //txtQuantity.Text = string.Empty;
                }
                else if (Convert.ToInt64(txtQuantity.Text) > currentStock)
                {
                    ConfirmationPopup form = new ConfirmationPopup((string)Application.Current.Resources["wastage_popupquantityerrormsg"], header, false);
                    form.ShowDialog();
                    //  Common.ErrorNotification((string)Application.Current.Resources["wastage_popupquantityerrormsg"], header, false);
                }
                else
                {
                    try
                    {
                        WastageModel wastageModel = new WastageModel(RowId, productCode, txtName.Text, Convert.ToInt32(txtQuantity.Text), txtDate.Text, txt_Reason.Text, txtBatchNo.Text, UserModelVm.BranchId, UserModelVm.CompanyId);
                        controller.SaveUpdateWastage(wastageModel);
                        Common.Notification((string)Application.Current.Resources["wastage_UpdatedSuccessMsg"], header, false);
                        ClearFields();
                        GoToBackPage();
                    }
                    catch (Exception ex)
                    {
                        ConfirmationPopup form = new ConfirmationPopup(ex.Message, header, false);
                        form.ShowDialog();
                        // Common.ErrorNotification(ex.Message, header, false);
                    }
                }
            }
            else
            {
                Common.ErrorMessage((string)Application.Current.Resources["errorInvalidProductSelection"], header);
            }
        }
        public static ConfirmationType Show(string message)
        {
            ConfirmationPopup popup = new ConfirmationPopup
            {
                Body    = message,
                Topmost = true
            };

            if (popup.ShowDialog().GetValueOrDefault())
            {
                return(popup.Result ? ConfirmationType.Yes : ConfirmationType.No);
            }

            return(ConfirmationType.Canceled);
        }
Example #22
0
 public void stock_AddItem(ProductModel itemToAdd)
 {
     if (purchaseStocks.Any(x => x.ProductCode == itemToAdd.Id) && _selectedStock.ProductCode != itemToAdd.Id)
     {
         ConfirmationPopup form = new ConfirmationPopup((string)myResourceDictionary["purchase_already"], header, true);
         form.ShowDialog();
         if (Common._isChecked)
         {
             AddpurchaseItemSource(itemToAdd);
         }
     }
     else
     {
         AddpurchaseItemSource(itemToAdd);
     }
 }
Example #23
0
 public void stock_AddItem(ProductModel itemToAdd)
 {
     if (StockAdjustments.Any(x => x.ProductCode == itemToAdd.Id) && _selectedStock.ProductCode != itemToAdd.Id)
     {
         ConfirmationPopup form = new ConfirmationPopup((string)Application.Current.Resources["purchase_already"], "OpeningStock", true);
         form.ShowDialog();
         if (Common._isChecked)
         {
             AddItemSource(itemToAdd);
         }
     }
     else
     {
         AddItemSource(itemToAdd);
     }
 }
        public static ConfirmationType Show(string message, string title)
        {
            ConfirmationPopup popup = new ConfirmationPopup
            {
                Title         = title,
                Body          = message,
                ShowInTaskbar = false
            };

            if (popup.ShowDialog().GetValueOrDefault())
            {
                return(popup.Result ? ConfirmationType.Yes : ConfirmationType.No);
            }

            return(ConfirmationType.Canceled);
        }
Example #25
0
 private void btn_save_click(object sender, RoutedEventArgs e)
 {
     if (string.IsNullOrEmpty(tax_Detail.Text) || string.IsNullOrEmpty(tax_Rate.Text))
     {
         ConfirmationPopup form = new ConfirmationPopup((string)Application.Current.Resources["error_message_Tax"], header, false);
         form.ShowDialog();
     }
     else
     {
         decimal? nullval = null;
         TaxModel model   = new TaxModel(RowId, tax_Detail.Text, Convert.ToDouble(tax_Rate.Text), CommonFunctions.ParseDateToFinclaveString(DateTime.Now.ToShortDateString()), string.Empty, string.Empty, string.Empty);
         controller.SaveUpdateTax(model);
         Common.Notification((string)Application.Current.Resources["tax_UpdateSuccessMsg"], header, false);
         NavigateBackPage();
     }
 }
Example #26
0
        private void delete_product_Click(object sender, RoutedEventArgs e)
        {
            dynamic row = lvProducts.SelectedItem;

            msg = (string)Application.Current.Resources["product_delete_alert"];
            ConfirmationPopup form = new ConfirmationPopup(msg, header, true);

            form.ShowDialog();
            if (Common._isChecked)
            {
                var result = controller.DeleteProduct(row.Id);
                if (result.FaultData == null)
                {
                    ResponseVm response = controller.GetProductsByCompanyAndBranch();//.ToList();
                    if (response.FaultData == null)
                    {
                        _products = response.Response.Cast <ProductModel>().ToList();
                        lvProducts.ItemsSource = _products;
                        msg = (string)Application.Current.Resources["delete_success_alert"];
                        // ConfirmationPopup form1 = new ConfirmationPopup(msg, header, false);
                        //  form1.ShowDialog();
                        Common.Notification(msg, header, false);
                        edit_Product.IsEnabled  = false;
                        edit_Product.Background = Brushes.Gray;
                        btn_clear.IsEnabled     = false;
                        btn_clear.Background    = Brushes.Gray;
                        btn_Label.IsEnabled     = false;
                        btn_Label.Background    = Brushes.Gray;
                        btn_Delete.IsEnabled    = false;
                        btn_Delete.Background   = Brushes.Gray;
                    }
                    else
                    {
                        ConfirmationPopup form2 = new ConfirmationPopup(response.FaultData.Detail.ErrorDetails, header, false);
                        form2.ShowDialog();
                    }
                }
                else
                {
                    msg  = (string)Application.Current.Resources["product_exist_exeption"];
                    form = new ConfirmationPopup(msg, header, false);
                    form.ShowDialog();
                    // Common.ErrorNotification(msg, header, false);
                }
            }
        }
Example #27
0
 private void AddItemsToProductList(ProductModel productItem)
 {
     if (offerDetails.Any(x => x.ProductCode == productItem.Id) && _offerDetails.ProductCode != productItem.Id)
     {
         // Common.ErrorMessage((string)Application.Current.Resources["purchase_already"], CallingPage);
         ConfirmationPopup form = new ConfirmationPopup((string)Application.Current.Resources["Offer_ProductproductExists"], CallingPage, true);
         form.ShowDialog();
         if (Common._isChecked)
         {
             AddItemSource(productItem);
         }
     }
     else
     {
         AddItemSource(productItem);
     }
 }
Example #28
0
        private void btn_delete_Click(object sender, RoutedEventArgs e)
        {
            dynamic           row  = lvSuppliers.SelectedItem;
            ConfirmationPopup form = new ConfirmationPopup((string)Application.Current.Resources["supplier_ConformationMsg"], header, true);

            form.ShowDialog();
            if (Common._isChecked)
            {
                controller.DeleteSupplier(row.Id);
                _supplier = controller.GetSuppliersByCompanyAndBrach(UserModelVm.CompanyId, UserModelVm.BranchId).OrderBy(x => x.Id).ToList <SupplierModel>();
                lvSuppliers.ItemsSource = _supplier;
                //  msg = "Supplier deleted successfully";
                // ConfirmationPopup form1 = new ConfirmationPopup(msg, header, false);
                //  form1.ShowDialog();
                Common.Notification((string)Application.Current.Resources["supplier_DeletedMsg"], header, false);
                DisableButtons();
            }
        }
Example #29
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();
            }
        }
Example #30
0
        private void btn_Save_Click(object sender, RoutedEventArgs e)
        {
            if (supplierCode > 0)
            {
                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;
                    int?               nullint  = null;
                    PurchaseOrderModel model    = new PurchaseOrderModel(0, CommonFunctions.ParseDateToFinclave(DateTime.Now.ToShortDateString()), 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), UserModelVm.UserId, CommonFunctions.ParseDateToFinclaveString(DateTime.Now.ToShortDateString()), (int)CommonEnum.PurchaseStatus.WaitingForApproval, null, null, UserModelVm.CompanyId, UserModelVm.BranchId, string.Empty, string.Empty, purchase_invoiceNo.Text, purchase_invoiceDate.Text);
                    int purchaseId = purchaseController.SaveUpdatePurchase(model);

                    // stocks = lstPurchase.ItemsSource.Cast<StockModel>().ToList();
                    newStocks.AddRange(Stocks.Where(z => z.ProductCode > 0 && z.Quantity > 0).Select(x =>
                    {
                        return(new StockModel(0, null, x.Quantity, x.CostPrice, x.SellingPrice, x.MRP, x.Discount, x.BatchNo, x.ProductCode, purchaseId));
                        // newStocks.Add(stock);
                    }).ToList());

                    purchaseController.SaveUpdateStocks(newStocks);
                    //  ConfirmationPopup form = new ConfirmationPopup((string)myResourceDictionary["purchase_savedmsg"], header, false);
                    //  form.ShowDialog();
                    Common.Notification((string)Application.Current.Resources["purchase_savedmsg"], header, false);
                    ClearData();
                    Purchase form1 = new Purchase();
                    NavigationService.Navigate(form1);
                }
                else
                {
                    ConfirmationPopup form = new ConfirmationPopup((string)myResourceDictionary["purchase_requiredFields"], header, false);
                    form.ShowDialog();
                    // Common.ErrorNotification((string)Application.Current.Resources["purchase_requiredFields"], header, false);
                }
            }
            else
            {
                ConfirmationPopup form = new ConfirmationPopup((string)Application.Current.Resources["supplier_requiredFields"], header, false);
                form.ShowDialog();
                //  Common.ErrorNotification((string)Application.Current.Resources["supplier_requiredFields"], header, false);
            }
        }