public Jinher.AMP.BTP.Deploy.CustomDTO.ResultDTO <System.Collections.Generic.List <string> > GetUsedExt(System.Guid appId) { ResultDTO <List <string> > result = new ResultDTO <List <string> >() { isSuccess = true }; if (appId == Guid.Empty) { result.isSuccess = false; result.Message = "参数不能为空"; return(result); } try { result.Data = ExpressCollection.ObjectSet().Where(e => e.AppId == appId).Select(e => e.ExpCode).ToList(); } catch (Exception ex) { result.isSuccess = false; result.Message = "查询失败"; LogHelper.Error("查询常用快递异常", ex); } return(result); }
/// <summary> /// 收藏 /// </summary> /// <param name="appId"></param> /// <returns></returns> public Jinher.AMP.BTP.Deploy.CustomDTO.ResultDTO <System.Collections.Generic.List <Jinher.AMP.BTP.Deploy.ExpressCodeDTO> > GetAllExt(System.Guid appId) { ResultDTO <List <ExpressCodeDTO> > result = new ResultDTO <List <ExpressCodeDTO> >() { isSuccess = true }; try { result.Data = (from t in ExpressCollection.ObjectSet() where t.AppId == appId join e in ExpressCode.ObjectSet() on t.ExpCode equals e.ExpCode orderby e.ExpCode select new ExpressCodeDTO() { ExpCode = e.ExpCode, ExpCompanyName = e.ExpCompanyName }).ToList(); } catch (Exception ex) { result.isSuccess = false; result.Message = "查询失败"; LogHelper.Error("查询快递异常", ex); } return(result); }
public Jinher.AMP.BTP.Deploy.CustomDTO.ResultDTO SaveUsedExt(System.Guid appId, System.Collections.Generic.List <string> expressCodeList) { ResultDTO result = new ResultDTO() { isSuccess = true }; if (expressCodeList == null || appId == Guid.Empty) { result.isSuccess = false; result.Message = "参数不能为空"; return(result); } try { var oldList = ExpressCollection.ObjectSet().Where(e => e.AppId == appId).ToList(); foreach (var item in oldList) { item.EntityState = EntityState.Deleted; ContextFactory.CurrentThreadContext.SaveObject(item); } foreach (var code in expressCodeList) { var item = new ExpressCollection(); item.Id = Guid.NewGuid(); item.AppId = appId; item.ExpCode = code; item.EntityState = EntityState.Added; ContextFactory.CurrentThreadContext.SaveObject(item); } ContextFactory.CurrentThreadContext.SaveChanges(); } catch (Exception ex) { result.isSuccess = false; result.Message = "保存失败"; LogHelper.Error("保存常用快递异常", ex); } return(result); }