public HttpResponseMessage GetShopDetail(int ShopID) { var response = new MyHttpResponseMessage(); response.apiNumber = "C062_EQMController_GetShopDetail"; var msg = ""; try { var shop = org.org_ShopSugar.GetById(ShopID); var corp = new ORM.SqlSugar.Model.org.org_CorpMaster(); if (shop != null) { if (!string.IsNullOrEmpty(shop.CorpCode)) { corp = org.org_CorpMasterSugar.GetById(shop.CorpCode); } } var rbj = new { shop = shop, corp = corp }; response.SetContent(HttpStatus.ok, "获取成功", rbj, ResponseType.josn); } catch (Exception ex) { msg = "ERROR"; AddErrorLog(LogEnum.org, ex.Message, ex.StackTrace); response.SetContent(HttpStatus.error, ex.Message, msg, ResponseType.josn); } return(response); }
public HttpResponseMessage VerifyJoinIn(string MemberCode, string JoinTime) { var response = new MyHttpResponseMessage(); response.apiNumber = "C066_EQMController_VerifyJoinIn"; var msg = ""; try { var join = org.org_JoinInSugar.GetSingle(p => p.MemberCode == MemberCode && p.JoinTime == JoinTime.ToDateTime()); if (join == null) { response.SetContent(HttpStatus.error, "不存在这条记录", join, ResponseType.josn); return(response); } join.Status = 1; var result = db.SqlServerClient.Ado.UseTran(() => { if (string.IsNullOrEmpty(join.CorpCode)) { //创建企业 var corp = new ORM.SqlSugar.Model.org.org_CorpMaster(); var CorpCode = org.GetCorpCode(join.CorpProvince); corp.CorpCode = CorpCode; corp.CorpName = join.CorpName; corp.SocialCreditCode = join.SocialCreditCode; corp.RegisteredAddr = join.CorpAddr; join.CorpCode = corp.CorpCode; org.org_CorpMasterSugar.Insert(corp); } if (join.ShopID == 0) { //创建营业部 var shop = new ORM.SqlSugar.Model.org.org_Shop(); shop.ShopName = join.ShopName; shop.Address = join.CorpAddr; shop.CorpCode = join.CorpCode; shop.DutyMemberCode = MemberCode; var id = org.org_ShopSugar.InsertReturnIdentity(shop); join.ShopID = id; } var mc = new ORM.SqlSugar.Model.mb.mb_MemberCorp(); mc.MemberCode = MemberCode; mc.CorpCode = join.CorpCode; mc.ShopID = join.ShopID.ToInt32(); mc.CreateTime = DateTime.Now; mb.mb_MemberCorpSugar.Insert(mc); org.org_JoinInSugar.Update(join); }); if (result.IsSuccess) { response.SetContent(HttpStatus.ok, "审核成功", join, ResponseType.josn); } else { response.SetContent(HttpStatus.error, result.ErrorMessage, null, ResponseType.josn); } } catch (Exception ex) { msg = "ERROR"; AddErrorLog(LogEnum.org, ex.Message, ex.StackTrace); response.SetContent(HttpStatus.error, ex.Message, msg, ResponseType.josn); } return(response); }