private void CheckUser(string username, string password) { bllAdmins bll = new bllAdmins(); string userpwd = OEncryp.Encrypt(password); AdminsEntity adminEntity = bll.GetEntitySigInfo(" WHERE uname='" + username + "' AND upwd='" + userpwd + "'"); if (adminEntity.userid > 0) { LoginedUserEntity loginedUser = new LoginedUserEntity(adminEntity.userid.ToString(), adminEntity.upwd, adminEntity.uname, adminEntity.umobile); DataTable dtPermission = bll.GetPermissionInfo(loginedUser.GUID, loginedUser.UserID, loginedUser.UserID); if (dtPermission != null && dtPermission.Rows.Count > 0) { loginedUser.Permission = dtPermission; loginedUser.SetLoginCookie(); //string appJson = JsonHelper.ObjectToJSON(loginedUser); Context.Cache.Insert("logincache_" + loginedUser.UserID, loginedUser); loginedUser.SetLoginCookie(); Response.Redirect("index.html"); } else { Message.InnerHtml = "您的帐号无效,请联系管理员!"; } } else { Message.InnerHtml = "用户或密码错误!"; } }
//保存数据 protected void Save_btn_Click(object sender, EventArgs e) { string role = hidroleid.Value.TrimEnd(','); if (role.Length == 0) { Script(Page, "pcLayerMsg('选择角色!');"); return; } //获取页面信息 string username = txt_uname.Text; string pwd = txt_pwd.Text; string umobile = ""; string status = ddl_status.SelectedValue; string descr = txt_descr.Text; DataTable dt = new DataTable(); if (hidId.Value.Length == 0)//添加信息 { bll.Add("0", "0", id, username, pwd, "", umobile, descr, status, base.LoginedUser.Name, LoginedUser.UserID.ToString(), role); hidId.Value = id; this.PageTitle.Operate = "修改"; } else//修改信息 { string uid = hidId.Value.ToString(); AdminsEntity UEntity = bll.GetEntitySigInfo("where userid=" + uid); UEntity.uname = username; UEntity.upwd = pwd; UEntity.umobile = umobile; UEntity.remark = descr; bll.Update("0", "0", UEntity, role); Context.Cache.Remove("RoleInfo_BackWeb_" + hidId.Value); } //显示结果 if (ShowResult(bll.oResult.Code, bll.oResult.Msg, errormessage)) { SetPage(hidId.Value); } }