public bool DeleteUser(int id) { Model.t_user model = userbll.GetModel(id); Model.user_role urmodel = user_rolebll.GetModels(model.id); Model.t_role rolemodel = rolebll.GetModel(urmodel.roleid); Model.role_permission rolepemodel = role_permissionbll.GetModels(rolemodel.id); Model.t_permission permmodel = t_permissionbll.GetModel(rolepemodel.permissionid); if (urmodel != null) { user_rolebll.Delete(urmodel.id); } if (rolepemodel != null) { role_permissionbll.Delete(rolepemodel.id); } if (model != null) { userbll.Delete(model.id); } //if (rolemodel != null) //{ // rolebll.Delete(rolemodel.id); //} if (permmodel != null) { t_permissionbll.Delete(permmodel.id); } return(true); }
/// <summary> /// 得到一个对象实体 /// </summary> public Model.t_user GetModel(int id) { StringBuilder strSql = new StringBuilder(); strSql.Append(@"select top 1 a.*,c.name,e.pename from [dbo].[t_user] a left join [dbo].[user_role] b on a.id=b.userid "); strSql.Append(@"left join [dbo].[t_role] c on c.id=b.roleid left join [dbo].[role_permission] d on d.roleid=c.id left join [dbo].[t_permission] e on e.id=d.permissionid"); strSql.Append(" where a.id=@id"); SqlParameter[] parameters = { new SqlParameter("@id", SqlDbType.Int, 4) }; parameters[0].Value = id; Model.t_user model = new Model.t_user(); DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { return(DataRowToModel(ds.Tables[0].Rows[0])); } else { return(null); } }
//protected override void Initialize(System.Web.Routing.RequestContext requestContext) //{ // base.Initialize(requestContext); // #region 验证登录================================== // if (IsUserLogin()) // { // Model.t_user model = GetUserInfo(); // ViewBag.UserName = model.username; // ViewData["usermodel"] = model; // ViewBag.islogin = 1; // ViewBag.Navigation = Get_navigation(); // //获得最后登录日志 // DataTable dt = new Bll.user_login_log().GetList(2, "user_name='" + model.user_name + "'", "id desc").Tables[0]; // if (dt.Rows.Count == 2) // { // ViewBag.curr_login_ip = dt.Rows[0]["login_ip"].ToString(); // ViewBag.pre_login_ip = dt.Rows[1]["login_ip"].ToString(); // ViewBag.pre_login_time = dt.Rows[1]["login_time"].ToString(); // } // else if (dt.Rows.Count == 1) // { // ViewBag.curr_login_ip = dt.Rows[0]["login_ip"].ToString(); // } // } // else // { // ViewBag.islogin = 0; // ViewBag.Navigation = Get_navigation(); // //ContentResult content = new ContentResult(); // //content.Content = string.Format("<script type='text/javascript'>alert('登陆后才可以查看该页面');window.parent.location.href='{0}';</script>", "/account/register?url=" + Request.Url);//? // //System.Web.HttpContext.Current.Response.Write(content.Content); // } // #endregion //} #region 用户方法========================================== /// <summary> /// 判断用户是否已经登录(解决Session超时问题) /// </summary> public bool IsUserLogin() { //如果Session为Null if (System.Web.HttpContext.Current.Session[NKeys.SESSION_USER_INFO] != null) { return(true); } else { //检查Cookies string username = Utils.GetCookie(NKeys.COOKIE_USER_NAME_REMEMBER, "qinuo"); string password = Utils.GetCookie(NKeys.COOKIE_USER_PWD_REMEMBER, "qinuo"); if (username != "" && password != "") { Bll.t_user bll = new Bll.t_user(); Model.t_user model = new Model.t_user(); model = bll.GetModelpwd(username, password, false); if (model != null) { System.Web.HttpContext.Current.Session[NKeys.SESSION_USER_INFO] = model; return(true); } } } return(false); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(Model.t_user model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into t_user("); strSql.Append("username,pwd,employeename,adddate,Email)"); strSql.Append(" values ("); strSql.Append("@username,@pwd,@employeename,@adddate,@Email)"); strSql.Append(";select @@IDENTITY"); SqlParameter[] parameters = { new SqlParameter("@username", SqlDbType.VarChar, 50), new SqlParameter("@pwd", SqlDbType.VarChar, 50), new SqlParameter("@employeename", SqlDbType.VarChar, 50), new SqlParameter("@adddate", SqlDbType.VarChar, 50), new SqlParameter("@Email", SqlDbType.NVarChar, 50) }; parameters[0].Value = model.username; parameters[1].Value = model.pwd; parameters[2].Value = model.employeename; parameters[3].Value = model.adddate; parameters[4].Value = model.Email; object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters); if (obj == null) { return(0); } else { return(Convert.ToInt32(obj)); } }
public void BindData() { #region //if (!Context.User.Identity.IsAuthenticated) //{ // return; //} //AccountsPrincipal user = new AccountsPrincipal(Context.User.Identity.Name); //if (user.HasPermissionID(PermId_Modify)) //{ // gridView.Columns[6].Visible = true; //} //if (user.HasPermissionID(PermId_Delete)) //{ // gridView.Columns[7].Visible = true; //} #endregion Model.t_user user = (Model.t_user)Session["UserInfo"]; if (user == null) { Response.Redirect("UserLogin.aspx"); } DataSet ds = new DataSet(); StringBuilder strWhere = new StringBuilder(); strWhere.Append("add_ID!=0 "); strWhere.AppendFormat(" and add_u_ID={0}", user.u_ID); if (txtKeyword.Text.Trim() != "") { strWhere.AppendFormat(" and add_contactName like '%{0}%' ", txtKeyword.Text.Trim()); } ds = bll.GetList(strWhere.ToString()); gridView.DataSource = ds; gridView.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { Model.t_user user = (Model.t_user)Session["UserInfo"]; if (user == null) { Response.Redirect("UserLogin.aspx"); } userid.Text = user.u_ID.ToString(); if (Request["cid"] != null) { string id = Request["cid"]; traid.Text = id; DataSet ds = new BLL.t_orderevaluate().GetList(" oe_per_id= " + user.u_ID + " and oe_per_type='我' and oe_tra_id=" + id); if (ds.Tables.Count == 1 && ds.Tables[0].Rows.Count == 0) { MultiView1.ActiveViewIndex = 0; } else { MultiView1.ActiveViewIndex = 2; } } else { Response.Redirect("UserLogin.aspx"); } } }
protected void Page_Load(object sender, EventArgs e) { Model.t_user user = (Model.t_user)Session["UserInfo"]; if (user == null) { Response.Redirect("UserLogin.aspx"); } integral.InnerText = user.u_integral.ToString(); }
public ActionResult AddUser() { Bll.t_role bllrole = new Bll.t_role(); Model.t_user model = GetUserInfo(); ViewData["zhiwu"] = bllrole.GetModelList("1=1"); if (model != null) { ViewBag.employeename = model.employeename; } return(View()); }
private void EditPhotoData(string i) { Model.t_user user = (Model.t_user)Session["UserInfo"]; int num = Convert.ToInt32(i); user.u_pic_ID = num; new BLL.t_user().Update(user); Session["UserInfo"] = user; Response.Redirect("Default.aspx?id=1"); }
private string AddUserCon(string username, string name, string pwd, string zhiwu, string jurisdiction) { Model.t_user model = new Model.t_user(); Model.t_role model1 = new Model.t_role(); Model.user_role model2 = new Model.user_role(); Model.t_permission model3 = new Model.t_permission(); Model.role_permission model4 = new Model.role_permission(); if (username == null && name == null && pwd == null && zhiwu == null && jurisdiction == null) { return("{\"status\": 0,\"msg\":\"添加失败!\"}"); } if (username != null && name != null && pwd != null) { model.username = username; model.employeename = name; model.pwd = DESEncrypt.Encrypt(pwd); model.adddate = (DateTime.Now).ToString(); userbll.Add(model); } if (jurisdiction != null) { model3.pename = jurisdiction; model3.adddate = (DateTime.Now).ToString(); t_permissionbll.Add(model3); } Model.t_user tmodel = new Model.t_user(); tmodel = userbll.GetModels(); Model.t_role tmodel1 = new Model.t_role(); tmodel1 = rolebll.GetModelss(zhiwu); Model.t_permission tmodel3 = new Model.t_permission(); tmodel3 = t_permissionbll.GetModels(); if (tmodel != null) { //用户ID model2.userid = tmodel.id; //角色id model2.roleid = tmodel1.id; user_rolebll.Add(model2); } if (tmodel3 != null) { model4.permissionid = tmodel3.id; model4.roleid = tmodel1.id; role_permissionbll.Add(model4); } return("{\"status\": 1,\"msg\":\"添加成功!\"}"); }
public ActionResult UserList() { Model.t_user model = GetUserInfo(); if (model != null) { ViewBag.name = model.name; ViewBag.employeename = model.employeename; } ViewData["userlist"] = userbll.GetModelLists("1=1"); return(View()); }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { Model.t_user user = (Model.t_user)Session["UserInfo"]; if (user != null) { strid = user.u_ID.ToString(); int u_ID = (Convert.ToInt32(strid)); ShowInfo(u_ID); } } }
/// <summary> /// 取得用户信息 /// </summary> public Model.t_user GetUserInfo() { if (IsUserLogin()) { Model.t_user model = System.Web.HttpContext.Current.Session[NKeys.SESSION_USER_INFO] as Model.t_user; if (model != null) { //为了能查询到最新的用户信息,必须查询最新的用户资料 model = new Bll.t_user().GetModel(model.id); return(model); } } return(null); }
public ActionResult NewIndex() { ViewBag.islogin = IsUserLogin() ? 1 : 0; if (IsUserLogin()) { Model.t_user model = GetUserInfo(); if (model != null) { ViewBag.name = model.name; ViewBag.employeename = model.employeename; } } return(View()); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { Model.t_user user = (Model.t_user)Session["UserInfo"]; if (user == null) { Response.Redirect("UserLogin.aspx"); } lab_Name.Text = user.u_name; d_lab_user.Text = user.u_nickName; d_img_user.Src = new BLL.t_picture().GetModel(user.u_pic_ID).pic_valid; lab_lasttime.Text = user.u_lastLoginDate.ToString(); } }
private void ShowInfo(string id) { Model.t_user user = (Model.t_user)Session["UserInfo"]; if (user == null) { Response.Redirect("WALLEcommunity.aspx?id=12"); } userid.Text = user.u_ID.ToString(); Model.t_systemleave systemleave = new BLL.t_systemleave().GetModel(int.Parse(id)); userid.Text = user.u_ID.ToString(); //userImg.Src = new BLL.t_picture().GetModel(user.u_pic_ID).pic_valid; content.InnerText = systemleave.sl_content; date.InnerText = systemleave.sl_date.ToString(); main_img.Src = new BLL.t_picture().GetModel(int.Parse(systemleave.sl_pic_id.ToString())).pic_valid; }
/// <summary> /// 检查登录状态 /// </summary> /// <returns></returns> public string CheckLoginStatus() { Model.t_user model = new Model.t_user(); if (System.Web.HttpContext.Current.Session[NKeys.SESSION_USER_INFO] != null) { model = (Model.t_user)System.Web.HttpContext.Current.Session[NKeys.SESSION_USER_INFO]; } string session = model.username; if (!string.IsNullOrEmpty(session)) { return(session); } else { return("null"); } }
private string Updatepwdss(string updatepwd, string updatepwd2, string username) { Model.t_user model = userbll.GetUpdatepwd(username); if (model == null) { return("{\"status\": 2,\"msg\": \"错误提示:没有此账号,请重试!\"}"); } if (updatepwd != updatepwd2) { return("{\"status\": 0,\"msg\": \"错误提示:2次密码不一致,请重试!\"}"); } if (model != null) { model.pwd = DESEncrypt.Encrypt(updatepwd2); userbll.Update(model); } return("{\"status\": 1,\"msg\": \"修改成功!\"}"); }
protected void Page_Load(object sender, EventArgs e) { lab_menu.Value = Request.Params["id"]; Model.t_user user = (Model.t_user)Session["UserInfo"]; if (user == null || Session["UserInfo"] == null) { Response.Redirect("UserLogin.aspx"); } else { if (!IsPostBack) { this.UserName.Text = user.u_nickName; imgPhoto.Src = new BLL.t_picture().GetModel(user.u_pic_ID).pic_valid; if (Request.Params["id"] != null && Request.Params["id"].Trim() != "") { } } } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { Model.t_user user = (Model.t_user)Session["UserInfo"]; if (user == null) { Response.Redirect("UserLogin.aspx"); } userid.Text = user.u_ID.ToString(); if (Request["rid"] != null) { string id = Request["rid"]; Model.t_tradingrecord tradingrecord = new BLL.t_tradingrecord().GetModel(int.Parse(id)); tradingrecord.tra_accomplish = "已取消"; new BLL.t_tradingrecord().Update(tradingrecord); } } }
/// <summary> /// 得到一个对象实体 /// </summary> public Model.t_user DataRowToModel(DataRow row) { Model.t_user model = new Model.t_user(); if (row != null) { if (row["id"] != null && row["id"].ToString() != "") { model.id = int.Parse(row["id"].ToString()); } if (row["username"] != null) { model.username = row["username"].ToString(); } if (row["employeename"] != null) { model.employeename = row["employeename"].ToString(); } if (row["pwd"] != null) { model.pwd = row["pwd"].ToString(); } if (row["name"] != null) { model.name = row["name"].ToString(); } if (row["pename"] != null) { model.pename = row["pename"].ToString(); } if (row["adddate"] != null) { model.adddate = row["adddate"].ToString(); } if (row["Email"] != null) { model.Email = row["Email"].ToString(); } } return(model); }
private string UpdateUserss(string username, string name, string pwd, string zhiwu, string jurisdiction) { if (username == null && name == null && pwd == null && zhiwu == null && jurisdiction == null) { return("{\"status\": 0,\"msg\":\"修改失败!\"}"); } Model.t_user model = userbll.GetModelss(username); if (model != null) { model.username = username; model.employeename = name; if (model.pwd != pwd) { model.pwd = DESEncrypt.Encrypt(pwd); } userbll.Update(model); } Model.user_role urmodel = user_rolebll.GetModels(model.id); Model.t_role rolemodel = rolebll.GetModelss(zhiwu); if (rolemodel != null) { urmodel.roleid = rolemodel.id; user_rolebll.Update(urmodel); } //if (rolemodel!=null) //{ // rolemodel.name = zhiwu; // rolebll.Update(rolemodel); //} Model.role_permission rolepemodel = role_permissionbll.GetModels(rolemodel.id); Model.t_permission permmodel = t_permissionbll.GetModel(rolepemodel.permissionid); if (permmodel != null) { permmodel.pename = jurisdiction; t_permissionbll.Update(permmodel); } return("{\"status\": 1,\"msg\":\"修改成功!\"}"); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(Model.t_user model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update t_user set "); strSql.Append("username=@username,"); strSql.Append("pwd=@pwd,"); strSql.Append("employeename=@employeename,"); strSql.Append("adddate=@adddate,"); strSql.Append("Email=@Email"); strSql.Append(" where id=@id"); SqlParameter[] parameters = { new SqlParameter("@username", SqlDbType.VarChar, 50), new SqlParameter("@pwd", SqlDbType.VarChar, 50), new SqlParameter("@employeename", SqlDbType.VarChar, 50), new SqlParameter("@adddate", SqlDbType.VarChar, 50), new SqlParameter("@Email", SqlDbType.NVarChar, 50), new SqlParameter("@id", SqlDbType.Int, 4) }; parameters[0].Value = model.username; parameters[1].Value = model.pwd; parameters[2].Value = model.employeename; parameters[3].Value = model.adddate; parameters[4].Value = model.Email; parameters[5].Value = model.id; int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { user = (Model.t_user)Session["UserInfo"]; if (user == null) { Response.Redirect("CommodityView.aspx?id=9"); } userid.Text = user.u_ID.ToString(); if (Request.Params["cid"] != null && Request.Params["cid"].Trim() != "") { strid = Request.Params["cid"]; int com_ID = (Convert.ToInt32(strid)); ShowInfo(com_ID); } else { Response.Redirect("CommodityView.aspx?id=9"); } } }
public Model.t_role GetModel(int id) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 id,name,description,adddate from t_role "); strSql.Append(" where id=@id"); SqlParameter[] parameters = { new SqlParameter("@id", SqlDbType.Int, 4) }; parameters[0].Value = id; Model.t_user model = new Model.t_user(); DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { return(DataRowToModel(ds.Tables[0].Rows[0])); } else { return(null); } }
public ActionResult UpdateUser(int id) { Bll.t_role bllrole = new Bll.t_role(); Model.t_user model1 = GetUserInfo(); Model.t_user model = userbll.GetModel(id); ViewBag.username = model.username; //账号 ViewBag.employeename = model1.employeename; //姓名 ViewBag.employeename1 = model.employeename; ViewBag.pwd = model.pwd; if (model != null) { Model.user_role urmodel = user_rolebll.GetModels(model.id); Model.t_role rolemodel = rolebll.GetModel(urmodel.roleid); ViewBag.zhiwu = rolemodel.name; if (rolemodel != null) { Model.role_permission rolepemodel = role_permissionbll.GetModels(rolemodel.id); Model.t_permission permmodel = t_permissionbll.GetModel(rolepemodel.permissionid); ViewBag.pername = permmodel.pename; } ViewData["zhiwu1"] = bllrole.GetModelList("1=1"); } return(View()); }
protected void btn_Login_Click1(object sender, EventArgs e) { Console.WriteLine(Session["CheckCode"]); #region 检查验证码 if ((Session["CheckCode"] != null) && (Session["CheckCode"].ToString() != "")) { if (Session["CheckCode"].ToString().ToLower() != this.CheckCode.Value.ToLower()) { this.lblMsg.Text = "输入的验证码有误!"; Session["CheckCode"] = null; return; } else { this.lblMsg.Text = ""; Session["CheckCode"] = null; string userName = PageValidate.InputText(input_userName.Text.Trim(), 30); string Password = MD5Enctypt.MD5.Md5Encrypt(PageValidate.InputText(input_passWord.Text.Trim(), 30)); string Password2 = MD5Enctypt.MD5.Md5Encrypt(PageValidate.InputText(input_passWord2.Text.Trim(), 30)); string address = PageValidate.InputText(input_Address.Text.Trim(), 100); string phone = PageValidate.InputText(input_phone.Text.Trim(), 15); string name = PageValidate.InputText(input_Name.Text.Trim(), 30); string idnumber = PageValidate.InputText(input_IDnumber.Text.Trim(), 4); BLL.t_user t_User = new BLL.t_user(); bool isPhoneExists = t_User.Exists(phone); if (isPhoneExists) { this.lblMsg.Text = "您输入的电话号码已经注册!"; Response.Write("<script> alert('您输入电话号码已经注册!')</script>"); } if (Password != Password2) { this.lblMsg.Text = "两次密码不匹配!"; Response.Write("<script> alert('两次密码不匹配!')</script>"); } if (!PageValidate.IsNumber(idnumber)) { this.lblMsg.Text = "您输入的身份证号码不是数字!"; Response.Write("<script> alert('您输入的身份证号码不是数字!')</script>"); } else { Model.t_user user = new Model.t_user(); user.u_address = ddl_p.Items[ddl_p.SelectedIndex].Text + ddl_c.Items[ddl_c.SelectedIndex].Text + ddl_d.Items[ddl_d.SelectedIndex].Text + input_Address.Text; user.u_birthDate = DateTime.Parse(this.input_birthdate.Text); user.u_creaditsLogID = int.Parse(this.input_IDnumber.Text); user.u_name = input_Name.Text; user.u_phone = input_phone.Text; user.u_registrationDate = DateTime.Now; user.u_nickName = input_userName.Text; user.u_passWord = Password; t_User.Add(user); Model.t_address addressF = new Model.t_address(); addressF.add_contactName = user.u_name; addressF.add_u_ID = new BLL.t_user().GetModel(user.u_phone).u_ID; addressF.add_contactPhone = user.u_phone; addressF.add_address = input_Address.Text; addressF.add_province = ddl_p.Items[ddl_p.SelectedIndex].Text; addressF.add_counties = ddl_d.Items[ddl_d.SelectedIndex].Text; addressF.add_city = ddl_c.Items[ddl_c.SelectedIndex].Text; addressF.add_date = DateTime.Now; addressF.add_default = "1"; new BLL.t_address().Add(addressF); Response.Write("<script> alert('成功注册,回到登录页面!')</script>"); Response.Redirect("../User/UserLogin.aspx"); } #region ////验证登录信息,如果验证通过则返回当前用户对象的安全上下文信息 //// AccountsPrincipal newUser = AccountsPrincipal.ValidateLogin(userName, Password); //BLL.t_user user = new BLL.t_user(); //if (isNumber) //{ // if (user.Exists(int.Parse(userName))) // { // if (user.IsLogin(int.Parse(userName), Password)) // { // WalleProject.Model.t_user _user = new WalleProject.Model.t_user(); // _user = user.GetModel(int.Parse(userName)); // Session["UserInfo"] = _user; // HttpCookie cookie = new HttpCookie("USER_NAME"); // cookie.Value = input_userName.Text; // Response.Cookies.Add(cookie); // Response.Redirect("../User/Default.aspx"); // } // else // { // this.lblMsg.Text = "您输入的密码不正确!"; // Response.Write("<script>alert('您输入的密码不正确!')</script>"); // } // } // else // { // this.lblMsg.Text = "您输入的用户名不存在!"; // Response.Write("<script> alert('您输入的用户名不存在!')</script>"); // } //} #endregion } } else { Response.Redirect("../User/UserRigister.aspx"); } #endregion #region /* * if (newUser == null)//登录信息不对 * { * this.lblMsg.Text = "登陆失败: " + userName; * if ((Session["PassErrorCountAdmin"] != null) && (Session["PassErrorCountAdmin"].ToString() != "")) * { * int PassErroeCount = Convert.ToInt32(Session["PassErrorCountAdmin"]); * Session["PassErrorCountAdmin"] = PassErroeCount + 1; * } * else * { * Session["PassErrorCountAdmin"] = 1; * } * } * else * { * * //根据用户对象的上下文得到用户对象信息,用于得到其他信息 * User currentUser = new LTP.Accounts.Bus.User(newUser); * //if (currentUser.UserType != "AA") * //{ * // this.lblMsg.Text = "你非管理员用户,你没有权限登录后台系统!"; * // return; * //} * * //把当前用户对象实例赋给Context.User,这样做将会把完整的用户信息加载到ASP.NET提供的验证体系中 * Context.User = newUser; * //验证当前用户密码 * if (((SiteIdentity)User.Identity).TestPassword(Password) == 0) * { * this.lblMsg.Text = "你的密码无效!"; * if ((Session["PassErrorCountAdmin"] != null) && (Session["PassErrorCountAdmin"].ToString() != "")) * { * int PassErroeCount = Convert.ToInt32(Session["PassErrorCountAdmin"]); * Session["PassErrorCountAdmin"] = PassErroeCount + 1; * } * else * { * Session["PassErrorCountAdmin"] = 1; * } * } * else * { * //保存当前用户对象信息 * FormsAuthentication.SetAuthCookie(userName, false); * Session["UserInfo"] = currentUser; * Session["Style"] = currentUser.Style; * if (Session["returnPage"] != null) * { * string returnpage = Session["returnPage"].ToString(); * Session["returnPage"] = null; * Response.Redirect(returnpage); * } * else * { * Response.Redirect("main.htm"); * } * } * * }*/ #endregion }
/// <summary> /// 增加一条数据 /// </summary> public int Add(Model.t_user model) { return(dal.Add(model)); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(Model.t_user model) { return(dal.Update(model)); }
protected void btnSave_Click(object sender, EventArgs e) { try { string strErr = ""; int number = int.Parse(txt_number.Value); int addressID; if (number <= 0 && number > int.Parse(lblcom_number.Text)) { strErr = "回收的数量不符合要求"; } if (strErr != "") { MessageBox.Show(this, strErr); return; } if (r6.Checked) { addressID = int.Parse(lb_address.SelectedValue); } else { Model.t_address address = new Model.t_address(); address.add_province = ddl_p.Items[ddl_p.SelectedIndex].Text; address.add_city = ddl_c.Items[ddl_c.SelectedIndex].Text; address.add_counties = ddl_d.Items[ddl_d.SelectedIndex].Text; address.add_address = input_Address.Text; address.add_date = DateTime.Now; address.add_default = "0"; address.add_u_ID = int.Parse(userid.Text); address.add_postcode = 000000; address.add_contactName = input_userName.Text; address.add_contactPhone = input_phone.Text; address.add_ID = new BLL.t_address().GetMaxId(); bool istrue = new BLL.t_address().Add(address); addressID = address.add_ID; } user = new BLL.t_user().GetModel(int.Parse(userid.Text)); int tra_U_ID = int.Parse(userid.Text); decimal tra_transactionAmount = decimal.Parse(this.lblcom_conversionInt.Text); DateTime tra_transactionDate = DateTime.Now; string tra_accomplish = "发布"; int tra_staff_id = 0; int sta_comwas_id = int.Parse(this.lblcom_id.Text); int tra_number = int.Parse(this.txt_number.Value); if (user.u_integral < tra_number * tra_transactionAmount) { strErr += "你的积分不够哦!\\n"; MessageBox.Show(this, strErr); return; } user.u_integral = Convert.ToInt32(user.u_integral - tra_number * tra_transactionAmount); bool isuser = new BLL.t_user().Update(user); // int tra_addressID = int.Parse(this.rad_address.SelectedValue); string tra_type = "商品"; string tra_vaild = "是"; int tra_sort = 1; WalleProject.Model.t_tradingrecord model = new WalleProject.Model.t_tradingrecord(); model.tra_addressID = addressID; model.tra_U_ID = tra_U_ID; model.tra_transactionAmount = tra_transactionAmount; model.tra_transactionDate = tra_transactionDate; model.tra_accomplish = tra_accomplish; model.tra_staff_id = tra_staff_id; model.sta_comwas_id = sta_comwas_id; model.tra_number = tra_number; model.tra_type = tra_type; model.tra_vaild = tra_vaild; model.tra_sort = tra_sort; WalleProject.BLL.t_tradingrecord bll = new WalleProject.BLL.t_tradingrecord(); bll.Add(model); Maticsoft.Common.MessageBox.ShowAndRedirect(this, "发布成功,等待回收员接单", "CommodityView.aspx?id=9"); } catch (Exception ex) { MessageBox.Show(this, ex.Message); } }