Exemplo n.º 1
0
        public static MenuCollection GetMenuCollection(MenuMaster menuMaster)
        {
            Database       database = new Database("PSCPortalConnectionString");
            MenuCollection result   = new MenuCollection(new Menu());

            using (DbConnection connection = database.GetConnection())
            {
                DbCommand command = GetSelectAllByMenuMasterIdCommand(database);
                #region MenuMasterId
                DbParameter MenuMasterId = database.GetParameter(System.Data.DbType.Guid, "@MenuMasterId", menuMaster.Id);
                command.Parameters.Add(MenuMasterId);
                #endregion
                command.Connection = connection;
                connection.Open();
                DbDataReader reader = command.ExecuteReader();
                while (reader.Read())
                {
                    Guid idParent = Guid.Empty;
                    if (reader["MenuParent"].ToString() != string.Empty)
                    {
                        idParent = (Guid)reader["MenuParent"];
                    }
                    if (idParent == System.Guid.Empty)
                    {
                        result = new MenuCollection(new Menu(reader));
                        continue;
                    }
                    Menu parent = (Menu)result.Search(d => ((Menu)d).Id == idParent);
                    Menu dir    = new Menu(reader);
                    result.Add(parent, dir);
                }
            }
            return(result);
        }
Exemplo n.º 2
0
        public static MenuMasterAuthentication GetMenuMasterAuthentication(MenuMaster MenuMaster)
        {
            MenuMasterAuthentication result = new MenuMasterAuthentication();

            result._MenuMaster = MenuMaster;
            MenuMasterPermissionCollection MenuMasterPermissionList = MenuMasterPermissionCollection.GetMenuMasterPermissionCollection();

            foreach (MenuMasterPermission item in MenuMasterPermissionList)
            {
                result._listAuthentication.Add(item, new List <Role>());
            }
            RoleCollection roleList = RoleCollection.GetRoleCollection();
            Database       database = new Database("PSCPortalConnectionString");

            using (DbConnection connection = database.GetConnection())
            {
                DbCommand command = database.GetCommand(connection);

                #region MenuMasterId
                DbParameter prMenuMasterId = database.GetParameter(System.Data.DbType.Guid, "@MenuMasterId", MenuMaster.Id);
                command.Parameters.Add(prMenuMasterId);
                #endregion

                command.CommandText = "MenuMasterAuthentication_GetAllByMenuMasterId";
                command.CommandType = System.Data.CommandType.StoredProcedure;

                connection.Open();
                DbDataReader         reader = command.ExecuteReader();
                int                  idtptemp;
                Guid                 idrtemp;
                MenuMasterPermission tptemp;
                Role                 rtemp;
                while (reader.Read())
                {
                    idtptemp = (int)reader["MenuMasterPermissionId"];
                    idrtemp  = (Guid)reader["RoleId"];
                    tptemp   = MenuMasterPermissionList.Where(tp => tp.Id == idtptemp).Single();
                    rtemp    = roleList.Where(r => r.Id == idrtemp).Single();
                    result._listAuthentication[tptemp].Add(rtemp);
                }
            }
            return(result);
        }
Exemplo n.º 3
0
        public void TopicMakeMenu(Topic topic, MenuMaster menuMaster)
        {
            Database database = new Database("PSCPortalConnectionString");

            using (DbConnection connection = database.GetConnection())
            {
                DbCommand command = database.GetCommand(connection);
                command.CommandType = System.Data.CommandType.StoredProcedure;

                #region SourceTopicId
                DbParameter prSourceTopicId = database.GetParameter(System.Data.DbType.Guid, "@SourceTopicId", topic.Id);
                command.Parameters.Add(prSourceTopicId);
                #endregion

                #region DestMenuMasterId
                DbParameter prDestMenuMasterId = database.GetParameter(System.Data.DbType.Guid, "@DestMenuMasterId", menuMaster.Id);
                command.Parameters.Add(prDestMenuMasterId);
                #endregion

                #region DestMenuMasterName
                DbParameter prDestMenuMasterName = database.GetParameter(System.Data.DbType.String, "@DestMenuMasterName", menuMaster.Name);
                command.Parameters.Add(prDestMenuMasterName);
                #endregion

                #region DestMenuMasterDescription
                DbParameter prDestMenuMasterDescription = database.GetParameter(System.Data.DbType.String, "@DestMenuMasterDescription", menuMaster.Description);
                command.Parameters.Add(prDestMenuMasterDescription);
                #endregion



                command.CommandText = "Topic_MakeMenu";
                command.CommandType = System.Data.CommandType.StoredProcedure;

                connection.Open();
                command.ExecuteNonQuery();
            }
        }
Exemplo n.º 4
0
 public MenuMasterArgs(MenuMaster menuMaster, Guid pageId)
 {
     _menuMaster = menuMaster;
     _pageId     = pageId;
 }
Exemplo n.º 5
0
 public MenuMasterArgs(MenuMaster menuMaster, bool isEdit)
 {
     _menuMaster = menuMaster;
     _isEdit     = isEdit;
 }