Esempio n. 1
0
 public static string Get(SqlTransaction myTransaction)
 {
     return(MyRule.Get(myTransaction, MyRule.Goup_ID, MyRule.Object_ID));
 }
Esempio n. 2
0
 public static string Get()
 {
     return(MyRule.Get(MyRule.Goup_ID, MyRule.Object_ID));
 }
Esempio n. 3
0
 public static string Get(SqlConnection myConnection)
 {
     return(MyRule.Get(myConnection, MyRule.Goup_ID, MyRule.Object_ID));
 }
Esempio n. 4
0
        //public static void AddCombo(System.Windows.Forms.ComboBox combo)
        //{
        //    MyLib.TableToComboBoxcombo, MyRule.GetList(), "SYS_USER_RULEName", "SYS_USER_RULEID");
        //}

        //public static void AddComboAll(System.Windows.Forms.ComboBox combo)
        //{
        //    DataTable dataTable = new DataTable();
        //    dataTable = MyRule.GetList();
        //    DataRow dataRow = dataTable.NewRow();
        //    dataRow["SYS_USER_RULEID"] = "All";
        //    dataRow["SYS_USER_RULEName"] = "Tất cả";
        //    dataTable.Rows.InsertAt(dataRow, 0);
        //    MyLib.TableToComboBox(combo, dataTable, "SYS_USER_RULEName", "SYS_USER_RULEID");
        //}

        public static bool Check(MyRule.EnumRule rule, string myObject)
        {
            bool allowAccess;

            if (!(MyRule.Get(MyLogin.RoleId, myObject) != "OK"))
            {
                switch (rule)
                {
                case MyRule.EnumRule.AllowAccess:
                {
                    allowAccess = MyRule.AllowAccess;
                    break;
                }

                case MyRule.EnumRule.AllowAdd:
                {
                    allowAccess = MyRule.AllowAdd;
                    break;
                }

                case MyRule.EnumRule.AllowDelete:
                {
                    allowAccess = MyRule.AllowDelete;
                    break;
                }

                case MyRule.EnumRule.AllowEdit:
                {
                    allowAccess = MyRule.AllowEdit;
                    break;
                }

                case MyRule.EnumRule.AllowPrint:
                {
                    allowAccess = MyRule.AllowPrint;
                    break;
                }

                case MyRule.EnumRule.AllowExport:
                {
                    allowAccess = MyRule.AllowExport;
                    break;
                }

                case MyRule.EnumRule.AllowImport:
                {
                    allowAccess = MyRule.AllowImport;
                    break;
                }

                default:
                {
                    allowAccess = true;
                    break;
                }
                }
            }
            else
            {
                allowAccess = false;
            }
            return(allowAccess);
        }