public void Employee201Update(Guid employeeId, Employee201Model model) { using (TransactionScope ts = new TransactionScope()) { var emp = this._repoEmployee.Query().Filter(x => x.id == employeeId).Include(x => x.mf_Employee201).Get().FirstOrDefault(); var data = emp.mf_Employee201; var userId = this.GetCurrentUserId(); UpdateEntity <Employee201Model, mf_Employee201> uptEnt; if (data == null) { uptEnt = this._repoEmployee201.PrepareEntity(model); uptEnt.Insert(); } else { uptEnt = this._repoEmployee201.UpdateFromModel(data, model); uptEnt.Update(); } uptEnt.MatchAllDataField() .SetValue(x => x.updatedBy, userId) .SetValue(x => x.updatedDate, DateTime.Now); var entity = uptEnt.GetEntity(); this._unitOfWork.Save(); emp.employee201Id = entity.id; this._repoEmployee.Update(emp); this._unitOfWork.Save(); ts.Complete(); } }
public ActionResult GetEmployee201File(Guid id) { var model = this._employeeService.Employee201FileGetByEmployeeId(id); if (model == null) { model = new Employee201Model(); } model.employeeId = id; this.PrepareEmployee201FileModel(model); return(PartialView("_Employee201File", model)); }
private void PrepareEmployee201FileModel(Employee201Model model) { model.EmploymentStatusList = this._employmentStatusService.GetQuery().Select(x => new DataReference() { value = x.id.Value, description = x.description }).ToList(); model.EmploymentTypeList = this._employmentTypeService.GetQuery().Select(x => new DataReference() { value = x.id.Value, description = x.description }).ToList(); model.PositionLevelList = this._enumReferenceService.GetQuery(ReferenceList.POSITION_LEVEL).ToList(); model.PayRateTypeList = this._enumReferenceService.GetQuery(ReferenceList.PAY_RATE_TYPE).ToList(); model.TaxStatusList = this._enumReferenceService.GetQuery(ReferenceList.TAX_STATUS).ToList(); }
public ActionResult AjaxUpdateEmployee201(Employee201Model model, Guid employeeId) { try { if (ModelState.IsValid) { this._employeeService.Employee201Update(employeeId, model); } } catch (Exception ex) { this.AddModelError(ex); } return(this.JsonResultWithModelStateInfo(successMsg: "Employee 201 File successfully saved.")); }