//Function to update user Details public void UpdateCustomer(updateCustomer updatefield, string sessionName) { try { string updateQuery = ""; switch (updatefield) { case updateCustomer.custName: updateQuery = "UPDATE tblCustomer SET custName ='" + name.Text + "'WHERE custUsername ='******'"; break; case updateCustomer.custSurname: updateQuery = "UPDATE tblCustomer SET custSurname ='" + surname.Text + "'WHERE custUsername ='******'"; break; case updateCustomer.custEmail: updateQuery = "UPDATE tblCustomer SET custEmail ='" + email.Text + "'WHERE custUsername ='******'"; break; case updateCustomer.custPhoneNo: updateQuery = "UPDATE tblCustomer SET custPhoneNo ='" + cellNo.Text + "'WHERE custUsername ='******'"; break; case updateCustomer.custPostCode: updateQuery = "UPDATE tblCustomer SET custPostCode ='" + postalCode.Text + "'WHERE custUsername ='******'"; break; case updateCustomer.custTown: updateQuery = "UPDATE tblCustomer SET custName ='" + town.Text + "'WHERE custUsername ='******'"; break; case updateCustomer.custStreetName: updateQuery = "UPDATE tblCustomer SET custStreetName ='" + streetName.Text + "'WHERE custUsername ='******'"; break; case updateCustomer.custUnitNo: updateQuery = "UPDATE tblCustomer SET custUnitNo ='" + unitNo.Text + "'WHERE custUsername ='******'"; break; case updateCustomer.custStandNo: updateQuery = "UPDATE tblCustomer SET custStandNo ='" + standNo + "'WHERE custUsername ='******'"; break; } con.Open(); var cmd = new OdbcCommand(updateQuery, con); cmd.ExecuteNonQuery(); } catch (Exception ex) { Console.WriteLine("Error " + ex); } finally { con.Close(); } }
public ActionResult Register(string mobile, string code) { try { //判断验证码是否正确 UserCheckMobile existCheckMobileUserInfo = CheckMobileService.GetLastCheckMobileInfo(mobile); if (code != existCheckMobileUserInfo.CheckCode) { return(Json(JsonHandler.CreateMessage(0, "验证码错误,请重新输入!"))); } //根据手机号码取出会员信息 var usermodel = WebUtils.Get <CustomerNew>(WebConfig.ApiBaseUrl + "WlxApi/GetCustomerBySql", mobile); //把openid等信息更新到万里信erp if (usermodel == null) { Tools.MessBox("test1"); InsertCustomerNew customer = new InsertCustomerNew(); customer.num = mobile; customer.openid = CurrentCustomer.OpenId; customer.wxname = CurrentCustomer.Name; var inserResult = WebUtils.Save <InsertCustomerNew>(WebConfig.ApiBaseUrl + "WlxApi/InsertVip", customer); Tools.MessBox("test2"); var url = DataUtils.GetRedirectToActionUrl(); return(Json(JsonHandler.CreateMessage(1, "注册成功", url), JsonRequestBehavior.AllowGet)); //return Json(JsonHandler.CreateMessage(0, "您不是线下会员,请到附近门店办理会员后再来关联"), JsonRequestBehavior.AllowGet); } updateCustomer updatcustomer = new updateCustomer(); updatcustomer.openid = CurrentCustomer.OpenId; updatcustomer.wx_name = CurrentCustomer.Name; updatcustomer.vpid = usermodel.c_identity.ToString(); var result = WebUtils.Save <updateCustomer>(WebConfig.ApiBaseUrl + "WlxApi/UpdateVip", updatcustomer); if (result) { Customer customer = new Customer(); customer.Phone = mobile; Session["Customer"] = customer; Tools.MessBox(string.Format("时间:{0},描述:{1}", DateTime.Now, customer.Phone), "//Log//Register//Session//"); var url = DataUtils.GetRedirectToActionUrl(); return(Json(JsonHandler.CreateMessage(1, "注册成功", url), JsonRequestBehavior.AllowGet)); } else { return(Json(JsonHandler.CreateMessage(0, "注册失败"), JsonRequestBehavior.AllowGet)); } } catch (Exception ex) { Tools.MessBox(ex.ToString(), "//Log//Register//Exception"); return(Json(JsonHandler.CreateMessage(0, "注册失败", Url.Action("Index")), JsonRequestBehavior.AllowGet)); } }
public void Test3() { //更新openid,nickname等会员微信信息到用户表(通过接口) updateCustomer updatcustomer = new updateCustomer(); updatcustomer.openid = "o1MJTwqmd2HhAP3Wwmayc84H-Wx4"; updatcustomer.wx_name = "笑看人生"; updatcustomer.vpid = "5002739"; updatcustomer.name = "黄紫俊"; updatcustomer.sex = "男"; updatcustomer.address = "厦门"; updatcustomer.birthday = DateTime.Now; updatcustomer.num = "15960290707"; var result = WebUtils.Save <updateCustomer>("http://114.55.66.247:7777/api/WlxApi/UpdateVip", updatcustomer); }