public async Task <IActionResult> UploadFilesAjax()
        {
            try
            {
                CurrentUser cUser = new CurrentUser(HttpContext, _configuration);

                var          customHeaders = Request.Headers;
                StringValues aId           = "";
                StringValues Type          = "";
                if (customHeaders.ContainsKey("aId") && customHeaders.ContainsKey("Type"))
                {
                    customHeaders.TryGetValue("aId", out aId);
                    customHeaders.TryGetValue("Type", out Type);

                    List <FileUploadViewModel> fuvms = await fileUploadService.UploadFiles(Request, HttpContext);

                    foreach (FileUploadViewModel fuvm in fuvms)
                    {
                        fuvm.PhysicalFilePath = fuvm.PhysicalFilePath.Replace(@"\", @"/");
                        await leverageRepo.SaveLeverageImage(fuvm.OriginalFileName, fuvm.LogicalFileName, fuvm.PhysicalFilePath, Int32.Parse(aId));
                    }
                }

                return(Json("Success"));
            }
            catch (CustomException cex)
            {
                var responseObj = new EmaintenanceMessage(cex.Message, cex.Type, cex.IsException, cex.Exception?.ToString());
                return(StatusCode(StatusCodes.Status500InternalServerError, responseObj));
            }
            catch (Exception ex)
            {
                return(Ok(new EmaintenanceMessage(ex.Message)));
            }
        }
        public async Task <IActionResult> SaveCategoryClassRel([FromBody] List <AssetCategoryClassRelViewModel> avms)
        {
            try
            {
                CurrentUser cUser = new CurrentUser(HttpContext, _configuration);

                foreach (AssetCategoryClassRelViewModel avm in avms)
                {
                    avm.UserId = cUser.UserId;
                    await AssetCategoryRepo.SaveCategoryClassRel(avm);
                }
                await auditLogService.LogActivity(cUser.UserId, cUser.HostIP, cUser.SessionId, "AssetCategory", "Category/Class Relation Updated.");

                return(Ok());
            }
            catch (CustomException cex)
            {
                var returnObj = new EmaintenanceMessage(cex.Message, cex.Type, cex.IsException, cex.Exception?.ToString());
                return(StatusCode(StatusCodes.Status500InternalServerError, returnObj));
            }
            catch (Exception ex)
            {
                return(StatusCode(StatusCodes.Status500InternalServerError, new EmaintenanceMessage(ex.Message)));
            }
        }
Exemple #3
0
        public async Task <IActionResult> GetAnalysisByUnit(string type, string sType, int uaId, int lId)
        {
            CurrentUser cUser = new CurrentUser(HttpContext, _configuration);

            try
            {
                JobUnitAnalysisViewModel juavm = (JobUnitAnalysisViewModel)await reportFeederRepo.GetUnitAnalysisById(uaId, type, sType, lId);

                if (juavm.JobUnitSymptomsListJson != null)
                {
                    juavm.JobUnitSymptomsList = JsonConvert.DeserializeObject <List <JobUnitSymptomsViewModel> >(juavm.JobUnitSymptomsListJson);
                }
                if (juavm.JobUnitAmplitudeListJson != null)
                {
                    juavm.JobUnitAmplitudeList = JsonConvert.DeserializeObject <List <JobUnitAmplitudeViewModel> >(juavm.JobUnitAmplitudeListJson);
                }
                await auditLogService.LogActivity(cUser.UserId, cUser.HostIP, cUser.SessionId, "Create Report", "Loaded Analysis (Vibration / Oil) Report Data by selected Unit.");

                return(Ok(juavm));
            }
            catch (CustomException cex)
            {
                var responseObj = new EmaintenanceMessage(cex.Message, cex.Type, cex.IsException, cex.Exception?.ToString());
                return(StatusCode(StatusCodes.Status500InternalServerError, responseObj));
            }
            catch (Exception ex)
            {
                return(Ok(new EmaintenanceMessage(ex.Message)));
            }
        }
Exemple #4
0
        public async Task <IActionResult> UploadFiles()
        {
            try
            {
                CurrentUser cUser = new CurrentUser(HttpContext, _configuration);

                var          customHeaders = Request.Headers;
                StringValues aId           = "";
                StringValues Type          = "";
                if (customHeaders.ContainsKey("aId") && customHeaders.ContainsKey("Type"))
                {
                    customHeaders.TryGetValue("aId", out aId);
                    customHeaders.TryGetValue("Type", out Type);
                    List <FileUploadViewModel> fuvms = await fileUploadService.UploadFiles(Request, HttpContext);

                    foreach (FileUploadViewModel fuvm in fuvms)
                    {
                        await reportFeederRepo.SaveOrUpdateAttachments(Type, Int32.Parse(aId), 0, fuvm.OriginalFileName, fuvm.LogicalFileName, fuvm.PhysicalFilePath, "Y", cUser.UserId);
                    }
                }
                await auditLogService.LogActivity(cUser.UserId, cUser.HostIP, cUser.SessionId, "Create Report", "Image Uploaded.");

                return(Json("Success"));
            }
            catch (CustomException cex)
            {
                var responseObj = new EmaintenanceMessage(cex.Message, cex.Type, cex.IsException, cex.Exception?.ToString());
                return(StatusCode(StatusCodes.Status500InternalServerError, responseObj));
            }
            catch (Exception ex)
            {
                return(Ok(new EmaintenanceMessage(ex.Message)));
            }
        }
Exemple #5
0
        public async Task <IActionResult> SaveUserSiteAccess([FromBody] ClientSiteUserAccessViewModel csuvm)
        {
            try
            {
                CurrentUser cUser = new CurrentUser(HttpContext, _configuration);
                ClientSiteUserAccessParsedViewModel csuavm = null;

                foreach (UserInfoViewModel uivm in csuvm.AssignedUsers)
                {
                    csuavm              = new ClientSiteUserAccessParsedViewModel();
                    csuavm.UserId       = uivm.UserId;
                    csuavm.LoginUserId  = cUser.UserId;
                    csuavm.ClientSiteId = csuvm.ClientSiteId;
                    csuavm.Active       = "Y";
                    await clientSiteRepo.SaveSiteUserAccess(csuavm);
                }
                await auditLogService.LogActivity(cUser.UserId, cUser.HostIP, cUser.SessionId, "Client Site", "User Client Site Access Modified");

                return(Ok());
            }
            catch (CustomException cex)
            {
                var returnObj = new EmaintenanceMessage(cex.Message, cex.Type, cex.IsException, cex.Exception?.ToString());
                return(StatusCode(StatusCodes.Status500InternalServerError, returnObj));
            }
            catch (Exception ex)
            {
                return(StatusCode(StatusCodes.Status500InternalServerError, new EmaintenanceMessage(ex.Message)));
            }
        }
        public async Task <IActionResult> Create([FromBody] PlantViewModel pvm)
        {
            try
            {
                CurrentUser cUser = new CurrentUser(HttpContext, _configuration);
                pvm.UserId      = cUser.UserId;
                pvm.ReturnKey   = 1;
                pvm.PlantAreaId = 0;
                pvm.Active      = "Y";
                var result = await plantRepo.SaveOrUpdate(pvm);

                await auditLogService.LogActivity(cUser.UserId, cUser.HostIP, cUser.SessionId, "Plant", "Plant Created.");

                return(Ok(result));
            }
            catch (CustomException cex)
            {
                var returnObj = new EmaintenanceMessage(cex.Message, cex.Type, cex.IsException, cex.Exception?.ToString());
                return(StatusCode(StatusCodes.Status500InternalServerError, returnObj));
            }
            catch (Exception ex)
            {
                return(StatusCode(StatusCodes.Status500InternalServerError, new EmaintenanceMessage(ex.Message)));
            }
        }
        public async Task <IActionResult> SaveMultilingual([FromBody] List <CountryViewModel> cvms)
        {
            try
            {
                CurrentUser cUser = new CurrentUser(HttpContext, _configuration);
                foreach (CountryViewModel cvm in cvms)
                {
                    if (cvm.CountryId == 0)
                    {
                        cvm.CountryId = 0;
                        cvm.Active    = "Y";
                    }
                    cvm.UserId = cUser.UserId;
                    await cntryRepo.SaveOrUpdate(cvm);
                }
                await auditLogService.LogActivity(cUser.UserId, cUser.HostIP, cUser.SessionId, "Country", "Country Created / Updated in Multi Language.");

                return(Ok());
            }
            catch (CustomException cex)
            {
                var returnObj = new EmaintenanceMessage(cex.Message, cex.Type, cex.IsException, cex.Exception?.ToString());
                return(StatusCode(StatusCodes.Status500InternalServerError, returnObj));
            }
            catch (Exception ex)
            {
                return(StatusCode(StatusCodes.Status500InternalServerError, new EmaintenanceMessage(ex.Message)));
            }
        }
Exemple #8
0
        public async Task <IActionResult> UpdateOilProperties([FromBody] List <JobEquipOilPropertiesViewModel> jeopvms)
        {
            try
            {
                CurrentUser cUser = new CurrentUser(HttpContext, _configuration);
                foreach (JobEquipOilPropertiesViewModel jeopvm in jeopvms)
                {
                    if (jeopvm.JobEquipOilPropertiesId == 0)
                    {
                        jeopvm.JobEquipOilPropertiesId = 0;
                        jeopvm.Active = "Y";
                    }
                    jeopvm.UserId = cUser.UserId;
                    await reportFeederRepo.SaveorUpdateOilProperties(jeopvm);
                }
                await auditLogService.LogActivity(cUser.UserId, cUser.HostIP, cUser.SessionId, "Create Report", "Oil Properties Modified.");

                return(Ok());
            }
            catch (CustomException cex)
            {
                var returnObj = new EmaintenanceMessage(cex.Message, cex.Type, cex.IsException, cex.Exception?.ToString());
                return(StatusCode(StatusCodes.Status500InternalServerError, returnObj));
            }
            catch (Exception ex)
            {
                return(StatusCode(StatusCodes.Status500InternalServerError, new EmaintenanceMessage(ex.Message)));
            }
        }
Exemple #9
0
        public async Task <IActionResult> GetLanguagesByStatus(string status)
        {
            try
            {
                CurrentUser cUser = new CurrentUser(HttpContext, _configuration);
                if (status != null & status == "All")
                {
                    var result = await lRepo.GetAllLanguages();

                    await auditLogService.LogActivity(cUser.UserId, cUser.HostIP, cUser.SessionId, "Languages", "Language list Loaded.");

                    return(Ok(result));
                }
                else
                {
                    return(Ok(await lRepo.GetLanguagesByStatus(status)));
                }
            }
            catch (CustomException cex)
            {
                var responseObj = new EmaintenanceMessage(cex.Message, cex.Type, cex.IsException, cex.Exception?.ToString());
                return(StatusCode(StatusCodes.Status500InternalServerError, responseObj));
            }
            catch (Exception ex)
            {
                return(Ok(new EmaintenanceMessage(ex.Message)));
            }
        }
Exemple #10
0
 public async Task <IActionResult> Import([FromBody] List <UsersViewModel> uvms)
 {
     try
     {
         CurrentUser cUser = new CurrentUser(HttpContext, _configuration);
         foreach (UsersViewModel u in uvms)
         {
             if (u.UserName != null)
             {
                 string baseURL = HttpContext.Request.Host.ToUriComponent();
                 u.ApplicationBaseURL = baseURL;
                 u.UserId             = 0;
                 u.CreatedUserId      = cUser.UserId;
                 await uRepo.SaveOrUpdate(u, _identityManager);
             }
         }
         return(Ok());
     }
     catch (CustomException cex)
     {
         var returnObj = new EmaintenanceMessage(cex.Message, cex.Type, cex.IsException, cex.Exception?.ToString());
         return(StatusCode(StatusCodes.Status500InternalServerError, returnObj));
     }
     catch (Exception ex)
     {
         return(StatusCode(StatusCodes.Status500InternalServerError, new EmaintenanceMessage(ex.Message)));
     }
 }
Exemple #11
0
 public async Task <IActionResult> Create([FromBody] List <ConditionCodeMapViewModel> ccmvms)
 {
     try
     {
         CurrentUser cUser = new CurrentUser(HttpContext, _configuration);
         foreach (ConditionCodeMapViewModel ccmvm in ccmvms)
         {
             if (ccmvm.ClientsConditionName != null)
             {
                 ccmvm.UserId        = cUser.UserId;
                 ccmvm.ConditionName = ccmvm.ClientsConditionName;
                 await ccmRepo.SaveOrUpdate(ccmvm);
             }
             else
             {
                 throw new CustomException("Mandatory", "Client Condition Name is Mandatory.", "Error", true, "Custom Message : Client Condition Name is Mandatory.");
             }
         }
         return(Ok());
     }
     catch (CustomException cex)
     {
         var returnObj = new EmaintenanceMessage(cex.Message, cex.Type, cex.IsException, cex.Exception?.ToString());
         return(StatusCode(StatusCodes.Status500InternalServerError, returnObj));
     }
     catch (Exception ex)
     {
         return(StatusCode(StatusCodes.Status500InternalServerError, new EmaintenanceMessage(ex.Message)));
     }
 }
Exemple #12
0
        public async Task <IActionResult> UploadFiles()
        {
            try
            {
                CurrentUser cUser = new CurrentUser(HttpContext, _configuration);

                var          customHeaders      = Request.Headers;
                StringValues aId                = "";
                StringValues Type               = "";
                StringValues EquipmentId        = "";
                StringValues PlantAreaId        = "";
                StringValues Saving             = "";
                StringValues ReportDate         = "";
                StringValues RecommendationDate = "";
                StringValues Recommendation     = "";
                StringValues Remarks            = "";
                if (customHeaders.ContainsKey("aId") && customHeaders.ContainsKey("Type"))
                {
                    customHeaders.TryGetValue("aId", out aId);
                    customHeaders.TryGetValue("Type", out Type);
                    customHeaders.TryGetValue("equipmentId", out EquipmentId);
                    customHeaders.TryGetValue("plantAreaId", out PlantAreaId);
                    customHeaders.TryGetValue("saving", out Saving);
                    customHeaders.TryGetValue("reportDate", out ReportDate);
                    customHeaders.TryGetValue("recommendationDate", out RecommendationDate);
                    customHeaders.TryGetValue("recommendation", out Recommendation);
                    customHeaders.TryGetValue("remarks", out Remarks);
                    List <FileUploadViewModel> fuvms = await fileUploadService.UploadFiles(Request, HttpContext);

                    foreach (FileUploadViewModel fuvm in fuvms)
                    {
                        TechUpgradeViewModel svm = new TechUpgradeViewModel();
                        svm.ClientSiteId       = Int32.Parse(aId);
                        svm.EquipmentId        = Int32.Parse(EquipmentId);
                        svm.ReportDate         = DateTime.Parse(ReportDate);
                        svm.Saving             = Decimal.Parse(Saving);
                        svm.RecommendationDate = DateTime.Parse(RecommendationDate);
                        svm.Recommendation     = Recommendation;
                        svm.OriginalFileName   = fuvm.OriginalFileName;
                        svm.LogicalFileName    = fuvm.LogicalFileName;
                        svm.PhysicalFilePath   = fuvm.PhysicalFilePath.Replace(@"\", @"/");
                        svm.Active             = "Y";
                        svm.UserId             = cUser.UserId;
                        await iRepo.SaveOrUpdate(svm);
                    }
                }

                return(Json("Success"));
            }
            catch (CustomException cex)
            {
                var responseObj = new EmaintenanceMessage(cex.Message, cex.Type, cex.IsException, cex.Exception?.ToString());
                return(StatusCode(StatusCodes.Status500InternalServerError, responseObj));
            }
            catch (Exception ex)
            {
                return(Ok(new EmaintenanceMessage(ex.Message)));
            }
        }
        public async Task <IActionResult> UploadFiles()
        {
            try
            {
                CurrentUser cUser = new CurrentUser(HttpContext, _configuration);

                var          customHeaders   = Request.Headers;
                StringValues aId             = "";
                StringValues Type            = "";
                StringValues FileDescription = "";
                StringValues PlantAreaId     = "";
                StringValues ReportTypeId    = "";
                StringValues EquipmentId     = "";
                StringValues UnitId          = "";
                StringValues ReportDate      = "";
                if (customHeaders.ContainsKey("aId") && customHeaders.ContainsKey("Type"))
                {
                    customHeaders.TryGetValue("aId", out aId);
                    customHeaders.TryGetValue("Type", out Type);
                    customHeaders.TryGetValue("fileDescription", out FileDescription);
                    customHeaders.TryGetValue("plantAreaId", out PlantAreaId);
                    customHeaders.TryGetValue("equipmentId", out EquipmentId);
                    customHeaders.TryGetValue("unitId", out UnitId);
                    customHeaders.TryGetValue("reportTypeId", out ReportTypeId);
                    customHeaders.TryGetValue("reportDate", out ReportDate);
                    List <FileUploadViewModel> fuvms = await fileUploadService.UploadFiles(Request, HttpContext);

                    foreach (FileUploadViewModel fuvm in fuvms)
                    {
                        OtherReportsViewModel orvm = new OtherReportsViewModel();
                        orvm.ClientSiteId    = Int32.Parse(aId);
                        orvm.PlantAreaId     = Int32.Parse(PlantAreaId);
                        orvm.EquipmentId     = Int32.Parse(EquipmentId);
                        orvm.UnitId          = Int32.Parse(UnitId);
                        orvm.ReportTypeId    = Int32.Parse(ReportTypeId);
                        orvm.ReportDate      = DateTime.Parse(ReportDate);
                        orvm.FileDescription = FileDescription;
                        orvm.FileName        = fuvm.OriginalFileName;
                        orvm.LogicalName     = fuvm.LogicalFileName;
                        orvm.PhysicalPath    = fuvm.PhysicalFilePath;
                        orvm.Active          = "Y";
                        orvm.UserId          = cUser.UserId;
                        await OtherReportsRepo.SaveOrUpdate(orvm);
                    }
                }

                return(Json("Success"));
            }
            catch (CustomException cex)
            {
                var responseObj = new EmaintenanceMessage(cex.Message, cex.Type, cex.IsException, cex.Exception?.ToString());
                return(StatusCode(StatusCodes.Status500InternalServerError, responseObj));
            }
            catch (Exception ex)
            {
                return(Ok(new EmaintenanceMessage(ex.Message)));
            }
        }
Exemple #14
0
        public async Task<IActionResult> Create([FromBody] UserClientSiteRelViewModel ucsrvm)
        {
            try
            {
                CurrentUser cUser = new CurrentUser(HttpContext, _configuration);

                if (ucsrvm.UserId == cUser.UserId)
                {
                    throw new CustomException("You are not Authorized to update your own Access!!!", "Warning", true, "Custom Message: You are not Authorized to update your own Access!!!");
                }
                else
                {
                    if (ucsrvm.CountryRelations != null && ucsrvm.CountryRelations.Count > 0)
                    {
                        string Type = "Country";
                        foreach (CountryRelations crs in ucsrvm.CountryRelations)
                        {
                            await ucsrRepo.SaveOrUpdate(cUser.UserId, ucsrvm.UserId, Type, crs.CountryId, crs.Active);
                        }
                    }
                    if (ucsrvm.CostCentreRelations != null && ucsrvm.CostCentreRelations.Count > 0)
                    {
                        string Type = "CostCentre";
                        foreach (CostCentreRelations ccrs in ucsrvm.CostCentreRelations)
                        {
                            await ucsrRepo.SaveOrUpdate(cUser.UserId, ucsrvm.UserId, Type, ccrs.CostCentreId, ccrs.Active);
                        }
                    }
                    if (ucsrvm.ClientRelations != null && ucsrvm.ClientRelations.Count > 0)
                    {
                        string Type = "Client";
                        foreach (ClientRelations clrs in ucsrvm.ClientRelations)
                        {
                            await ucsrRepo.SaveOrUpdate(cUser.UserId, ucsrvm.UserId, Type, clrs.ClientId, clrs.Active);
                        }
                    }
                    if (ucsrvm.ClientSiteRelations != null && ucsrvm.ClientSiteRelations.Count > 0)
                    {
                        string Type = "ClientSite";
                        foreach (ClientSiteRelations csrs in ucsrvm.ClientSiteRelations)
                        {
                            await ucsrRepo.SaveOrUpdate(cUser.UserId, ucsrvm.UserId, Type, csrs.ClientSiteId, csrs.Active);
                        }
                    }
                }
                return Ok("Success");
            }
            catch (CustomException cex)
            {
                var returnObj = new EmaintenanceMessage(cex.Message, cex.Type, cex.IsException, cex.Exception?.ToString());
                return StatusCode(StatusCodes.Status500InternalServerError, returnObj);
            }
            catch (Exception ex)
            {
                return StatusCode(StatusCodes.Status500InternalServerError, new EmaintenanceMessage(ex.Message));
            }
        }
Exemple #15
0
        public async Task <IActionResult> CreateComments([FromBody] JobStatusCommentsViewModel jscvm)
        {
            try
            {
                CurrentUser cUser = new CurrentUser(HttpContext, _configuration);
                jscvm.CommentId = 0;
                jscvm.Active    = "Y";
                jscvm.UserId    = cUser.UserId;

                if (jscvm.Type == null && jscvm.Type == "")
                {
                    throw new CustomException("Please select valid type for comments", "Error", true, "Type(s) are Job, Equipment and UnitAnalysis and it is mandatory to Save Comments.");
                }
                else
                {
                    if (jscvm.Type == "J")
                    {
                        var result = await reportFeederRepo.SaveJobComments(jscvm);

                        await auditLogService.LogActivity(cUser.UserId, cUser.HostIP, cUser.SessionId, "Create Report", "Comments Created for Job.");

                        return(Ok(result));
                    }
                    else if (jscvm.Type == "E")
                    {
                        var result = await reportFeederRepo.SaveEquipmentComments(jscvm);

                        await auditLogService.LogActivity(cUser.UserId, cUser.HostIP, cUser.SessionId, "Create Report", "Comments Created for Equipment.");

                        return(Ok(result));
                    }
                    else if (jscvm.Type == "U")
                    {
                        var result = await reportFeederRepo.SaveUnitAnalysisComments(jscvm);

                        await auditLogService.LogActivity(cUser.UserId, cUser.HostIP, cUser.SessionId, "Create Report", "Comments Created for Unit.");

                        return(Ok(result));
                    }
                    else
                    {
                        throw new CustomException("Please select valid type for comments", "Error", true, "Type(s) are Job, Equipment and UnitAnalysis and it is mandatory to Save Comments.");
                    }
                }
            }
            catch (CustomException cex)
            {
                var returnObj = new EmaintenanceMessage(cex.Message, cex.Type, cex.IsException, cex.Exception?.ToString());
                return(StatusCode(StatusCodes.Status500InternalServerError, returnObj));
            }
            catch (Exception ex)
            {
                return(StatusCode(StatusCodes.Status500InternalServerError, new EmaintenanceMessage(ex.Message)));
            }
        }
Exemple #16
0
 public async Task <IActionResult> GetlanguageById(int id)
 {
     try
     {
         return(Ok(await lRepo.GetLanguages(id)));
     }
     catch (CustomException cex)
     {
         var returnObj = new EmaintenanceMessage(cex.Message, cex.Type, cex.IsException, cex.Exception?.ToString());
         return(StatusCode(StatusCodes.Status500InternalServerError, returnObj));
     }
     catch (Exception ex)
     {
         return(StatusCode(StatusCodes.Status500InternalServerError, new EmaintenanceMessage(ex.Message)));
     }
 }
Exemple #17
0
 public async Task <IActionResult> SearchByName(string param)
 {
     try
     {
         return(Ok(await uRepo.GetUserByName(param)));
     }
     catch (CustomException cex)
     {
         var responseObj = new EmaintenanceMessage(cex.Message, cex.Type, cex.IsException, cex.Exception?.ToString());
         return(StatusCode(StatusCodes.Status500InternalServerError, responseObj));
     }
     catch (Exception ex)
     {
         return(Ok(new EmaintenanceMessage(ex.Message)));
     }
 }
 public async Task <IActionResult> GetPerformanceReport([FromBody] PerformanceReportViewModel prvm)
 {
     try
     {
         return(Ok(await prRepo.GetPerformanceReport(prvm)));
     }
     catch (CustomException cex)
     {
         var responseObj = new EmaintenanceMessage(cex.Message, cex.Type, cex.IsException, cex.Exception?.ToString());
         return(StatusCode(StatusCodes.Status500InternalServerError, responseObj));
     }
     catch (Exception ex)
     {
         return(Ok(new EmaintenanceMessage(ex.Message)));
     }
 }
Exemple #19
0
 public async Task <IActionResult> GetAttachmentByUnitAnalysis(int uaId, string status)
 {
     try
     {
         return(Ok(await reportFeederRepo.GetAttachmentByUnitAnalysisId(uaId, status)));
     }
     catch (CustomException cex)
     {
         var responseObj = new EmaintenanceMessage(cex.Message, cex.Type, cex.IsException, cex.Exception?.ToString());
         return(StatusCode(StatusCodes.Status500InternalServerError, responseObj));
     }
     catch (Exception ex)
     {
         return(Ok(new EmaintenanceMessage(ex.Message)));
     }
 }
 public async Task <IActionResult> GetCountryByName(int lId, string name, string searchParam)
 {
     try
     {
         return(Ok(await cntryRepo.GetCountryByName(lId, name, searchParam)));
     }
     catch (CustomException cex)
     {
         var responseObj = new EmaintenanceMessage(cex.Message, cex.Type, cex.IsException, cex.Exception?.ToString());
         return(StatusCode(StatusCodes.Status500InternalServerError, responseObj));
     }
     catch (Exception ex)
     {
         return(Ok(new EmaintenanceMessage(ex.Message)));
     }
 }
Exemple #21
0
 public async Task <IActionResult> GetOilPropertiesByEquipment(int jeId, int lId)
 {
     try
     {
         return(Ok(await reportFeederRepo.GetOilPropertiesByEquipmentId(jeId, lId)));
     }
     catch (CustomException cex)
     {
         var responseObj = new EmaintenanceMessage(cex.Message, cex.Type, cex.IsException, cex.Exception?.ToString());
         return(StatusCode(StatusCodes.Status500InternalServerError, responseObj));
     }
     catch (Exception ex)
     {
         return(Ok(new EmaintenanceMessage(ex.Message)));
     }
 }
Exemple #22
0
 public async Task <IActionResult> GetSymptomsByUnitAnalysis(string type, string sType, int lId)
 {
     try
     {
         return(Ok(await reportFeederRepo.GetSymptomsByUnitAnalysis(type, sType, lId)));
     }
     catch (CustomException cex)
     {
         var responseObj = new EmaintenanceMessage(cex.Message, cex.Type, cex.IsException, cex.Exception?.ToString());
         return(StatusCode(StatusCodes.Status500InternalServerError, responseObj));
     }
     catch (Exception ex)
     {
         return(Ok(new EmaintenanceMessage(ex.Message)));
     }
 }
Exemple #23
0
 public async Task <IActionResult> GetUserRoleGroupAccess(int lId, string uId)
 {
     try
     {
         return(Ok(await urgrRepo.GetUserRoleGroupAccess(lId, uId)));
     }
     catch (CustomException cex)
     {
         var responseObj = new EmaintenanceMessage(cex.Message, cex.Type, cex.IsException, cex.Exception?.ToString());
         return(StatusCode(StatusCodes.Status500InternalServerError, responseObj));
     }
     catch (Exception ex)
     {
         return(Ok(new EmaintenanceMessage(ex.Message)));
     }
 }
 public async Task <IActionResult> SearchCostCentre([FromBody] CostCentreViewModel cvm)
 {
     try
     {
         return(Ok(await cRepo.SearchCostCentre(cvm)));
     }
     catch (CustomException cex)
     {
         var responseObj = new EmaintenanceMessage(cex.Message, cex.Type, cex.IsException, cex.Exception?.ToString());
         return(StatusCode(StatusCodes.Status500InternalServerError, responseObj));
     }
     catch (Exception ex)
     {
         return(Ok(new EmaintenanceMessage(ex.Message)));
     }
 }
 public async Task <IActionResult> GetFailureModeAssetClassRel(int LanguageId, int FailureModeId)
 {
     try
     {
         return(Ok(await failureModeRepo.GetFailureModeAssetClassRel(LanguageId, FailureModeId)));
     }
     catch (CustomException cex)
     {
         var responseObj = new EmaintenanceMessage(cex.Message, cex.Type, cex.IsException, cex.Exception?.ToString());
         return(StatusCode(StatusCodes.Status500InternalServerError, responseObj));
     }
     catch (Exception ex)
     {
         return(Ok(new EmaintenanceMessage(ex.Message)));
     }
 }
Exemple #26
0
 public async Task <IActionResult> GetTransSector(int sId)
 {
     try
     {
         return(Ok(await sRepo.GetTransSectors(sId)));
     }
     catch (CustomException cex)
     {
         var responseObj = new EmaintenanceMessage(cex.Message, cex.Type, cex.IsException, cex.Exception?.ToString());
         return(StatusCode(StatusCodes.Status500InternalServerError, responseObj));
     }
     catch (Exception ex)
     {
         return(Ok(new EmaintenanceMessage(ex.Message)));
     }
 }
 public async Task <IActionResult> GetLeverageServiceList(int jeId, int lId)
 {
     try
     {
         return(Ok(await leverageRepo.GetLeverageServiceList(jeId, lId)));
     }
     catch (CustomException cex)
     {
         var responseObj = new EmaintenanceMessage(cex.Message, cex.Type, cex.IsException, cex.Exception?.ToString());
         return(StatusCode(StatusCodes.Status500InternalServerError, responseObj));
     }
     catch (Exception ex)
     {
         return(Ok(new EmaintenanceMessage(ex.Message)));
     }
 }
 public async Task <IActionResult> Search([FromBody] FailureModeViewModel fmvm)
 {
     try
     {
         return(Ok(await failureModeRepo.GetFailureModeByParams(fmvm)));
     }
     catch (CustomException cex)
     {
         var responseObj = new EmaintenanceMessage(cex.Message, cex.Type, cex.IsException, cex.Exception?.ToString());
         return(StatusCode(StatusCodes.Status500InternalServerError, responseObj));
     }
     catch (Exception ex)
     {
         return(Ok(new EmaintenanceMessage(ex.Message)));
     }
 }
Exemple #29
0
 public async Task <IActionResult> Update([FromBody] SectorViewModel svm)
 {
     try
     {
         return(Ok(await sRepo.SaveOrUpdate(svm)));
     }
     catch (CustomException cex)
     {
         var returnObj = new EmaintenanceMessage(cex.Message, cex.Type, cex.IsException, cex.Exception?.ToString());
         return(StatusCode(StatusCodes.Status500InternalServerError, returnObj));
     }
     catch (Exception ex)
     {
         return(StatusCode(StatusCodes.Status500InternalServerError, new EmaintenanceMessage(ex.Message)));
     }
 }
 public async Task <IActionResult> Get(int cId, int lId, string status)
 {
     try
     {
         return(Ok(await cRepo.GetCostCentreByStatus(cId, lId, status)));
     }
     catch (CustomException cex)
     {
         var responseObj = new EmaintenanceMessage(cex.Message, cex.Type, cex.IsException, cex.Exception?.ToString());
         return(StatusCode(StatusCodes.Status500InternalServerError, responseObj));
     }
     catch (Exception ex)
     {
         return(Ok(new EmaintenanceMessage(ex.Message)));
     }
 }