Example #1
0
        public void GetSlotNumsForColour(string colour)
        {
            validParkingLotExists();
            colour = colour.ToLower();
            List <string> cars = new List <string>();

            foreach (var reg in _regToColourMap.Keys)
            {
                if (_regToColourMap[reg].ToLower().Equals(colour))
                {
                    cars.Add(reg);
                }
            }
            if (cars.Count == 0)
            {
                throw new NotFoundException();
            }

            List <string> slots = new List <string>();

            foreach (var slot in _slotToRegMap.Keys)
            {
                if (cars.Contains(_slotToRegMap[slot]))
                {
                    slots.Add(slot.ToString());
                }
            }

            if (slots.Count == 0)
            {
                throw new NotFoundException();
            }
            output.Print(PrintInput.CommaSeparatedList(slots));
            return;
        }
Example #2
0
        public void GetStatus()
        {
            validParkingLotExists();
            int slotLength = ParkingLot.SlotNumberText.Length, regNoLength = ParkingLot.RegistrationNumberText.Length;

            foreach (var slot in _slotToRegMap.Keys)
            {
                slotLength  = (slot.ToString().Length > slotLength) ? slot.ToString().Length : slotLength;
                regNoLength = (_slotToRegMap[slot].Length > regNoLength) ? _slotToRegMap[slot].Length : regNoLength;
            }
            string slotGap = "";

            for (int i = 0; i < (slotLength - ParkingLot.SlotNumberText.Length + 7); i++)
            {
                slotGap += " ";
            }

            string regGap = "";

            for (int i = 0; i < regNoLength - ParkingLot.RegistrationNumberText.Length + 7; i++)
            {
                regGap += " ";
            }

            output.Print(PrintInput.BeautifyStatusOutput(ParkingLot.SlotNumberText, slotLength) + PrintInput.BeautifyStatusOutput(ParkingLot.RegistrationNumberText, regNoLength) + ParkingLot.ColourText);
            foreach (var key in _slotToRegMap.Keys)
            {
                output.Print(string.Format("{0}{1}{2}", PrintInput.BeautifyStatusOutput(key.ToString(), slotLength), PrintInput.BeautifyStatusOutput(_slotToRegMap[key], regNoLength), _regToColourMap[_slotToRegMap[key]]));
            }
            return;
        }
Example #3
0
        public void GetRegistrationNumsForColour(string colour)
        {
            validParkingLotExists();
            colour = colour.ToLower();
            List <string> cars = new List <string>();

            foreach (var reg in _regToColourMap.Keys)
            {
                if (_regToColourMap[reg].ToLower().Equals(colour))
                {
                    cars.Add(reg);
                }
            }
            if (cars.Count == 0)
            {
                throw new NotFoundException();
            }
            output.Print(PrintInput.CommaSeparatedList(cars));
            return;
        }
 public byte[] Print(PrintInput parameter)
 {
     return(this.tryAction(
                createRequest: () => this.getNewRequest("/JPolicyFeature/GetPolicyPDF.cmd?id=b99699fa-43df-d981-917a-15ce29af79c6", Method.POST)
                .AddJsonBody(parameter),
                createResponse: request => this.execute(request),
                createResult: response =>
     {
         var requestResult = this.GetSimpleResult <string>(response);
         if (requestResult.Length % 3 != 0)
         {
             throw new VirtuResponceException($"requestResult.Length = {requestResult.Length}, requestResult.Length % 3 = {requestResult.Length % 3}");
         }
         byte[] result = new byte[requestResult.Length / 3];
         for (int index = 0; index < result.Length; ++index)
         {
             result[index] = (byte)(100 * this.getByte(requestResult[3 * index]) + 10 * this.getByte(requestResult[3 * index + 1]) + 1 * this.getByte(requestResult[3 * index + 2]));
         }
         return result;
     }));
 }
        public IHttpActionResult PrintReport([FromBody] PrintInput docParams)
        {
            try
            {
                Eticadata.Views.Reports.ReportsGcePOS report = new Views.Reports.ReportsGcePOS(Eti.Aplicacao, "", ERP.EtiEnums.ExportWebFormat.PDF);
                EtiAplicacao etiapp = new EtiAplicacao();

                byte[] reportBytes;

                var rptProp = new Eticadata.Common.EtiReportProperties()
                {
                    TpDocAEmitir        = TpDocumentoAEmitir.Vendas,
                    AbrevTpDoc          = docParams.DocType,
                    CodExercicio        = docParams.DocFiscalYearCode,
                    CodSeccao           = docParams.DocSeccion,
                    Numero              = docParams.DocNumber,
                    EtiApp              = Eti.Aplicacao,
                    ExportaFicheiro     = false,
                    SoExportacao        = false,
                    ToPrinter           = true,
                    IncrementPrintCount = true,
                    //FrontOffBackOff = ReportApplication.BackOffice,
                    ExportaFormato = "1"
                };

                reportBytes = report.EmiteDocumentos(rptProp);

                if (!string.IsNullOrEmpty(rptProp.ErrorDescription))
                {
                    return(BadRequest(rptProp.ErrorDescription));
                }

                return(Ok(reportBytes));
            }
            catch (Exception ex)
            {
                return(BadRequest(ex.ToString()));
            }
        }