Exemplo n.º 1
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");
                    default:
                        return false;

                }
            }
            else
            {
                return true;
            }
            
        }
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;
 }