Ejemplo n.º 1
0
        private void BtnDelete_Click(object sender, EventArgs e)
        {
            // User can't delete his/her own account by him/her self
            if (actionUser.Id == user.Id)
            {
                Blur blur = new Blur(this, UIConstants.MinBlurOpacity);
                blur.Show();

                new MessageDialog
                {
                    DialogButtonsIndex = MessageDialog.DialogButtons.One,
                    DialogIconIndex    = MessageDialog.DialogIcon.Sorry,
                    ThirdBtnText       = "OK",
                    Title   = "Impossible to delete this Account",
                    Message = "Sorry you can't delete your account yourself. To so either create a new admin account or use another account. Contact Franz Nkemaka for more!",
                    TopMost = true,
                }.ShowDialog();

                blur.Close();
            }
            else
            {
                Blur blur = new Blur(this, UIConstants.MinBlurOpacity);
                blur.Show();

                MessageDialog messageDialog = new MessageDialog
                {
                    DialogButtonsIndex = MessageDialog.DialogButtons.Two,
                    DialogIconIndex    = MessageDialog.DialogIcon.Sorry,
                    SecondBtnText      = "No",
                    ThirdBtnText       = "Yes",
                    ThirdBtnColor      = Color.Tomato,
                    Title   = "Are you sure ?",
                    Message = $"Are you sure you want to permanently delete { user.FirstName }, this user will be deleted immediately. You can't undo this action.",
                    TopMost = true,
                };

                var dialogResult = messageDialog.ShowWithEvent();
                if (dialogResult == MessageDialog.OnClickEvent.ThirdButton)
                {
                    //Delete
                    DeleteUser();
                    ActionDialog = Enums.ActionDialog.Deleted;
                }

                blur.Close();
            }
        }
Ejemplo n.º 2
0
        private void BtnAddCustomer_Click(object sender, EventArgs e)
        {
            Blur blur = new Blur(this, UIConstants.FormBlurOpacity);

            blur.Show();

            new SearchItems
            {
                ItemTypeIndex = SearchItems.ItemType.Customer,
                User          = Sale.User,
                Store         = Sale.Store,
                OnAdd         = OnAddCustomer,
                Task          = Enums.Task.Create,
            }.ShowDialog();

            blur.Close();
        }
Ejemplo n.º 3
0
        private void BtnProductDetails_Click(object sender, EventArgs e)
        {
            // Show SelectedProduct Details if is set
            if (SelectedProduct is object)
            {
                Blur blur = new Blur(this, UIConstants.FormBlurOpacity);
                blur.Show();

                ProductDetails productDetails = new ProductDetails
                {
                    Product = SelectedProduct,
                    Task    = Enums.Task.ReadOnly,
                    TopMost = true
                };

                var formResponse = productDetails.ShowDialog();
                blur.Close();
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Open Dashboard With UserControl Name
        /// </summary>
        /// <param name="userControlName"></param>
        void OpenDashboard(string userControlName)
        {
            //Add Blur Effect
            Blur blur = new Blur(this, 0.15);

            blur.Show();

            DashboardForm dashboardForm = new DashboardForm
            {
                //Remove "card" from userControlName
                TabName     = userControlName,
                TopMost     = true,
                WindowState = this.WindowState
            };

            dashboardForm.ShowDialog();

            //Remove Blur
            blur.Close();
        }
Ejemplo n.º 5
0
        private void Pay_Click(object sender, EventArgs e)
        {
            Blur blur = new Blur(this, UIConstants.MinBlurOpacity);

            blur.Show();
            this.TopMost = false;

            UnListenScanner();

            // Show Pay Form
            Sale.IsGuest = !IsCustomerAdded;
            Pay Pay = new Pay
            {
                Sale       = Sale,
                OnComplete = OnPaymentCompled,
                TopMost    = true,
            };

            Pay.ShowDialog();
            this.TopMost = true;
            blur.Close();
        }
Ejemplo n.º 6
0
        void CheckUpdates()
        {
            if (IsAppUpToDate)
            {
                return;
            }
            else
            {
                if (Util.IsUpdateRequired(App))
                {
                    Blur blur = new Blur(this, UIConstants.MinBlurOpacity);
                    blur.Show();

                    MessageDialog messageDialog = new MessageDialog
                    {
                        DialogButtonsIndex = MessageDialog.DialogButtons.Two,
                        DialogIconIndex    = MessageDialog.DialogIcon.Sorry,
                        SecondBtnText      = "Yes",
                        ThirdBtnText       = "No",
                        ThirdBtnColor      = Color.Tomato,
                        Title   = "A new version is available and it's required",
                        Message = $"A new version is available and it is required, you must update to use this app " +
                                  $"again since in each release lot's of errors are fixed & some Backend endpoints are removed. " +
                                  $"Should the update start ?",
                        TopMost = true,
                    };

                    var dialogResult = messageDialog.ShowWithEvent();
                    if (dialogResult == MessageDialog.OnClickEvent.SecondButton) // yes
                    {
                        Util.Func.StartInstaller(this);
                    }
                    else // no
                    {
                        Extensions.ExitApplication();
                    }
                    blur.Close();
                }
                else
                {
                    Blur blur = new Blur(this, UIConstants.MinBlurOpacity);
                    blur.Show();

                    MessageDialog messageDialog = new MessageDialog
                    {
                        DialogButtonsIndex = MessageDialog.DialogButtons.Two,
                        DialogIconIndex    = MessageDialog.DialogIcon.Sorry,
                        SecondBtnText      = "Yes",
                        ThirdBtnText       = "No",
                        ThirdBtnColor      = Color.Tomato,
                        Title   = "A new version is available",
                        Message = $"A new version is available, it's very important to get the latest " +
                                  $"update since in each release lots of errors are fixed & some Backend endpoints are removed. " +
                                  $"Do you want to update ?",
                        TopMost = true,
                    };

                    var dialogResult = messageDialog.ShowWithEvent();
                    if (dialogResult == MessageDialog.OnClickEvent.SecondButton) // yes
                    {
                        Util.Func.StartInstaller(this);
                    }
                    else // no
                    {
                        // Continue
                        return;
                    }
                    blur.Close();
                }
            }
        }