public RocketSaleDetailEN GetSaleDetail(int pMasterID, int pPersonID) { RocketSaleDetailEN councilCount = new RocketSaleDetailEN(); try { councilCount = saleDAL.GetSalesDetail(pMasterID, pPersonID); } catch (Exception ex) { councilCount = null; Console.WriteLine(ex.InnerException); EventViewerLoggerBL.LogError(ex.Message); } return(councilCount); }
public HttpResponseMessage GetSaleDetail(HttpRequestMessage request) { IEnumerable <string> token = null; request.Headers.TryGetValues("Token-autorization", out token); //TODO: Corregir error ortográfico PersonEN personVerified = personBL.VerifyPersonAuthentication(token); if (personVerified != null) { if (personVerified.IsValidToken) { personVerified.MasterID = 1019; RocketSaleDetailEN SaleDetail = saleBL.GetSaleDetail(personVerified.MasterID, personVerified.PersonID); if (SaleDetail != null) { var historyResult = interactor.createSaleDetailResponse(SaleDetail, personBL.RenewAuthToken(personVerified)); return(Request.CreateResponse <IResponse>(HttpStatusCode.OK, historyResult)); } else { response.HttpCode = 500; response.Message = "Something went wrong"; return(Request.CreateResponse <IResponse>(HttpStatusCode.InternalServerError, response)); } } else { response.HttpCode = 401; response.Message = "Authentication token has expired."; return(Request.CreateResponse <IResponse>(HttpStatusCode.Unauthorized, response)); } } else { response.HttpCode = 401; response.Message = "Token authorization has expired or is not valid"; return(Request.CreateResponse <IResponse>(HttpStatusCode.Unauthorized, response)); } }
public RocketSaleDetailEN GetSalesDetail(int pMasterID, int pPersonID) { RocketSaleDetailEN SalesDetail = new RocketSaleDetailEN(); try { connection.Cnn.Open(); SalesDetail = connection.Cnn.Query <RocketSaleDetailEN>("SpSalesDetail", new { Distributor = pMasterID, PDV = pPersonID }, commandType: CommandType.StoredProcedure).FirstOrDefault(); } catch (Exception ex) { Console.WriteLine("Error SaleDAL: " + ex.Message); EventViewerLoggerDAL.LogError(ex.Message); } finally { connection.Cnn.Close(); } return(SalesDetail); }
public IResponse createSaleDetailResponse(RocketSaleDetailEN pSaleDetail, string pToken) { //RocketSalesDetailResponse response = new RocketSalesDetailResponse(); //respuesta json //SaleDetailListResponse AllSales = new SaleDetailListResponse(); //objeto contiene lista RocketSaleDetail rocketSalesDetail = new RocketSaleDetail(); rocketSalesDetail.balanceID = pSaleDetail.BalanceID; rocketSalesDetail.personID = pSaleDetail.PersonID; rocketSalesDetail.personMasterID = pSaleDetail.PersonMasterID; rocketSalesDetail.receivable = pSaleDetail.Receivable; rocketSalesDetail.reconcileCount = pSaleDetail.ReconcileCount; rocketSalesDetail.name = pSaleDetail.Name; rocketSalesDetail.bStatus = pSaleDetail.BStatus; rocketSalesDetail.zone = pSaleDetail.Zone; rocketSalesDetail.minDate = pSaleDetail.MinDate; rocketSalesDetail.maxDate = pSaleDetail.MaxDate; rocketSalesDetail.distributor = pSaleDetail.Distributor; rocketSalesDetail.sale = pSaleDetail.Sale; return(rocketSalesDetail); }