예제 #1
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);
        }
예제 #2
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);
            }
        }
예제 #3
0
        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);
        }
예제 #4
0
        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);
        }
예제 #5
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();
     }
 }
예제 #6
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);
     }
 }
예제 #7
0
        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)
            {
                // var isExsist= responce.Any(x => x.BarCode.ToLower() == barcode_.Text.ToLower());
                //   if (isExsist)
                //  {
                ConfirmationPopup form = new ConfirmationPopup((string)Application.Current.Resources["barcode_exeption"], header, false);
                form.ShowDialog();
                // Common.ErrorNotification((string)Application.Current.Resources["barcode_exeption"], header, false);
                barcode_.Text = string.Empty;
                // }
            }
        }
예제 #8
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);
     }
 }
예제 #9
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);
                }
            }
        }
예제 #10
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);
     }
 }
예제 #11
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();
            }
        }
예제 #12
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();
            }
        }
예제 #13
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);
            }
        }
예제 #14
0
    // QR found by cam handler
    private void HandleOnQRCodeFound(ZXing.BarcodeFormat barCodeType, string barCodeValue)
    {
        QRCodeManager.Instance.StopScanning();
        Product prod = Product.Parse(barCodeValue);

        if (prod == null)
        {
            QRCode qr = QRCode.QRParse(barCodeValue);
            if (ValidQR(qr.RawData))
            {
                UserUtilities.AllocatePoints(qr.TokenValue);
                IndicateScore(qr.TokenValue, true);
                SoundManager.Instance.PlaySound("CoinCollect");

                GameManager.Instance.analytics.LogEvent(new EventHitBuilder().SetEventCategory("Token Distribution").SetEventAction(qr.QRType.ToString()).SetEventValue(qr.TokenValue));

                if (qr.QRType != QRCode.QRTypes.Tokens)
                {
                    GameManager.Organizations Org = (GameManager.Organizations)Enum.Parse(typeof(GameManager.Organizations), qr.QRType.ToString());
                    if (GameManager.Instance.MiniGameEnabledOrgs.Contains(Org))
                    {
                        GameManager.Instance.Unlock(Org);
                    }
                }
            }
            else
            {
                DisplayNotification(true, "You have already redeemed this reward today.");
            }
        }
        else
        {
            GameObject        Popup = Instantiate(Confirmtion_Prefab, gameObject.transform);
            ConfirmationPopup conf  = Popup.GetComponent <ConfirmationPopup>();
            conf.prod         = prod;
            conf.Message.text = "Are you certain you would like to spend " + prod.TokenValue + " Tokens to recieve " + prod.ProductName + ".";
        }

        List_BTN.interactable = false;
        List_Tab.SetActive(true);
        Scan_BTN.interactable = true;
        Scan_Tab.SetActive(false);
    }
예제 #15
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;
        }
예제 #16
0
        private void tax_Rate_LostFocus(object sender, RoutedEventArgs e)
        {
            var textBox        = sender as TextBox;
            var isNumericValue = Common.isNumeric(textBox.Text, System.Globalization.NumberStyles.AllowDecimalPoint);

            if (!isNumericValue)
            {
                textBox.Text = string.Empty;
            }
            else if (tax_Rate.Text == ".")
            {
                tax_Rate.Text = string.Empty;
            }
            else if (!string.IsNullOrEmpty(tax_Rate.Text) && Convert.ToDouble(tax_Rate.Text) > 100)
            {
                tax_Rate.Text = string.Empty;
                ConfirmationPopup form = new ConfirmationPopup((string)Application.Current.Resources["tax_RateErrorMsg"], header, false);
                form.ShowDialog();
                // Common.ErrorNotification((string)Application.Current.Resources["tax_RateErrorMsg"], header, false);
            }
        }
