Esempio n. 1
0
 protected void Bt_Login_Click(object sender, EventArgs e)
 {
     string loginId = TB_LoginId.Text.Trim();
     string password = TB_Password.Text.Trim();
     if (CB_Storage.Checked)
         StoragePwd(loginId, password);
     SessionUser user = new SessionUser();
     user.SetSession(loginId, password, Session);
     if (SessionUser.IsLogined())
     {
         Model.Log logM = new Model.Log();
         logM.OperationItem = "操作员登录";
         logM.Operator = loginId;
         logM.OperationTime = DateTime.Now;
         logM.OperationDetail = "ip:【" + Request.UserHostAddress + "】";
         _log.Add(logM);
         if (Request.QueryString["returnurl"] == null)
             Response.Redirect("NewsManage/NewsList.aspx");
         else
             Response.Redirect(HttpUtility.UrlDecode(Request.QueryString["returnurl"].ToString()));
     }
     else
     {
         RadScriptManager.RegisterStartupScript(this.Page, this.GetType(), "c1", "OpenAlert('用户名不存在或密码错误!');", true);
     }
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     user = SessionUser.GetSession();
     LoginId = user.UserInfo.UserID;
     if (!IsPostBack)
     {
         DataSet ds = scd.GetListBySysCode(user.UserInfo.UserID, "Role");
         string role = "";
         if (ds.Tables[0].Rows.Count != 0)
         {
             role = ds.Tables[0].Rows[0]["SysCodeDetialContext"].ToString();
         }
         Ltr_OperatorInfo.Text =  "("+role+")";
     }
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            user = SessionUser.GetSession();
            if (!IsPostBack)
            {

                RadMenuItem radMenuItem1 = new RadMenuItem("功能(F)");
                radMenuItem1.AccessKey = "F";
                radMenuItem1.Items.Add(new RadMenuItem("注销(E)"));
                radMenuItem1.Items.Add(new RadMenuItem("关闭(X)"));
                radMenuItem1.PostBack = false;

                RadMenuItem radMenuItem4 = new RadMenuItem("系统代码管理(M)");
                radMenuItem4.AccessKey = "M";
                if (user.hasAuthority("Auth_Code_CRUD"))
                {
                    radMenuItem4.Items.Add(new RadMenuItem("查看系统代码(V)", "SystemManage/SysCodeList.aspx") { AccessKey = "V" });
                    radMenuItem4.Items.Add(new RadMenuItem("新建系统代码(N)", "SystemManage/AddSysCode.aspx") { AccessKey = "N" });
                    radMenuItem4.Items.Add(new RadMenuItem() { IsSeparator = true });
                }
                radMenuItem4.Items.Add(new RadMenuItem("查看操作员(V)", "SystemManage/SysUserList.aspx") { AccessKey = "V" });
                if (user.hasAuthority("Auth_SysUser_Add"))
                {
                    radMenuItem4.Items.Add(new RadMenuItem("新建操作员(N)", "SystemManage/AddSysUser.aspx") { AccessKey = "N" });
                }
                radMenuItem4.PostBack = false;

                RadMenuItem radMenuItem3 = new RadMenuItem("条目管理(P)");
                radMenuItem3.AccessKey = "P";
                bool newsTag = false;

                if (user.hasAuthority("Auth_News_Retrieve"))
                {
                    newsTag = true;
                    radMenuItem3.Items.Add(new RadMenuItem("检索条目(B)", "NewsManage/NewsList.aspx") { AccessKey = "B" });
                }
                if (user.hasAuthority("Auth_News_Add"))
                {
                    newsTag = true;
                    radMenuItem3.Items.Add(new RadMenuItem("添加条目(J)", "NewsManage/NewsEdit.aspx") { AccessKey = "J" });
                }

                if (user.hasAuthority("Auth_News_Examine"))
                {
                    newsTag = true;
                    radMenuItem3.Items.Add(new RadMenuItem("条目审核(E)", "NewsManage/NewsCheck.aspx") { AccessKey = "E" });

                }
                RadMenuItem radMenuItem8 = new RadMenuItem("公告管理(P)");
                radMenuItem8.AccessKey = "N";
                radMenuItem8.Items.Add(new RadMenuItem("公告添加(K)", "NoticeManage/NoticeEdit.aspx") { AccessKey = "K" });
                radMenuItem8.Items.Add(new RadMenuItem("公告列表(H)", "NoticeManage/NoticeList.aspx") { AccessKey = "H" });

                RadMenuItem radMenuItem9 = new RadMenuItem("积分管理(I)");
                radMenuItem9.AccessKey = "I";
                radMenuItem9.Items.Add(new RadMenuItem("积分历史(K)", "IntegralManage/IntegralList.aspx") { AccessKey = "K" });
                radMenuItem9.Items.Add(new RadMenuItem("积分配置(C)", "IntegralManage/IntegralConfiguration.aspx") { AccessKey = "C" });
                radMenuItem9.Items.Add(new RadMenuItem("礼品查询(L)", "IntegralManage/GiftList.aspx") { AccessKey = "L" });
                radMenuItem9.Items.Add(new RadMenuItem("礼品定义(D)", "IntegralManage/GiftEdit.aspx") { AccessKey = "D" });
                radMenuItem9.Items.Add(new RadMenuItem("积分兑换记录(H)", "IntegralManage/IntegralExchangeRecords.aspx") { AccessKey = "H" });

                RadMenuItem radMenuItem10 = new RadMenuItem("问卷管理(Q)");
                radMenuItem10.AccessKey = "Q";
                radMenuItem10.Items.Add(new RadMenuItem("检索问卷(C)", "QuestionnaireManage/QuestionnaireList.aspx") { AccessKey = "C" });
                radMenuItem10.Items.Add(new RadMenuItem("添加问卷(A)", "QuestionnaireManage/QuestionnaireEdit.aspx") { AccessKey = "A" });

                RadMenuItem radMenuItem6 = new RadMenuItem("分类管理(C)");
                radMenuItem6.AccessKey = "C";
                radMenuItem6.Items.Add(new RadMenuItem("分类查询(S)", "CategoryManage/CategoryView.aspx") { AccessKey = "S" });

                RadMenuItem radMenuItem7 = new RadMenuItem("终端用户管理(C)");
                radMenuItem7.AccessKey = "U";

                bool userTag = false;

                if (user.hasAuthority("Auth_EndUser_Retrieve"))
                {
                    userTag = true;
                    radMenuItem7.Items.Add(new RadMenuItem("查询终端用户(R)", "EndUserManage/EndUserList.aspx") { AccessKey = "R" });
                }
                if (user.hasAuthority("Auth_News_Add"))
                {
                    userTag = true;
                    radMenuItem7.Items.Add(new RadMenuItem("添加终端用户(A)", "EndUserManage/AddEndUser.aspx") { AccessKey = "A" });

                }

                RadMenuItem radMenuItem11 = new RadMenuItem("用户行为分析(C)");
                radMenuItem11.AccessKey = "C";
                radMenuItem11.Items.Add(new RadMenuItem("用户行为统计(A)", "UserBehaviorManage/UserBehaviorStatistics.aspx") { AccessKey = "A" });

                RadMenuItem radMenuItem5 = new RadMenuItem("日志管理(L)");
                radMenuItem5.AccessKey = "L";
                radMenuItem5.Items.Add(new RadMenuItem("日志查询(R)", "LogManage/LogList.aspx") { AccessKey = "R" });

                RadMenuItem skinMenu = new RadMenuItem("皮肤(T)");
                skinMenu.AccessKey = "T";
                skinMenu.Items.Add(new RadMenuItem("Windows7") { AccessKey = "W" });
                skinMenu.Items.Add(new RadMenuItem("Black") { AccessKey = "B" });
                skinMenu.Items.Add(new RadMenuItem("Metro") { AccessKey = "M" });
                skinMenu.PostBack = false;

                AddRadMenuItem(radMenuItem1);

                if (newsTag)
                {
                    AddRadMenuItem(radMenuItem3);
                }
                AddRadMenuItem(radMenuItem8);
                if (userTag)
                {
                    AddRadMenuItem(radMenuItem7);
                }
                AddRadMenuItem(radMenuItem10);
                AddRadMenuItem(radMenuItem9);
                AddRadMenuItem(radMenuItem11);
                AddRadMenuItem(radMenuItem6);
                AddRadMenuItem(radMenuItem4);
                if (user.hasAuthority("Auth_Log"))
                {
                    AddRadMenuItem(radMenuItem5);
                }

                AddRadMenuItem(skinMenu);
            }
        }
Esempio n. 4
0
        private void ValidatePwd()
        {
            HttpCookie cookie = Request.Cookies["Login"];
            if (cookie == null)
                return;
            string loginId = cookie.Values["loginId"];
            string password;
            try
            {
                string psw = cookie.Values["pwd"].Replace(' ', '+');
                password = Encoding.UTF8.GetString(Convert.FromBase64String(psw));
            }
            catch
            {
                return;
            }

            SessionUser user = new SessionUser();
            user.SetSession(loginId, password, Session);
            if (SessionUser.IsLogined())
            {
                string skinValue = "Windows7";
                Session["SkinId"] = skinValue;
                Model.Log logM = new Model.Log();
                logM.OperationItem = "操作员登录";
                logM.Operator = loginId;
                logM.OperationTime = DateTime.Now;
                logM .OperationDetail = "ip:【" + Request.UserHostAddress + "】";
                _log.Add(logM);
                if (Request.QueryString["returnurl"] == null)
                    Response.Redirect("NewsManage/NewsList.aspx");
                else
                    Response.Redirect(HttpUtility.UrlDecode(Request.QueryString["returnurl"].ToString()));
            }
            TB_LoginId.Text = loginId;
        }