public ActionResult Edit(Epm_AdPutRecord model) { string fileDataJson = Request.Form["fileDataJsonFile"]; //获取上传文件json字符串 List <Base_Files> fileList = JsonConvert.DeserializeObject <List <Base_Files> >(fileDataJson); //将文件信息json字符 Result <int> result = new Result <int>(); ResultView <string> view = new ResultView <string>(); if (string.IsNullOrEmpty(model.AdName)) { view.Flag = false; view.Message = "广告名称不能为空"; return(Json(view)); } if (Convert.ToBoolean(Request.Form["State"]) == true) { model.State = 1; } else { model.State = 0; } using (BusinessClientProxy proxy = new BusinessClientProxy(ProxyEx(Request))) { model.EndTime = Convert.ToDateTime(model.EndTime.Value.ToString("yyyy-MM-dd") + " 23:59:59"); result = proxy.UpdateAdPutRecord(model, fileList); } return(Json(result.ToResultView())); }
public object InitInfo() { //Dictionary<long, string> projectList = new Dictionary<long, string>(); List <Epm_Project> projectList = new List <Epm_Project>(); Epm_AdPutRecord ad = new Epm_AdPutRecord(); Dictionary <string, int> dic = new Dictionary <string, int>(); List <Epm_OilStation> oilList = new List <Epm_OilStation>(); string adUrl = ""; List <string> attendance = new List <string>(); using (ClientSiteClientProxy proxy = new ClientSiteClientProxy(ProxyEx(""))) { QueryCondition qc = new QueryCondition(); qc.ConditionList.Add(new ConditionExpression() { ExpName = "AdTargetNum", ExpValue = 0, ExpOperater = eConditionOperator.Equal, ExpLogical = eLogicalOperator.And }); // todo : 添加广告查询条件 var adResult = proxy.GetAdShowList(qc); if (adResult.Flag == EResultFlag.Success && adResult.Data.Any()) { ad = adResult.Data.FirstOrDefault() ?? new Epm_AdPutRecord(); var filesResult = proxy.GetBaseFiles(new List <long>() { ad.Id }); if (filesResult.Flag == EResultFlag.Success && filesResult.Data.Any()) { string type = ad.GetType().Name; var file = filesResult.Data.FirstOrDefault(p => p.TableId == ad.Id && p.TableName == type && (p.ImageType == "big" || p.ImageType == "start")); adUrl = file == null ? "" : file.Url; } } var user = CurrentUserView; QueryCondition qc1 = new QueryCondition() { PageInfo = GetPageInfo(1, false) }; qc1.PageInfo.isAllowPage = false; qc1.ConditionList = new List <ConditionExpression> { new ConditionExpression() { ExpName = "State", ExpValue = (int)ProjectState.Construction, ExpOperater = eConditionOperator.Equal, ExpLogical = eLogicalOperator.And } }; qc1.SortList.Add(new SortExpression() { SortName = "OperateTime", SortType = eSortType.Desc }); if (user != null) { var proList = proxy.GetProjectListById(user.CompanyId, user.UserId).Data; if (proList != null) { projectList = proxy.GetProjectListById(user.CompanyId, user.UserId).Data; } } //获取油站列表 var oilStationResult = proxy.GetOilStationAllList(); if (oilStationResult.Flag == EResultFlag.Success && oilStationResult.Data.Any()) { oilList = oilStationResult.Data; } //考勤设置信息 var attendanceList = proxy.GetAttendanceModel(); if (attendanceList.Flag == EResultFlag.Success && attendanceList.Data != null) { attendance = attendanceList.Data.AttendanceTimeList; } } //签到距离 string value = ConfigurationManager.AppSettings["FaceAIDistance"]; var data = new { adInfo = new { id = ad.Id, image = AppCommonHelper.SystemSetting["resourceUrl"] + "/Content/screen.jpg", url = "" }, projectList = projectList.Select(p => new { projectId = p.Id, projectName = p.Name, latitude = p.ProjectSubjectId == null ? 0 : GetOilInfo(oilList, p.ProjectSubjectId.Value) == null ? 0 : GetOilInfo(oilList, p.ProjectSubjectId.Value).Latitude, longitude = p.ProjectSubjectId == null ? 0 : GetOilInfo(oilList, p.ProjectSubjectId.Value) == null ? 0 : GetOilInfo(oilList, p.ProjectSubjectId.Value).Longitude, //latitude = "34.231696", //longitude = "108.93393", //oilStationName = GetOilInfo(oilList, p.ProjectSubjectId.Value) == null ? "" : GetOilInfo(oilList, p.ProjectSubjectId.Value).Name, distance = value ?? "0", }), waitList = new { approvalCount = 0, //dic.ContainsKey("approvalCount") ? dic["approvalCount"] : 0, unreadMsg = 0 //dic.ContainsKey("unreadMsg") ? dic["unreadMsg"] : 0 }, timedReminderList = getAttendence(attendance), sysSetting = AppCommonHelper.SystemSetting }; return(Json(APIResult.GetSuccessResult(data))); }
/// <summary> /// 修改广告投放 /// </summary> /// <param name="model"></param> /// <returns></returns> public Result <int> UpdateAdPutRecord(Epm_AdPutRecord model, List <Base_Files> fileList = null) { return(base.Channel.UpdateAdPutRecord(model, fileList)); }