/// <summary> /// 获取今日style /// </summary> /// <returns></returns> public SWfsIndexModule GetSWfsIndexModuleByTodayStyle() { SWfsIndexModule module = new SWfsIndexModule(); module = DapperUtil.Query <SWfsIndexModule>("ComBeziWfs_SWfsIndexModule_GetSWfsIndexModuleTodayStyle").FirstOrDefault(); return(module); }
/// <summary> /// 获取包含今日style在内的所有楼层 /// </summary> /// <returns></returns> public List <SWfsIndexModule> GetAllFloors() { List <SWfsIndexModule> floors = DapperUtil.Query <SWfsIndexModule>("ComBeziWfs_SWfsIndexModule_GetSWfsIndexModuleIncludeTodayStyle").FilterList() ?? new List <SWfsIndexModule>(); for (int i = 0; i < floors.Count; i++)//类型转变时间判定 { SWfsIndexModule temp = floors[i]; CheckAdShowTypeChangeDate(temp); } return(floors); }
/// <summary> /// 根据楼层id获取楼层对象 /// </summary> /// <param name="floorId"></param> /// <returns></returns> public SWfsIndexModule GetSWfsIndexModuleById(int floorId) { if (floorId <= 0) { return(null); } SWfsIndexModule tempFloor = DapperUtil.Query <SWfsIndexModule>("ComBeziWfs_SWfsIndexModule_GetSWfsIndexModuleByModuleId", new { ModuleId = floorId }).FirstOrDefault(); //if (tempFloor != null) // tempFloor = CheckAdShowTypeChangeDate(ref tempFloor); return(tempFloor); }
/// <summary> /// 判定类型转变时间, 更新到数据库 /// </summary> /// <param name="module"></param> /// <returns></returns> public void CheckAdShowTypeChangeDate(SWfsIndexModule module) { if (module.PageNo == "index" && module.ADShowTypeChangeDate < DateTime.Now && (module.ADShowType == 1 || module.ADShowType == 2) && module.ModuleId > 0) { module.ADShowTypeChangeDate = Convert.ToDateTime("2099-01-01"); module.ADShowType = module.ADShowType == 1 ? (short)2 : (short)1; DapperUtil.Update <SWfsIndexModule>(module); //清除缓存 EnyimMemcachedClient.Instance.Remove("ComBeziWfs_SWfsIndexModule_GetSWfsIndexModuleIncludeTodayStyle_GetAllFloors"); } //return module; }
/// <summary> /// 获取楼层模型 /// </summary> /// <returns></returns> public SWfsIndexModule GetEmptySWfsIndexModuleModel() { SWfsIndexModule ClassfiedFloor = new SWfsIndexModule(); DateTime now = DateTime.Now; ClassfiedFloor.Stutas = 1; ClassfiedFloor.UpdateDate = MinTime; ClassfiedFloor.DateCreate = DateTime.Now; ClassfiedFloor.OperateUserId = PresentationHelper.GetPassport().UserName; ClassfiedFloor.ModuleName = ""; ClassfiedFloor.DataState = 1; ClassfiedFloor.UpdateDate = MinTime; ClassfiedFloor.ADShowTypeChangeDate = MinTime; return(ClassfiedFloor); }
/// <summary> /// 获取时间大于布局修改时间 开始时间小于现在时间的广告图前2位 /// </summary> /// <param name="module"></param> public List <SWfsOperationPicture> GetCurrentSWfsOperationPictureByModuleId(SWfsIndexModule module) { if (module.ModuleId == 0) { return(new List <SWfsOperationPicture>()); } Dictionary <string, object> dic = new Dictionary <string, object>(); //dic["ADShowType"] = module.ADShowType; dic.Add("ADShowType", module.ADShowType); return(DapperUtil.Query <SWfsOperationPicture>("ComBeziWfs_SWfsOperationPicture_GetCurrentSWfsOperationPictureByModuleId", dic, new { ModuleId = module.ModuleId, ADShowType = module.ADShowType } ).FilterList() ?? new List <SWfsOperationPicture>()); }
/// <summary> /// 更新或插入楼层 /// </summary> /// <param name="model"></param> /// <returns></returns> public SWfsIndexModule InsertOrUpdateSWfsIndexModule(SWfsIndexModule model, Boolean needEntity = false) { Dictionary <string, object> dic = new Dictionary <string, object>(); if (model.ModuleId <= 0) { DapperUtil.Insert <SWfsIndexModule>(model); } else { DapperUtil.Update <SWfsIndexModule>(model); } if (needEntity && model.ModuleId <= 0)//插入时 需要获取最ID { var result = DapperUtil.Query <int>("ComBeziWfs_SWfsIndexModule_GetSWfsIndexModuleIdByCreaterAndCreateTime", new { model.DateCreate, model.OperateUserId }).FilterList(); model.ModuleId = (result != null && result.Any()) ? result.First() : -1; } return(model); }
/// <summary> /// 创建楼层 /// </summary> /// <param name="AdshowType"></param> /// <param name="PageNo"></param> /// <param name="ModuleName"></param> /// <param name="Sort"></param> /// <returns></returns> public int CreateFloor(short AdshowType, string PageNo, string ModuleName, int Sort) { try { List <SWfsIndexModule> floors = GetChanelFloors(PageNo); if (!floors.Any(a => a.Sort == Sort) && floors.Count() <= 8 && (new SWfsProductCommentService().GetGlobalConfigByFNo(PageNo) != null))//包含分类层一共9个 { SWfsIndexModule floor = GetEmptySWfsIndexModuleModel(); floor.ADShowType = AdshowType; floor.ModuleName = ModuleName; floor.WebSiteNo = NewsChannelsSservice.Website; floor.Sort = Sort; floor.PageNo = PageNo; floor.ADShowTypeChangeDate = Convert.ToDateTime("2099-01-01"); new SWfsIndexModuleService().InsertOrUpdateSWfsIndexModule(floor); return(1); } return(-1); } catch (Exception) { return(-1); } }
public int CreateClassifiedFloor(string PageNo) { try { List <SWfsIndexModule> floors = GetChanelFloors(PageNo); if (!floors.Any(a => a.ADShowType == 5) && (new SWfsProductCommentService().GetGlobalConfigByFNo(PageNo) != null)) { SWfsIndexModule floor = GetEmptySWfsIndexModuleModel(); floor.ADShowType = 5; floor.ModuleName = "分类展示楼层"; floor.ADShowType = 5; floor.WebSiteNo = NewsChannelsSservice.Website; floor.PageNo = PageNo; floor.ADShowTypeChangeDate = Convert.ToDateTime("2099-01-01"); new SWfsIndexModuleService().InsertOrUpdateSWfsIndexModule(floor); return(1); } return(-1); } catch (Exception) { return(-1); } }