protected void ibtnLogin_Click(object sender, EventArgs e) { if (Session["AdminValidateCode"] == null) { Response.Redirect("Index.aspx"); Response.End(); } string CheckCode = Session["AdminValidateCode"].ToString(); Session.Remove("AdminValidateCode"); if (TxtVerify.Value.ToUpper() == CheckCode) { string loginName = string.Empty; string passWord = string.Empty; loginName = txtLoginName.Value.Trim(); passWord = Rc.Common.StrUtility.DESEncryptLogin.EncryptString(psd.Value); Model_VSysUserRole loginModel = new Model_VSysUserRole(); object obj = new BLL_VSysUserRole().GetVDoctorInfoModelByLogin(loginName, passWord); if (obj != null) { loginModel = obj as Model_VSysUserRole; DataTable dt = new BLL_SysModule().GetOwenModuleListByCacheBySysCode(loginModel.SysUser_ID, Rc.Common.StrUtility.clsUtility.ReDoStr(loginModel.SysRole_IDs, ',')); DataRow[] drs = dt.Select("isLast='1' and url<>'#'", "DefaultOrder desc"); if (drs.Count() > 0) { Session["LoginUser"] = loginModel; if (Request["iurl"] != null) { Response.Redirect(Request["iurl"].ToString()); } else { Response.Redirect("/" + drs[0]["url"].ToString()); } } else { Rc.Common.StrUtility.clsUtility.ErrorDispose(this.Page, 6, false); } } else { Session.Clear(); ClientScript.RegisterStartupScript(this.GetType(), "login", "<script>$(function(){layer.ready(function(){layer.msg('用户名或密码错误',{icon:2})})})</script>"); } } else { ClientScript.RegisterStartupScript(this.GetType(), "login", "<script>$(function(){layer.ready(function(){layer.msg('验证码输入不正确',{icon:2})})})</script>"); } }
protected string GetFristMenu() { //临时字符串 string strTemp = string.Empty; //css样式 string strCss = string.Empty; StringBuilder strMenu = new StringBuilder(); //从缓存中读取菜单 DataTable dt = new BLL_SysModule().GetOwenModuleListByCacheBySysCode(loginUser.SysUser_ID, Rc.Common.StrUtility.clsUtility.ReDoStr(loginUser.SysRole_IDs, ',')); if (dt != null) { //查询出一级菜单 var drs = dt.Select(" PARENTID='0' "); //最上级 string urldefault = string.Empty; for (int i = 0; i < drs.Length; i++) { if (Module_Ids.IndexOf(drs[i]["ModuleId"].ToString()) >= 0) { strCss = "active"; } else { strCss = ""; } strMenu.Append("<li class=\"" + strCss + "\">"); DataTable dtTemp = new DataTable(); dtTemp = new BLL_clsAuth().GetOwenTreeByCatchBySysCode(loginUser.SysUser_ID, Rc.Common.StrUtility.clsUtility.ReDoStr(loginUser.SysRole_IDs, ','), drs[i]["moduleid"].ToString().Substring(0, 2)); DataRow[] drTemp = dtTemp.Select("isLast='1' and url<>'#'", "DefaultOrder desc"); if (drTemp.Length > 0) { urldefault = drTemp[0]["url"].ToString(); //Response.Redirect("/" + drs[0]["url"].ToString()); } else { //PHHC.Share.StrUtility.clsUtility.ErrorDispose(this.Page, 6, false); } strMenu.Append("<a href='" + Rc.Common.StrUtility.clsUtility.getHostPath() + "/" + urldefault + "'\">" + drs[i]["modulename"] + "</a></li> "); //strMenu.Append("<div class=\"div_menu_split\" id=\"div_menu_split_00" + (i + 1) + "\"></div> "); } } return(strMenu.ToString()); }