public async Task <int> GetAllCounts(SearchRequestVM searchRequestVM) { try { searchRequestVM.SearchObject.Filters.FilterByMe = 0; var searchObject = searchRequestVM.SearchObject; // Encode all fields which are coming from js SearchUtility.EncodeSearchDetails(searchObject.Filters, false); // Encode Search Term searchObject.SearchTerm = (searchObject.SearchTerm != null) ? WebUtility.HtmlEncode(searchObject.SearchTerm).Replace(ServiceConstants.ENCODED_DOUBLE_QUOTES, ServiceConstants.DOUBLE_QUOTE) : string.Empty; ClientContext clientContext = null; clientContext = spoAuthorization.GetClientContext(searchRequestVM.Client.Url); var searchResultsVM = await docRepository.GetDocumentsAsync(searchRequestVM, clientContext); return(searchResultsVM.TotalRows); } catch (Exception ex) { customLogger.LogError(ex, MethodBase.GetCurrentMethod().DeclaringType.Name, MethodBase.GetCurrentMethod().Name, logTables.SPOLogTable); throw; } }
public async Task <IActionResult> Get([FromBody] String filter) { string result = string.Empty; try { #region Error Checking ErrorResponse errorResponse = null; if (filter == null) { errorResponse = new ErrorResponse() { Message = errorSettings.MessageNoInputs, ErrorCode = HttpStatusCode.BadRequest.ToString(), Description = "No filter was passed" }; return(matterCenterServiceFunctions.ServiceResponse(errorResponse, (int)HttpStatusCode.OK)); } #endregion var configResultsVM = await configRepository.GetConfigurationsAsync(filter); CreateConfig(configResultsVM, "uiconfig.js", false); return(matterCenterServiceFunctions.ServiceResponse(configResultsVM, (int)HttpStatusCode.OK)); } catch (Exception exception) { customLogger.LogError(exception, MethodBase.GetCurrentMethod().DeclaringType.Name, MethodBase.GetCurrentMethod().Name, logTables.SPOLogTable); throw; } }
public async Task <IActionResult> Get(DateTime date) { try { if (date == null) { return(BadRequest()); } var costs = await repository.GetCosts(date); if (costs == null) { return(StatusCode((int)HttpStatusCode.NotFound)); } var dtoCosts = modelTransformer.RangeOfModelCostsToRangeOfDTOModelCosts(costs); return(Ok(dtoCosts)); } catch (Exception ex) { logger.LogError(ex); return(StatusCode((int)HttpStatusCode.InternalServerError, ServerMessages.INTERNAL_SERVER_ERROR)); } }
/// <summary> /// This method will get all content types from the specified content type group and will filter out the content types that user has selected /// when creating the matter /// </summary> /// <param name="clientContext">The sharepoint context object</param> /// <param name="contentTypesNames">Content Type Names that user selected in the create matter screen</param> /// <param name="client">The client object which contains information for which client the matter is getting created and the url of the client</param> /// <param name="matter">The matter information that is getting created</param> /// <returns></returns> public IList <ContentType> GetContentTypeData(ClientContext clientContext, IList <string> contentTypesNames, Client client, Matter matter) { ContentTypeCollection contentTypeCollection = null; IList <ContentType> selectedContentTypeCollection = new List <ContentType>(); try { if (null != clientContext && null != contentTypesNames) { Web web = clientContext.Web; string contentTypeName = contentTypesConfig.OneDriveContentTypeGroup.Trim(); contentTypeCollection = web.ContentTypes; clientContext.Load(contentTypeCollection, contentType => contentType.Include(thisContentType => thisContentType.Name).Where(currContentType => currContentType.Group == contentTypeName)); clientContext.ExecuteQuery(); selectedContentTypeCollection = GetContentTypeList(contentTypesNames, contentTypeCollection.ToList()); } } catch (Exception exception) { customLogger.LogError(exception, MethodBase.GetCurrentMethod().DeclaringType.Name, MethodBase.GetCurrentMethod().Name, logTables.SPOLogTable); throw; } return(selectedContentTypeCollection); }
public GenericResponseVM UpdateMatterMetadata(MatterMetdataVM matterMetadata) { var matter = matterMetadata.Matter; var matterDetails = matterMetadata.MatterDetails; var client = matterMetadata.Client; ClientContext clientContext = null; GenericResponseVM returnFlag = null; try { clientContext = spoAuthorization.GetClientContext(matterMetadata.Client.Url); PropertyValues matterStampedProperties = matterRepositoy.GetStampedProperties(clientContext, matter.Name); Dictionary <string, string> propertyList = SetStampProperty(client, matter, matterDetails); matterRepositoy.SetPropertBagValuesForList(clientContext, matterStampedProperties, matter.Name, propertyList); if (matterMetadata.MatterProvisionFlags.SendEmailFlag) { returnFlag = ShareMatter(matterMetadata, matterMetadata.MatterProvisionFlags.MatterLandingFlag); } else { ServiceUtility.GenericResponse("", "Matter Update Success"); } } catch (Exception ex) { DeleteMatter(client, matter); customLogger.LogError(ex, MethodBase.GetCurrentMethod().DeclaringType.Name, MethodBase.GetCurrentMethod().Name, logTables.SPOLogTable); throw; } return(returnFlag); }
public ServiceResponse GetProducts() { try { return(_productManager.GetProducts()); } catch (Exception ex) { _logger.LogError <ProductController>(ex.StackTrace); throw; } }
/// <summary> /// Gets the order. /// </summary> /// <param name="order">The order.</param> /// <returns></returns> public ServiceResponse GetOrder(OrderDTO order) { try { return(_serviceResponseMapper.Map(_orderRepository.GetOrder(order))); } catch (Exception ex) { _customLogger.LogError <OrderManager>(ex.StackTrace); throw; } }
public IActionResult Get() { try { return(Ok(new { data = repository.GetUserTaskTypes().ToArray() })); } catch (Exception ex) { logger.LogError(ex); return(StatusCode(500, Constants.ServerMessage.INTERNAL_SERVER_ERROR)); } }
public ServiceResponse GetOrders() { try { return(_orderManager.GetOrders()); } catch (Exception ex) { _customLogger.LogError <OrderController>(ex.StackTrace); throw; } }
/// <summary> /// This method will get the access token for the service and creats SharePoint ClientContext object and returns that object /// </summary> /// <param name="url">The SharePoint Url for which the client context needs to be creatwed</param> /// <returns>ClientContext - Return SharePoint Client Context Object</returns> public ClientContext GetClientContext(string url) { try { string accessToken = GetAccessToken().Result; return(GetClientContextWithAccessToken(Convert.ToString(url, CultureInfo.InvariantCulture), accessToken)); } catch (Exception ex) { customLogger.LogError(ex, MethodBase.GetCurrentMethod().DeclaringType.Name, MethodBase.GetCurrentMethod().Name, logTables.SPOLogTable); throw; } }
/// <summary> /// Gets the product. /// </summary> /// <param name="product">The product.</param> /// <returns></returns> public ServiceResponse GetProduct(ProductDTO product) { try { var result = _productRepository.GetProduct(product); return(_serviceResponseMapper.Map(result)); } catch (Exception ex) { _logger.LogError <ProductManager>(ex.StackTrace); throw; } }
public async Task <IActionResult> Get([FromQuery][Required, Range(1, 12)] int month, [FromQuery][Required, Range(2020, 2200)] int year) { try { var plans = await repository.GetPlansWithMaxAmountOfCosts(month, year); return(Ok(modelTransformer.RangeOfModelsPlanToRangeOfDTOPlans(plans))); } catch (Exception ex) { logger.LogError(ex); return(StatusCode((int)HttpStatusCode.InternalServerError, Constants.ServerMessages.INTERNAL_SERVER_ERROR)); } }
public IActionResult DownloadAttachmentsAsStream([FromBody] MailAttachmentDetails mailAttachmentDetails) { try { #region Error Checking GenericResponseVM genericResponse = null; if (mailAttachmentDetails == null && mailAttachmentDetails.FullUrl == null) { genericResponse = new GenericResponseVM() { Value = errorSettings.MessageNoInputs, Code = HttpStatusCode.BadRequest.ToString(), IsError = true }; return(matterCenterServiceFunctions.ServiceResponse(genericResponse, (int)HttpStatusCode.OK)); } #endregion Stream downloadAttachments = documentProvision.DownloadAttachments(mailAttachmentDetails); var fileContentResponse = new HttpResponseMessage(HttpStatusCode.OK); fileContentResponse.Headers.Clear(); fileContentResponse.Content = new StreamContent(downloadAttachments); fileContentResponse.Content.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue(DocumentProvision.ReturnExtension(string.Empty)); //fileContentResponse.Headers.Add("Content-Type", ReturnExtension(string.Empty)); fileContentResponse.Content.Headers.Add("Content-Length", downloadAttachments.Length.ToString()); fileContentResponse.Content.Headers.Add("Content-Description", "File Transfer"); //application/octet-stream fileContentResponse.Content.Headers.Add("Content-Disposition", "attachment; filename=" + documentSettings.TempEmailName + new Guid().ToString() + ServiceConstants.EMAIL_FILE_EXTENSION); fileContentResponse.Content.Headers.Add("Content-Transfer-Encoding", "binary"); fileContentResponse.Content.Headers.Expires = DateTimeOffset.Now.AddDays(-1);; fileContentResponse.Headers.Add("Cache-Control", "must-revalidate, post-check=0, pre-check=0"); fileContentResponse.Headers.Add("Pragma", "public"); var fileAttachmentContent = fileContentResponse.Content.ReadAsStringAsync(); var response = new { fileAttachment = fileAttachmentContent, fileName = documentSettings.TempEmailName + Guid.NewGuid().ToString() + ServiceConstants.EMAIL_FILE_EXTENSION }; return(new ObjectResult(response)); } catch (Exception ex) { customLogger.LogError(ex, MethodBase.GetCurrentMethod().DeclaringType.Name, MethodBase.GetCurrentMethod().Name, logTables.SPOLogTable); throw; } }
public async Task <IActionResult> Get(DateTime beginDate, DateTime endDate) { try { var incomesData = await repository.GetIncomes(beginDate, endDate); var dtoIncomes = modelTransformer.RangeOfModelsIncomesToDTOIncomes(incomesData); return(Ok(dtoIncomes)); } catch (Exception ex) { logger.LogError(ex); return(StatusCode((int)HttpStatusCode.InternalServerError, ServerMessages.INTERNAL_SERVER_ERROR)); } }
public IActionResult Error() { var errorInfo = HttpContext.Features.Get <IExceptionHandlerPathFeature>(); _logger.LogError($"Hatanın oluştuğu yer :\n {errorInfo.Path}\n\n Hata Mesajı : \n {errorInfo.Error.Message}\n\n Stack Trace : \n {errorInfo.Error.StackTrace}"); return(Problem(detail: "Ooops! A problem has occurred.We notified our engineer to be repaired as soon as possible.")); }
public static void LogError(string message, Exception ex) { if (Logger != null) { Logger.LogError(message, ex); } }
public List <Airport> ProccessFile(string pathToFile, List <TimeZoneInformation> timeZoneAirports, ref int rowsIgnored) { List <Airport> result = new List <Airport>(); foreach (var line in fileParser.GetAllLinesFromFile(pathToFile)) { try { string[] items = service.SplitLine(line); int currentId = items[0].ToInt(); string airportName = items[1]; var timeZone = GetAirportsTimeZone(timeZoneAirports, currentId); if (!service.IsValid(items, timeZone)) { logger.LogInfo($"Invalid row: {currentId} - {airportName}"); rowsIgnored++; continue; } Airport airport = TransformLineToAirportObject(items, timeZone); result.Add(airport); } catch (Exception ex) { logger.LogError(ex.Message); } } return(result); }
public IActionResult Error() { var errorInfo = HttpContext.Features.Get <IExceptionHandlerPathFeature>(); _customLogger.LogError($"\nHatanın oluştuğu yer:{errorInfo.Path}\n Hata Mesajı : {errorInfo.Error.Message} \n Stack Trace: {errorInfo.Error.StackTrace}"); return(Problem(detail: "bir hata olustu, en kisa zamanda fixlenecek")); }
public IActionResult Error() { var exceptionHandler = HttpContext.Features.Get <IExceptionHandlerPathFeature>(); _customLogger.LogError($"Hatanın oluştuğu yer :{exceptionHandler.Path}\nHatanın mesajı :{exceptionHandler.Error.Message}\nStack Trace :{exceptionHandler.Error.StackTrace}"); return(View()); }
public IActionResult Error() { var errorInfo = HttpContext.Features.Get <IExceptionHandlerPathFeature>(); _customLogger.LogError($"\n Hatanın oluştuğu yer: {errorInfo.Path} \n Hata Mesajı : {errorInfo.Error.Message} \n Stack Trace : {errorInfo.Error.StackTrace}"); return(Problem("Bir hata oluştu en kısa zamanda düzeltilecektir")); }
public async Task ConvertToScdAsync(string[] currentOggFiles, CancellationToken cancellationToken) { var processed = 0; var failed = 0; foreach (var file in currentOggFiles) { try { await Task.Run(() => Convert(file)); processed++; var scdFile = file.Contains(".scd.ogg") ? file.Replace(".ogg", "") : file.Replace(".ogg", ".scd"); _sendMessageEvent.OnSendMessageEvent(new SendMessageEventArgs($"{new FileInfo(scdFile).Name} created")); } catch (Exception ex) { var message = $"There was a problem converting {file}."; _sendMessageEvent.OnSendMessageEvent(new SendMessageEventArgs($"{message}\r\n{ex.Message}.")); _logger.LogError(ex, message); failed++; } } var result = $"Completed SCD Conversion. {processed} converted. {failed} failed."; _sendMessageEvent.OnSendMessageEvent(new SendMessageEventArgs($"{result}")); _logger.LogInformation(result); }
public bool ExecuteMyWorkerServiceProcess() { bool isSuccessful = false; lock (_asynLock) { try { #region Normal Logger //_logger.LogTrace("{LogId}{Application}{LogMessage}{AdditionalInformation}", new object[] { Guid.NewGuid(), "Application Name", "Normal Logger - LogTrace", "Normal Logger - LogTrace" }); //_logger.LogDebug("{LogId}{Application}{LogMessage}{AdditionalInformation}", new object[] { Guid.NewGuid(), "Application Name", "Normal Logger - LogDebug", "Normal Logger - LogDebug" }); //_logger.LogInformation("{LogId}{Application}{LogMessage}{AdditionalInformation}", new object[] { Guid.NewGuid(), "Application Name", "Normal Logger - LogInformation", "Normal Logger - LogInformation" }); //_logger.LogWarning("{LogId}{Application}{LogMessage}{AdditionalInformation}", new object[] { Guid.NewGuid(), "Application Name", "Normal Logger - LogWarning", "Normal Logger - LogWarning" }); //_logger.LogError("{LogId}{Application}{LogMessage}{AdditionalInformation}", new object[] { Guid.NewGuid(), "Application Name", "Normal Logger - LogError", "Normal Logger - LogError" }); //_logger.LogCritical("{LogId}{Application}{LogMessage}{AdditionalInformation}", new object[] { Guid.NewGuid(), "Application Name", "Normal Logger - LogCritical", "Normal Logger - LogCritical" }); #endregion #region Custom Logger _customLogger.LogVerbose("Custom Logger- LogVerbose", "Custom Logger - LogVerbose"); _customLogger.LogDebug("Custom Logger - LogDebug", "Custom Logger- LogDebug"); _customLogger.LogInformation("Custom Logger - LogInformation", "Custom Logger - LogInformation"); _customLogger.LogWarning("Custom Logger - LogWarning", "Custom Logger- LogWarning"); Exception exError = new Exception("Custom Logger - LogError"); _customLogger.LogError(exError, "Custom Logger- LogError"); Exception exFetal = new Exception("Custom Logger - LogError"); _customLogger.LogFatal(exFetal, "Custom Logger - LogFatal"); #endregion int i = 1; int j = 0; int k = i / j; isSuccessful = true; } catch (Exception ex) { #region Normal Logger //_logger.LogError("{LogId}{Application}{LogMessage}{AdditionalInformation}", new object[] { Guid.NewGuid(), "Application Name", ex.Message, ex.StackTrace }); #endregion #region Custom Logger _customLogger.LogError(ex, "Some string"); #endregion isSuccessful = false; } } return(isSuccessful); }
/// <summary> /// This method will return the taxonomy hierarchy either for the practice group term set or for client term sets /// </summary> /// <typeparam name="T">The return type from this class</typeparam> /// <param name="clientContext">The sharepoint client context</param> /// <param name="termStoreDetails">The term store deatils that client has passed to we apiu</param> /// <param name="generalSettings">The general settings config values</param> /// <param name="taxonomySettings">The taxonomy settings config values</param> /// <returns></returns> public TaxonomyResponseVM GetTaxonomyHierarchy(Client client, TermStoreDetails termStoreDetails) { try { using (clientContext = spoAuthorization.GetClientContext(client.Url)) { TaxonomySession taxonomySession = TaxonomySession.GetTaxonomySession(clientContext); TermStore termStore; clientContext.Load(taxonomySession.TermStores); clientContext.ExecuteQuery(); termStore = taxonomySession.TermStores[0]; clientContext.Load( termStore, store => store.Name, store => store.Groups.Include( group => group.Name)); clientContext.ExecuteQuery(); taxonomyResponseVM = GetTaxonomyHierarchy(termStore, termStoreDetails); } } catch (Exception ex) { customLogger.LogError(ex, MethodBase.GetCurrentMethod().DeclaringType.Name, MethodBase.GetCurrentMethod().Name, logTables.SPOLogTable); throw; } return(taxonomyResponseVM); }
private Task HandleExceptionAsync(HttpContext context, Exception exception, ICustomLogger logger) { logger.LogError($"Something went wrong: {exception}"); context.Response.ContentType = "application/json"; context.Response.StatusCode = (int)HttpStatusCode.InternalServerError; return context.Response.WriteAsync(ErrorDetails.SetError(context.Response.StatusCode, "Internal Server Error from the custom middleware.")); }
public async Task <IActionResult> GetUsers([FromBody] SearchRequestVM searchRequestVM) { try { #region Error Checking GenericResponseVM genericResponse = null; if (searchRequestVM.Client == null && string.IsNullOrWhiteSpace(searchRequestVM.Client.Url)) { genericResponse = new GenericResponseVM() { Value = errorSettings.MessageNoInputs, Code = HttpStatusCode.BadRequest.ToString(), IsError = true }; return(matterCenterServiceFunctions.ServiceResponse(genericResponse, (int)HttpStatusCode.OK)); } #endregion searchRequestVM.SearchObject.SearchTerm = (!string.IsNullOrWhiteSpace(searchRequestVM.SearchObject.SearchTerm)) ? searchRequestVM.SearchObject.SearchTerm : string.Empty; IList <Users> users = await userRepositoy.GetUsersAsync(searchRequestVM); if (users != null && users.Count != 0) { return(matterCenterServiceFunctions.ServiceResponse(users, (int)HttpStatusCode.OK)); } else { Users noResult = new Users() { Name = errorSettings.PeoplePickerNoResults, LogOnName = string.Empty, Email = string.Empty, EntityType = string.Empty }; users.Add(noResult); return(matterCenterServiceFunctions.ServiceResponse(users, (int)HttpStatusCode.OK)); } } catch (Exception ex) { customLogger.LogError(ex, MethodBase.GetCurrentMethod().DeclaringType.Name, MethodBase.GetCurrentMethod().Name, logTables.SPOLogTable); throw; } }
public async Task <IActionResult> Get() { try { var categories = await repository.GetCostCategories(); if (categories == null) { return(StatusCode((int)HttpStatusCode.InternalServerError, ServerMessages.DATA_NOT_FOUND)); } return(Ok(categories)); } catch (Exception ex) { logger.LogError(ex); return(StatusCode((int)HttpStatusCode.InternalServerError, ServerMessages.INTERNAL_SERVER_ERROR)); } }
public async Task <IActionResult> UrlExists(Client client, string oneNoteUrl, string matterLandingPageUrl) { string result = string.Empty; try { spoAuthorization.AccessToken = HttpContext.Request.Headers["Authorization"]; #region Error Checking ErrorResponse errorResponse = null; //if the token is not valid, immediately return no authorization error to the user if (errorResponse != null && !errorResponse.IsTokenValid) { return(matterCenterServiceFunctions.ServiceResponse(errorResponse, (int)HttpStatusCode.Unauthorized)); } if (client == null && string.IsNullOrEmpty(oneNoteUrl) && string.IsNullOrEmpty(matterLandingPageUrl)) { errorResponse = new ErrorResponse() { Message = errorSettings.MessageNoInputs, ErrorCode = HttpStatusCode.BadRequest.ToString(), Description = "No input data is passed" }; return(matterCenterServiceFunctions.ServiceResponse(errorResponse, (int)HttpStatusCode.NotFound)); } #endregion var oneNoteUrlExists = await sharedRepository.UrlExistsAsync(client, oneNoteUrl); var matterLandingUrlExists = await sharedRepository.UrlExistsAsync(client, matterLandingPageUrl); var urlExists = new { OneNoteExists = oneNoteUrlExists, MatterLandingExists = matterLandingUrlExists }; return(matterCenterServiceFunctions.ServiceResponse(urlExists, (int)HttpStatusCode.OK)); } catch (Exception exception) { customLogger.LogError(exception, MethodBase.GetCurrentMethod().DeclaringType.Name, MethodBase.GetCurrentMethod().Name, logTables.SPOLogTable); throw; } }
/// <summary> /// This method will check whether the given login user is present in a /// sharepoint group or not /// </summary> /// <param name="client"></param> /// <param name="groupName"></param> /// <returns></returns> //public bool CheckUserPermissionsInGroup(Client client, string groupName) //{ // try // { // ClientContext clientContext = spoAuthorization.GetClientContext(client.Url); // Web web = clientContext.Web; // //Get the group name in which to check the user // Group group = web.SiteGroups.GetByName(groupName); // clientContext.Load(group, grp => grp.Title, grp => grp.Users); // clientContext.ExecuteQuery(); // //Loop through all the users in that group // foreach (User usr in group.Users) // { // //If the user is found in that group, return true else return false // if (usr.Email.ToLower().Trim() == Context.User.Identity.Name.ToLower().Trim()) // { // return true; // } // } // return false; // } // catch (Exception ex) // { // //If the user doesn't belong to the user, the code will throw the exception and the user may not belong to the group and // //log the message and return false from the method // customLogger.LogError(ex, MethodBase.GetCurrentMethod().DeclaringType.Name, MethodBase.GetCurrentMethod().Name, logTables.SPOLogTable); // return false; // } //} /// <summary> /// This method will return the user object who has currently logged into the system /// </summary> /// <param name="clientContext"></param> /// <returns></returns> public Users GetLoggedInUserDetails(ClientContext clientContext) { Users currentUserDetail = new Users(); try { clientContext.Load(clientContext.Web.CurrentUser, userInfo => userInfo.Title, userInfo => userInfo.Email, userInfo => userInfo.LoginName); clientContext.ExecuteQuery(); currentUserDetail.Name = clientContext.Web.CurrentUser.Title; currentUserDetail.Email = clientContext.Web.CurrentUser.Email; //Check if email is available to get account name, if not use login name if (!String.IsNullOrEmpty(currentUserDetail.Email)) { currentUserDetail.LogOnName = currentUserDetail.Email; } else { currentUserDetail.LogOnName = clientContext.Web.CurrentUser.LoginName; } //Retrieve user name from login int splitPositionStart; int splitPositionEnd = currentUserDetail.LogOnName.LastIndexOf(ServiceConstants.SYMBOL_AT, StringComparison.OrdinalIgnoreCase); if (splitPositionEnd == -1) //The user is an on-premise account { splitPositionStart = currentUserDetail.LogOnName.LastIndexOf(ServiceConstants.BACKWARD_SLASH, StringComparison.OrdinalIgnoreCase) + 1; splitPositionEnd = currentUserDetail.LogOnName.Length; } else { splitPositionStart = currentUserDetail.LogOnName.LastIndexOf(ServiceConstants.PIPE, StringComparison.OrdinalIgnoreCase) + 1; } currentUserDetail.LogOnName = currentUserDetail.LogOnName.Substring(splitPositionStart, splitPositionEnd - splitPositionStart); return(currentUserDetail); } catch (Exception exception) { customLogger.LogError(exception, MethodBase.GetCurrentMethod().DeclaringType.Name, MethodBase.GetCurrentMethod().Name, logTables.SPOLogTable); throw; } }
public async Task <IActionResult> Get([FromBody] SearchRequestVM searchRequestVM) { try { spoAuthorization.AccessToken = HttpContext.Request.Headers["Authorization"]; #region Error Checking ErrorResponse errorResponse = null; //if the token is not valid, immediately return no authorization error to the user if (errorResponse != null && !errorResponse.IsTokenValid) { return(matterCenterServiceFunctions.ServiceResponse(errorResponse, (int)HttpStatusCode.Unauthorized)); } if (searchRequestVM == null && searchRequestVM.Client == null && searchRequestVM.SearchObject == null) { errorResponse = new ErrorResponse() { Message = errorSettings.MessageNoInputs, ErrorCode = HttpStatusCode.BadRequest.ToString(), Description = "No input data is passed" }; return(matterCenterServiceFunctions.ServiceResponse(errorResponse, (int)HttpStatusCode.NotFound)); } #endregion var searchObject = searchRequestVM.SearchObject; // Encode all fields which are coming from js SearchUtility.EncodeSearchDetails(searchObject.Filters, false); // Encode Search Term searchObject.SearchTerm = (searchObject.SearchTerm != null) ? WebUtility.HtmlEncode(searchObject.SearchTerm).Replace(ServiceConstants.ENCODED_DOUBLE_QUOTES, ServiceConstants.DOUBLE_QUOTE) : string.Empty; var searchResultsVM = await documentRepositoy.GetDocumentsAsync(searchRequestVM); return(matterCenterServiceFunctions.ServiceResponse(searchResultsVM.SearchResults, (int)HttpStatusCode.OK)); } catch (Exception ex) { customLogger.LogError(ex, MethodBase.GetCurrentMethod().DeclaringType.Name, MethodBase.GetCurrentMethod().Name, logTables.SPOLogTable); throw; } }
public IActionResult Error() { var exceptionHandler = HttpContext.Features.Get <IExceptionHandlerPathFeature>(); _customLogger.LogError($"Hatanın Oluştuğu yer :{exceptionHandler.Path} \n" + $"Hatanın mesajı :{exceptionHandler.Error.Message} \n " + $"Stack Trace : {exceptionHandler.Error.StackTrace}"); ViewBag.Path = exceptionHandler.Path;//hata nerde gerceklesti ViewBag.Message = exceptionHandler.Error.Message; return(View()); }