Ejemplo n.º 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;
            }
        }
        public void DeleteMasterWillDeleteLocalMasterFileIfExists()
        {
            var masterLocation = masterPath + "Master.txt";

            // Closes the file after creating it
            File.Create(masterLocation).Dispose();

            var project = new ProjectStructure()
            {
                Id             = ObjectId.GenerateNewId().ToString(),
                TimeOfCreation = DateTime.Now.ToString(),
                Progress       = ProjectStructure.Types.State.Completed,
                MasterLocation = masterLocation
            };

            MockMakerClient.Setup(x => x.ReadProject(It.IsAny <string>())).Returns(new ProjectResponse {
                Project = project
            });
            MockMakerClient.Setup(x => x.DeleteProject(It.IsAny <string>())).Returns(new ProjectResponse {
                Error = "Error"
            });

            var model = new DeleteProjectModel(masterPath, mosaicPath);

            model.DeleteProject(MockMakerClient.Object, ObjectId.GenerateNewId().ToString());
            Assert.IsFalse(File.Exists(masterLocation));
        }
Ejemplo n.º 3
0
        private ProjectStructure CreateProjectStructureHelper(bool SmallAdded, bool LargeAdded, bool Completed)
        {
            var project = new ProjectStructure()
            {
                Id             = ObjectId.GenerateNewId().ToString(),
                Progress       = ProjectStructure.Types.State.Created,
                TimeOfCreation = DateTime.Now.ToString()
            };

            if (SmallAdded)
            {
                project.Progress = ProjectStructure.Types.State.Smalladded;
                var smallTileIds = new List <string>()
                {
                    "1", "2", "3"
                };
                project.SmallFileIds.Add(smallTileIds);
            }
            if (LargeAdded)
            {
                project.MasterLocation = "//MasterLocation//";
                project.LargeFileId    = ObjectId.GenerateNewId().ToString();
                project.Progress       = ProjectStructure.Types.State.Largeadded;
            }
            if (Completed)
            {
                project.MosaicLocation = "//MosaicLocation//";
                project.Progress       = ProjectStructure.Types.State.Completed;
            }
            return(project);
        }
Ejemplo n.º 4
0
        /*
         * Runs the program.
         */
        public static void Main(string[] args, int serverPort, Func <ProjectStructure, EditorWindow> initializeWindowFunction)
        {
            // Get the project structure.
            var projectStructure = ProjectStructureFinder.FindProjectStructure(Directory.GetCurrentDirectory(), args);

            if (projectStructure == null)
            {
                Console.WriteLine("No project structure was found in the directory or parent directories.");
                projectStructure = new ProjectStructure(new NullStructure(Directory.GetCurrentDirectory()), Directory.GetCurrentDirectory());
            }

            // Create the request handler.
            var requestHandler = new RequestHandler();
            var sessions       = new SessionStorage();

            requestHandler.RegisterHandler("POST", "/connect", new ConnectRequestHandler(sessions, projectStructure, initializeWindowFunction));
            requestHandler.RegisterHandler("POST", "/attach", new AttachRequestHandler(sessions));
            requestHandler.RegisterHandler("POST", "/detach", new DetachRequestHandler(sessions));
            requestHandler.RegisterHandler("POST", "/disconnect", new DisconnectRequestHandler(sessions));
            requestHandler.RegisterHandler("POST", "/openscript", new OpenScriptRequestHandler(sessions));
            requestHandler.RegisterHandler("GET", "/session", new SessionRequestHandler(sessions));
            requestHandler.RegisterHandler("GET", "/readscript", new ReadScriptRequestHandler(sessions));

            // Output the starter information.
            Console.WriteLine("Serving on port " + serverPort);
            Console.WriteLine("\tProject type: " + projectStructure.GetName());
            Console.WriteLine("\tProject directory: " + projectStructure.GetProjectDirectory());

            // Create and start the web server.
            var server = new HttpServer(serverPort, requestHandler);

            server.Start();
        }
Ejemplo n.º 5
0
        private ProjectStructure UpdateReadOnlyProperties(IMongoDatabase db, ProjectStructure response)
        {
            var smallFileIds = ReadSmallFieldIds(db, response.Id);

            if (smallFileIds != null && smallFileIds.Count() > 0)
            {
                response.SmallFileIds.AddRange(smallFileIds);
            }

            return(response);
        }
Ejemplo n.º 6
0
 public Elem(string name,DBModelDtoBase obj ,ElemType type,ref ProjectStructure structure)
 {
     Name = name;
     Type = type;
     Object = obj;
     Children = new List<Elem>();
     if(Type ==  ElemType.Folder)
     {
         Folder = (FolderDto) obj;
         Children = Elem.GetFilesFromFolder(ref structure, (FolderDto)Object);
         var folders = Elem.GetFoldersFromFolder(ref structure, (FolderDto) Object);
         Children.AddRange(folders);
     }
 }
