protected void btnOK_Click(object sender, EventArgs e) { using (SqlConnection conn = new SqlConnection(Globals.ConnectionString)) { conn.Open(); string corpcode = this.txtCorpCode.Text.Trim(); string username = this.txtUserCode.Text.Trim(); string password = this.txtPassword.Text.Trim(); string valicode = this.txtValiCode.Text.Trim(); string checkcode = Request.Cookies["CheckCode"].Value; if (String.Compare(checkcode, valicode, true) != 0) { lblMessage.Text = "验证码错误,请输入正确的验证码。"; lblMessage.Visible = true; return; } object p = NotaryCorpAdminBLL.CheckLogin(conn, corpcode,username, password); if (p.Equals("-1") || p.Equals("-2") || p.Equals("-3") ) { lblMessage.Text = "认证信息输入有误,请重试。"; lblMessage.Visible = true; return; } //set session Session["corpadmin.id"] = Functions.CleanDBGuid(((DataRow)p)["id"]); string corpid = Functions.CleanDBGuid(((DataRow)p)["corp_id"]); Session["corp.id"] = corpid; Session["corpadmin.username"] = Functions.CleanDBString(((DataRow)p)["username"]); //notarycorp也应该可以无缝跳转到corp功能 Session["notarycorpadmin.id"] = Session["corpadmin.id"]; Session["notarycorp.id"] = Session["corp.id"]; Session["notarycorpadmin.username"] = Session["corpadmin.username"]; CorpDAL cd = new CorpDAL(conn); DataRow c = cd.GetACorp(corpid); if (c != null) { Session["corp.name"] = Functions.CleanDBString(c["name"]); } //redirect string url = "../index.aspx"; if (Session["lasturl"] != null) { url = Session["lasturl"].ToString(); } Response.Redirect(url); } }
private void BindData(SqlConnection conn) { string cpid = Functions.ParseStr(ViewState["cpid"]); CorpDAL corpDAL = new CorpDAL(conn); SysResDAL sysResDAL = new SysResDAL(conn); DataRow pa = corpDAL.GetAPersonApplyInfoByCPID(cpid); if (null == pa) return; ViewState["person.id"] = Functions.CleanDBGuid(pa["person_id"]); ViewState["cp_status"] = Functions.CleanDBInt(pa["cp_status"]); PersonInfo.Conn = conn; PersonInfo.PersonID = Functions.CleanDBGuid(pa["person_id"]); CorpPersonLog.CPID = cpid; CorpPersonLog.XmlGridFile = "../corp/lists.xml"; CorpPersonLog.XmlGridName = "corppersonlog"; CorpPersonLog.BindGrid(); }
public static object CheckLogin(SqlConnection conn,string corpcode, string username, string password) { CorpDAL corpDAL = new CorpDAL(conn); DataRow c = corpDAL.GetACorpByCode(corpcode); if (null == c) return "-3"; //无此corp string cid = Functions.CleanDBGuid(c["id"]); CorpAdminDAL corpAdminDAL = new CorpAdminDAL(conn); string password_md5 = CommonBLL.GetMD5Password(password); DataRow p = corpAdminDAL.GetACorpAdminByCorpIDandUsername(cid, username); if (null == p) return "-1"; if (Functions.CleanDBString(p["password"]).Equals(password_md5)) { //return Functions.CleanDBGuid(p["id"]); return p; } else { return "-2"; } }
protected void btnSearch_Click(object sender, EventArgs e) { using (SqlConnection conn = new SqlConnection(Globals.ConnectionString)) { CorpDAL corpDAL = new CorpDAL(conn); string corpcode = this.txtCorpCode.Text.Trim(); DataRow c = corpDAL.GetACorpByCode(corpcode); if (null == c) { GetAlertMsg("您查询的企业不存在,请输入正确的企业代码。"); return; } lCorpID.Text = Functions.CleanDBGuid(c["id"]); lCorpName.Text = Functions.CleanDBString(c["name"]); lAddress.Text = Functions.CleanDBString(c["address"]); lWebSite.Text = Functions.CleanDBString(c["website"]); lTel.Text = Functions.CleanDBString(c["tel"]); btnApply.Visible = true; } }