public Root <EditAllocationStructureResultDto> EditAllocationStructure([FromUri] EditAllocationStructureResultDto editAllocationStructureResultDto) { var list = new List <EditAllocationStructureResultDto>(); var value = _editDataPortalService.EditAllocationStructure(editAllocationStructureResultDto); list.Add(value); return(new Root <EditAllocationStructureResultDto> { Items = list }); }
public EditAllocationStructureResultDto EditAllocationStructure(EditAllocationStructureResultDto editAllocationStructureResultDto) { var employeeMembership = EmployeeMembershipRepository.Load(editAllocationStructureResultDto.EmployeeMembershipId); var section = new B_Section(); var organizationalCell = new B_OrganizationalCell(); var organizationalUnit = new B_OrganizationalUnit(); var employee = new B_Employee(); section.SetId(editAllocationStructureResultDto.SectionId); organizationalUnit.SetId(editAllocationStructureResultDto.OrganizationalUnitId); organizationalCell.SetId(editAllocationStructureResultDto.OrganizationalCellId); employee.SetId(editAllocationStructureResultDto.DirectSupervisorId); if (editAllocationStructureResultDto.SectionId == 0) { section = null; } if (editAllocationStructureResultDto.OrganizationalCellId == 0) { organizationalCell = null; } if (editAllocationStructureResultDto.OrganizationalUnitId == 0) { organizationalUnit = null; } if (editAllocationStructureResultDto.DirectSupervisorId == 0) { employee = null; } employeeMembership.Position = editAllocationStructureResultDto.Position; employeeMembership.Section = section; employeeMembership.OrganizationalCell = organizationalCell; employeeMembership.OrganizationalUnit = organizationalUnit; employeeMembership.DirectSupervisor = employee; EmployeeMembershipRepository.SaveAndFlush(employeeMembership, editAllocationStructureResultDto.UserId); editAllocationStructureResultDto.Success = true; return(editAllocationStructureResultDto); }
protected void btn_Save_Click(object sender, EventArgs e) { var editAllocationStructureResultDto = new EditAllocationStructureResultDto() { EmployeeMembershipId = Convert.ToInt32(hf_EmployeeMembershipId.Value), Position = tb_PositionTable.Text, SectionId = Convert.ToInt32(ddl_Section.SelectedValue), OrganizationalUnitId = Convert.ToInt32(ddl_OrganizationalUnit.SelectedValue), OrganizationalCellId = Convert.ToInt32(ddl_OrganizationalCell.SelectedValue), DirectSupervisorId = Convert.ToInt32(hf_DirectSupervisorId.Value), }; var result = PageMethodsHelper.InvokeWebAPI <EditAllocationStructureResultDto>( WebAPIVariables.editAllocationStructure, PageMethodsHelper.ObjectToUrlParam(editAllocationStructureResultDto)).FirstOrDefault(); if (result.Success) { pnl_SuccessMessage.Visible = true; pnl_SuccessMessage.Style.Clear(); pnl_SuccessMessage.Style.Add("display", "inline"); } }