예제 #17
0
        private void supplier_discount_KeyUp(object sender, RoutedEventArgs e)
        {
            var textBox        = sender as TextBox;
            var isNumericValue = Common.isNumeric(textBox.Text, System.Globalization.NumberStyles.AllowDecimalPoint);

            if (!isNumericValue)
            {
                textBox.Text = string.Empty;
            }
            else if (supplier_discount.Text == ".")
            {
                supplier_discount.Text = string.Empty;
            }
            else if (!string.IsNullOrEmpty(supplier_discount.Text) && Convert.ToDecimal(supplier_discount.Text) > 100)
            {
                ConfirmationPopup form = new ConfirmationPopup((string)Application.Current.Resources["invalid_DiscountSupplier"], header, false);
                form.ShowDialog();
                //  Common.ErrorNotification((string)Application.Current.Resources["invalid_DiscountSupplier"], header, false);
                supplier_discount.Text = string.Empty;
            }
        }
예제 #18
0
        private void btn_active_Click(object sender, RoutedEventArgs e)
        {
            dynamic row = lvUsers.SelectedItem;

            if (row.IsDefault == true)
            {
                //  msg = "Can't Inactive default company";
                ConfirmationPopup confirmPopUp = new ConfirmationPopup((string)Application.Current.Resources["company_InactiveErrorMsg"], "Company", false);
                confirmPopUp.ShowDialog();
                return;
            }
            CompanyModel company = new CompanyModel(row.Id, row.Name, row.Description, row.PhoneNo, row.Logo, row.IsDefault, row.IsActive == true ? false : true, row.CreatedBy, row.UpdatedDate, row.ModifiedBy, row.CreatedBy);

            controller.SaveUpdateCompany(company);
            Window yourParentWindow = Window.GetWindow(this);

            if (yourParentWindow.GetType().Name == "Main")
            {
                var page = yourParentWindow as Main;
                page.BindCompanyCMBFiltered();
                //   (Main)yourParentWindow.
            }
            List <CompanyModel> companies = controller.GetCompanies().ToList();

            _companies          = companies;
            lvUsers.ItemsSource = _companies;
            string status = row.IsActive == true ? "In Active" : "Active";

            msg = "Company " + status + " Successfully.";
            //   ConfirmationPopup form1 = new ConfirmationPopup(msg, "Company", false);
            Common.Notification(msg, header, false);
            // form1.ShowDialog();
            edit_Company.IsEnabled    = false;
            edit_Company.Background   = Brushes.Gray;
            btn_clear.IsEnabled       = false;
            btn_clear.Background      = Brushes.Gray;
            btn_active.Visibility     = Visibility.Collapsed;
            btn_viewBranch.IsEnabled  = false;
            btn_viewBranch.Background = Brushes.Gray;
        }
예제 #19
0
 public void stock_AddItem(ProductModel itemToAdd)
 {
     if (OpeningStocks.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);
     }
     //OpeningStockModel _openingStock = new OpeningStockModel();
     //_openingStock.ProductName = itemToAdd.ItemName;
     //_openingStock.productCode = Convert.ToInt64(itemToAdd.Id);
     //_openingStock.CurrentStock = OpeningStockController.GetCurrentStockByProductCode(Convert.ToInt64(itemToAdd.Id));
     //OpeningStocks[rowIndex] = _openingStock;
     //lvOpeningStock.ItemsSource = OpeningStocks;
 }
예제 #20
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);
            }
        }
        async void DeleteVacationPeriodCommand(object VacPeriodData)
        {
            var periodToDelete = VacPeriodData as SpentVacations;

            if (periodToDelete == null)
            {
                return;
            }

            var confirmationPopup = new ConfirmationPopup("Delete this vacation period (" + periodToDelete.TotalDays.ToString() + " days) from " + periodToDelete.RefYear.ToString() + "?");
            await PopupNavigation.Instance.PushAsync(confirmationPopup);

            var result = await confirmationPopup.GetResult();


            if (result.Equals("true"))
            {
                this.Vacations.Remove(periodToDelete);
                await App.Database._spentVacations.DeleteSpentVacationsAsync(periodToDelete);

                await this.ExecuteLoadItemsCommand();
            }
        }
예제 #22
0
        private void ConfirmUnsavedChanges(Action action)
        {
            if (unsavedChanges)
            {
                Action yes = () =>
                {
                    Save();
                    action();
                };
                Action no = () =>
                {
                    action();
                };

                ConfirmationPopup popup = new ConfirmationPopup(new Rectangle(SCREEN_WIDTH / 2 - ConfirmationPopup.TOTAL_WIDTH / 2, 100, ConfirmationPopup.TOTAL_WIDTH, ConfirmationPopup.TOTAL_HEIGHT),
                                                                gui, "Save unsaved changes?", yes, no);
                gui.Add(popup);
            }
            else
            {
                action();
            }
        }
