public bool ChangeStatus(string Ids, OutDoorStatus OutDoorStatus) { var result = true; try { var IdsArray = Ids.Split(',').Select(x => Convert.ToInt32(x)); var OutDoorStatusValue = (int)OutDoorStatus; DB_Service.Set<OutDoor>().Where(x => IdsArray.Contains(x.MediaID)).ToList().ForEach(x => x.Status = OutDoorStatusValue); DB_Service.Commit(); } catch (DbEntityValidationException ex) { result = false; } return result; }
public void ChangeStatus(string ids, OutDoorStatus Status, string reason = null) { var IdsArray = Utilities.GetIdList(ids); var dbStatus = Status; if (Status == OutDoorStatus.Verified) { dbStatus = OutDoorStatus.ShowOnline; } var info = string.Empty; if (Status == OutDoorStatus.VerifyFailed) { if (!string.IsNullOrEmpty(reason)) { info = reason; } else { info = "请检查信息是否含有非法字符,或者表单是否填写完整"; } } db.Set <OutDoor>().Where(x => IdsArray.Contains(x.ID)).ToList() .ForEach(x => { x.Status = (int)dbStatus; x.Unapprovedlog = reason; }); db.Commit(); if (Status == OutDoorStatus.Verified) { OutDoorLuceneService.CreateIndex(ids); SendAuthedMessage(IdsArray, reason); } else { OutDoorLuceneService.UpdateIndex(ids); if (Status == OutDoorStatus.VerifyFailed) { SendAuthFieldedMessage(IdsArray, reason); } } }
public void ChangeStatus(string ids, OutDoorStatus Status, string reason = null) { var IdsArray = Utilities.GetIdList(ids); var dbStatus = Status; if (Status == OutDoorStatus.Verified) { dbStatus = OutDoorStatus.ShowOnline; } var info = string.Empty; if (Status == OutDoorStatus.VerifyFailed) { if (!string.IsNullOrEmpty(reason)) { info = reason; } else { info = "请检查信息是否含有非法字符,或者表单是否填写完整"; } } db.Set<OutDoor>().Where(x => IdsArray.Contains(x.ID)).ToList() .ForEach(x => { x.Status = (int)dbStatus; x.Unapprovedlog = reason; }); db.Commit(); if (Status == OutDoorStatus.Verified) { OutDoorLuceneService.CreateIndex(ids); SendAuthedMessage(IdsArray, reason); } else { OutDoorLuceneService.UpdateIndex(ids); if (Status == OutDoorStatus.VerifyFailed) { SendAuthFieldedMessage(IdsArray, reason); } } }
public IQueryable<OutDoorListItem> GetVerifyList(OutDoorStatus OutDoorStatus, bool includeUpLevel = false) { int OutDoorStatusValue = (int)OutDoorStatus; var query = DB_Service.Set<OutDoor>() .Include(x => x.MediaImg) .Include(x => x.Area) .Include(x => x.Area.PCategory); if (includeUpLevel) { query = query.Where(x => x.Status >= OutDoorStatusValue); } else { query = query.Where(x => x.Status == OutDoorStatusValue); } return query.Select(x => new OutDoorListItem() { MediaID = x.MediaID, AddTime = x.AddTime, Status = x.Status, FocusImg = x.MediaImg.FocusImgUrl, Price = x.Price, Unapprovedlog = x.Unapprovedlog, MediaCode = x.MeidaCode, Name = x.Name, Province = x.Area.PCategory.CateName, City = x.Area.CateName }); }
public IQueryable<OutDoorListItem> GetMemberOutDoor(int MemberID, OutDoorStatus OutDoorStatus, bool includeUpLevel = false) { int OutDoorStatusValue = (int)OutDoorStatus; var query = DB_Service.Set<OutDoor>() .Include(x => x.MediaImg) .Where(x => x.MemberID == MemberID); if (includeUpLevel) { query = query.Where(x => x.Status >= OutDoorStatusValue); } else { query = query.Where(x => x.Status == OutDoorStatusValue); } return query.Select(x => new OutDoorListItem() { MediaID = x.MediaID, AddTime = x.AddTime, FocusImg = x.MediaImg.FocusImgUrl, Status = x.Status, Unapprovedlog = x.Unapprovedlog, Name = x.Name }); }
public IQueryable<OutDoor> GetList(OutDoorStatus OutDoorStatus, bool includeUpLevel = false) { int OutDoorStatusValue = (int)OutDoorStatus; var query = DB_Service.Set<OutDoor>() .Include(x => x.MediaImg) .Include(x => x.Area) .Include(x => x.Area.PCategory) .Include(x => x.OutDoorMediaCate) .Include(x => x.OutDoorMediaCate.PCategory) .Include(x => x.PeriodCate); if (includeUpLevel) { query = query.Where(x => x.Status >= OutDoorStatusValue); } else { query = query.Where(x => x.Status == OutDoorStatusValue); } return query; }