Exemplo n.º 1
0
        public int Login(string Id, string pass, string storeId)
        {
            DataTable getCashierpass = getGui.GetEmployeePass(Id);

            if (getCashierpass.Rows.Count == 0)
            {
                return(0);
            }
            else
            {
                string cashierPass = getCashierpass.Rows[0][1].ToString();
                string adminPass   = getGui.GetAdminPass(storeId).Rows[0][1].ToString();
                if (pass.ToLower() == cashierPass.ToLower() || pass.ToLower() == adminPass.ToLower())
                {
                    if (pass.ToLower() == cashierPass.ToLower())
                    {
                        StaticClass.isAdmin = false;
                    }
                    else
                    {
                        StaticClass.isAdmin = true;
                    }
                    StaticClass.cashierId = Id;
                    DataTable thongTinNV = getGui.GetEmpById(Id);
                    StaticClass.thongTinNV = thongTinNV.Rows[0];
                    return(2);
                }
                else
                {
                    return(1);
                }
            }
        }
Exemplo n.º 2
0
        public static bool CheckGrant(string storeId, string cashierId, int grantNum)
        {
            get_GUI   getGui = new get_GUI();
            DataTable emp    = getGui.GetEmpById(cashierId);

            Service.ServiceGet service = new ServiceGet();
            switch (grantNum)
            {
            case XEM_BAN_KHAC:
                if (emp.Rows[0][XEM_BAN_KHAC].ToString() == "P")
                {
                    return(true);
                }
                else if (emp.Rows[0][XEM_BAN_KHAC].ToString() == "Y")
                {
                    FrmAdminPass frm = new FrmAdminPass();
                    if (frm.ShowDialog() == DialogResult.OK)
                    {
                        if (!service.checkAdminPass(frm.text, storeId))
                        {
                            MessageBox.Show("Password không đúng !");
                            return(false);
                        }
                        else
                        {
                            return(true);
                        }
                    }
                    else
                    {
                        return(false);
                    }
                }
                else
                {
                    return(false);
                }
                break;

            default:
                return(false);
            }
        }
Exemplo n.º 3
0
        private static bool check(string storeId, string cashierId, string columnName)
        {
            get_GUI   getGui = new get_GUI();
            DataTable emp    = getGui.GetEmpById(cashierId);

            Service.ServiceGet service = new ServiceGet();
            if (emp.Rows[0][columnName].ToString() == "Y")
            {
                return(true);
            }
            else if (emp.Rows[0][columnName].ToString() == "P")
            {
                FrmAdminPass frm = new FrmAdminPass();
                if (frm.ShowDialog() == DialogResult.OK)
                {
                    if (!service.checkAdminPass(frm.text, storeId))
                    {
                        Alert.Show("Password không đúng !", Color.Red);
                        return(false);
                    }
                    else
                    {
                        return(true);
                    }
                }
                else
                {
                    return(false);
                }
            }
            else if (emp.Rows[0][columnName].ToString() == "N")
            {
                Alert.Show("Bạn không có quyền để\n thực hiện chức năng này", Color.Red);
                return(false);
            }
            return(false);
        }
Exemplo n.º 4
0
        public static bool CheckGrant(string storeId, string cashierId, int grantNum)
        {
            if (!StaticClass.isAdmin)
            {
                get_GUI            getGui  = new get_GUI();
                DataTable          emp     = getGui.GetEmpById(cashierId);
                Service.ServiceGet service = new ServiceGet();
                switch (grantNum)
                {
                case XEM_BAN_KHAC:
                    return(check(storeId, cashierId, "CFA_Other_Tables"));

                case CFA_INVOICE_DELETE_ITEMS:
                    return(check(storeId, cashierId, "CFA_Invoice_DeleteItems"));

                case CFA_INVOICE_DISCOUNT:
                    return(check(storeId, cashierId, "CFA_Invoice_Discount"));

                case CFA_INVOICE_PRICE_CHANGE:
                    return(check(storeId, cashierId, "CFA_Invoice_PriceChange"));

                case CFA_INVOICE_VOID:
                    return(check(storeId, cashierId, "CFA_Invoice_Void"));

                case CFA_TRANSFER_TABLE:
                    return(check(storeId, cashierId, "CFA_Transfer_Tables"));

                case CFA_INVOICE_QUAN_CHANGE:
                    return(check(storeId, cashierId, "CFA_ENDTRANS_CASH"));

                case CFA_INVOICE_RETURN:
                    return(check(storeId, cashierId, "CFA_Refund_Item"));

                case CFA_SETUP_TAX:
                    return(check(storeId, cashierId, "CFA_Setup_Tax"));

                case CFA_SETUP_PRINTER:
                    return(check(storeId, cashierId, "CFA_Setup_DefPrinter"));

                case CFA_SETUP_RECEIPT_NOTES:
                    return(check(storeId, cashierId, "CFA_SETUP_RECEIPT_NOTES"));

                case CFA_SETUP_DEPTS_EDIT:
                    return(check(storeId, cashierId, "CFA_Depts_Edit"));

                case CFA_SETUP_INVENT_EDIT:
                    return(check(storeId, cashierId, "CFA_Inven_Edit"));

                case CFA_SETUP_EDIT_EMP:
                    return(check(storeId, cashierId, "CFA_SETUP_EDIT_EMPLOYEES"));

                case CFA_REPORT_DISPLAY:
                    return(check(storeId, cashierId, "CFA_Reports_Display"));

                case CFA_TS_CONFIG:
                    return(check(storeId, cashierId, "CFA_TS_CONFIG"));

                case CFA_Open_Cash_Drawer:
                    return(check(storeId, cashierId, "CFA_Open_Cash_Drawer"));

                case CFA_Cust_Edit:
                    return(check(storeId, cashierId, "CFA_Cust_Edit"));

                case CFA_PRINT_HOLD:
                    return(check(storeId, cashierId, "CFA_PRINT_HOLD"));

                case CFA_ENDTRANS_ACCOUNT:
                    return(check(storeId, cashierId, "CFA_ENDTRANS_ACCOUNT"));

                case CFA_AUCTION_SHIP:
                    return(check(storeId, cashierId, "CFA_AUCTION_SHIP"));

                case CFA_PULLBACK_INVOICE:
                    return(check(storeId, cashierId, "CFA_PULLBACK_INVOICE"));

                default:
                    return(false);
                }
            }
            else
            {
                return(true);
            }
        }