Beispiel #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();
                string    adminSwipe  = getGui.GetAdminPass(storeId).Rows[0][2].ToString();
                DataTable thongTinNV  = getGui.GetEmployeeByID(storeId, Id);
                if (Convert.ToBoolean(thongTinNV.Rows[0][Employee_Prop.Disabled]))
                {
                    return(3);
                }
                if (pass.ToLower() == cashierPass.ToLower() || pass.ToLower() == adminPass.ToLower() || (pass.ToLower() == adminSwipe.ToLower() && adminSwipe != ""))
                {
                    if (pass.ToLower() == cashierPass.ToLower())
                    {
                        StaticClass.isAdmin = false;
                    }
                    else
                    {
                        StaticClass.isAdmin = true;
                    }
                    StaticClass.cashierId = Id;
                    //DataTable thongTinNV = getGui.GetEmployeeByID(storeId,Id);
                    StaticClass.thongTinNV = thongTinNV.Rows[0];
                    return(2);
                }
                else
                {
                    return(1);
                }
            }
        }
Beispiel #2
0
        private static bool check(string storeId, string cashierId, string columnName)
        {
            get_GUI   getGui = new get_GUI();
            DataTable emp    = getGui.GetEmployeeByID(storeId, 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);
        }