private JObject GetInvoiceApproveJsonStructure(InvoiceApprove invoiceProperties, Guid processId) { OperationResult result = new OperationResult(); JObject jObject = new JObject(); try { if (invoiceProperties != null) { jObject.Add(InvoiceFields.StatusCode, AboxDynamicsBase.Classes.Constants.ApprovedStatusInvoiceDropdownValue); } return(jObject); } catch (Exception ex) { LogEventInfo log = new LogEventInfo(LogLevel.Error, Logger.Name, null, "", null, new Exception(ex.ToString())); log.Properties["ProcessID"] = processId; log.Properties["AppID"] = AboxDynamicsBase.Classes.Constants.ApplicationIdWebAPI; log.Properties["MethodName"] = System.Reflection.MethodBase.GetCurrentMethod().Name; Logger.Log(log); jObject = null; return(jObject); } }
public OperationResult ApproveInvoice(InvoiceApprove invoiceApproveRequest, Guid processId) { OperationResult responseObject = new OperationResult(); try { if (invoiceApproveRequest != null) { JObject invoiceUpdateObject = this.GetInvoiceApproveJsonStructure(invoiceApproveRequest, processId); responseObject = this.InvoiceUpdateRequest(invoiceUpdateObject, invoiceApproveRequest.InvoiceId, processId); } } catch (Exception ex) { LogEventInfo log = new LogEventInfo(LogLevel.Error, Logger.Name, null, "", null, new Exception(ex.ToString())); log.Properties["ProcessID"] = processId; log.Properties["AppID"] = AboxDynamicsBase.Classes.Constants.ApplicationIdWebAPI; log.Properties["MethodName"] = System.Reflection.MethodBase.GetCurrentMethod().Name; Logger.Log(log); //Logger.Error(ex,""); responseObject.Code = ""; responseObject.Message = ex.ToString(); responseObject.IsSuccessful = false; responseObject.Data = null; } return(responseObject); }
public IHttpActionResult ApproveInvoice([FromBody] InvoiceApprove invoiceApproveRequest) { Guid processId = Guid.NewGuid(); LogEventInfo log = new LogEventInfo(LogLevel.Debug, Logger.Name, $"ProcessID: {processId} Request hacia {Request.RequestUri} con el JSON:**START** {JsonConvert.SerializeObject(invoiceApproveRequest)} **END**"); log.Properties["ProcessID"] = processId; log.Properties["AppID"] = AboxDynamicsBase.Classes.Constants.ApplicationIdWebAPI; log.Properties["MethodName"] = System.Reflection.MethodBase.GetCurrentMethod().Name; Logger.Log(log); EInvoice invoiceProcedures = new EInvoice(); OperationResult response = null; try { if (invoiceApproveRequest != null) { response = invoiceProcedures.ApproveInvoice(invoiceApproveRequest, processId); if (response.IsSuccessful) { return(Ok(response)); } else { return(Content(HttpStatusCode.InternalServerError, response)); } } else { return(Content(HttpStatusCode.BadRequest, new OperationResult { Code = "", IsSuccessful = false, Data = null, Message = "La solicitud JSON enviada es incorrecta" })); } } catch (Exception ex) { LogEventInfo logEx = new LogEventInfo(LogLevel.Error, Logger.Name, null, $"Request hacia {Request.RequestUri} con el JSON:**START** {JsonConvert.SerializeObject(invoiceApproveRequest)} **END**", null, new Exception(ex.ToString())); logEx.Properties["ProcessID"] = processId; logEx.Properties["AppID"] = Constants.ApplicationIdWebAPI; logEx.Properties["MethodName"] = System.Reflection.MethodBase.GetCurrentMethod().Name; Logger.Log(logEx); return(Content(HttpStatusCode.InternalServerError, new OperationResult { IsSuccessful = false, Data = null, Message = ex.ToString(), Code = "" })); } }