/// <summary> /// 新增,修改 一条数据 /// </summary> /// <param name="request"></param> /// <returns></returns> public BaseResult AppRegPersonSaveOne(AppRegPersonSaveOne request) { if (string.IsNullOrEmpty(request.hanphone)) { throw new Exception("用户不能为空"); } BaseResult br = new BaseResult(); var webapi = ConfigurationManager.AppSettings["appApi"]; using (var db = DbFactory.Open()) { try { //查询是否存在该记录 var findAppRegUser = db.Select <AppGetReg>(w => w.Mobile == request.hanphone && w.UserName == request.username && w.AdcdId == request.adcdid); List <AppAlluserView> list = null; if (findAppRegUser == null || findAppRegUser.Count == 0) { //删除 db.Delete <AppGetReg>(w => w.AdcdId == request.adcdid); list = db.Select <AppAlluserView>(w => w.adcdId == request.adcdid.ToString()); if (list != null && list.Count > 0) { StringBuilder sb = new StringBuilder(); list.ForEach(w => { var model = db.Single <AppUser>(x => x.Phone == w.phone); if (model != null) { sb.Append("insert into AppGetReg(Mobile, UserName, AdcdId,CreateTime,Operate) values('" + w.phone + "','" + w.userName + "','" + w.adcdId + "',GETDATE(),'1');"); } //using (var client = new JsonServiceClient(webapi)) //{ // var r = client.Get<AppRegUser>("?username="******"error")//app端已注册 // { // sb.Append("insert into AppGetReg(Mobile, UserName, AdcdId,CreateTime,Operate) values('" + w.phone + "','" + w.userName + "','" + w.adcdId + "',GETDATE(),'1');"); // } //} }); br.IsSuccess = db.ExecuteNonQuery(sb.ToString()) > 0 ? true : false; } } } catch (Exception ex) { br.IsSuccess = false; br.ErrorMsg = ex.Message; } return(br); } }
public BaseResult POST(AppRegPersonSaveOne request) { return(_IAppRegPersonUpdate.AppRegPersonSaveOne(request)); }