internal static Collection <BOMenu> GetSideMenuCollectionLevel3(int p1, int p2, string pinnumber, string modulename)
        {
            Collection <BOMenu> collection = new Collection <BOMenu>();


            PBSDBUtility idb = new PBSDBUtility();


            string mnqry = @"SELECT        dbo.menus.menu_id, dbo.menus.menu_text, dbo.menus.MenuOrder, dbo.menus.url, dbo.menus.menu_code, dbo.menus.[level], dbo.menus.parent_menu_id, dbo.menus.audit_user_id, dbo.menus.audit_ts, 
                         dbo.menus.LastEditDate, dbo.menus.CreationDate, dbo.menus.ModuleName, dbo.menus.CssClass, dbo.menus.FormName
FROM            dbo.menus INNER JOIN
                         dbo.AppsPermission ON dbo.menus.menu_id = dbo.AppsPermission.menu_id
						 where menus.ModuleName='"                         + modulename + "' and menus.isActive = 1 and menus.level=3 and parent_menu_id=" + p1 + " and AppsPermission.pin_number='" + pinnumber + "' order by dbo.menus.MenuOrder asc";

            using (DataTable table = idb.GetDataBySQLString(mnqry))
            {
                if (table == null)
                {
                    return(null);
                }

                foreach (DataRow row in table.Rows)
                {
                    BOMenu model = new BOMenu();

                    model.MenuId       = Conversion.TryCastInteger(row["menu_id"]);
                    model.MenuText     = Conversion.TryCastString(row["menu_text"]);
                    model.Url          = Conversion.ResolveUrl(Conversion.TryCastString(row["url"]));
                    model.MenuCode     = Conversion.TryCastString(row["menu_code"]);
                    model.Level        = Conversion.TryCastInteger(row["level"]);
                    model.ParentMenuId = Conversion.TryCastInteger(row["parent_menu_id"]);
                    model.CssClass     = Conversion.TryCastString(row["CssClass"]);

                    collection.Add(model);
                }
            }



            return(collection);
        }
        public static Collection <BOMenu> GetMenuCollection_Accounts(int parentMenuId, short level, string pinnumber)
        {
            Collection <BOMenu> collection = new Collection <BOMenu>();


            PBSDBUtility idb = new PBSDBUtility();


            string mnqry = @"SELECT        dbo.menus.menu_id, dbo.menus.menu_text, dbo.menus.MenuOrder, dbo.menus.url, dbo.menus.menu_code, dbo.menus.[level], dbo.menus.parent_menu_id, dbo.menus.audit_user_id, dbo.menus.audit_ts, 
                         dbo.menus.LastEditDate, dbo.menus.CreationDate, dbo.menus.ModuleName, dbo.menus.CssClass, dbo.menus.FormName
FROM            dbo.menus INNER JOIN
                         dbo.AppsPermission ON dbo.menus.menu_id = dbo.AppsPermission.menu_id
						 where menus.ModuleName='ACCOUNTS' order by dbo.menus.MenuOrder asc"                        ;

            using (DataTable table = idb.GetDataBySQLString(mnqry))
            {
                if (table == null)
                {
                    return(null);
                }

                foreach (DataRow row in table.Rows)
                {
                    BOMenu model = new BOMenu();

                    model.MenuId       = Conversion.TryCastInteger(row["menu_id"]);
                    model.MenuText     = Conversion.TryCastString(row["menu_text"]);
                    model.Url          = Conversion.ResolveUrl(Conversion.TryCastString(row["url"]));
                    model.MenuCode     = Conversion.TryCastString(row["menu_code"]);
                    model.Level        = Conversion.TryCastInteger(row["level"]);
                    model.ParentMenuId = Conversion.TryCastInteger(row["parent_menu_id"]);
                    model.CssClass     = Conversion.TryCastString(row["CssClass"]);

                    collection.Add(model);
                }
            }



            return(collection);
        }
        ///Menu
        ///
        public static Collection <BOMenu> GetMenuCollection(string path, short level, string pinnumber)
        {
            try
            {
                var collection = new Collection <BOMenu>();

                var idb = new PBSDBUtility();

                string relativePath = Conversion.GetRelativePath(path);


                var ht = new Hashtable();
                ht.Add("pin_number", pinnumber);
                ht.Add("URL", path);

                DataTable table = idb.GetDataByProc(ht, "Menu_getByUrl");


                foreach (DataRow row in table.Rows)
                {
                    var model = new BOMenu();

                    model.MenuId       = Conversion.TryCastInteger(row["menu_id"]);
                    model.MenuText     = Conversion.TryCastString(row["menu_text"]);
                    model.Url          = Conversion.ResolveUrl(Conversion.TryCastString(row["url"]));
                    model.MenuCode     = Conversion.TryCastString(row["menu_code"]);
                    model.Level        = Conversion.TryCastInteger(row["level"]);
                    model.ParentMenuId = Conversion.TryCastInteger(row["parent_menu_id"]);
                    model.CssClass     = Conversion.TryCastString(row["CssClass"]);
                    model.MenuName     = Conversion.TryCastString(row["ParentMenuText"]);

                    collection.Add(model);
                }
                // }
                return(collection);
            }
            catch (Exception)
            {
                return(null);
            }
        }
        public static Collection <BOMenu> GetRootMenuCollection(string path)
        {
            Collection <BOMenu> collection = new Collection <BOMenu>();

            PBSDBUtility idb          = new PBSDBUtility();
            string       relativePath = Conversion.GetRelativePath(path);

            int rootparentmenuid = int.Parse(idb.AggRetrive("select  parent_menu_id from menus WHERE url='" + path + "'").ToString());

            int parent_menu_id = int.Parse(idb.AggRetrive("select parent_menu_id from menus where menu_id=" + rootparentmenuid + "").ToString());



            using (DataTable table = idb.GetDataBySQLString("SELECT * FROM  menus WHERE parent_menu_id=" + parent_menu_id + "  ORDER BY menu_id"))
            {
                if (table == null)
                {
                    return(null);
                }

                foreach (DataRow row in table.Rows)
                {
                    BOMenu model = new BOMenu();

                    model.MenuId       = Conversion.TryCastInteger(row["menu_id"]);
                    model.MenuText     = Conversion.TryCastString(row["menu_text"]);
                    model.Url          = Conversion.ResolveUrl(Conversion.TryCastString(row["url"]));
                    model.MenuCode     = Conversion.TryCastString(row["menu_code"]);
                    model.Level        = Conversion.TryCastInteger(row["level"]);
                    model.ParentMenuId = Conversion.TryCastInteger(row["parent_menu_id"]);

                    collection.Add(model);
                }
            }

            return(collection);
        }
        public static Collection <BOMenu> GetMenuCollection_Collection(int parentMenuId, short level, string pinnumber)
        {
            Collection <BOMenu> collection = new Collection <BOMenu>();


            PBSDBUtility idb = new PBSDBUtility();



            using (DataTable table = idb.GetDataBySQLString("SELECT  * FROM  menus WHERE ModuleName='COLL' order by  MenuOrder ASC"))
            {
                if (table == null)
                {
                    return(null);
                }

                foreach (DataRow row in table.Rows)
                {
                    BOMenu model = new BOMenu();

                    model.MenuId       = Conversion.TryCastInteger(row["menu_id"]);
                    model.MenuText     = Conversion.TryCastString(row["menu_text"]);
                    model.Url          = Conversion.ResolveUrl(Conversion.TryCastString(row["url"]));
                    model.MenuCode     = Conversion.TryCastString(row["menu_code"]);
                    model.Level        = Conversion.TryCastInteger(row["level"]);
                    model.ParentMenuId = Conversion.TryCastInteger(row["parent_menu_id"]);
                    model.CssClass     = Conversion.TryCastString(row["CssClass"]);

                    collection.Add(model);
                }
            }



            return(collection);
        }
        /// <summary>
        /// Menu collection by parent menuid, level, pin
        /// </summary>
        /// <param name="parentMenuId"></param>
        /// <param name="level"></param>
        /// <param name="pinnumber"></param>
        /// <returns></returns>

        public static Collection <BOMenu> GetMenuCollection(int parentMenuId, short level, string pinnumber)
        {
            Collection <BOMenu> collection = new Collection <BOMenu>();


            PBSDBUtility idb = new PBSDBUtility();



            if (parentMenuId > 0)
            {
                string mqrylevel2 = @"SELECT     dbo.AppsPermission.menu_id, dbo.menus.menu_text, dbo.menus.url, dbo.menus.menu_code, dbo.menus.[level], 
                                     dbo.menus.parent_menu_id,dbo.AppsPermission.pin_number
                                    ,CssClass FROM   dbo.AppsPermission INNER JOIN  dbo.menus ON 
                                     dbo.AppsPermission.menu_id = dbo.menus.menu_id  where
                                    menus.parent_menu_id='" + parentMenuId + "' and menus.level=" + level + " and   dbo.AppsPermission.pin_number='" + pinnumber + "' order by menus.MenuOrder ASC ";

                using (DataTable table = idb.GetDataBySQLString(mqrylevel2))
                {
                    if (table == null)
                    {
                        return(null);
                    }

                    foreach (DataRow row in table.Rows)
                    {
                        BOMenu model = new BOMenu();

                        model.MenuId       = Conversion.TryCastInteger(row["menu_id"]);
                        model.MenuText     = Conversion.TryCastString(row["menu_text"]);
                        model.Url          = Conversion.ResolveUrl(Conversion.TryCastString(row["url"]));
                        model.MenuCode     = Conversion.TryCastString(row["menu_code"]);
                        model.Level        = Conversion.TryCastInteger(row["level"]);
                        model.ParentMenuId = Conversion.TryCastInteger(row["parent_menu_id"]);
                        model.CssClass     = Conversion.TryCastString(row["CssClass"]);

                        collection.Add(model);
                    }
                }
            }

            else
            {
                string mnqry = @"SELECT        dbo.menus.menu_id, dbo.menus.menu_text, dbo.menus.MenuOrder, dbo.menus.url, dbo.menus.menu_code, dbo.menus.[level], dbo.menus.parent_menu_id, dbo.menus.audit_user_id, dbo.menus.audit_ts, 
                         dbo.menus.LastEditDate, dbo.menus.CreationDate, dbo.menus.ModuleName, dbo.menus.CssClass, dbo.menus.FormName
FROM            dbo.menus INNER JOIN
                         dbo.AppsPermission ON dbo.menus.menu_id = dbo.AppsPermission.menu_id
						 where menus.ModuleName='TEXTILE EDUCATION & HRD' order by dbo.menus.MenuOrder asc"                        ;

                using (DataTable table = idb.GetDataBySQLString(mnqry))
                {
                    if (table == null)
                    {
                        return(null);
                    }

                    foreach (DataRow row in table.Rows)
                    {
                        BOMenu model = new BOMenu();

                        model.MenuId       = Conversion.TryCastInteger(row["menu_id"]);
                        model.MenuText     = Conversion.TryCastString(row["menu_text"]);
                        model.Url          = Conversion.ResolveUrl(Conversion.TryCastString(row["url"]));
                        model.MenuCode     = Conversion.TryCastString(row["menu_code"]);
                        model.Level        = Conversion.TryCastInteger(row["level"]);
                        model.ParentMenuId = Conversion.TryCastInteger(row["parent_menu_id"]);
                        model.CssClass     = Conversion.TryCastString(row["CssClass"]);

                        collection.Add(model);
                    }
                }
            }



            return(collection);
        }