예제 #1
0
 public IActionResult GetStructureListCode([FromQuery] DispatchStructureCodePayload dispatachRequirement)
 {
     try
     {
         var response = _siteDispatchService.GetStructureListCodesByDispId(dispatachRequirement);
         return(Ok(response));
     }
     catch (Exception e)
     {
         Util.LogError(e);
         return(StatusCode(StatusCodes.Status500InternalServerError, new ErrorClass()
         {
             code = StatusCodes.Status500InternalServerError.ToString(), message = "Something went wrong"
         }));
     }
 }
예제 #2
0
 public List <StructureListCode> GetStructureListCodesByDispId(DispatchStructureCodePayload dispatchRequirement)
 {
     try {
         List <StructureListCode> result = new List <StructureListCode> ();
         if (dispatchRequirement.role_hierarchy == commonEnum.Rolename.PROCUREMENT)
         {
             var structureListCodes = _context.Query <StructureListCode> ().FromSqlRaw("select ps.Id as Id,ps.struct_code as StructureId,s.name as StructureName from dispatch_requirement dr inner join disp_req_structure drs on dr.id  = drs.dispreq_id inner join project_structure ps on drs.proj_struct_id =ps.id  inner join structures s on ps.structure_id =s.id where dispreq_id = {0}", dispatchRequirement.dispReqId).ToList();
             result = _mapper.Map <List <StructureListCode> > (structureListCodes);
         }
         else if (dispatchRequirement.role_hierarchy == commonEnum.Rolename.VENDOR)
         {
             var structureListCodes = _context.Query <StructureListCode> ().FromSqlRaw("select ps.Id as Id,ps.struct_code as StructureId,s.name as StructureName from dispatchreq_subcont drs inner join disp_subcont_structure dss on drs.id  = dss.dispreqsubcont_id inner join project_structure ps on dss.proj_struct_id =ps.id inner join structures s on ps.structure_id =s.id where drs.dispreq_id ={0}", dispatchRequirement.dispReqId).ToList();
             result = _mapper.Map <List <StructureListCode> > (structureListCodes);
         }
         return(result);
     } catch (Exception ex) {
         throw ex;
     }
 }
        public List <StructureListCode> GetStructureListCodesByDispId(DispatchStructureCodePayload dispatchRequirement)
        {
            List <StructureListCode> structureListCodes = _siteDispatchRepository.GetStructureListCodesByDispId(dispatchRequirement);

            return(structureListCodes);
        }