public bool IsVerifiedAuthorization(string userAuthorization)
        {
            if (UserAuthorizations.Contains("ALL") ||
                UserAuthorizations.Contains(userAuthorization))
            {
                return(true);
            }
            UserAuthenticationForm userAuthenticationForm = new UserAuthenticationForm();

            userAuthenticationForm.UserAuthorization = userAuthorization;
            userAuthenticationForm.ShowDialog();
            return(userAuthenticationForm.HasAuthorization);
        }
Example #2
0
        public static void LogOutUser()
        {
            //reset auto login properties
            Properties.Settings.Default.Username = "";
            Properties.Settings.Default.Password = "";
            Properties.Settings.Default.Save();

            //reset all other static fields
            UserID      = null;
            Username    = null;
            AccessToken = null;
            ExpenseCategories.Clear();
            EarningCategories.Clear();
            DailyInfoList.Clear();
            MonthlyInfoList.Clear();

            UserAuthenticationForm form = new UserAuthenticationForm();

            form.Show();
        }
Example #3
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            this.issuccess = false;
            long ornumber = long.Parse(txtORno.Text.Trim());

            if (ornumber == 0)
            {
                UserAuthenticationForm userAuthenticationForm = new UserAuthenticationForm();
                userAuthenticationForm.UserAuthorization = "REFUNDITEM";
                userAuthenticationForm.ShowDialog();
                if (userAuthenticationForm.HasAuthorization)
                {
                    successReturn();
                }
            }
            else
            {
                decimal prodcount       = get_productCountFromOR(this.productid, ornumber);
                decimal ABSnegative_qty = Math.Abs(negative_qty);
                if (prodcount >= ABSnegative_qty)
                {
                    successReturn();
                }
                else
                {
                    if (prodcount == 0)
                    {
                        fncFilter.alert("OR has no such products");
                    }
                    else
                    {
                        fncFilter.alert("Products intended for refund are more than sales in Previous OR");
                    }
                }
            }
        }
Example #4
0
        private void done_process()
        {
            decimal new_qty;
            bool    isNum = decimal.TryParse(txtNewQty_d.Text, out new_qty);

            if (isNum)
            {
                decimal old_qty = fncFilter.getDecimalValue(this.lblOldQty_d.Text);
                if (new_qty >= old_qty)
                {
                    if (new_qty - old_qty > 99)
                    {
                        if (DialogHelper.ShowDialog("Are you sure you want to increase the item quantity by this much?", MessageBoxButtons.YesNo) == DialogResult.No)
                        {
                            this.Close();
                            return;
                        }
                    }

                    this.new_qty = new_qty;
                    this.Close();
                    return;
                }

                bool permcheck = false;
                if (new_qty == 0 && this.delete_auth == true)
                {
                    permcheck = true;
                }
                else if (new_qty < 0 && this.return_auth == true)
                {
                    permcheck = true;
                }
                else if (new_qty < old_qty && this.return_auth == true)
                {
                    permcheck = true;
                }
                else if (new_qty == 0)
                {
                    UserAuthenticationForm userAuthenticationForm = new UserAuthenticationForm();
                    userAuthenticationForm.UserAuthorization = "REMOVEITEM";
                    userAuthenticationForm.ShowDialog();
                    permcheck = userAuthenticationForm.HasAuthorization;
                }
                else
                {
                    UserAuthenticationForm userAuthenticationForm = new UserAuthenticationForm();
                    userAuthenticationForm.UserAuthorization = "REFUNDITEM";
                    userAuthenticationForm.ShowDialog();
                    permcheck = userAuthenticationForm.HasAuthorization;
                }

                if (permcheck)
                {
                    if (new_qty < 0 && cls_globalvariables.RefundMemo_v == "2")
                    {
                        frmRefundInfo refundinfo = new frmRefundInfo();
                        refundinfo.productid    = productid;
                        refundinfo.negative_qty = new_qty;
                        refundinfo.productname  = productname;
                        refundinfo.ShowDialog();
                        if (refundinfo.issuccess)
                        {
                            this.new_qty         = new_qty;
                            this.salesdetailmemo = refundinfo.salesdetailmemo;
                            this.Close();
                        }
                    }
                    else
                    {
                        this.new_qty         = new_qty;
                        this.salesdetailmemo = "";
                        this.Close();
                        return;
                    }
                }
            }
            else
            {
                fncFilter.alert(cls_globalvariables.warning_input_invalid);
                txtNewQty_d.Focus();
                txtNewQty_d.SelectAll();
                return;
            }
        }