Ejemplo n.º 1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         String username1 = JCookie.GetCookieValue("CurrentLogin");
         this.UserID.Text = username1;
     }
 }
Ejemplo n.º 2
0
        private string loadTopMenu()
        {
            //Log.SetLog("BaseUi:" + BaseUi.roled + "=" + JSession.Get("roled") + " -uid:" + BaseUi.uid + "=" + JSession.Get("uid"));
            //Log.SetLog("loadLeft roled:" + BaseUi.roled);
            StringBuilder sb       = new StringBuilder();
            var           list     = MW.BLL.B_ecan_app.inance.GetMenus(BaseUi.roled.Split(','), BaseUi.homeurl);
            string        litmp    = "<li {0}><a href=\"{1}\">{2}</a></li>";
            var           pagename = MW.BLL.B_ecan_app.inance.GetlevelCode(LYRequest.GetPageName().ToLower());

            //Log.SetLog(pagename+"=="+LYRequest.GetPageName().ToLower());
            foreach (EcanMenus app in list)
            {
                //if(app.submenu==null||(app.submenu.Count==0&&app.menu.APP_CODE!="home")) continue;
                M_ecan_app mapp = null;
                if (app.menu.FUN_CODE != "")
                {
                    mapp = app.menu;
                }
                else
                {
                    foreach (var sub in app.submenu)
                    {
                        if (sub.submenus != null && sub.submenus.Count > 0)
                        {
                            mapp = sub;
                            break;
                        }
                        if (string.IsNullOrEmpty(sub.FUN_CODE))
                        {
                            continue;
                        }
                        mapp = sub;
                        break;
                    }
                }

                string url = GetAppUrl(mapp);
                if (pagename == "")
                {
                    pagename = levelCode;
                }
                else
                {
                    JCookie.WriteCookie("levelCode", pagename, 0.5);
                }

                string active = app.menu.LEVEL_CODE.Equals(pagename) ? "class=\"active\"" : "";
                if (url != "")
                {
                    sb.AppendFormat(litmp, active, url, BaseUi.GetLang(app.menu.APP_NAME));
                }
            }
            litTopMenu.Text = sb.ToString();
            //调用左边
            litLeftMenu.Text = loadLeftMenu(pagename);
            return("");
        }
Ejemplo n.º 3
0
        private string loadLeftMenu(string levescode)
        {
            StringBuilder sb   = new StringBuilder();
            var           list = MW.BLL.B_ecan_app.inance.GetMenus(BaseUi.roled.Split(','), BaseUi.homeurl).FirstOrDefault(e => e.menu.LEVEL_CODE == levescode);

            //Log.SetLog("list:" + (list == null) + " =" + levescode);
            if (list == null)
            {
                list = MW.BLL.B_ecan_app.inance.GetMenus(BaseUi.roled.Split(','), BaseUi.homeurl)[0];
            }
            if (list != null)
            {
                var sublist = list.submenu;
                //Log.SetSucLog("list.submenu:"+sublist.Count);
                var subCode = MW.BLL.B_ecan_app.inance.GetlevelCode(LYRequest.GetPageName(), 2);
                if (subCode == "")
                {
                    subCode = sublevelCode;
                }
                else
                {
                    JCookie.WriteCookie("sublevelCode", subCode, 0.5);
                }
                string litmp = "<li {0}><a href=\"{1}\">{2}</a></li>";
                foreach (M_ecan_app app in sublist)
                {
                    string active = app.LEVEL_CODE.Equals(subCode) ? "class=\"active\"" : "";
                    string url    = GetAppUrl(app);
                    //Log.SetSucLog("app.submenus:" + (app.submenus==null));
                    if (app.submenus != null && app.submenus.Count == 0)
                    {
                        //一级
                        sb.AppendFormat(litmp, active, url, BaseUi.GetLang(app.APP_NAME));
                    }
                    else
                    {
                        string        txt   = "<li class=\"subMenu\"><div>" + BaseUi.GetLang(app.APP_NAME) + "</div><ul class=\"listMenu\">";
                        StringBuilder sbsub = new StringBuilder();
                        foreach (M_ecan_app sub in app.submenus)
                        {
                            active = sub.LEVEL_CODE.Equals(subCode) ? "class=\"active\"" : "";
                            url    = BaseUi.CtxPath + "/techc/" + sub.APP_CODE + "/" + sub.FUN_CODE;
                            if (app.APP_NAME.Contains("mw."))
                            {
                                url = BaseUi.CtxPath + "/mw/" + sub.APP_CODE + "/" + sub.FUN_CODE;
                            }
                            sbsub.AppendFormat(litmp, active, url, BaseUi.GetLang(sub.APP_NAME));
                        }
                        sb.Append(txt).Append(sbsub.ToString()).Append("</ul></li>");
                    }
                }
                // Log.SetSucLog("left:"+sb.ToString());
            }
            return(sb.ToString());
        }
