示例#1
0
        private void chọnDatabaseToolStripMenuItem_Click(object sender, EventArgs e)
        {
            FrmAdminPass frm = new FrmAdminPass();

            if (frm.ShowDialog() == DialogResult.OK)
            {
                if (!serviceGet.checkAdminPass(frm.text, StaticClass.storeId))
                {
                    Alert.Show("Password không đúng !");
                }
                else
                {
                    FrmConfigDatabase frmConfigDatabase = new FrmConfigDatabase();
                    frmConfigDatabase.ShowDialog();
                }
            }
        }
示例#2
0
        private void button2_Click(object sender, EventArgs e)
        {
            FrmAdminPass adminPass = new FrmAdminPass();

            if (adminPass.ShowDialog() == DialogResult.OK)
            {
                if (serviceGet.checkAdminPass(adminPass.text, "1001"))
                {
                    formEditLayout            = new FrmEditLayout();
                    formEditLayout.formLayout = this;
                    formEditLayout.ShowDialog();
                }
                else
                {
                    Alert.Show("Bạn đã nhập sai \nmật khẩu !", Color.Red);
                }
            }
        }
示例#3
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);
            }
        }
示例#4
0
        public static bool ShowAdminPassRequest()
        {
            Service.ServiceGet serviceGet = new ServiceGet();
            FrmAdminPass       frm        = new FrmAdminPass();

            if (frm.ShowDialog() == DialogResult.OK)
            {
                if (!serviceGet.checkAdminPass(frm.text, StaticClass.storeId))
                {
                    Alert.Show("Password không đúng !");
                    return(false);
                }
                else
                {
                    return(true);
                }
            }
            return(false);
        }
示例#5
0
 private void creTextBox2_KeyPress(object sender, KeyPressEventArgs e)
 {
     if (e.KeyChar == 13)
     {
         Service.ServiceGet serviceGet = new ServiceGet();
         if (serviceGet.checkAdminPass(creTextBox2.Text, StaticClass.storeId))
         {
             Success             = true;
             StaticClass.isAdmin = true;
             DialogResult        = DialogResult.OK;
         }
         if (serviceGet.LoginBySwipe(creTextBox2.Text, StaticClass.storeId) == 0)
         {
             Success      = true;
             DialogResult = DialogResult.OK;
         }
         creTextBox1.SelectAll();
         creTextBox1.Focus();
     }
 }
示例#6
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);
        }