Exemplo n.º 1
0
        public static CustomList <LeftMenuItems> GetAllLeftMenuItems()
        {
            ConnectionManager          conManager = new ConnectionManager(ConnectionName.SysMan);
            CustomList <LeftMenuItems> LeftMenuItemsCollection = new CustomList <LeftMenuItems>();
            IDataReader  reader = null;
            const String sql    = "select MenuID as ObjectID, ApplicationID, ParentID, FormName, DisplayMember,MenuType, MenuSequence, ValueMember,'menu' As ObjectType, CAST(1 as bit) CanSelect, CAST(1 as bit) CanInsert,CAST (1 as bit) CanUpdate, CAST (1as bit) CanDelete from Menu";

            try
            {
                conManager.OpenDataReader(sql, out reader);
                while (reader.Read())
                {
                    LeftMenuItems newLeftMenuItems = new LeftMenuItems();
                    newLeftMenuItems.SetData(reader);
                    LeftMenuItemsCollection.Add(newLeftMenuItems);
                }
                LeftMenuItemsCollection.InsertSpName = "spInsertLeftMenuItems";
                LeftMenuItemsCollection.UpdateSpName = "spUpdateLeftMenuItems";
                LeftMenuItemsCollection.DeleteSpName = "spDeleteLeftMenuItems";
                return(LeftMenuItemsCollection);
            }
            catch (Exception ex)
            {
                throw (ex);
            }
            finally
            {
                if (reader != null && !reader.IsClosed)
                {
                    reader.Close();
                }
            }
        }
Exemplo n.º 2
0
        public static CustomList <LeftMenuItems> GetAllLeftMenuItemsByUserCodeAndApplicationID(string userCode, int applicationId)
        {
            ConnectionManager          conManager = new ConnectionManager(ConnectionName.SysMan);
            CustomList <LeftMenuItems> LeftMenuItemsCollection = new CustomList <LeftMenuItems>();
            IDataReader reader = null;

            if (HttpContext.Current.Session["UserSession_LeftMenu"] != null)
            {
                return((CustomList <LeftMenuItems>)HttpContext.Current.Session["UserSession_LeftMenu"]);
            }

            conManager.OpenDataReader(out reader, "spWebGetMenusByUserAndApplication", userCode, applicationId);

            try
            {
                while (reader.Read())
                {
                    LeftMenuItems newLeftMenuItems = new LeftMenuItems();
                    newLeftMenuItems.SetData(reader);
                    LeftMenuItemsCollection.Add(newLeftMenuItems);
                }

                LeftMenuItemsCollection.InsertSpName = "spInsertLeftMenuItems";
                LeftMenuItemsCollection.UpdateSpName = "spUpdateLeftMenuItems";
                LeftMenuItemsCollection.DeleteSpName = "spDeleteLeftMenuItems";

                HttpContext.Current.Session["UserSession_LeftMenu"] = LeftMenuItemsCollection;
                return(LeftMenuItemsCollection);
            }
            catch (Exception ex)
            {
                throw (ex);
            }
            finally
            {
                if (conManager != null)
                {
                    conManager.CloseConnection();
                    conManager.Dispose();
                }
                if (reader != null && !reader.IsClosed)
                {
                    reader.Close();
                }
            }
        }
Exemplo n.º 3
0
        public static CustomList<LeftMenuItems> GetAllLeftMenuItemsByUserCodeAndApplicationID(string userCode, int applicationId)
        {
            ConnectionManager conManager = new ConnectionManager(ConnectionName.SysMan);
            CustomList<LeftMenuItems> LeftMenuItemsCollection = new CustomList<LeftMenuItems>();
            IDataReader reader = null;

            if (HttpContext.Current.Session["UserSession_LeftMenu"] != null)
                return (CustomList<LeftMenuItems>)HttpContext.Current.Session["UserSession_LeftMenu"];

            conManager.OpenDataReader(out reader, "spWebGetMenusByUserAndApplication", userCode, applicationId);

            try
            {
                while (reader.Read())
                {
                    LeftMenuItems newLeftMenuItems = new LeftMenuItems();
                    newLeftMenuItems.SetData(reader);
                    LeftMenuItemsCollection.Add(newLeftMenuItems);
                }

                LeftMenuItemsCollection.InsertSpName = "spInsertLeftMenuItems";
                LeftMenuItemsCollection.UpdateSpName = "spUpdateLeftMenuItems";
                LeftMenuItemsCollection.DeleteSpName = "spDeleteLeftMenuItems";

                HttpContext.Current.Session["UserSession_LeftMenu"] = LeftMenuItemsCollection;
                return LeftMenuItemsCollection;
            }
            catch (Exception ex)
            {
                throw (ex);
            }
            finally
            {
                if (conManager != null)
                {
                    conManager.CloseConnection();
                    conManager.Dispose();
                }
                if (reader != null && !reader.IsClosed)
                    reader.Close();
            }
        }
Exemplo n.º 4
0
 public static CustomList<LeftMenuItems> GetAllLeftMenuItems()
 {
     ConnectionManager conManager = new ConnectionManager(ConnectionName.SysMan);
     CustomList<LeftMenuItems> LeftMenuItemsCollection = new CustomList<LeftMenuItems>();
     IDataReader reader = null;
     const String sql = "select MenuID as ObjectID, ApplicationID, ParentID, FormName, DisplayMember,MenuType, MenuSequence, ValueMember,'menu' As ObjectType, CAST(1 as bit) CanSelect, CAST(1 as bit) CanInsert,CAST (1 as bit) CanUpdate, CAST (1as bit) CanDelete from Menu";
     try
     {
         conManager.OpenDataReader(sql, out reader);
         while (reader.Read())
         {
             LeftMenuItems newLeftMenuItems = new LeftMenuItems();
             newLeftMenuItems.SetData(reader);
             LeftMenuItemsCollection.Add(newLeftMenuItems);
         }
         LeftMenuItemsCollection.InsertSpName = "spInsertLeftMenuItems";
         LeftMenuItemsCollection.UpdateSpName = "spUpdateLeftMenuItems";
         LeftMenuItemsCollection.DeleteSpName = "spDeleteLeftMenuItems";
         return LeftMenuItemsCollection;
     }
     catch (Exception ex)
     {
         throw (ex);
     }
     finally
     {
         if (reader != null && !reader.IsClosed)
             reader.Close();
     }
 }