示例#1
0
        public MI4TServiceResponse <IndexResponse> RemoveDocument(MI4TServiceRequest <IndexRequest> query)
        {
            MI4TLogger.WriteLog(ELogLevel.INFO, "Entering into method IndexService.RemoveDocument");
            MI4TServiceResponse <IndexResponse> serviceResponse = new MI4TServiceResponse <IndexResponse>();

            try
            {
                //serviceResponse.ServicePayload = new IndexResponse();
                //serviceResponse.ServicePayload.Result = 1;
                MI4TLogger.WriteLog(ELogLevel.INFO, "RemoveDocument is  called publish is true1 ");

                IndexResponse    resultValue;
                MI4TIndexManager indexManager = new MI4TIndexManager(query.ServicePayload.LanguageInRequest);
                resultValue = indexManager.RemoveDocument(query.ServicePayload);
                serviceResponse.ServicePayload = resultValue;
                MI4TLogger.WriteLog(ELogLevel.INFO, "RemoveDocument is  called publish is true 2");
            }
            catch (Exception ex)
            {
                serviceResponse.ServicePayload              = new IndexResponse();
                serviceResponse.ServicePayload.Result       = 0;
                serviceResponse.ServicePayload.ErrorMessage = "RemoveDocument is not called ispublish is false";
                MI4TLogger.WriteLog(ELogLevel.INFO, "RemoveDocument is not called ispublish is false");
                string logString = MI4TServiceConstants.LOG_MESSAGE + Environment.NewLine;
                string request   = query != null?query.ToJSONText() : "Request = NULL";

                logString = string.Concat(logString, string.Format("Service Request: {0}", request),
                                          Environment.NewLine, string.Format("{0}{1}", ex.Message, ex.StackTrace));
                MI4TLogger.WriteLog(ELogLevel.ERROR, logString);
                CatchException <IndexResponse>(ex, serviceResponse);
            }
            MI4TLogger.WriteLog(ELogLevel.INFO, "Exiting from method IndexService.RemoveDocument");
            return(serviceResponse);
        }
示例#2
0
        private void CatchException <T>(Exception ex, MI4TServiceResponse <T> serviceResponse)
        {
            MI4TServiceFault fault = new MI4TServiceFault();

            ExceptionHelper.HandleException(ex, out fault);
            serviceResponse.ResponseContext.FaultCollection.Add(fault);
        }
示例#3
0
        public MI4TServiceResponse <IndexResponse> AddDocument(MI4TServiceRequest <IndexRequest> query)
        {
            MI4TLogger.WriteLog(ELogLevel.INFO, "Enter into method IndexService.AddDocumnet()");
            MI4TServiceResponse <IndexResponse> serviceResponse = new MI4TServiceResponse <IndexResponse>();

            try
            {
                string        language = query.ServicePayload.LanguageInRequest;
                IndexResponse resultValue;

                MI4TIndexManager indexManager = new MI4TIndexManager(language);
                resultValue = indexManager.AddDocument(query.ServicePayload);
                MI4TLogger.WriteLog(ELogLevel.INFO, "AddDocumnet is called publish is true");
                serviceResponse.ServicePayload = resultValue;
            }
            catch (Exception ex)
            {
                serviceResponse.ServicePayload              = new IndexResponse();
                serviceResponse.ServicePayload.Result       = 1;
                serviceResponse.ServicePayload.ErrorMessage = "AddDocumnet is not called ispublish is false";
                MI4TLogger.WriteLog(ELogLevel.INFO, "AddDocumnet is not called ispublish is false" + ex.Message);
            }
            return(serviceResponse);
        }