/// <summary> /// 更新一条数据 /// </summary> public void Update(string GUID, string UID, membersEntity UEntity) { string MesCode = string.Empty; int result = dal.Update(UEntity, ref MesCode); CheckResult(result, MesCode); }
//保存数据 protected void Save_btn_Click(object sender, EventArgs e) { //获取页面信息 string wxaccount = txt_wxaccount.Text; string mobile = txt_mobile.Text; string remark = txt_remark.Text; string status = "1"; if (this.hidId.Value.Length != 0)//添加信息 { membersEntity UEntity = bll.GetEntitySigInfo(" where memid='" + hidId.Value + "'"); if (UEntity.memcode.Length > 0) { UEntity.wxaccount = wxaccount; UEntity.mobile = mobile; UEntity.remark = remark; UEntity.status = status; bll.Update("0", "0", UEntity); } this.PageTitle.Operate = "修改"; } //显示结果 ShowResult(bll.oResult.Code, bll.oResult.Msg, errormessage); }
/// <summary> /// 单行数据转实体对象 /// </summary> /// <param name="dr"></param> /// <returns></returns> private membersEntity SetEntityInfo(DataRow dr) { membersEntity Entity = new membersEntity(); Entity.memid = dr["memid"].ToString(); Entity.memcode = dr["memcode"].ToString(); Entity.wxaccount = dr["wxaccount"].ToString(); Entity.mobile = dr["mobile"].ToString(); Entity.remark = dr["remark"].ToString(); Entity.status = dr["status"].ToString(); return(Entity); }
/// <summary> /// 检验表单数据 /// </summary> /// <returns></returns> public bool CheckPageInfo(string type, string memid, string memcode, string wxaccount, string mobile, string remark, string status) { bool rel = false; try { Entity = new membersEntity(); Entity.memid = memid; Entity.memcode = memcode; Entity.wxaccount = wxaccount; Entity.mobile = mobile; Entity.remark = remark; Entity.status = status; rel = true; } catch (System.Exception) { } return(rel); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(ref membersEntity Entity, ref string MesCode) { intReturn = 0; SqlParameter[] sqlParameters = { new SqlParameter("@memid", Entity.memid), new SqlParameter("@memcode", SqlDbType.VarChar, 32), new SqlParameter("@wxaccount", Entity.wxaccount), new SqlParameter("@mobile", Entity.mobile) }; sqlParameters[0].Direction = ParameterDirection.Output; sqlParameters[1].Direction = ParameterDirection.Output; intReturn = DBHelper.ExecuteNonQuery("dbo.p_members_Add", CommandType.StoredProcedure, sqlParameters); if (intReturn == 0) { Entity.memid = sqlParameters[0].Value.ToString(); Entity.memcode = sqlParameters[1].Value.ToString(); } return(intReturn); }
/// <summary> /// 微信小程序获取信息 /// </summary> /// <param name="dicPar"></param> public void GetMember(Dictionary <string, object> dicPar) { ///要检测的参数信息 List <string> pra = new List <string>() { "openid", "mobile" }; //检测方法需要的参数 if (!CheckActionParameters(dicPar, pra)) { return; } var openid = dicPar["openid"].ToString(); var mobile = dicPar["mobile"].ToString(); if (string.IsNullOrEmpty(mobile)) { ReturnResultJson("2", "手机号为空,请在微信中绑定手机号"); return; } if (openid == "undefined") { ReturnResultJson("2", "网络繁忙,请稍后再试"); return; } bllmembers bllmembers = new bllmembers(); membersEntity member = bllmembers.GetEntitySigInfo(" where wxaccount='" + openid + "'"); if (!string.IsNullOrWhiteSpace(member.memid))//已注册过会员 { ReturnJsonStr(JsonHelper.ObjectToJSON(member)); } else//未注册过会员 { bllmembers.Add("", "", "", "", openid, mobile, "", "1"); member = bllmembers.GetEntitySigInfo(" where wxaccount='" + openid + "'"); ReturnJsonStr(JsonHelper.ObjectToJSON(member)); } }
/// <summary> /// 更新一条数据 /// </summary> public int Update(membersEntity Entity, ref string MesCode) { SqlParameter[] sqlParameters = { new SqlParameter("@memid", Entity.memid), new SqlParameter("@memcode", Entity.memcode), new SqlParameter("@buscode", Entity.buscode), new SqlParameter("@wxaccount", Entity.wxaccount), new SqlParameter("@mobile", Entity.mobile), new SqlParameter("@remark", Entity.remark), new SqlParameter("@status", Entity.status), new SqlParameter("@mescode", SqlDbType.VarChar, 128) }; sqlParameters[sqlParameters.Length - 1].Direction = ParameterDirection.Output; intReturn = DBHelper.ExecuteNonQuery("dbo.p_members_Update", CommandType.StoredProcedure, sqlParameters); if (intReturn != -1) { MesCode = sqlParameters[sqlParameters.Length - 1].Value.ToString(); } return(intReturn); }
/// <summary> /// 设置页面信息 /// </summary> /// <param name="id">ID</param> private void SetPage(string id, string from) { string filter = " where memcode='" + id + "'"; membersEntity entity = bll.GetEntitySigInfo(filter); if (entity != null) { hidId.Value = entity.memid; url = "MemberCardShow.aspx?id=" + hidId.Value; memcode = hidId.Value; txt_wxaccount.Text = entity.wxaccount; txt_mobile.Text = entity.mobile; //txt_email.Text = entity txt_tel.Text = entity.mobile; ddl_provinceid_SelectedIndexChanged(null, null); ddl_cityid_SelectedIndexChanged(null, null); txt_remark.Text = entity.remark; } }