예제 #23
0
        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);
            }
        }
예제 #24
0
파일: Mission.cs 프로젝트: xdidx/gta-demago
        public void addObjective(AbstractObjective objective)
        {
            objective.OnFailed += (sender, reason) => {
                #region Show checkpoint popup
                var title    = reason;
                var subtitle = "Voulez-vous revenir au dernier checkpoint ?";

                ConfirmationPopup checkpointPopup = new ConfirmationPopup(title, subtitle);
                checkpointPopup.OnPopupAccept += () =>
                {
                    this.loadLastCheckpoint();
                };
                checkpointPopup.OnPopupRefuse += () =>
                {
                    this.stop(true);
                };
                checkpointPopup.show();
                #endregion
            };
            objective.OnAccomplished += (sender, elapsedTime) => {
                this.next();
            };
            objectives.Add(objective);
        }
예제 #25
0
        public static void ErrorMessage(string errorMessage, string callingPage)
        {
            ConfirmationPopup form = new ConfirmationPopup(errorMessage, callingPage, false);

            form.ShowDialog();
        }
예제 #26
0
        public static void ShowConfirmationPopup(string message, string callingPage, bool isBtnShow)
        {
            ConfirmationPopup confirmform = new ConfirmationPopup(message, callingPage, isBtnShow);

            confirmform.ShowDialog();
        }
