public JsonResult AddYKien(int tacNghiepId, int coQuanId, string guid, string noiDung) { return(ExecuteWithErrorHandling(() => { return ExecuteResult(() => { var add = new TacNghiepYKienCoQuanResult { CoQuanId = coQuanId, TacNghiepId = tacNghiepId, NoiDung = noiDung, CreatedBy = UserName, }; //1. Save data to DB var save = YKienCoQuanRepository.Add(add); ExecuteTryLogException(() => { //2. Change status muc do hoan thanh TacNghiepTinhHinhThucHienRepository.UpdateIncrementMucDoHoanThanh(tacNghiepId, coQuanId, UserName, EnumMucDoHoanThanh.DANGTHUCHIEN); //3. Move files temp into the upload folder MoveFilesYKienCuaCacCoQuan(guid, tacNghiepId, add.Id); }); return save; }); })); }
public PartialViewResult NoiDungYKienCuaCacCoQuan(int id)//TacNghiepId { var result = YKienCoQuanRepository.GetByTacNghiepId(id); var user = AuthInfo(); if ((!User.IsInRole(RoleConstant.ADMIN) || !User.IsInRole(RoleConstant.SUPPER_ADMIN)) && !User.IsInRole(RoleConstant.PHONGNOIVU)) { result = result.Where(x => x.CoQuanId == user.CoQuanId); ExecuteTryLogException(() => { //Update Muc od hoan thanh la da xem TacNghiepTinhHinhThucHienRepository.UpdateIncrementMucDoHoanThanh(id, user.CoQuanId, user.UserName, EnumMucDoHoanThanh.DAXEM); }); } result.ToList().ForEach(x => { //Get files by yKienCoQuanId string path = EnsureFolderTacNghiepWithCoQuan(x.TacNghiepId, x.Id); x.JsonFiles = GetPathFiles(path); }); var model = new InitNoiDungYKienCuaCacCoQuanViewModel { CoQuanId = user.CoQuanId, TacNghiepId = id, CacYKienCuaCoQuanResult = result, }; return(PartialView("_PartialPageNoiDungYKien", model)); }
public JsonResult EditYKien(int id, string noiDung)//id y kien co quan { return(ExecuteWithErrorHandling(() => { var model = YKienCoQuanRepository.Single(id); model.NoiDung = noiDung; ExecuteTryLogException(() => { TacNghiepTinhHinhThucHienRepository.UpdateIncrementMucDoHoanThanh(model.TacNghiepId, model.CoQuanId, UserName, EnumMucDoHoanThanh.DANGTHUCHIEN); }); return ExecuteResult(() => { return YKienCoQuanRepository.Update(model); }); })); }