Esempio n. 1
0
 public static bool IsDelete(string myObject)
 {
     return(MyRule.Check(MyRule.EnumRule.AllowDelete, myObject));
 }
Esempio n. 2
0
 public static bool IsImport(string myObject)
 {
     return(MyRule.Check(MyRule.EnumRule.AllowImport, myObject));
 }
Esempio n. 3
0
        public static string Insert(SqlConnection myConnection)
        {
            string str = MyRule.Insert(myConnection, MyRule.m_Goup_ID, MyRule.m_Object_ID, MyRule.m_Rule_ID, MyRule.m_AllowAdd, MyRule.m_AllowDelete, MyRule.m_AllowEdit, MyRule.m_AllowAccess, MyRule.m_AllowPrint, MyRule.m_AllowExport, MyRule.m_AllowImport, MyRule.m_Active);

            return(str);
        }
Esempio n. 4
0
 public static bool IsAdd(string myObject)
 {
     return(MyRule.Check(MyRule.EnumRule.AllowAdd, myObject));
 }
Esempio n. 5
0
 public static string Get(SqlConnection myConnection)
 {
     return(MyRule.Get(myConnection, MyRule.Goup_ID, MyRule.Object_ID));
 }
Esempio n. 6
0
 public static string Get(SqlTransaction myTransaction)
 {
     return(MyRule.Get(myTransaction, MyRule.Goup_ID, MyRule.Object_ID));
 }
Esempio n. 7
0
 public static bool Exist(SqlTransaction myTransaction)
 {
     return(MyRule.Exist(myTransaction, MyRule.m_Goup_ID, MyRule.m_Object_ID));
 }
Esempio n. 8
0
 public static bool Check(string myObject)
 {
     return(MyRule.Check(MyRule.EnumRule.All, myObject));
 }
Esempio n. 9
0
 public static string Delete(SqlTransaction myTransaction)
 {
     return(MyRule.Delete(MyRule.m_Goup_ID, MyRule.m_Object_ID));
 }
Esempio n. 10
0
 public static bool Exist()
 {
     return(MyRule.Exist(MyRule.m_Goup_ID, MyRule.m_Object_ID));
 }
Esempio n. 11
0
 public static string Delete(SqlConnection myConnection)
 {
     return(MyRule.Delete(myConnection, MyRule.m_Goup_ID, MyRule.m_Object_ID));
 }
Esempio n. 12
0
 public static string Delete()
 {
     return(MyRule.Delete(MyRule.m_Goup_ID, MyRule.m_Object_ID));
 }
Esempio n. 13
0
 public static string CreateKey()
 {
     return(MyRule.CreateKey(""));
 }
Esempio n. 14
0
 public static bool IsPrint(string myObject)
 {
     return(MyRule.Check(MyRule.EnumRule.AllowPrint, myObject));
 }
Esempio n. 15
0
 public static string Get()
 {
     return(MyRule.Get(MyRule.Goup_ID, MyRule.Object_ID));
 }
Esempio n. 16
0
        public static string Update(SqlTransaction myTransaction)
        {
            string str = MyRule.Update(myTransaction, MyRule.m_Goup_ID, MyRule.m_Object_ID, MyRule.m_Rule_ID, MyRule.m_AllowAdd, MyRule.m_AllowDelete, MyRule.m_AllowEdit, MyRule.m_AllowAccess, MyRule.m_AllowPrint, MyRule.m_AllowExport, MyRule.m_AllowImport, MyRule.m_Active);

            return(str);
        }
Esempio n. 17
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);
        }