/// <summary> /// 添加报名用户 /// </summary> /// <param name="nonceCode"></param> /// <param name="redirectUrl"></param> public int AddSignUpUser(UserSignModel model) { StringBuilder strSql = new StringBuilder(); strSql.Append("IF NOT EXISTS (select top 1 id from Hot_SignUpUser where customerid=@customerid and openid=@openid and type=@type) "); strSql.AppendLine(" BEGIN "); strSql.Append("insert into Hot_SignUpUser("); strSql.Append("customerid,name,mobile,address,openid,nickname,headimgurl,city,Province,type,content1,content2,content3,content4)"); strSql.Append(" values ("); strSql.Append("@customerid,@name,@mobile,@address,@openid,@nickname,@headimgurl,@city,@Province,@type,@content1,@content2,@content3,@content4)"); strSql.AppendLine(" END "); strSql.AppendLine(" else "); strSql.AppendLine(" BEGIN "); strSql.Append(" update Hot_SignUpUser set name=@name,mobile=@mobile,address=@address ,nickname=@nickname,city=@city,Province=@Province,type=@type,content1=@content1,content2=@content2,content3=@content3,content4=@content4 where customerid=@customerid and openid=@openid and type=@type "); strSql.AppendLine(" END "); SqlParameter[] parameters = { new SqlParameter("@customerid", model.customerid), new SqlParameter("@name", model.name), new SqlParameter("@mobile", model.mobile), new SqlParameter("@address", model.address), new SqlParameter("@openid", model.openid), new SqlParameter("@nickname", model.nickname), new SqlParameter("@headimgurl", model.headimgurl), new SqlParameter("@city", model.city), new SqlParameter("@Province", model.Province), new SqlParameter("@type", model.Type), new SqlParameter("@content1", model.content1), new SqlParameter("@content2", model.content2), new SqlParameter("@content3", model.content3), new SqlParameter("@content4", model.content4) }; return(DbHelperSQL.ExecuteSql(strSql.ToString(), parameters)); }
private void signUp() { try { string name = this.GetFormValue("name", ""); string mobile = this.GetFormValue("mobile", ""); string province = this.GetFormValue("province", ""); string city = this.GetFormValue("city", ""); string county = this.GetFormValue("county", ""); int customerid = this.GetFormValue("customerid", 0); WeixinOAuthUserInfoModel userInfo = UserService.Instance.GetUserInfo(customerid); UserSignModel model = new UserSignModel() { name = name, Province = province, city = city, address = county, customerid = customerid, mobile = mobile, openid = userInfo.Openid, nickname = userInfo.Nickname, headimgurl = userInfo.Headimgurl, Type = this.GetFormValue("type", 0), content1 = this.GetFormValue("content1", ""), content2 = this.GetFormValue("content2", ""), content3 = this.GetFormValue("content3", ""), content4 = this.GetFormValue("content4", ""), }; if (UserSignUp.Instance.AddSignUpUser(model) > 0) { this.code = 1; } else { this.msg = "预约失败"; } } catch (Exception ex) { this.msg = "预约失败"; LogHelper.Error(string.Format("signUp--->>message:{0} ,StackTrace:{1}", ex.Message, ex.StackTrace)); } }
/// <summary> /// 获取当前报名用户信息 /// </summary> /// <param name="customerId"></param> /// <param name="openid"></param> /// <returns></returns> public UserSignModel GetSignUpUserInfo(int customerId, string openid, int type = 0) { string sql = "select id,customerid,name,mobile,[address],openid,nickname,headimgurl,city,Province,createtime,type,content1,content2,content3,content4 from Hot_SignUpUser where customerid=@customerid and openid=@openid and type=@type"; SqlParameter[] parameters = { new SqlParameter("@customerid", customerId), new SqlParameter("@openid", openid), new SqlParameter("@type", type) }; UserSignModel model = new UserSignModel(); using (SqlDataReader dr = DbHelperSQL.ExecuteReader(sql, parameters)) { model = DbHelperSQL.GetEntity <UserSignModel>(dr); } return(model); }
/// <summary> /// 添加报名用户 /// </summary> /// <param name="nonceCode"></param> /// <param name="redirectUrl"></param> public int AddSignUpUser(UserSignModel model) { return(dal.AddSignUpUser(model)); }