public ActionResult Detail(int id) { var hoso = HoSoCongViecRepository.Single(id); var init = InitModel(); var coQuanInfos = CoQuanRepository.GetAll().Select(x => x.ToDataInfo()); var model = new EditCongViecViewModel { Id = id, UsersInfos = init.UsersInfos, LinhVucCongViecInfos = init.LinhVucCongViecInfos, TrangThaiCongViecInfos = init.TrangThaiCongViecInfos, CoQuanInfos = coQuanInfos, LinhVucCongViecId = hoso.LinhVucCongViecId, VanBanLienQuanViewModel = hoso.CongViecVanBanResults.ToList(), QuaTrinhXuLyViewModel = hoso.CongViecQuaTrinhXuLyResult.ToList(), NgayHetHan = hoso.NgayHetHan, NgayKhoiTao = hoso.NgayTao, NoiDungCongViec = hoso.NoiDung, TrangThaiCongViecId = hoso.TrangThaiCongViecId, UserPhuTrachId = hoso.UserPhuTrachId, UserXuLyChinhId = hoso.UserXuLyId, UsersPhoiHopId = hoso.CongViecPhoiHopResult.Select(x => x.UserId).ToArray(), DanhGiaCongViec = hoso.DanhGiaCongViec.HasValue ? (EnumDanhGiaCongViec)hoso.DanhGiaCongViec.Value : EnumDanhGiaCongViec.LEVEL0, JsonFiles = GetPathFiles(EnsureFolderCongViec(id)) }; return(View(model)); }
private IPagedList <HoSoCongViecResult> SearchAll(ValueSearchViewModel model) { var query = HoSoCongViecRepository.Find(model.ToValueSearch()); query.ToList().ForEach(x => { var folderCongViec = EnsureFolderCongViec(x.Id); x.JsonFiles = GetPathFiles(folderCongViec); }); return(query.ToPagedList(model.Page, TechOfficeConfig.PAGESIZE)); }
public JsonResult AddRecord(AddCongViecViewModel model) { return(ExecuteWithErrorHandling(() => { var data = new HoSoCongViecResult { CongViecPhoiHopResult = model.UsersPhoiHopId.Select(x => new CongViecPhoiHopResult { UserId = x }), CongViecQuaTrinhXuLyResult = model.QuaTrinhXuLyViewModel.Where(x => x.Gio != 0 && x.Phut != 0) .Select(x => new CongViecQuaTrinhXuLyResult { GioBanHanh = (byte)x.Gio, PhutBanHanh = (byte)x.Phut, NgayBanHanh = x.Ngay, NoiDung = x.NoiDung, NguoiThem = x.NguoiThem, NhacNho = (byte)x.NhacNho, IsDeleted = false }), CongViecVanBanResults = model.VanBanLienQuanViewModel.Where( x => x.CoQuanId.HasValue && x.CoQuanId != 0 && !string.IsNullOrEmpty(x.NoiDung)) .Select(x => new CongViecVanBanResult { SoVanBan = x.SoVanBan, NgayBanHanh = x.Ngay, NoiDung = x.NoiDung, CoQuanId = x.CoQuanId.Value }), NgayHetHan = model.NgayHetHan, NgayTao = model.NgayKhoiTao, LinhVucCongViecId = model.LinhVucCongViecId, UserPhuTrachId = model.UserPhuTrachId, UserXuLyId = model.UserXuLyChinhId, TrangThaiCongViecId = model.TrangThaiCongViecId, NoiDung = model.NoiDungCongViec, CreatedBy = UserName }; return ExecuteResult(() => { var saveResult = HoSoCongViecRepository.AddCongViecWithChildren(data); if (data.Id > 0) { ExecuteTryLogException(() => { MoveFiles(model.Guid, data.Id); }); } return saveResult; }); })); }
public JsonResult Detail(int id, EditCongViecViewModel model) { return(ExecuteWithErrorHandling(() => { var congViec = HoSoCongViecRepository.Single(id); //Get all van ban lien quan AddOrUpdateXuLy(id, model); AddOrUpdateVanBan(id, model); if (User.IsInRole(RoleConstant.LANHDAO)) { congViec.NgayHetHan = model.NgayHetHan; congViec.LinhVucCongViecId = model.LinhVucCongViecId; congViec.UserPhuTrachId = model.UserPhuTrachId; congViec.DanhGiaCongViec = model.DanhGiaCongViec == EnumDanhGiaCongViec.LEVEL0 ? null : (byte?)model.DanhGiaCongViec; congViec.UserXuLyId = model.UserXuLyChinhId; congViec.CongViecPhoiHopResult = model.UsersPhoiHopId?.Select(x => new CongViecPhoiHopResult { UserId = x, HoSoCongViecId = id }); } congViec.TrangThaiCongViecId = model.TrangThaiCongViecId; AddOrUpdatePhoiHop(id, congViec.CongViecPhoiHopResult); HoSoCongViecRepository.Update(congViec); return new JsonResult { JsonRequestBehavior = JsonRequestBehavior.AllowGet, Data = new { code = "SB01" } }; })); }
public ActionResult Summaries(InitValueStatictisSearchViewModel model) { var finds = HoSoCongViecRepository.Find(new ValueSearchCongViec { From = model.From, To = model.To, LinhVucCongViecId = model.LinhVucCongViecId, NoiDungCongViec = model.NoiDungCongViec, NoiDungVanBan = model.NoiDungVanBan, Role = model.VaiTroXuLy, SoVanBan = model.SoVanBan, TrangThaiCongViecId = model.TrangThaiCongViecId, NhanVienId = model.UserId, CoQuanId = model.CoQuanId }); var results = new List <SummariesCongViecResult>(); if (finds != null && finds.Any()) { finds.ToList().ForEach(x => { results.Add(new SummariesCongViecResult { NgayTao = x.NgayTao.ToString("dd/MM/yyyy"), NgayHetHan = x.NgayHetHan?.ToString("dd/MM/yyyy"), LinhVuc = x.LinhVucCongViec.Name, XuLyChinh = x.UserXyLy.HoVaTen, PhuTrach = x.UserPhuTrach.HoVaTen, TrangThai = x.TrangThaiCongViecInfo.IfNotNull(y => y.Name), PhoiHop = x.CongViecPhoiHopResult .Select(y => y.UserInfo != null ? y.UserInfo.HoVaTen : string.Empty).ToAggregate() }); }); } return(View(results)); }
public ActionResult Statistic(DateTime From, DateTime To) { var results = HoSoCongViecRepository.Statistic(From, To); return(View(results)); }