public void login(HttpContext context) { string name = context.Request["name"].ToString(); string pwd = context.Request["pwd"].ToString(); string qx = context.Request["qx"].ToString(); if (qx == "1")//管理员 { string sql = "select * from [dbo].[asm_manager] where bh='" + name + "' and pwd='" + pwd + "'"; DataTable dt = DbHelperSQL.Query(sql).Tables[0]; if (dt.Rows.Count > 0) { OperUtil.Add("AdminOperaID", "0"); OperUtil.setCooki("operaName", name); System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder(); stringBuilder.Append("{"); stringBuilder.Append("\"result\":\"1\""); //完成 stringBuilder.Append("}"); context.Response.Write(stringBuilder.ToString()); } else { System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder(); stringBuilder.Append("{"); stringBuilder.Append("\"result\":\"2\""); //完成 stringBuilder.Append("}"); context.Response.Write(stringBuilder.ToString()); } } else if (qx == "2") { string sql = "select * from asm_opera where name='" + name + "' and pwd='" + pwd + "'"; DataTable dd = DbHelperSQL.Query(sql).Tables[0]; if (dd.Rows.Count > 0) { OperUtil.setCooki("operaName", name); OperUtil.Add("AdminOperaID", dd.Rows[0]["id"].ToString()); System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder(); stringBuilder.Append("{"); stringBuilder.Append("\"result\":\"1\""); //完成 stringBuilder.Append("}"); context.Response.Write(stringBuilder.ToString()); } else { System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder(); stringBuilder.Append("{"); stringBuilder.Append("\"result\":\"2\""); //完成 stringBuilder.Append("}"); context.Response.Write(stringBuilder.ToString()); } } }