Exemple #1
0
        public IHttpActionResult GetAll()
        {
            GetSettlementResponse response = new GetSettlementResponse();

            try
            {
                List <Settlement> settlements = settlementBL.GetSettlement();
                response.Settlements = settlements;
                response.Success     = true;
            }
            catch (SettlementException ex)
            {
                response.ErrorCode    = ex.Error;
                response.ErrorMessage = "Error. " + ex.Error.ToString();
                response.Success      = false;
            }
            catch (Exception ex)
            {
                response.ErrorMessage = "Error. " + ex.Message;
                response.Success      = false;
            }
            return(Ok(response));
        }
Exemple #2
0
        public void TestInsertSettlement()
        {
            SettlementBL settlementBL = new SettlementBL(connectionString);
            Settlement   settlement   = new Settlement();

            settlement.CicleId           = 1; //Assume we have a cicle with ID 1
            settlement.ProducerId        = 1; //Assume we have a producer with ID 1
            settlement.CashAdvancesTotal = 1000;
            settlement.Date               = System.DateTime.Now;
            settlement.Paid               = true;
            settlement.CreditsTotal       = 3000;
            settlement.WeightTicketsTotal = 4000;
            settlement.Total              = 5000;
            settlement.User               = "******"; //Assume we have a user with this ID
            settlement.WeightTicketsIds   = new System.Collections.ObjectModel.Collection <int>()
            {
                1
            };
            settlementBL.InsertSettlement(settlement);
            settlementBL.UpdateSettlement(settlement);
            List <Settlement> settlements = settlementBL.GetSettlement(null, null);
        }