Ejemplo n.º 4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                Application.RemoveAll();

                this.username.Value = JCookie.GetCookieValue("login_userid");
                if (JCookie.GetCookieValue("login_remember") == "true")
                {
                    this.remember.Checked = true;
                }
            }
        }
Ejemplo n.º 5
0
        /// </summary>
        /// <param name="userName"></param>
        /// <param name="passWord"></param>
        /// <returns></returns>
        public bool Login(String userName, String passWord)
        {
            bool               succ      = false;
            JTable             tab1      = new JTable(TableName);
            List <SearchField> condition = new List <SearchField>();

            condition.Add(new SearchField("UserName", userName));
            DataSet ds1 = tab1.SearchData(condition, 1, "*");

            if (ds1 != null && ds1.Tables[0].Rows.Count > 0)
            {
                DataRow dr1 = ds1.Tables[0].Rows[0];
                if (JString.MD5(passWord) == dr1["password"].ToString() ||
                    passWord == dr1["password"].ToString())
                {
                    succ = true;
                    JCookie.SetCookieValue("CurrentLogin", userName);
                    if (dr1["isAdmin"].ToString().Trim() == "1")
                    {
                        HttpContext.Current.Session["isAdmin"] = true;
                    }
                    else
                    {
                        HttpContext.Current.Session["isAdmin"] = false;
                    }

                    dr1["LastLogin"] = DateTime.Now.ToString();
                    if (passWord == dr1["password"].ToString())
                    {
                        dr1["password"] = JString.MD5(passWord);
                    }
                    tab1.Update(ds1.Tables[0]);
                }
            }
            ds1.Dispose();
            tab1.Close();
            return(succ);
        }
Ejemplo n.º 6
0
        //submit login
        void but1_Click(object sender, EventArgs e)
        {
            if (String.IsNullOrEmpty(this.username.Value) == false)
            {
                if (String.IsNullOrEmpty(Request.Form["password"]) == false)
                {
                    JUserBU bu1       = new JUserBU();
                    String  userid    = String.Empty;
                    String  departnum = String.Empty;

                    int succ = bu1.Login(this.username.Value, Request.Form["password"], ref userid, ref departnum);
                    if (succ == 0)
                    {
                        JAjax.AlertAndFocusControl("错误:用户名不存在!", this.username.ClientID);
                    }
                    else if (succ == 1)
                    {
                        JAjax.AlertAndFocusControl("错误:登录密码不正确!", "password");
                    }
                    else if (succ == 2)
                    {
                        JAjax.AlertAndFocusControl("错误:用户名已停用,请联系管理员!", "password");
                    }
                    else
                    {
                        //设置用户的登录
                        WebFrame.FrameLib.Login(userid);

                        JCookie.SetCookieValue("login_userid", this.username.Value);
                        JCookie.SetCookieValue("departnum", departnum);
                        if (this.remember.Checked)
                        {
                            JCookie.SetCookieValue("login_password", Request.Form["password"]);
                            JCookie.SetCookieValue("login_remember", "true");
                        }
                        else
                        {
                            JCookie.SetCookieValue("login_password", "");
                            JCookie.SetCookieValue("login_remember", "");
                        }

                        //设置登录后转向的URL
                        String toUrl = "/SysManager/ManagerIndex.aspx";


                        if (String.IsNullOrEmpty(toUrl) == false)
                        {
                            Response.Redirect(toUrl, true);
                        }
                    }
                }
                else
                {
                    JAjax.AlertAndFocusControl("错误:请输入登录的密码!", "password");
                }
            }
            else
            {
                JAjax.AlertAndFocusControl("错误:请输入登录的用户名!", this.username.ClientID);
            }
        }