Пример #1
0
        // private void ConstructProjectStructureDocument (int projectStructureID, ProjectStructureDocumentDetails doc, ProjectStructureDocuments docdb) {
        //  if (docdb == null) {
        //      docdb = new ProjectStructureDocuments ();
        //  }

        //  docdb.ProjectStructureId = projectStructureID;
        //  docdb.FileName = docdb.FileName;
        //  docdb.FileType = docdb.FileType;
        //  docdb.Path = docdb.Path;
        // }

        public AssignStructureDtlsOnly GetAssignStructureDtlsById(ComponentQueryParam filterReq)
        {
            try {
                Structures structDetails         = _context.Structures.Include(x => x.StructureType).Where(x => x.Id == filterReq.StructId).FirstOrDefault();
                Project    projDB                = _context.Project.Include(x => x.Ic).Include(x => x.Bu).Where(x => x.Id == filterReq.ProjectId).FirstOrDefault();
                AssignStructureDtlsOnly response = new AssignStructureDtlsOnly();
                ProjectStructure        pStruct  = _context.ProjectStructure.Include(x => x.ProjectStructureDocuments).Include(x => x.Project).Include(x => x.Structure).Include(x => x.Structure.StructureType).Where(m => m.IsDelete == false && m.Structure.IsDelete == false && m.ProjectId == filterReq.ProjectId && m.StructureId == filterReq.StructId).FirstOrDefault();

                response.StrcutureTypeName = structDetails.StructureType.Name;
                if (pStruct != null)
                {
                    List <Component> lstComp = _context.Component.Include(x => x.CompType).Where(m => m.ProjStructId == pStruct.Id).ToList();
                    var responseMap          = _mapper.Map <AssignStructureDtlsOnly> (pStruct);
                    var responseMapComp      = _mapper.Map <List <ComponentDetails> > (lstComp);
                    responseMap.Components = responseMapComp;
                    response = responseMap;
                }
                else
                {
                    int    structCount = _context.ProjectStructure.Count() + 1;
                    string structId    = constantVal.StructureIdPrefix + structCount.ToString().PadLeft(6, '0');
                    response.StructureAttributes = structDetails.StructureAttributesDef;
                    response.StructureId         = structDetails.Id;
                    response.StructureCode       = structId;
                }
                response.ICName            = projDB.Ic.Name;
                response.BuName            = projDB.Bu.Name;
                response.StrcutureTypeName = structDetails.StructureType.Name;


                return(response);
            } catch (Exception ex) {
                throw ex;
            }
        }
Пример #2
0
        public AssignStructureDtlsOnly GetAssignStructureDtlsByProjStructId(int ProjStructId)
        {
            try
            {
                AssignStructureDtlsOnly response = _repository.GetAssignStructureDtlsByProjStructId(ProjStructId);

                return(response);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #3
0
        public AssignStructureDtlsOnly GetAssignStructureDtlsById(ComponentQueryParam queryFilter)
        {
            try
            {
                AssignStructureDtlsOnly response = _repository.GetAssignStructureDtlsById(queryFilter);

                return(response);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }