示例#1
0
        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));
        }
示例#2
0
        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));
        }
示例#3
0
        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;
                });
            }));
        }
示例#4
0
        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" }
                };
            }));
        }
示例#5
0
        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));
        }
示例#6
0
        public ActionResult Statistic(DateTime From, DateTime To)
        {
            var results = HoSoCongViecRepository.Statistic(From, To);

            return(View(results));
        }