public ActionResult Add() { var init = InitModel(); var model = new AddCongViecViewModel { UsersInfos = init.UsersInfos, LinhVucCongViecInfos = init.LinhVucCongViecInfos, TrangThaiCongViecInfos = init.TrangThaiCongViecInfos, VanBanLienQuanViewModel = new List <InitVanBanViewModel> { new InitVanBanViewModel { CoQuanInfos = CoQuanRepository.GetAll().Select(x => x.ToDataInfo()) } }, QuaTrinhXuLyViewModel = new List <InitQuaTrinhXuLyViewModel> { new InitQuaTrinhXuLyViewModel { Gio = 0, Ngay = new DateTime(), NoiDung = string.Empty, NguoiThem = UserName } }, Guid = Guid.NewGuid().ToString() }; return(View(model)); }
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)); }
public PartialViewResult Edit(int id) { var nhom = NhomCoQuanRepository.GetAll().Select(x => x.ToDataInfo()); var data = CoQuanRepository.Single(id).ToDataViewModel().Update(u => { u.NhomCoQuanInfos = nhom; }); return(PartialView("Edit", data)); }
private InitTacNghiepViewModel CreateTacNghiepModel(int?nhomCoQuanId) { var model = new InitTacNghiepViewModel { LinhVucTacNghiepInfo = LinhVucTacNghiepRepository.GetAll().Select(x => x.ToDataInfo()), MucDoHoanThanhInfo = MucDoHoanThanhRepository.GetAll(), NhomCoQuanInfos = NhomCoQuanRepository.GetAll().Select(x => x.ToDataInfo()), }; //Check user has role allow select nhom co quan and co quan when statistic if (User.IsInRole(RoleConstant.ALLOW_SELECT)) { model.CoQuanInfos = nhomCoQuanId.HasValue ? CoQuanRepository.GetAllByNhomCoQuanId(nhomCoQuanId.Value).Select(x => x.ToDataInfo()).ToList() : new List <CoQuanInfo>(); } else { var user = AuthInfo(); model.NhomCoQuanId = user.CoQuanInfo.NhomCoQuanId; model.CoQuanId = user.CoQuanId; model.CoQuanInfos = new List <CoQuanInfo>() { user.CoQuanInfo }; } //end check return(model); }
public PartialViewResult CoQuanLienQuan(int?id) //id: tacNghiepId { var model = CoQuanRepository.GetAll().GroupBy(x => x.NhomCoQuan, x => x, (key, cq) => new InitCoQuanCoLienQuan { NhomCoQuan = key, CoQuanInfos = cq.Select(q => q.ToDataInfo()).ToList(), }); return(PartialView("_PartialPageGroupListBodies", model)); }
public async Task <JsonResult> DeleteConfirmed(int id) { return(await ExecuteWithErrorHandling(async() => { if (id == 0) { Response.StatusCode = (int)HttpStatusCode.BadRequest; return Json("Bad Request", JsonRequestBehavior.AllowGet); } return await ExecuteResultAsync(async() => await CoQuanRepository.DeleteByAsync(id)); })); }
public async Task <JsonResult> Create(CoQuanViewModel model) { return(await ExecuteWithErrorHandling(async() => { var result = model.ToDataResult <CoQuanResult>().Update(u => { u.NhomCoQuanId = model.NhomCoQuanId; u.CreatedBy = UserName; }); return await ExecuteResultAsync(async() => await CoQuanRepository.AddAsync(result)); })); }
public PartialViewResult List(int?page) { var nhom = NhomCoQuanRepository.GetAll().Select(x => x.ToDataInfo()); var items = CoQuanRepository.GetAll().Select(x => x.ToDataViewModel().Update(u => { u.NhomCoQuanInfos = nhom; u.NhomCoQuanInfo = NhomCoQuanRepository.GetById(x.NhomCoQuanId).ToDataInfo(); })).ToList(); var pageNumber = page ?? 1; return(PartialView(items.ToPagedList(pageNumber, TechOfficeConfig.PAGESIZE))); }
public async Task <JsonResult> Edit(int id, CoQuanViewModel model) { return(await ExecuteWithErrorHandling(async() => { var cv = model.ToDataResult <CoQuanResult>().Update(u => { u.Id = id; u.NhomCoQuanId = model.NhomCoQuanId; u.LastUpdatedBy = UserName; }); return await ExecuteResultAsync(async() => await CoQuanRepository.UpdateAsync(cv)); })); }
public ActionResult Create() { var cvs = ChucVuRepository.GetAll().Select(x => x.ToDataInfo()).ToList(); var roles = RoleRepository.GetAll().Select(x => x.ToRoleViewModel()).ToList(); var cqs = CoQuanRepository.GetAll().Select(x => x.ToDataInfo()).ToList(); var userInfo = new AddUserViewModel { RoleInfos = roles, ChucVuInfos = cvs, CoQuanInfos = cqs, }; return(View(userInfo)); }
public JsonResult GetCoQuanByNhomCoQuan(int nhomCoQuanId) { return(ExecuteWithErrorHandling(() => { var result = CoQuanRepository.GetAllByNhomCoQuanId(nhomCoQuanId); var jsonResult = result.Aggregate("<option selected='selected' value>Tất cả</option>", (current, item) => current + $"<option value={item.Id}>{item.Ten}</option>"); return new JsonResult { JsonRequestBehavior = JsonRequestBehavior.AllowGet, Data = jsonResult }; })); }
private ThuTucViewModel IniViewModel() { _listLinhVucThuTuc = LinhVucThuTucRepository.GetAll().OrderByDescending(x => x.Id); _listLinhVucThuTuc.ToList().ForEach(x => { x.Ten = string.Format("{0}{1}", GetNameMultiple(x), x.Ten); }); var data = new ThuTucViewModel { CoQuanInfos = CoQuanRepository.GetAll().Select(x => x.ToDataInfo()), LinhVucThuTucInfo = _listLinhVucThuTuc.OrderBy(x => x.Id).Select(x => x.ToDataInfo()), }; return(data); }
private InitThuTucViewModel CreateVanBanModel(string thuTucCongViec, int?coQuanId, int?linhVucCongViecId) { var model = new InitThuTucViewModel { LinhVucThuTucInfo = LinhVucThuTucRepository.GetAll().Select(x => x.ToDataInfo()), CoQuanInfos = CoQuanRepository.GetAll().Select(x => x.ToDataInfo()), ValueSearch = new ValueSearchViewModel { ThuTucCongViec = thuTucCongViec, CoQuanId = coQuanId, LinhVucThuTucId = linhVucCongViecId, Page = 1, }, }; return(model); }
public ActionResult StatisticAndSearch() { //var items = HoSoCongViecRepository.Statistic(); //get list users belong phongnoivu var users = UserRepository.GetUsersByCoQuanId(TechOfficeConfig.IDENTITY_PHONGNOIVU).Select(x => x.ToDataInfo()); var linhVucs = LinhVucCongViecRepository.GetAll().Select(x => x.ToDataInfo()); var coquan = CoQuanRepository.GetAll().Select(x => x.ToDataInfo()); var trangThaiCongViecs = TrangThaiCongViecRepository.GetAll().Select(x => x.ToDataInfo()); var model = new InitValueStatictisSearchViewModel { From = DateTime.Now.AddMonths(-1), To = DateTime.Now, UserInfoNoiVu = users, LinhVucCongViecInfos = linhVucs, CoQuanInfos = coquan, TrangThaiCongViecInfos = trangThaiCongViecs }; return(View(model)); }
public ActionResult Edit(int id) { var user = UserRepository.Single(id); var chucvu = ChucVuRepository.GetAll().Select(x => x.ToDataInfo()); var coQuan = CoQuanRepository.GetAll().Select(x => x.ToDataInfo()); var userRole = UserRoleRepository.GetRolesByUserId(id); var roles = RoleRepository.GetAll().ToList(); roles.ForEach(x => { userRole.ToList().ForEach(y => { if (y.RoleId == x.Id) { x.IsChecked = true; } }); }); AddUserViewModel model = new AddUserViewModel { Id = user.Id, FullName = user.HoVaTen, UserName = user.UserName, IsLocked = user.IsLocked, ChucVuId = user.ChucVuId, ChucVuInfos = chucvu, CoQuanId = user.CoQuanId, CoQuanInfos = coQuan, CreateDate = user.CreateDate, CreatedBy = user.CreatedBy, RoleInfos = roles.Select(x => x.ToRoleViewModel()).ToList(), }; return(View(model)); }