public IHttpActionResult GetQuotaExpressions(string id) { OfferQuotaCellsResponse _responseEnvelope = new OfferQuotaCellsResponse(Request.Properties["requestId"].ToString(), true); int status = 1; String apiUser = RequestContext.Principal.Identity.Name; MonitorEvent evt = new MonitorEvent("OfferService"); try { _responseEnvelope.Data = OffersManager.GetOfferQuotaExpression(Request, apiUser, id); } catch (Exception e) { //Edit for R184 _responseEnvelope.Data.Errors.Add(new ErrorObject(ErrorKey.ERR_INTERNAL_FATAL)); //R185 Modification //_responseEnvelope.Data.Errors.Add(new ErrorObject(ErrorKey.ERR_INTERNAL_FATAL)); LoggerFactory.GetLogger().InfoJson(new Methods().Exception_ToLogObject(_responseEnvelope.Meta.Id, RequestContext.Principal.Identity.Name, OperationType, OperationName, e)); status = 0; } finally { if (_responseEnvelope.Data.Errors != null && _responseEnvelope.Data.Errors.Count > 0) { if (_responseEnvelope.Data.Errors.Exists(i => i.Id == ErrorKey.ERR_INTERNAL_FATAL)) status = 0; _responseEnvelope.Status = false; } else _responseEnvelope.Data.Errors = null; evt.Log(_responseEnvelope.Meta.Id, "GetOfferQuotaCells", status); } return Ok(_responseEnvelope); }
public IHttpActionResult Get() { MonitorEvent evt = new MonitorEvent("OfferService"); int status = 1; String apiUser = RequestContext.Principal.Identity.Name; OffersResponse _responseEnvelope = new OffersResponse(Request.Properties["requestId"].ToString(), true); OperationName = operationName.GetAllTestOffers.ToString(); try { _responseEnvelope.Data = OffersManager.GetOffers(Request, apiUser); } catch (Exception e) { //In case of an internal application error, we will end up with the internal error id //In case of an internal web service call, we will end up with the back-end unavailable error id //Edit for R184 _responseEnvelope.Data.Errors.Add(new ErrorObject(ErrorKey.ERR_INTERNAL_FATAL)); //R185 Modification //_responseEnvelope.Data.Errors.Add(new ErrorObject(errorKey)); //We add the exception with the stack-trace in the OfferServiceLog file LoggerFactory.GetLogger().ErrorJson(new Methods().Exception_ToLogObject(_responseEnvelope.Meta.Id, RequestContext.Principal.Identity.Name, OperationType, OperationName, e)); status = 0; } finally { if (_responseEnvelope.Data.Errors.Count > 0) { if (_responseEnvelope.Data.Errors.Exists(i => i.Id == ErrorKey.ERR_INTERNAL_FATAL)) status = 0; _responseEnvelope.Status = false; } else _responseEnvelope.Data.Errors = null; evt.Log(_responseEnvelope.Meta.Id, "GetOffers", status); } return Ok(_responseEnvelope); }
public IHttpActionResult GetAttributes() { MonitorEvent evt = new MonitorEvent("OfferService"); int status = 1; CodebookResponse _responseEnvelope = new CodebookResponse(Request.Properties["requestId"].ToString(), true); String apiUser = RequestContext.Principal.Identity.Name; OperationName = operationName.GetAttributes.ToString(); //Get the attributes and put them into the response envelope try { _responseEnvelope.Data = AttributesManager.GetPublishedAttributes(Request, apiUser); } catch (Exception e) { //Edit for R184 _responseEnvelope.Data.Errors.Add(new ErrorObject(ErrorKey.ERR_INTERNAL_FATAL)); //R185 Modification //_responseEnvelope.Data.Errors.Add(new ErrorObject(ErrorKey.ERR_INTERNAL_FATAL)); LoggerFactory.GetLogger().InfoJson(new Methods().Exception_ToLogObject(_responseEnvelope.Meta.Id, apiUser, OperationType, OperationName, e)); status = 0; } finally { if (_responseEnvelope.Data.Errors.Count > 0) { if (_responseEnvelope.Data.Errors.Exists(i => i.Id == ErrorKey.ERR_INTERNAL_FATAL)) status = 0; _responseEnvelope.Status = false; } else _responseEnvelope.Data.Errors = null; evt.Log(_responseEnvelope.Meta.Id, "GetAttributeList", status); } return Ok(_responseEnvelope); }