/// <summary> /// 保存实体数据(新增、修改) /// <param name="keyValue">主键</param> /// <summary> /// <returns></returns> public void SaveEntity(int?keyValue, dm_dauomai_plan_manageEntity entity) { try { if (keyValue > 0) { entity.Modify(keyValue); this.BaseRepository("dm_data").Update(entity); } else { entity.Create(); this.BaseRepository("dm_data").Insert(entity); } } catch (Exception ex) { if (ex is ExceptionEx) { throw; } else { throw ExceptionEx.ThrowServiceException(ex); } } }
public void SyncPlanList(Query_CPS_Stores_PlansRequest query_CPS_Stores_PlansRequest) { try { DuoMai_ApiManage duoMai_ApiManage = new DuoMai_ApiManage(CommonConfig.duomai_appkey, CommonConfig.duomai_appsecret); query_CPS_Stores_PlansRequest.is_apply = 0; query_CPS_Stores_PlansRequest.page_size = 200; List <CPS_Stores_PlansEntity> cPS_Stores_PlansEntities = duoMai_ApiManage.Query_CPS_Stores_Plans(query_CPS_Stores_PlansRequest); List <dm_dauomai_plan_manageEntity> dm_dauomai_plan_manageList = new List <dm_dauomai_plan_manageEntity>(); foreach (var item in cPS_Stores_PlansEntities) { dm_dauomai_plan_manageEntity dm_Dauomai_Plan_ManageEntity = new dm_dauomai_plan_manageEntity { ads_apply_status = item.ads_apply_status, ads_id = item.ads_id, ads_logo = item.ads_logo, ads_name = item.ads_name, apply_mode = item.apply_mode, category = item.category, category_area = item.category_area, channel = item.channel, commission = item.commission, etime = item.etime, stime = item.stime, rddays = item.rddays, status = item.status, store_name = item.store_name, url = item.url }; dm_Dauomai_Plan_ManageEntity.Create(); dm_dauomai_plan_manageList.Add(dm_Dauomai_Plan_ManageEntity); } if (dm_dauomai_plan_manageList.Count > 0) { this.BaseRepository("dm_data").Insert(dm_dauomai_plan_manageList); } if (cPS_Stores_PlansEntities.Count >= 200) { query_CPS_Stores_PlansRequest.page++; SyncPlanList(query_CPS_Stores_PlansRequest); } } catch (Exception ex) { if (ex is ExceptionEx) { throw; } else { throw ExceptionEx.ThrowServiceException(ex); } } }