예제 #1
0
파일: Menu.cs 프로젝트: n4gava/mixerp
        public static Collection<MixERP.Net.Common.Models.Core.Menu> GetMenuCollection(int parentMenuId, short level)
        {
            Collection<MixERP.Net.Common.Models.Core.Menu> collection = new Collection<Common.Models.Core.Menu>();

            int userId = MixERP.Net.BusinessLayer.Helpers.SessionHelper.GetUserId();
            int officeId = MixERP.Net.BusinessLayer.Helpers.SessionHelper.GetOfficeId();
            string culture = MixERP.Net.BusinessLayer.Helpers.SessionHelper.GetCulture().TwoLetterISOLanguageName;

            using (DataTable table = MixERP.Net.DatabaseLayer.Core.Menu.GetMenuTable(parentMenuId, level, userId, officeId, culture))
            {
                if (table == null)
                {
                    return null;
                }

                foreach (DataRow row in table.Rows)
                {
                    MixERP.Net.Common.Models.Core.Menu model = new Common.Models.Core.Menu();

                    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;
        }
예제 #2
0
        public static Collection <Common.Models.Core.Menu> GetRootMenuCollection(string path)
        {
            Collection <Common.Models.Core.Menu> collection = new Collection <Common.Models.Core.Menu>();

            int    userId   = SessionHelper.GetUserId();
            int    officeId = SessionHelper.GetOfficeId();
            string culture  = SessionHelper.GetCulture().TwoLetterISOLanguageName;

            using (DataTable table = GetRootMenuTable(path, userId, officeId, culture))
            {
                if (table == null)
                {
                    return(null);
                }

                foreach (DataRow row in table.Rows)
                {
                    Common.Models.Core.Menu model = new Common.Models.Core.Menu();

                    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);
        }
예제 #3
0
파일: Menu.cs 프로젝트: ravikumr070/mixerp
        public static Collection<MixERP.Net.Common.Models.Core.Menu> GetRootMenuCollection(string path)
        {
            Collection<MixERP.Net.Common.Models.Core.Menu> collection = new Collection<Common.Models.Core.Menu>();

            foreach(DataRow row in MixERP.Net.DatabaseLayer.Core.Menu.GetRootMenuTable(path).Rows)
            {
                MixERP.Net.Common.Models.Core.Menu model = new Common.Models.Core.Menu();

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

                collection.Add(model);
            }

            return collection;
        }
예제 #4
0
        public static Collection <MixERP.Net.Common.Models.Core.Menu> GetMenuCollection(int parentMenuId, short level)
        {
            Collection <MixERP.Net.Common.Models.Core.Menu> collection = new Collection <Common.Models.Core.Menu>();

            foreach (DataRow row in MixERP.Net.DatabaseLayer.Core.Menu.GetMenuTable(parentMenuId, level).Rows)
            {
                MixERP.Net.Common.Models.Core.Menu model = new Common.Models.Core.Menu();

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

                collection.Add(model);
            }

            return(collection);
        }