コード例 #1
0
        protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);

            lstGroupRoles.Items.Clear();
            CmdDB.FillToListBox(lstGroupRoles.Items);

            DataTable dtGroupRoles = CmdRoleDB.GetGroupRoles(groupInfo.Group_ID);
            string    roles        = "|";

            foreach (DataRow row in dtGroupRoles.Rows)
            {
                roles += row["Cmd_ID"] + "|";
            }

            int i = 0;

            while (i < lstGroupRoles.Items.Count)
            {
                if (roles.IndexOf("|" + lstGroupRoles.Items[i].Value + "|") < 0)
                {
                    lstGroupRoles.Items.RemoveAt(i);
                }
                else
                {
                    i += 1;
                }
            }
        }
コード例 #2
0
ファイル: Default.aspx.cs プロジェクト: coltechvn/SolArt
        private void LoadControls()
        {
            string cmd = ConvertUtility.ToString(Request.QueryString["cmd"]);

            if (cmd == string.Empty)
            {
                placeControls.Controls.Add(LoadControl(AppEnv.ADMIN_PATH + "/UserControls/Core/WelCome.ascx"));
                return;
            }

            if ((cmd == "management") && (CurrentAdminInfo.User_Email == AppEnv.ADMIN_EMAIL))
            {
                placeControls.Controls.Add(LoadControl(AppEnv.ADMIN_PATH + "/UserControls/Core/CmdManager.ascx"));
                return;
            }
            if (cmd == "accessdeny")
            {
                placeControls.Controls.Add(LoadControl(AppEnv.ADMIN_PATH + "/UserControls/Core/AccessDeny.ascx"));
                return;
            }

            CmdInfo info = CmdDB.GetInfo(CmdDB.GetIDByCmd(cmd));

            if (info == null || !info.Cmd_Enable)
            {
                Response.Redirect(AppEnv.ADMIN_ACCESSDENY);
            }

            lblCommandName.Text = info.Cmd_Name;
            if ((!CurrentAdminInfo.User_SuperAdmin) && (!CmdRoleDB.CheckRole(CurrentAdminInfo.User_ID, info.Cmd_ID)))
            {
                Response.Redirect(AppEnv.ADMIN_ACCESSDENY);
            }

            string modulePath = AppEnv.ADMIN_PATH + info.Cmd_Path;

            //modulePath.Replace("//", "/");

            if (File.Exists(Server.MapPath(modulePath)))
            {
                placeControls.Controls.Add(LoadControl(modulePath));
                return;
            }

            modulePath = AppEnv.MODULE_PATH + info.Cmd_Path;

            ////modulePath.Replace("//", "/");

            //Response.Write(modulePath);
            //Response.End();

            if (File.Exists(Server.MapPath(modulePath)))
            {
                placeControls.Controls.Add(LoadControl(modulePath));
                return;
            }
            lblErrorMessage.Text = " Không tìm thấy module, kiểm tra lại đường dẫn !";
        }
コード例 #3
0
ファイル: Header.ascx.cs プロジェクト: coltechvn/SolArt
        private void GetRoles()
        {
            arrCmdRoles = "|";
            DataTable dtUserRoles = CmdRoleDB.GetAllRolesForUser(CurrentAdminInfo.User_ID);

            foreach (DataRow row in dtUserRoles.Rows)
            {
                arrCmdRoles += row["Cmd_ID"] + "|";
            }
        }
コード例 #4
0
 protected void cmdRemover_Click(object sender, EventArgs e)
 {
     try
     {
         foreach (ListItem item in lstGroupRoles.Items)
         {
             if (item.Selected)
             {
                 CmdRoleDB.GroupRemoverRole(groupInfo.Group_ID, Convert.ToInt32(item.Value));
             }
         }
         lblUpdateStatus.Text = MiscUtility.UPDATE_SUCCESS;
     }
     catch
     {
         lblUpdateStatus.Text = MiscUtility.UPDATE_ERROR;
     }
 }