示例#1
0
        public static FormAccessRights GetFormAccessRightsByUserCodeAndFormName(string userCode, string formName)
        {
            ConnectionManager conManager = new ConnectionManager(ConnectionName.SysMan);
            IDataReader       reader     = null;

            FormAccessRights newFormAccessRights = new FormAccessRights();

            conManager.OpenDataReader(out reader, "spWebGetFormAccessRights", userCode, formName);
            try
            {
                while (reader.Read())
                {
                    newFormAccessRights.SetData(reader);
                }

                return(newFormAccessRights);
            }
            catch (Exception ex)
            {
                throw (ex);
            }
            finally
            {
                if (conManager != null)
                {
                    conManager.CloseConnection();
                    conManager.Dispose();
                }

                if (reader != null && !reader.IsClosed)
                {
                    reader.Close();
                }
            }
        }
示例#2
0
        public static CustomList <FormAccessRights> GetAllFormAccessRights()
        {
            ConnectionManager             conManager = new ConnectionManager(ConnectionName.SysMan);
            CustomList <FormAccessRights> FormAccessRightsCollection = new CustomList <FormAccessRights>();
            IDataReader  reader = null;
            const String sql    = "select *from SecurityRule_Object";

            try
            {
                conManager.OpenDataReader(sql, out reader);
                while (reader.Read())
                {
                    FormAccessRights newFormAccessRights = new FormAccessRights();
                    newFormAccessRights.SetData(reader);
                    FormAccessRightsCollection.Add(newFormAccessRights);
                }
                FormAccessRightsCollection.InsertSpName = "spInsertFormAccessRights";
                FormAccessRightsCollection.UpdateSpName = "spUpdateFormAccessRights";
                FormAccessRightsCollection.DeleteSpName = "spDeleteFormAccessRights";
                return(FormAccessRightsCollection);
            }
            catch (Exception ex)
            {
                throw (ex);
            }
            finally
            {
                if (reader != null && !reader.IsClosed)
                {
                    reader.Close();
                }
            }
        }
示例#3
0
 public static CustomList<FormAccessRights> GetAllFormAccessRights()
 {
     ConnectionManager conManager = new ConnectionManager(ConnectionName.SysMan);
     CustomList<FormAccessRights> FormAccessRightsCollection = new CustomList<FormAccessRights>();
     IDataReader reader = null;
     const String sql = "select *from SecurityRule_Object";
     try
     {
         conManager.OpenDataReader(sql, out reader);
         while (reader.Read())
         {
             FormAccessRights newFormAccessRights = new FormAccessRights();
             newFormAccessRights.SetData(reader);
             FormAccessRightsCollection.Add(newFormAccessRights);
         }
         FormAccessRightsCollection.InsertSpName = "spInsertFormAccessRights";
         FormAccessRightsCollection.UpdateSpName = "spUpdateFormAccessRights";
         FormAccessRightsCollection.DeleteSpName = "spDeleteFormAccessRights";
         return FormAccessRightsCollection;
     }
     catch (Exception ex)
     {
         throw (ex);
     }
     finally
     {
         if (reader != null && !reader.IsClosed)
             reader.Close();
     }
 }
示例#4
0
        protected internal void GetFormAccess()
        {
            SecurityManager manager = new SecurityManager();

            String formName = string.Empty;

            #if DEBUG
            {
                formName = Request.Url.AbsolutePath;
            }
            #else
            {
                formName = Request.Url.AbsolutePath.Replace(@"/ERP","");
            }
            #endif
            CustomList<LeftMenuItems> menuList = (CustomList<LeftMenuItems>)HttpContext.Current.Session["UserSession_LeftMenu"];
            if (menuList.IsNotNull())
            {
                LeftMenuItems menu = menuList.Find(f => f.FormName == formName);
                if (menu.IsNotNull())
                {
                    DocListFormatID = menu.DocListFormatID;
                    MenuID = menu.ObjectID;
                    StatusID = menu.StatusID;
                }
            }
            if (CurrentUserSession.IsAdmin)
            {
                accessRights = new FormAccessRights();
                accessRights.CanSelect = true;
                accessRights.CanInsert = true;
                accessRights.CanUpdate = true;
                accessRights.CanDelete = true;
            }
            else
            {
                this.accessRights = manager.GetFormAccessRights(CurrentUserSession.UserCode, formName);
            }
        }
示例#5
0
        public static FormAccessRights GetFormAccessRightsByUserCodeAndFormName(string userCode, string formName)
        {
            ConnectionManager conManager = new ConnectionManager(ConnectionName.SysMan);
            IDataReader reader = null;

            FormAccessRights newFormAccessRights = new FormAccessRights();
            conManager.OpenDataReader(out reader, "spWebGetFormAccessRights", userCode, formName);
            try
            {
                while (reader.Read())
                {
                    newFormAccessRights.SetData(reader);
                }

                return newFormAccessRights;
            }
            catch (Exception ex)
            {
                throw (ex);
            }
            finally
            {
                if (conManager != null)
                {
                    conManager.CloseConnection();
                    conManager.Dispose();
                }

                if (reader != null && !reader.IsClosed)
                    reader.Close();
            }
        }