public void UpdateEmployeeDocument(EmployeeDocumentDTO Record) { EmployeeDocument ReturnRecord = EmployeeDocumentRequestFormatter.ConvertRespondentInfoFromDTO(Record); //ReturnRecord.DocumentEmpCode = Record.DocumentEmpCode; _unitOfWork.EmployeeDocumentRepository.Update(ReturnRecord); }
public EmployeeDocumentDTO GetOneEmployeeDocument(int Id) { EmployeeDocument Record = _unitOfWork.EmployeeDocumentRepository.Get(x => x.DocumentId == Id).FirstOrDefault(); EmployeeDocumentDTO ReturnRecord = ResponseFormatters.EmployeeDocumentResponseFormatter.EmplyeeFamilyDbToDTO(Record); return(ReturnRecord); }
public static List <EmployeeDocumentDTO> EmplyoeeFamilyDbListToDTOList(List <EmployeeDocument> ModelData) { List <EmployeeDocumentDTO> ReturnRecord = new List <EmployeeDocumentDTO>(); foreach (EmployeeDocument Row in ModelData) { EmployeeDocumentDTO Record = new EmployeeDocumentDTO { DocumentCatId = Row.DocumentCatId, DocumentCreatedAt = Row.DocumentCreatedAt, DocumentEmpCode = Row.DocumentEmpCode, DocumentId = Row.DocumentId, DocumentOnlyAdmin = Row.DocumentOnlyAdmin, DocumentRemarks = Row.DocumentRemarks, DocumentTitle = Row.DocumentTitle, DocumentVerified = Row.DocumentVerified, Employee = new EmployeeDTO { EmpCode = Row.Employee.EmpCode, EmpName = Row.Employee.EmpName }, DocumentCategory = new DocumentCategoryDTO { CatId = Row.DocumentCategory.CatId, CatTitle = Row.DocumentCategory.CatTitle } }; ReturnRecord.Add(Record); } return(ReturnRecord); }
public ActionResult Update(int id) { EmployeeDocumentDTO Record = new EmployeeDocumentDTO(); Record = _employeeDocumentService.GetOneEmployeeDocument(id); Record.DocumentCategorySelectlist = _employeeDocumentService.GetDocumentCategorySelectList(); return(View("../Employee/Document/Update", Record)); }
//[Route("Document/Add/{id}")] public ActionResult Add(int Id) { ViewBag.SideBar = _moduleService.AdminEmployeeDetailsMenu(Id); EmployeeDocumentDTO Record = new EmployeeDocumentDTO(); Record.DocumentCategorySelectlist = _employeeDocumentService.GetDocumentCategorySelectList(); Record.DocumentEmpCode = Id; return(View("../Employee/Document/Add", Record)); }
public ActionResult Delete(int id) { //ViewBag.SideBar = _moduleService.AdminEmployeeDetailsMenu(id); EmployeeDocumentDTO Record = new EmployeeDocumentDTO(); try { Record.DocumentEmpCode = _employeeDocumentService.GetEmpCode(id); _employeeDocumentService.DeleteDocument(id); Session["Success"] = "Successfully Deleted Employee Document"; } catch (Exception Exception) { ViewBag.Error = Exception.Message; } return(RedirectToAction("Index", "Document", new { id = Record.DocumentEmpCode })); }
public static EmployeeDocument ConvertRespondentInfoFromDTO(EmployeeDocumentDTO empDocDTO) { Mapper.CreateMap <EmployeeDocumentDTO, EmployeeDocument>().ConvertUsing( m => { return(new EmployeeDocument { DocumentCatId = m.DocumentCatId, DocumentCreatedAt = m.DocumentCreatedAt, DocumentEmpCode = m.DocumentEmpCode, DocumentId = m.DocumentId, DocumentOnlyAdmin = m.DocumentOnlyAdmin, DocumentRemarks = m.DocumentRemarks, DocumentTitle = m.DocumentTitle, DocumentVerified = m.DocumentVerified, }); }); return(Mapper.Map <EmployeeDocumentDTO, EmployeeDocument>(empDocDTO)); }
public static EmployeeDocumentDTO EmplyeeFamilyDbToDTO(EmployeeDocument ModelData) { EmployeeDocumentDTO Record = new EmployeeDocumentDTO { DocumentCatId = ModelData.DocumentCatId, DocumentCreatedAt = ModelData.DocumentCreatedAt, DocumentEmpCode = ModelData.DocumentEmpCode, DocumentId = ModelData.DocumentId, DocumentOnlyAdmin = ModelData.DocumentOnlyAdmin, DocumentRemarks = ModelData.DocumentRemarks, DocumentTitle = ModelData.DocumentTitle, DocumentVerified = ModelData.DocumentVerified, Employee = new EmployeeDTO { EmpCode = ModelData.Employee.EmpCode, EmpName = ModelData.Employee.EmpName, } }; return(Record); }
public ActionResult Update(int id, EmployeeDocumentDTO Record) { Record.DocumentCategorySelectlist = _employeeDocumentService.GetDocumentCategorySelectList(); try { if (ModelState.IsValid) { _employeeDocumentService.UpdateEmployeeDocument(Record); Session["Success"] = "Successfully Updated Employee Document"; return(RedirectToAction("Index", "Document", new { id = Record.DocumentEmpCode })); } else { ViewBag.Error = "Form Error"; } } catch (Exception Exception) { ViewBag.Error = Exception.Message; } return(View("../Employee/Document/Update", Record)); }
public ActionResult Add(int id, EmployeeDocumentDTO data, HttpPostedFileBase file) { data.DocumentEmpCode = id; data.DocumentCategorySelectlist = _employeeDocumentService.GetDocumentCategorySelectList(); ModelState.Clear(); try { if (ModelState.IsValid) { if (file.ContentLength > 0) { var fileName = Path.GetFileName(file.FileName); var path = Path.Combine(Server.MapPath("~\\Uploads\\") + data.DocumentEmpCode); var savepath = Path.Combine(Server.MapPath("~\\Uploads\\") + data.DocumentEmpCode, fileName); Directory.CreateDirectory(path); file.SaveAs(savepath); data.DocumentTitle = fileName; } data.DocumentCreatedAt = DateTime.Now; data.DocumentOnlyAdmin = true; data.DocumentVerified = true; _employeeDocumentService.InsertEmployeeDocument(data); Session["Success"] = "Successfully Added Employee Document"; return(RedirectToAction("Index/" + id)); } else { ViewBag.Error = "Form Error"; } } catch (Exception Exception) { ViewBag.Error = Exception.Message; } return(View("../Employee/Document/Add", data)); }
public EmployeeDocumentDTO InsertEmployeeDocument(EmployeeDocumentDTO Record) { EmployeeDocument ReturnRecord = EmployeeDocumentRequestFormatter.ConvertRespondentInfoFromDTO(Record); return(EmployeeDocumentRequestFormatter.ConvertRespondentInfoToDTO(_unitOfWork.EmployeeDocumentRepository.Create(ReturnRecord))); }