Ejemplo n.º 7
0
        public ResponseMessage AddStructurecomponent(ADDStructureComponentDetails input)
        {
            try
            {
                ResponseMessage  responseMessage = new ResponseMessage();
                ProjectStructure structid        =
                    _context.ProjectStructure.Single(w => w.Id == input.ProjectStructureId);

                structid.ActualWbs       = input.ActualWbs;
                structid.FabricationYear = input.FabricationYear;
                structid.ActualWeight    = input.ActualWeight;
                structid.Reusuability    = input.Reusuability;
                structid.ExpReleaseDate  = input.ExpReleaseDate;
                if (input.uploadDocs != null)
                {
                    foreach (IFormFile file in input.uploadDocs)
                    {
                        Upload_Docs layerDoc = new Upload_Docs();
                        layerDoc.fileName   = file.FileName;
                        layerDoc.filepath   = UploadedFile(file);
                        layerDoc.uploadType = "Docs";
                        layerDoc.fileType   = Path.GetExtension(file.FileName);
                        this._repository.StructureDocsUpload(layerDoc, input.ProjectStructureId);
                        //  _gridRepo.LayerDocsUpload(layerDoc, layerId);
                    }
                }
                RemoveStructureDocs(input.remove_docs_filename);


                DispatchRequirement DispatchRequirement =
                    _context.DispatchRequirement.Single(w => w.Id == input.DispatchRequirementId);
                if (DispatchRequirement != null)
                {
                    DispatchRequirement.Status         = Util.GetDescription(commonEnum.SiteDispStructureStatus.FABRICATIONCOMPLETED).ToString();
                    DispatchRequirement.StatusInternal = Util.GetDescription(commonEnum.SiteDispStructureStatus.FABRICATIONCOMPLETED).ToString();
                }
                _context.ProjectStructure.Update(structid);
                _context.DispatchRequirement.Update(DispatchRequirement);

                _context.SaveChanges();

                responseMessage.Message = "ProjectStructure Updated sucessfully";
                return(responseMessage);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 8
0
 public ProjectCardModel(IMakerClient client, ProjectStructure project)
 {
     ProjectId      = project.Id;
     TileImageCount = project.SmallFileIds.Count;
     State          = project.Progress;
     MasterLocation = project.MasterLocation;
     MosaicLocation = project.MosaicLocation;
     TimeOfCreation = project.TimeOfCreation;
     if (!String.IsNullOrEmpty(project.LargeFileId))
     {
         var imageFile = client.ReadImageFile(project.LargeFileId);
         MasterFileName = imageFile?.File?.FileName;
     }
     // Tests for wrong id and whether assigning values are not null or empty
 }
Ejemplo n.º 9
0
        public int AddSurplus(AddSurplus surplusDetails)
        {
            ResponseMessage response = new ResponseMessage();

            using (var transaction = _context.Database.BeginTransaction()) {
                try {
                    // if (_context.SiteDeclaration.Where(x => x.StructId == surplusDetails.DispStructId && x.SitereqId == surplusDetails.SiteReqId).Count() > 0)
                    // {
                    //  throw new ValueNotFoundException("Structure Id already declared as surplus.");
                    // }
                    // else
                    {
                        SiteDeclaration surplusDb = _mapper.Map <SiteDeclaration> (surplusDetails);
                        surplusDb.CreatedAt      = DateTime.Now;
                        surplusDb.UpdatedBy      = 1; //TODO;
                        surplusDb.Status         = Util.GetDescription(commonEnum.SurPlusDeclSatus.NEW).ToString();
                        surplusDb.StatusInternal = Util.GetDescription(commonEnum.SurPlusDeclSatus.NEW).ToString();
                        surplusDb.CreatedAt      = DateTime.Now;
                        surplusDb.CreatedBy      = 1; //TODO
                        surplusDb.RoleId         = 4; //TODO
                        // surplusDb.SitereqId = 11;
                        _context.SiteDeclaration.Add(surplusDb);
                        _context.SaveChanges();

                        SitedeclStatusHistory siteStatusHist = new SitedeclStatusHistory();
                        siteStatusHist.SitedecId      = surplusDb.Id;
                        siteStatusHist.RoleId         = surplusDb.RoleId;
                        siteStatusHist.SitedecId      = surplusDb.SitereqId;
                        siteStatusHist.Status         = surplusDb.Status;
                        siteStatusHist.Notes          = "";
                        siteStatusHist.StatusInternal = surplusDb.StatusInternal;
                        siteStatusHist.UpdatedAt      = DateTime.Now;
                        siteStatusHist.UpdatedBy      = 1; //TODO;
                        _context.SitedeclStatusHistory.Add(siteStatusHist);
                        _context.SaveChanges();

                        ProjectStructure projStructDB = _context.ProjectStructure.Where(x => x.Id == surplusDetails.ProjStructId).FirstOrDefault();
                        projStructDB.CurrentStatus = Util.GetDescription(commonEnum.StructureInternalStatus.SURPLUSINITIATED).ToString();
                        _context.SaveChanges();
                        transaction.Commit();
                        return(surplusDb.Id);
                    }
                } catch (Exception ex) {
                    transaction.Rollback();
                    throw ex;
                }
            }
        }
Ejemplo n.º 10
0
        public ProjectResponse Create(IMongoDatabase db)
        {
            var request = new ProjectStructure()
            {
                Id             = ObjectId.GenerateNewId().ToString(),
                TimeOfCreation = DateTime.Now.ToString(),
                Progress       = ProjectStructure.Types.State.Created,
            };
            var collection = db.GetCollection <ProjectStructure>("Project");

            collection.InsertOne(request);
            return(new ProjectResponse()
            {
                Project = request
            });
        }
Ejemplo n.º 11
0
        public int UpsertProjectStructure(AssignStructureComponentDetails request)
        {
            ResponseMessage response = new ResponseMessage();

            response.Message = "Structure-compoennet assigned succusfully";
            // if (request?.ProjectStructureDetail == null)
            //  throw new ValueNotFoundException ("ProjectStructureDetail Request cannot be empty.");

            try {
                using (var transaction = _context.Database.BeginTransaction()) {
                    try {
                        var isUpdate           = false;
                        var projectStructureID = 0;
                        var projectStructure   = _context.ProjectStructure.Where(x => x.StructureId == request.StructureId && x.ProjectId == request.ProjectId && x.IsDelete == false).FirstOrDefault();
                        if (request.ProjectStructureId != null)
                        {
                            projectStructure = _context.ProjectStructure.Where(x => x.Id == request.ProjectStructureId && x.IsDelete == false).FirstOrDefault();
                        }

                        if (projectStructure != null)
                        {
                            projectStructure   = ConstructProjectStructure(request, projectStructure);
                            projectStructureID = projectStructure.Id;
                            isUpdate           = true;
                            _context.SaveChanges();
                        }
                        else
                        {
                            ProjectStructure projStructdb = null;
                            projStructdb = ConstructProjectStructure(request, projStructdb);
                            projStructdb.StructureStatus = Util.GetDescription(commonEnum.StructureStatus.AVAILABLE).ToString();
                            projStructdb.CurrentStatus   = Util.GetDescription(commonEnum.StructureInternalStatus.NEW).ToString();
                            _context.ProjectStructure.Add(projStructdb);
                            _context.SaveChanges();
                            projectStructureID = projStructdb.Id;
                        }
                        transaction.Commit();
                        return(projectStructureID);
                    } catch (Exception ex) {
                        transaction.Rollback();
                        throw ex;
                    }
                }
            } catch (Exception ex) {
                throw ex;
            }
        }
Ejemplo n.º 12
0
        public ResponseMessage AddStructureCost(ADDStructureCost input)
        {
            try
            {
                ResponseMessage  responseMessage = new ResponseMessage();
                ProjectStructure structid        =
                    _context.ProjectStructure.Single(w => w.Id == input.ProjectStructureId);
                DispReqStructure dispstructid =
                    _context.DispReqStructure.Single(w => w.ProjStructId == input.ProjectStructureId);

                dispstructid.FabriacationCost = input.Cost;
                DispFabricationCost fabrcost = new DispFabricationCost();
                fabrcost.DispatchNo      = input.DispatchNo;
                fabrcost.DispReqId       = input.DispatchRequirementId;
                fabrcost.DispStructureId = input.DispatchRequirementStructureId;
                fabrcost.Status          = Util.GetDescription(commonEnum.StructureStatus.NEW).ToString();
                fabrcost.StatusInternal  = Util.GetDescription(commonEnum.StructureStatus.NEW).ToString();
                _context.DispFabricationCost.Add(fabrcost);
                _context.DispReqStructure.Update(dispstructid);
                _context.SaveChanges();

                if (input.uploadDocs != null)
                {
                    foreach (IFormFile file in input.uploadDocs)
                    {
                        Upload_Docs layerDoc = new Upload_Docs();
                        layerDoc.fileName   = file.FileName;
                        layerDoc.filepath   = UploadedFile(file);
                        layerDoc.uploadType = "Docs";
                        layerDoc.fileType   = Path.GetExtension(file.FileName);
                        this._repository.StructureDocsUpload(layerDoc, input.ProjectStructureId);
                        //  _gridRepo.LayerDocsUpload(layerDoc, layerId);
                    }
                }
                RemoveStructureDocs(input.remove_docs_filename);

                _context.SaveChanges();

                responseMessage.Message = "Structure Cost Updated sucessfully";
                return(responseMessage);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 13
0
        public ProjectResponse InsertSmallFiles(IMongoDatabase db, ProjectInsertSmallFilesRequest request)
        {
            if (request.SmallFileIds == null || request.SmallFileIds.Count == 0)
            {
                return(new ProjectResponse()
                {
                    Error = "File ids cannot be null or empty"
                });
            }

            // Reads the projects with specified id in the db
            var readRequest = new ProjectRequest()
            {
                Id = request.Id
            };
            var project = Read(db, readRequest).Project;

            var collection = db.GetCollection <ProjectStructure>("Project");

            project.SmallFileIds.AddRange(request.SmallFileIds.Where(x => !project.SmallFileIds.Contains(x)));
            UpdateDefinition <ProjectStructure> update;

            //Deals with going back in the workflow
            //Only update the state if not gone backwards in project workflow
            if (project.Progress == ProjectStructure.Types.State.Largeadded)
            {
                update = Builders <ProjectStructure> .Update.Set(x => x.SmallFileIds, project.SmallFileIds)
                         .Set(x => x.Progress, ProjectStructure.Types.State.Smalladded);
            }
            else
            {
                update = Builders <ProjectStructure> .Update.Set(x => x.SmallFileIds, project.SmallFileIds);
            }

            var updateResponse = collection.UpdateOne(x => x.Id.Equals(request.Id), update);
            var response       = new ProjectStructure()
            {
                Id = request.Id
            };

            response.SmallFileIds.AddRange(request.SmallFileIds);
            return(new ProjectResponse()
            {
                Project = response
            });
        }
Ejemplo n.º 14
0
        public ResponseMessage UpdateFabricationStatus(FabricationVm input)
        {
            try
            {
                ResponseMessage  responseMessage = new ResponseMessage();
                ProjectStructure ProjectStruct   =
                    _context.ProjectStructure.Single(w => w.Id == input.projectstructreId);
                if (ProjectStruct != null)
                {
                    ProjectStruct.StructureStatus = Util.GetDescription(commonEnum.StructureStatus.NOTAVAILABLE).ToString();
                    ProjectStruct.CurrentStatus   = Util.GetDescription(commonEnum.StructureInternalStatus.INUSE).ToString();
                }
                _context.ProjectStructure.Update(ProjectStruct);


                DispReqStructure dispReqStr =
                    _context.DispReqStructure.Single(w => w.Id == input.DisptachRequiremntstructureId);
                if (dispReqStr != null)
                {
                    dispReqStr.DispStructStatus = Util.GetDescription(commonEnum.SiteDispStructureStatus.SCANNED).ToString();
                    dispReqStr.Location         = input.Location;
                }
                _context.DispReqStructure.Update(dispReqStr);

                DispatchRequirement disprequirement =
                    _context.DispatchRequirement.Single(w => w.Id == input.DispatchRequiremntId);
                if (disprequirement != null)
                {
                    disprequirement.Status         = Util.GetDescription(commonEnum.SiteDispatchSatus.PARTIALLYSCANNED).ToString();
                    disprequirement.StatusInternal = Util.GetDescription(commonEnum.SiteDispatchSatus.PARTIALLYSCANNED).ToString();
                    _context.DispatchRequirement.Update(disprequirement);

                    _context.SaveChanges();
                }


                responseMessage.Message = "Status   Updated sucessfully";
                return(responseMessage);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 15
0
    void OnGUI()
    {
        EditorGUILayout.BeginHorizontal();
        _folders = EditorGUILayout.ObjectField("", _folders, typeof(ScriptableObject), true) as ProjectStructure;
        EditorGUILayout.EndHorizontal();

        if (GUILayout.Button("Generate Project Folders"))
        {
            if (_folders == null)
            {
                ShowNotification(new GUIContent("No asset provided"));
            }
            else
            {
                ShowNotification(new GUIContent("Generating Folders. This action may take some time"));
                GenerateFolderss(_folders.Assets, 0, "Assets");
            }
        }
    }
        public void DeleteProjectWillReturnErrorIfProjectCannotBeDeleted()
        {
            var project = new ProjectStructure()
            {
                Id             = ObjectId.GenerateNewId().ToString(),
                TimeOfCreation = DateTime.Now.ToString(),
                Progress       = ProjectStructure.Types.State.Completed,
            };

            MockMakerClient.Setup(x => x.ReadProject(It.IsAny <string>())).Returns(new ProjectResponse {
                Project = project
            });
            MockMakerClient.Setup(x => x.DeleteProject(It.IsAny <string>())).Returns(new ProjectResponse {
                Error = "Error"
            });

            var model = new DeleteProjectModel();

            model.DeleteProject(MockMakerClient.Object, ObjectId.GenerateNewId().ToString());
            Assert.IsFalse(String.IsNullOrEmpty(model.Error));
        }
Ejemplo n.º 17
0
        public ResponseMessage InitiateScrapStructure(InitiateScrapStructure scrapStructure)
        {
            try
            {
                ResponseMessage responseMessage  = new ResponseMessage();
                ScrapStructure  scrapStructureDB = new ScrapStructure();
                scrapStructureDB.CreatedBy       = 1; //TODO
                scrapStructureDB.RoleId          = 1; //TODO
                scrapStructureDB.CreatedAt       = DateTime.Now;
                scrapStructureDB.FromProjectId   = scrapStructure.FromProjectId;
                scrapStructureDB.ProjStructId    = scrapStructure.ProjStructId;
                scrapStructureDB.Status          = commonEnum.ScrapStatus.NEW.ToString();
                scrapStructureDB.DispStructureId = scrapStructure.DispStructId;
                _context.ScrapStructure.Add(scrapStructureDB);
                // _context.SaveChanges();

                /*udpate structure status*/
                int projStructID           = Convert.ToInt32(scrapStructureDB.ProjStructId);
                ProjectStructure prjStruct = _context.ProjectStructure.Where(x => x.Id == projStructID).FirstOrDefault();
                prjStruct.StructureStatus = Util.GetDescription(commonEnum.StructureStatus.NOTAVAILABLE).ToString();
                prjStruct.CurrentStatus   = Util.GetDescription(commonEnum.StructureInternalStatus.SCRAPPED).ToString();
                _context.ProjectStructure.Update(prjStruct);
                // _context.SaveChanges();

                ScrapStatusHistory sshDB = new ScrapStatusHistory();
                sshDB.RoleId         = scrapStructure.RoleId;
                sshDB.ScrapStuctreId = scrapStructureDB.Id;
                sshDB.Status         = commonEnum.ScrapStatus.NEW.ToString();
                sshDB.UpdatedAt      = DateTime.Now;
                sshDB.UpdatedBy      = scrapStructureDB.CreatedBy;
                _context.ScrapStatusHistory.Add(sshDB);
                _context.SaveChanges();
                responseMessage.Message = "Scrap Structure created sucessfully";
                return(responseMessage);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 18
0
        public ResponseMessage AddComponentCost(ADDComponentCost input)
        {
            try
            {
                ProjectStructure structid =
                    _context.ProjectStructure.Single(w => w.Id == input.ProjStructId);
                structid.FabriacationCost = input.Cost;
                ResponseMessage responseMessage = new ResponseMessage();
                //List<DispStructureComp> struct = _context.DispStructureComp.w
                List <Component>    structureComps = _context.Component.Where(w => w.ProjStructId == input.ProjStructId).ToList();
                decimal             count          = structureComps.Sum(x => x.Weight) ?? 1;
                decimal             x        = input.Cost / count;
                DispFabricationCost fabrcost = new DispFabricationCost();
                fabrcost.DispatchNo     = input.DispatchNo;
                fabrcost.DispReqId      = input.DispatchRequirementId;
                fabrcost.Status         = Util.GetDescription(commonEnum.StructureStatus.NEW).ToString();
                fabrcost.StatusInternal = Util.GetDescription(commonEnum.StructureStatus.NEW).ToString();
                _context.DispFabricationCost.Add(fabrcost);
                _context.ProjectStructure.Update(structid);
                _context.SaveChanges();

                structureComps.ForEach(item =>
                {
                    // DispStructureComp structureComps=_context.DispStructureComp.Single(w=>w.DispStructureId==item.DispStructureCompId);

                    item.FabriacationCost = item.Weight * x;
                    _context.Component.Update(item);
                    _context.SaveChanges();
                });



                responseMessage.Message = "Structure Cost Updated sucessfully";
                return(responseMessage);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public void DeleteMasterImageReturnErrorIfImageDoesNotExist()
        {
            var project = new ProjectStructure()
            {
                Id             = ObjectId.GenerateNewId().ToString(),
                TimeOfCreation = DateTime.Now.ToString(),
                Progress       = ProjectStructure.Types.State.Largeadded,
                MasterLocation = "//InvalidLocation"
            };

            MockMakerClient.Setup(x => x.ReadProject(It.IsAny <string>())).Returns(new ProjectResponse {
                Project = project
            });
            MockMakerClient.Setup(x => x.DeleteProject(It.IsAny <string>())).Returns(new ProjectResponse {
                Error = "Error"
            });

            var model = new DeleteProjectModel();

            model.DeleteProject(MockMakerClient.Object, ObjectId.GenerateNewId().ToString());
            Assert.IsFalse(String.IsNullOrEmpty(model.Error));
        }
Ejemplo n.º 20
0
        private ProjectStructure ConstructProjectStructure(AssignStructureComponentDetails request, ProjectStructure projStruct)
        {
            int    structCount = _context.ProjectStructure.Count() + 1;
            string structId    = constantVal.StructureIdPrefix + structCount.ToString().PadLeft(6, '0');

            if (projStruct == null)
            {
                projStruct           = new ProjectStructure();
                projStruct.CreatedAt = DateTime.Now;
            }
            projStruct.ProjectId              = request.ProjectId;
            projStruct.StructureId            = request.StructureId;
            projStruct.StructCode             = request.StructureCode;
            projStruct.IsDelete               = false;
            projStruct.DrawingNo              = request.DrawingNo;
            projStruct.UpdatedAt              = DateTime.Now;
            projStruct.EstimatedWeight        = Convert.ToDecimal(request.EstimatedWeight);
            projStruct.StructCode             = structId;
            projStruct.ComponentsCount        = request.CompCount;
            projStruct.StructureAttributesVal = request.StructureAttributes;
            return(projStruct);
        }
Ejemplo n.º 21
0
        public override void LoadProjectStructure(int projectId, Action <ProjectStructure> onFinish)
        {
            string structureRequestString = string.Format(ApiRoutes.ProjectStructureRequest, projectId);

            var structureRequest = new RequestApi(structureRequestString);

            Logger.Info("API request: " + structureRequestString);

            structureRequest.OnFinish += response =>
            {
                ResponseApi structureResponseApi = (ResponseApi)response;

                if (!Helper.IsResponseGood(structureResponseApi))
                {
                    Logger.Fatal("Can not get " + structureRequestString);
                    onFinish.Invoke(null);

                    return;
                }

                string projectStructureJson = structureResponseApi.Data.ToString();

                ProjectStructure currentProjectStructure = projectStructureJson.JsonDeserialize <ProjectStructure>();

                foreach (var scene in currentProjectStructure.Scenes)
                {
                    var logicRequest = new RequestUri(scene.LogicResource);

                    logicRequest.OnFinish += response1 =>
                    {
                        ResponseUri logicResponse = (ResponseUri)response1;
                        scene.AssemblyBytes = logicResponse.ByteData;
                    };
                }

                onFinish.Invoke(currentProjectStructure);
            };
        }
Ejemplo n.º 22
0
        /*
         * Creates a Roblox Studio Window object.
         */
        private RobloxStudioWindow(BaseWindow window, ProjectStructure structure)
        {
            this.Window    = window;
            this.Structure = structure;

            // Create the pattern.
            this.FocusPattern = (WindowPattern)this.Window.Window.GetCurrentPattern(WindowPattern.Pattern);

            // Create the conditions.
            this.PaneCondition = new AndCondition(new List <Condition>
            {
                new PropertyCondition(AutomationElement.ClassNameProperty, "Qt5QWindowIcon"),
                new PropertyCondition(AutomationElement.ControlTypeProperty, ControlType.Pane)
            }.ToArray());
            this.EditorCondition = new PropertyCondition(AutomationElement.ControlTypeProperty, ControlType.Edit);
            this.TabCondition    = new AndCondition(new List <Condition>
            {
                new PropertyCondition(AutomationElement.ClassNameProperty, "Qt5QWindowIcon"),
                new PropertyCondition(AutomationElement.ControlTypeProperty, ControlType.Tab)
            }.ToArray());

            // Get the parents.
            this.EditorParent = this.Window.Window.FindFirst(TreeScope.Children, this.PaneCondition).FindFirst(TreeScope.Children, this.PaneCondition).FindAll(TreeScope.Children, this.PaneCondition)[1];
        }
        public ResponseMessage AddComponents(AddComponents request)
        {
            ResponseMessage response = new ResponseMessage();

            response.Message = "Components added succusfully";
            List <dispatchedStrucCount> result = new List <dispatchedStrucCount>();
            int count      = _context.Component.Where(s => s.ProjStructId == request.ProjStructId).Count();
            int Quantity   = request.Components.Where(x => x.CompId == null).Count();
            int excedCout  = count + Quantity;
            int totalcount = _context.ProjectStructure.Single(s => s.Id == request.ProjStructId).ComponentsCount ?? 0;

            if (totalcount < excedCout)
            {
                throw new ValueNotFoundException("Dispatch Components should match the required quantity.");
            }

            try {
                //	using (var transaction = _context.Database.BeginTransaction ())
                try {
                    var isUpdate                      = false;
                    var projectStructureID            = 0;
                    ProjectStructure projectStructure = _context.ProjectStructure.Where(x => x.Id == request.ProjStructId && x.IsDelete == false).FirstOrDefault();
                    int compCount                     = _context.Component.Where(x => x.ProjStructId == request.ProjStructId).Count();
                    int payLoadeCompCount             = request.Components.Where(x => x.CompId == null).Count();
                    int excedcout                     = payLoadeCompCount + compCount;
                    if (projectStructure.ComponentsCount < excedcout)
                    {
                        throw new ValueNotFoundException("Component limit exceed");
                    }
                    if (projectStructure == null)
                    {
                        throw new ValueNotFoundException("Project Structure not yet assigned");
                    }
                    projectStructureID = projectStructure.Id;
                    if (request.Components?.Count > 0)
                    {
                        List <Component>        componentls     = new List <Component> ();
                        List <ComponentHistory> componentHistls = new List <ComponentHistory> ();
                        foreach (var comp in request.Components)
                        {
                            ComponentType compTypeDB = _context.ComponentType.Where(x => x.Name == comp.CompTypeName && x.IsDelete == false).FirstOrDefault();
                            if (compTypeDB == null)
                            {
                                throw new ValueNotFoundException("Component Type Name doesn't exist");
                            }
                        }
                        foreach (var comp in request.Components)
                        {
                            var           compdb     = _context.Component.Where(x => x.CompId == comp.CompId && x.IsDelete == false).FirstOrDefault();
                            ComponentType compTypeDB = _context.ComponentType.Where(x => x.Name == comp.CompTypeName && x.IsDelete == false).FirstOrDefault();

                            if (compTypeDB == null)
                            {
                                throw new ValueNotFoundException("Component Type Name doesn't exist");
                            }
                            if (compdb != null)
                            {
                                compdb = ConstructComponent(projectStructureID, comp, compdb, compTypeDB);
                                _context.SaveChanges();
                            }
                            else
                            {
                                Component component = null;
                                comp.CompStatus = "O";
                                component       = ConstructComponent(projectStructureID, comp, component, compTypeDB);
                                _context.Component.Add(component);
                                _context.SaveChanges();
                            }
                        }
                        // projectStructure.ComponentsCount = request.Components.Count ();
                        _context.SaveChanges();
                    }
                    return(response);
                } catch (Exception ex) {
                    //	transaction.Rollback ();
                    throw ex;
                }
            } catch (Exception ex) {
                throw ex;
            }
        }
Ejemplo n.º 24
0
 public ProjectStructure GetStructure(UserCache u, string pname)
 {
     var project = u.Client.ProjectsOwner.Where(x => x.Name == pname).First();
     u.CurrentProject = project.AsDto();
     var structure = new ProjectStructure();
     //TODO: Реализовать учет прав доступа.
     foreach (var folder in project.Folders)
     {
         structure.Folders.Add(new FolderDto(){Name = folder.Name, Path = folder.Path});
         foreach (var file in folder.Files)
         {
             structure.Files.Add(new FileDto(){Name = file.Name, Path = file.Path});
         }
     }
     return structure;
 }
Ejemplo n.º 25
0
 private static List<Elem> GetFoldersFromFolder(ref ProjectStructure structure, FolderDto folder)
 {
     var result = new List<Elem>();
     for (int i = 0; i < structure.Folders.Count; ++i)
     {
         if ((structure.Folders[i].Path == folder.Path + "\\" + folder.Name)&&(structure.Folders[i] != folder))
         {
             var newFolder = structure.Folders[i];
             structure.Folders.RemoveAt(i);
             result.Add(new Elem(newFolder.Name, newFolder, ElemType.Folder, ref structure));
             --i;
         }
     }
     return result;
 }
Ejemplo n.º 26
0
 public static Elem Build(ProjectStructure structure)
 {
     structure.Folders.Sort((x,y)=> x.Path.CompareTo(y.Path));
     var folder = structure.Folders[0];
     return new Elem(folder.Name, folder,ElemType.Folder,ref structure);
 }
Ejemplo n.º 27
0
 private static List<Elem> GetFilesFromFolder(ref ProjectStructure structure, FolderDto folder)
 {
     var result = new List<Elem>();
     for(int i =0; i< structure.Files.Count; ++i)
     {
         if(structure.Files[i].Path == folder.Path+"\\"+folder.Name)
         {
             var file = structure.Files[i];
             structure.Files.RemoveAt(i);
             result.Add(new Elem(file.Name, file, ElemType.File,ref structure));
             --i;
         }
     }
     return result;
 }
 public async Task UpdateAsync(ProjectStructure itemIn)
 {
     await _items.ReplaceOneAsync(item => item.Id == itemIn.Id, itemIn);
 }
        public async Task <ProjectStructure> CreateAsync(ProjectStructure item)
        {
            await _items.InsertOneAsync(item);

            return(item);
        }
Ejemplo n.º 30
0
 /*
  * Fetches a Roblox Studio window.
  */
 public static RobloxStudioWindow GetWindow(string name, ProjectStructure structure)
 {
     return(new RobloxStudioWindow(BaseWindow.GetWindow(name), structure));
 }
Ejemplo n.º 31
0
 /*
  * Creates a request handler object.
  */
 public ConnectRequestHandler(SessionStorage sessions, ProjectStructure structure, Func <ProjectStructure, EditorWindow> initializeWindowFunction)
 {
     this.Sessions  = sessions;
     this.Structure = structure;
     this.InitializeWindowFunction = initializeWindowFunction;
 }
        private static void EnsureNoSqlDbSeeded(IFileStorageNoSqlDbSettings settings, ICollection <Project> projects)
        {
            IMongoCollection <ProjectStructure> projectStructureItems;
            IMongoCollection <File>             filesItems;
            IMongoCollection <FileHistory>      fileHistoriesItems;
            var client              = new MongoClient(settings.ConnectionString);
            var database            = client.GetDatabase(settings.DatabaseName);
            var itemsCollectionName = GetProjectStructureItemsCollectionName();

            projectStructureItems = database.GetCollection <ProjectStructure>(itemsCollectionName);
            filesItems            = database.GetCollection <File>(GetFileItemsCollectionName());
            fileHistoriesItems    = database.GetCollection <FileHistory>(GetFileHistoryItemsCollectionName());

            foreach (var project in projects)
            {
                var fileStructure = new FileStructure()
                {
                    Id      = Guid.NewGuid().ToString(),
                    Type    = Common.ModelsDTO.Enums.TreeNodeType.Folder,
                    Details = "Project details",
                    Name    = project.Name
                };
                File f1 = new File()
                {
                    Id        = Guid.NewGuid().ToString("N").Substring(0, 24),
                    Name      = "Program.cs",
                    Folder    = project.Name,
                    CreatorId = 1,
                    ProjectId = project.Id,
                    CreatedAt = DateTime.Now,
                    Content   = GetCSFileContent(project.Name),
                    Language  = "csharp"
                };
                File f2 = new File()
                {
                    Id        = Guid.NewGuid().ToString("N").Substring(0, 24),
                    Name      = project.Name + ".csproj",
                    Folder    = project.Name,
                    CreatorId = 1,
                    ProjectId = project.Id,
                    CreatedAt = DateTime.Now,
                    Content   = GetCSProjFileContent(),
                    Language  = "xml"
                };
                fileStructure.NestedFiles.Add(new FileStructure()
                {
                    Id   = f1.Id,
                    Name = "Program.cs",
                    Type = Common.ModelsDTO.Enums.TreeNodeType.File
                });
                fileStructure.NestedFiles.Add(new FileStructure()
                {
                    Id   = f2.Id,
                    Name = project.Name + ".csproj",
                    Type = Common.ModelsDTO.Enums.TreeNodeType.File
                });

                var emptyStructure = new ProjectStructure();
                emptyStructure.Id = project.Id.ToString();
                emptyStructure.NestedFiles.Add(fileStructure);

                filesItems.InsertOne(f1);
                filesItems.InsertOne(f2);
                projectStructureItems.InsertOne(emptyStructure);
            }
        }
Ejemplo n.º 33
0
        public ResponseMessage CreateDispatch(TWCCDispatchPayload payload)
        {
            try {
                string dispatchNo     = string.Empty;
                string structCode     = string.Empty;
                int    dispReuseCount = 0;
                int    projectId      = 1;
                List <dispatchedStrucCount> result = new List <dispatchedStrucCount>();
                string count = string.Format("select count(*) as cnt 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  where ps.structure_id = {0} and dr.sitereq_id = {1}", payload.StructureId, payload.siteRequirementId);
                result = _context.Set <dispatchedStrucCount>().FromSqlRaw(count).ToList();
                int dispatchedQuantity = result.FirstOrDefault().cnt;
                int excedCout          = dispatchedQuantity + payload.Quantity;
                int totalcount         = _context.SiteReqStructure.Single(s => s.SiteReqId == payload.siteRequirementId && s.StructId == payload.StructureId).Quantity ?? 0;
                if (totalcount < excedCout)
                {
                    throw new ValueNotFoundException("Dispatch quantity should match the required quantity.");
                }
                ServiceType servType = _context.ServiceType.Where(x => x.Id == payload.ServiceTypeId).FirstOrDefault();
                if (servType.Name == commonEnum.ServiceType.Fabrication.ToString())
                {
                    dispReuseCount = _context.DispatchRequirement.Include(m => m.Servicetype).Where(x => x.DispatchNo.Contains("DC")).Count() + 1;
                }
                else if (servType.Name == commonEnum.ServiceType.OutSourcing.ToString())
                {
                    dispReuseCount = _context.DispatchRequirement.Include(m => m.Servicetype).Where(x => x.DispatchNo.Contains("DC")).Count() + 1;
                }
                else if (servType.Name == commonEnum.ServiceType.Reuse.ToString())
                {
                    dispReuseCount = _context.DispatchRequirement.Include(m => m.Servicetype).Where(x => x.DispatchNo.Contains("DA")).Count() + 1;
                }

                SiteRequirement siteReqr = _context.SiteRequirement.Include(c => c.SiteReqStructure).Where(x => x.Id == payload.siteRequirementId).FirstOrDefault();
                //   for structure id override in multiple component
                if (servType.Name == commonEnum.ServiceType.Fabrication.ToString() || servType.Name == commonEnum.ServiceType.OutSourcing.ToString())
                {
                    // int structCount = _context.ProjectStructure.Count () + 1;
                    // structCode = constantVal.StructureIdPrefix + structCount.ToString ().PadLeft (6, '0');
                    dispatchNo = constantVal.DispVendorPrefix + dispReuseCount.ToString().PadLeft(6, '0');
                }
                if (servType.Name == commonEnum.ServiceType.Reuse.ToString())
                {
                    dispatchNo = constantVal.DispReusePrefix + dispReuseCount.ToString().PadLeft(6, '0');
                }
                ResponseMessage responseMessage = new ResponseMessage();
                using (var transaction = _context.Database.BeginTransaction()) {
                    try {
                        DispatchRequirement dispReq = new DispatchRequirement();
                        dispReq.CreatedAt       = DateTime.Now;
                        dispReq.CreatedBy       = payload.CreatedBy; //TODO
                        dispReq.DispatchNo      = dispatchNo;
                        dispReq.RoleId          = 1;                 // TODO
                        dispReq.ServicetypeId   = payload.ServiceTypeId;
                        dispReq.SitereqId       = payload.siteRequirementId;
                        dispReq.SiteReqStructid = _context.SiteReqStructure.Where(x => x.SiteReqId == payload.siteRequirementId && x.StructId == payload.StructureId).FirstOrDefault().Id;
                        dispReq.Status          = Util.GetDescription(commonEnum.SiteDispatchSatus.NEW).ToString();
                        dispReq.StatusInternal  = Util.GetDescription(commonEnum.SiteDispatchSatus.NEW).ToString();
                        dispReq.ToProjectid     = payload.ToProjectId;
                        dispReq.Quantity        = payload.Quantity;
                        _context.DispatchRequirement.Add(dispReq);
                        _context.SaveChanges();
                        int structCountDb = _context.ProjectStructure.Count();
                        for (int iQty = 1; iQty <= payload.Quantity; iQty++)
                        {
                            if (servType.Name == commonEnum.ServiceType.Fabrication.ToString() || servType.Name == commonEnum.ServiceType.OutSourcing.ToString())
                            {
                                int structCount = structCountDb + iQty;
                                structCode = constantVal.StructureIdPrefix + structCount.ToString().PadLeft(6, '0');
                            }

                            ProjectStructure projectStructure = new ProjectStructure();
                            if (servType.Name == commonEnum.ServiceType.Fabrication.ToString() || servType.Name == commonEnum.ServiceType.OutSourcing.ToString())
                            {
                                SiteReqStructure siteRequirementStructure = _context.SiteReqStructure.Where(x => x.SiteReqId == payload.siteRequirementId && x.StructId == payload.StructureId).FirstOrDefault();

                                projectStructure.StructureId            = payload.StructureId;
                                projectStructure.StructCode             = structCode;
                                projectStructure.ProjectId              = payload.ToProjectId;
                                projectStructure.DrawingNo              = "";
                                projectStructure.ComponentsCount        = 0;
                                projectStructure.StructureAttributesVal = siteRequirementStructure != null ? siteRequirementStructure.StructureAttributesVal : "";
                                projectStructure.EstimatedWeight        = 0;
                                projectStructure.StructureStatus        = Util.GetDescription(commonEnum.StructureStatus.NOTAVAILABLE).ToString();
                                projectStructure.CurrentStatus          = Util.GetDescription(commonEnum.StructureInternalStatus.DISPATCHINPROGRESS).ToString();
                                projectStructure.IsDelete  = false;
                                projectStructure.CreatedBy = payload.CreatedBy;
                                projectStructure.CreatedAt = DateTime.Now;
                                _context.ProjectStructure.Add(projectStructure);
                                _context.SaveChanges();
                            }
                            else
                            {
                                ProjectStructure structDB = _context.ProjectStructure.Where(x => x.Id == payload.ProjectStructureId).FirstOrDefault();
                                structDB.CurrentStatus   = Util.GetDescription(commonEnum.StructureInternalStatus.DISPATCHINPROGRESS).ToString();
                                structDB.StructureStatus = Util.GetDescription(commonEnum.StructureStatus.NOTAVAILABLE).ToString();
                                _context.SaveChanges();
                            }

                            DispReqStructure dispStrcture = new DispReqStructure();
                            dispStrcture.ProjStructId = servType.Name == commonEnum.ServiceType.Fabrication.ToString() || servType.Name == commonEnum.ServiceType.OutSourcing.ToString() ? projectStructure.Id : payload.ProjectStructureId;
                            dispStrcture.DispreqId    = dispReq.Id;
                            if (servType.Name == commonEnum.ServiceType.Reuse.ToString())
                            {
                                dispStrcture.FromProjectId = payload.FromProjectId;
                                dispStrcture.SurplusDate   = payload.SurplusFromDate;
                            }
                            dispStrcture.DispStructStatus = Util.GetDescription(commonEnum.SiteDispStructureStatus.NEW).ToString();
                            _context.DispReqStructure.Add(dispStrcture);
                            _context.SaveChanges();


                            if (servType.Name == commonEnum.ServiceType.Reuse.ToString())
                            {
                                var componentList = _context.Component.Where(x => x.ProjStructId == payload.ProjectStructureId).ToList();
                                foreach (Component comp in componentList)
                                {
                                    DispStructureComp dsc = new DispStructureComp();
                                    dsc.DispStructureId = dispStrcture.Id;
                                    dsc.DispCompId      = comp.Id;
                                    _context.DispStructureComp.Add(dsc);
                                }
                                _context.SaveChanges();
                            }
                        }

                        /***update site requirement Structure status  ***/

                        CodeList         dispQty = _context.Query <CodeList>().FromSqlRaw(string.Format("select  count(*) as Id,'' as Name , 0 as ServiceTypeId 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 where ps.structure_id ={0} and dr.sitereq_id ={1} and drs.disp_struct_status <> '{2}'", payload.StructureId, payload.siteRequirementId, Util.GetDescription(commonEnum.SiteDispStructureStatus.REJECT).ToString())).FirstOrDefault();
                        var              dispatchedStrucCount = dispQty.Id;
                        SiteRequirement  dbSiteReq            = _context.SiteRequirement.Where(x => x.Id == payload.siteRequirementId).FirstOrDefault();
                        SiteReqStructure dbSiteReqStructure   = _context.SiteReqStructure.Where(x => x.SiteReqId == payload.siteRequirementId && x.StructId == payload.StructureId).FirstOrDefault();
                        if (dbSiteReqStructure.Quantity > dispatchedStrucCount)
                        {
                            dbSiteReqStructure.Status = Util.GetDescription(commonEnum.SiteRequiremntStatus.PARTIALLYDISPATCHED).ToString();
                        }
                        else
                        {
                            dbSiteReqStructure.Status = Util.GetDescription(commonEnum.SiteRequiremntStatus.DISPATCHED).ToString();
                        }
                        _context.SaveChanges();


                        /***update site requirement status ***/
                        List <SiteReqStructure> lstReqStructure = _context.SiteReqStructure.Where(x => x.SiteReqId == payload.siteRequirementId).ToList();
                        if (lstReqStructure.Count() > 0 && lstReqStructure.Where(x => x.Status != Util.GetDescription(commonEnum.SiteRequiremntStatus.DISPATCHED).ToString()).Count() > 0)
                        {
                            dbSiteReq.Status         = Util.GetDescription(commonEnum.SiteRequiremntStatus.PARTIALLYDISPATCHED).ToString();
                            dbSiteReq.StatusInternal = Util.GetDescription(commonEnum.SiteRequiremntStatus.PARTIALLYDISPATCHED).ToString();
                        }
                        else
                        {
                            dbSiteReq.Status         = Util.GetDescription(commonEnum.SiteRequiremntStatus.DISPATCHED).ToString();
                            dbSiteReq.StatusInternal = Util.GetDescription(commonEnum.SiteRequiremntStatus.DISPATCHED).ToString();
                        }
                        _context.SaveChanges();


                        DisreqStatusHistory dispatchReqStatusHistory = new DisreqStatusHistory();
                        dispatchReqStatusHistory.DispatchNo     = dispatchNo;
                        dispatchReqStatusHistory.DispreqId      = dispReq.Id;
                        dispatchReqStatusHistory.Status         = Util.GetDescription(commonEnum.SiteDispatchSatus.NEW).ToString();
                        dispatchReqStatusHistory.StatusInternal = Util.GetDescription(commonEnum.SiteDispatchSatus.NEW).ToString();
                        dispatchReqStatusHistory.Notes          = "";
                        dispatchReqStatusHistory.RoleId         = payload.RoleId;
                        dispatchReqStatusHistory.CreatedBy      = payload.CreatedBy;
                        dispatchReqStatusHistory.CreatedAt      = DateTime.Now;
                        _context.DisreqStatusHistory.Add(dispatchReqStatusHistory);
                        _context.SaveChanges();
                        transaction.Commit();
                        responseMessage = new ResponseMessage()
                        {
                            Message = "Saved Successfully"
                        };
                    } catch (Exception ex) {
                        transaction.Rollback();
                        responseMessage = new ResponseMessage()
                        {
                            Message = "Error was found. Exception : " + ex.Message
                        };
                        throw ex;
                    }
                }

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