예제 #27
0
        //private void dgPurchase_PreviewMouseDoubleClick(object sender, MouseButtonEventArgs e)
        //{
        //    item = (sender as ListViewItem);
        //  //  btn_remove.IsEnabled = true;
        //   // btn_remove.Background = (Brush)color.ConvertFrom("#eb5151");
        //}

        //public static FixedDocument GetFixedDocument(FrameworkElement toPrint, PrintDialog printDialog)
        //{
        //    PrintCapabilities capabilities = printDialog.PrintQueue.GetPrintCapabilities(printDialog.PrintTicket);
        //    Size pageSize = new Size(printDialog.PrintableAreaWidth, printDialog.PrintableAreaHeight);
        //    Size visibleSize = new Size(capabilities.PageImageableArea.ExtentWidth, capabilities.PageImageableArea.ExtentHeight);
        //    FixedDocument fixedDoc = new FixedDocument();
        //    //If the toPrint visual is not displayed on screen we neeed to measure and arrange it
        //    toPrint.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));
        //    toPrint.Arrange(new Rect(new Point(0, 0), toPrint.DesiredSize));
        //    //
        //    Size size = toPrint.DesiredSize;
        //    //Will assume for simplicity the control fits horizontally on the page
        //    double yOffset = 0;
        //    while (yOffset < size.Height)
        //    {
        //        VisualBrush vb = new VisualBrush(toPrint);
        //        vb.Stretch = Stretch.None;
        //        vb.AlignmentX = AlignmentX.Left;
        //        vb.AlignmentY = AlignmentY.Top;
        //        vb.ViewboxUnits = BrushMappingMode.Absolute;
        //        vb.TileMode = TileMode.None;
        //        vb.Viewbox = new Rect(0, yOffset, visibleSize.Width, visibleSize.Height);
        //        PageContent pageContent = new PageContent();
        //        FixedPage page = new FixedPage();
        //        ((IAddChild)pageContent).AddChild(page);
        //        fixedDoc.Pages.Add(pageContent);
        //        page.Width = pageSize.Width;
        //        page.Height = pageSize.Height;
        //        Canvas canvas = new Canvas();
        //        FixedPage.SetLeft(canvas, capabilities.PageImageableArea.OriginWidth);
        //        FixedPage.SetTop(canvas, capabilities.PageImageableArea.OriginHeight);
        //        canvas.Width = visibleSize.Width;
        //        canvas.Height = visibleSize.Height;
        //        canvas.Background = vb;
        //        page.Children.Add(canvas);
        //        yOffset += visibleSize.Height;
        //    }
        //    return fixedDoc;
        //}
        private void btnPrint_Click(object sender, RoutedEventArgs e)
        {
            if (cmbPrinters.SelectedIndex != 0)
            {
                MasterLabelSettingModel model = new MasterLabelSettingModel(0, 0, print_item_code.IsChecked.Value, chk_item_detail.IsChecked.Value, "0", print_item_price.IsChecked.Value, chk_print_barcode.IsChecked.Value, "", "", string.Empty, "", "");
                //MasterLabelSettingModel model = new MasterLabelSettingModel(0, 0, print_item_code.IsChecked.Value, chk_item_detail.IsChecked.Value, "0", print_item_price.IsChecked.Value, chk_print_barcode.IsChecked.Value, bar_code_height.Text, label_sheet_dd.SelectedValue.ToString(), string.Empty, nud_start_row.Value.ToString(), nud_start_column.Value.ToString());
                //  int masterLabelId = controller.SaveUpdateMasterLabel(model);
                List <ProductLabelSettingModel> newStocks = new List <ProductLabelSettingModel>();
                List <ProductLabelSettingModel> Stocks    = lstPurchase.Items.Cast <ProductLabelSettingModel>().Select(x => x).ToList();
                if (Stocks.Any(x => x.ProductCode > 0 && x.Quantity > 0))
                {
                    // stocks = lstPurchase.ItemsSource.Cast<StockModel>().ToList();
                    newStocks.AddRange(Stocks.Where(z => z.ProductCode > 0 && z.Quantity > 0).Select(x =>
                    {
                        return(new ProductLabelSettingModel(0, 0, Convert.ToInt32(x.ProductCode), x.Quantity, x.ProductName));
                        // newStocks.Add(stock);
                    }).ToList());
                }
                MasterPrintInvoice form = new MasterPrintInvoice(model, newStocks);

                PrintDialog printDlg = new PrintDialog();
                //PageMediaSizeName pazesize = (PageMediaSizeName)Enum.Parse(typeof(PageMediaSizeName), CommonConstants._pazeSize + model.LabelSheet);
                //printDlg.PrintTicket.PageMediaSize = new PageMediaSize(pazesize);
                PageSettings obj = GetPrinterPageInfo(this.cmbPrinters.Text);


                #region CommentedCode
                ///  System.Windows.Forms.PrintPreviewDialog printPreviewDialog1 = new System.Windows.Forms.PrintPreviewDialog();

                //  if (printDlg.ShowDialog() == true)

                //  {
                //PrintCapabilities capabilities = printDlg.PrintQueue.GetPrintCapabilities(printDlg.PrintTicket);
                //Size pageSize = new Size(printDlg.PrintableAreaWidth, printDlg.PrintableAreaHeight);
                //Size visibleSize = new Size(capabilities.PageImageableArea.ExtentWidth, capabilities.PageImageableArea.ExtentHeight);
                // FixedDocument fixedDoc = new FixedDocument();
                ////If the toPrint visual is not displayed on screen we neeed to measure and arrange it
                //form.TvBox.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));
                //form.TvBox.Arrange(new Rect(new Point(0, 0), form.TvBox.DesiredSize));
                ////
                //Size size = form.TvBox.DesiredSize;
                ////Will assume for simplicity the control fits horizontally on the page
                //double yOffset = 0;
                //while (yOffset < size.Height)
                //{
                //    VisualBrush vb = new VisualBrush(form.TvBox);
                //    vb.Stretch = Stretch.None;
                //    vb.AlignmentX = AlignmentX.Left;
                //    vb.AlignmentY = AlignmentY.Top;
                //    vb.ViewboxUnits = BrushMappingMode.Absolute;
                //    vb.TileMode = TileMode.None;
                //    vb.Viewbox = new Rect(0, yOffset, visibleSize.Width, visibleSize.Height);

                //    PageContent pageContent = new PageContent();
                //    FixedPage page = new FixedPage();
                //    ((IAddChild)pageContent).AddChild(page);
                //    fixedDoc.Pages.Add(pageContent);
                //    form.TvBox.Width = printDlg.PrintableAreaWidth; //pageSize.Width;
                //    form.TvBox.Height = pageSize.Height;
                //    Canvas canvas = new Canvas();
                //    FixedPage.SetLeft(canvas, capabilities.PageImageableArea.OriginWidth);
                //    FixedPage.SetTop(canvas, capabilities.PageImageableArea.OriginHeight);
                //    canvas.Width = visibleSize.Width;
                //    canvas.Height = visibleSize.Height;
                //    canvas.Background = vb;
                //    canvas.Margin = new Thickness(2, 2, 2, 2);

                //    page.Children.Add(canvas);
                //    yOffset += visibleSize.Height;
                //}
                //;
                //  return fixedDoc;
                // form.TvBox.MaxWidth = pageSize.Width;
                #endregion
                #region EarlierCode
                //// get selected printer capabilities
                //System.Printing.PrintCapabilities capabilities = printDlg.PrintQueue.GetPrintCapabilities(printDlg.PrintTicket);
                ////get scale of the print wrt to screen of WPF visual

                //double scale = Math.Min(capabilities.PageImageableArea.ExtentWidth / this.ActualWidth, capabilities.PageImageableArea.ExtentHeight /
                //              this.ActualHeight);
                ////  //Transform the Visual to scale
                //form.TvBox.LayoutTransform = new ScaleTransform(scale, scale);
                //form.TvBox.Margin = new Thickness(5, 5, 5, 5);
                //form.Height = 1150;
                ////  //get the size of the printer page
                //Size sz = new Size(capabilities.PageImageableArea.ExtentWidth, capabilities.PageImageableArea.ExtentHeight);
                ////  //update the layout of the visual to the printer page size.
                //form.TvBox.Height = capabilities.PageImageableArea.ExtentHeight;
                //form.TvBox.Width = capabilities.PageImageableArea.ExtentWidth;
                //form.TvBox.Measure(sz);
                //////  form.Width = 850;
                //form.Arrange(new Rect(new Point(capabilities.PageImageableArea.OriginWidth, capabilities.PageImageableArea.OriginHeight), sz));

                ////  now print the visual to printer to fit on the one page.
                //for (var i = 0; i <= Convert.ToInt32(model.StartRow); i++)
                //{
                //    if (i == Convert.ToInt32(model.StartRow))
                //    {
                //        printDlg.PrintVisual(form.TvBox, "First Fit to Page WPF Print");
                //    }
                //}
                // printDlg.PrintDocument(fixedDoc.DocumentPaginator, "My Document");


                #endregion

                //PrintDialog pd = new PrintDialog();
                //pd.PrintQueue = new PrintQueue(new PrintServer(), cmbPrinters.Text);
                //if (DialogResult.OK == pd.ShowDialog(this))
                //{
                //    // Send a printer-specific to the printer.
                //    RawPrinterHelper.SendStringToPrinter(cmbPrinters.Text, "Check");
                //}
                //GenerateThermalLabelWorker(form);
                form.TvBox.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));
                form.TvBox.Arrange(new Rect(new Point(0, 0), form.TvBox.DesiredSize));
                PrintDialog dialog  = new PrintDialog();
                StackPanel  myPanel = new StackPanel();
                myPanel.RenderSize = form.TvBox.DesiredSize;

                foreach (PrintMasterSettingModel item in form.TvBox.Items)
                {
                    TextBlock myBlock = new TextBlock();
                    myBlock.Text          = "Item :" + item.ProductName;
                    myBlock.TextAlignment = System.Windows.TextAlignment.Center;
                    myPanel.Children.Add(myBlock);
                    Image myImage = new Image();
                    myImage.Width   = item.ImageData.Width;
                    myImage.Height  = item.ImageData.Height;
                    myImage.Stretch = Stretch.None;
                    myImage.Source  = item.ImageData;
                    myPanel.Children.Add(myImage);
                    TextBlock myBlock1 = new TextBlock();
                    myBlock1.Text          = "Price :" + item.Price;
                    myBlock1.TextAlignment = System.Windows.TextAlignment.Center;
                    myPanel.Children.Add(myBlock1);
                }
                myPanel.Arrange(new Rect(0, 20, form.TvBox.DesiredSize.Width,
                                         form.TvBox.DesiredSize.Height));
                dialog.PrintQueue = new PrintQueue(new PrintServer(), cmbPrinters.Text);
                //dialog.PrintDocument()
                //  dialog.ShowDialog();

                //System.Windows.Forms.PrintPreviewDialog printPrvDlg = new System.Windows.Forms.PrintPreviewDialog();
                //printPrvDlg.Document = myPanel;
                //printPrvDlg.Width = 1200;
                //printPrvDlg.Height = 800;
                //printPrvDlg.ShowDialog();
                dialog.PrintVisual(myPanel, "A Great Image.");

                //PrintCapabilities capabilities = printDlg.PrintQueue.GetPrintCapabilities(printDlg.PrintTicket);
                //Size pageSize = new Size(obj.Bounds.Width, obj.Bounds.Height);
                //Size visibleSize = new Size(obj.Bounds.Width, obj.Bounds.Height);
                //FixedDocument fixedDoc = new FixedDocument();

                ////If the toPrint visual is not displayed on screen we neeed to measure and arrange it
                //form.TvBox.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));
                //form.TvBox.Arrange(new Rect(new Point(0, 0), form.TvBox.DesiredSize));
                ////
                //Size size = form.TvBox.DesiredSize;
                ////Will assume for simplicity the control fits horizontally on the page
                //double yOffset = 0;
                //while (yOffset < size.Height)
                //{
                //    VisualBrush vb = new VisualBrush(form.TvBox);
                //    vb.Stretch = Stretch.None;
                //    vb.AlignmentX = AlignmentX.Left;
                //    vb.AlignmentY = AlignmentY.Top;
                //    vb.ViewboxUnits = BrushMappingMode.Absolute;
                //    vb.TileMode = TileMode.None;
                //    vb.Viewbox = new Rect(0, yOffset, visibleSize.Width, visibleSize.Height);
                //    PageContent pageContent = new PageContent();
                //    FixedPage page = new FixedPage();
                //    ((IAddChild)pageContent).AddChild(page);
                //    fixedDoc.Pages.Add(pageContent);
                //    page.Width = pageSize.Width;
                //    page.Height = pageSize.Height;
                //    Canvas canvas = new Canvas();
                //    FixedPage.SetLeft(canvas, capabilities.PageImageableArea.OriginWidth);
                //    FixedPage.SetTop(canvas, capabilities.PageImageableArea.OriginHeight);
                //    canvas.Width = visibleSize.Width;
                //    canvas.Height = visibleSize.Height;
                //    canvas.Background = vb;
                //    page.Children.Add(canvas);
                //    yOffset += visibleSize.Height;
                //}
                ////for (var i = 0; i <= Convert.ToInt32(model.StartRow); i++)
                ////{
                ////    if (i == Convert.ToInt32(model.StartRow))
                ////    {
                ////        printDlg.PrintVisual(form.TvBox, "First Fit to Page WPF Print");
                ////    }
                ////}
                ////printDlg.ShowDialog();
                //printDlg.PrintQueue = new PrintQueue(new PrintServer(), cmbPrinters.Text);
                ////PrintDocument pd=printDlg.
                //printDlg.PrintDocument(fixedDoc.DocumentPaginator, "First Fit to Page WPF Print");
            }
            else
            {
                ConfirmationPopup obj = new ConfirmationPopup((string)Application.Current.Resources["select_printer"], (string)Application.Current.Resources["masterLabel_Header_Popup"], false);
                obj.ShowDialog();
                //CommonFunction.Common.((string)Application.Current.Resources["select_printer"], "", false);
            }
        }
 protected virtual void OnButtonClicked()
 => ConfirmationPopup.ShowConfirmation(SaveCase, StartReader,
                                       "Save Changes", "Would you look to save your changes?", "Yes", "No");
예제 #29
0
        private void ShowError(string msg)
        {
            ConfirmationPopup form = new ConfirmationPopup(msg, header, false);

            form.ShowDialog();
        }
 public void OnPressExit()
 {
     ConfirmationPopup.ShowPopup("Are you sure you want to quit?", OnExitYes, OnExitNo);
 }