Esempio n. 1
0
        public String totalCount(List <OrderDetails> panier)
        {
            decimal total = 0;
            decimal sousTotal;

            foreach (OrderDetails od in panier)
            {
                if (od.IdProduit.Substring(0, 2) == "01")
                {
                    Alcool prod = lireAlcoolSpecifique(od.IdProduit);
                    sousTotal = prod.PrixUnitaire * od.Quantity;
                    total    += sousTotal;
                }
                else if (od.IdProduit.Substring(0, 2) == "00")
                {
                    Vin prod = lireVinSpecifique(od.IdProduit);
                    sousTotal = prod.PrixUnitaire * od.Quantity;
                    total    += sousTotal;
                }

                else if (od.IdProduit.Substring(0, 2) == "02")
                {
                    Chemise prod = lireChemiseSpecifique(od.IdProduit);
                    sousTotal = prod.PrixUnitaire * od.Quantity;
                    total    += sousTotal;
                }
            }
            total = System.Math.Round(total, 2);

            return(total.ToString());
        }
Esempio n. 2
0
        public void OnGet()
        {
            Name = "this";

            if (Request.Query["id"].Count >= 1)
            {
                ClientID = Request.Query["id"].ToString();
            }

            AppraisalsContext context = new AppraisalsContext("server=aaperfected.cvsd2ftiozra.us-east-1.rds.amazonaws.com;port=3306;database=Appraisals;user=aapreferred;password=FiftyMillion%%01;");

            if (ClientID != string.Empty && ClientID != null)
            {
                _report        = context.getReport(ClientID);
                _report.photos = context.getPhotoByClientID(ClientID);

                if (_report.basicInfo.vin != null)
                {
                    VinDecoded = decodeVIN(_report.basicInfo.vin.ToUpper());
                }
                string test = string.Empty;
            }
            else
            {
                _report        = context.getReport("a07ba482-2551-445a-977a-9a4d86bfa0c4");
                _report.photos = context.getPhotoByClientID("a07ba482-2551-445a-977a-9a4d86bfa0c4");
                VinDecoded     = new Vin();
            }
        }
Esempio n. 3
0
        public Vin decodeVIN(string VIN)
        {
            Vin decodedVehicleVINInfo = new Vin();

            try
            {
                var uri = new Uri(string.Format("https://vpic.nhtsa.dot.gov/api/vehicles/DecodeVin/" + VIN + "?format=json", string.Empty));

                HttpClient aapHttpClient = new HttpClient()
                {
                    MaxResponseContentBufferSize = 2147483647,
                    Timeout = new System.TimeSpan(0, 0, 15) // 15 second timeout
                };

                HttpResponseMessage response = null;
                response = aapHttpClient.GetAsync(uri).Result;

                if (response.IsSuccessStatusCode)
                {
                    var vResponseContent = response.Content.ReadAsStringAsync().Result;
                    decodedVehicleVINInfo = Vin.FromJson(vResponseContent);
                }
            }
            catch (System.Exception ex)
            {
                //await Application.Current.MainPage.DisplayAlert("", "Error creating new customer " + ex.Message.ToString(), "OK");
            }

            return(decodedVehicleVINInfo);
        }
        public override int GetHashCode()
        {
            int hash = 1;

            if (Brand.Length != 0)
            {
                hash ^= Brand.GetHashCode();
            }
            if (Channel.Length != 0)
            {
                hash ^= Channel.GetHashCode();
            }
            if (Authorization.Length != 0)
            {
                hash ^= Authorization.GetHashCode();
            }
            if (Vin.Length != 0)
            {
                hash ^= Vin.GetHashCode();
            }
            if (RequestId.Length != 0)
            {
                hash ^= RequestId.GetHashCode();
            }
            return(hash);
        }
Esempio n. 5
0
 public void TransportCountryTest()
 {
     Assert.True(Vin.GetVINCountry("52111111111111111") == "США");
     Assert.True(Vin.GetVINCountry("TZ111111111111111") == "Португалия");
     Assert.True(Vin.GetVINCountry("89111111111111111") == "unknown country");
     Assert.True(Vin.GetVINCountry("TM111111111111111") == "Чехия");
 }
        public async Task <IActionResult> PutVin([FromRoute] int id, [FromBody] Vin vin)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != vin.Id)
            {
                return(BadRequest());
            }

            _context.Entry(vin).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!VinExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
        public override int ExecuterRequete(SqlConnection sqlConn)
        {
            SqlCommand sqlCmd = new SqlCommand("LireVinSpecifiqueWeb", sqlConn);

            sqlCmd.CommandType = CommandType.StoredProcedure;

            sqlCmd.Parameters.Add("@numVin", SqlDbType.VarChar).Value = IdVin;

            SqlDataReader sqlReader = sqlCmd.ExecuteReader();

            if (sqlReader.Read() == true)
            {
                v = new Vin(Convert.ToString(sqlReader["idProduit"]),
                            Convert.ToString(sqlReader["nomVin"]),
                            Convert.ToDecimal(sqlReader["prixUnitaire"]),
                            Convert.ToString(sqlReader["typeVin"]),
                            Convert.ToString(sqlReader["saveur"]),
                            Convert.ToString(sqlReader["provenanceVin"]),
                            Convert.ToString(sqlReader["maturation"]),
                            Convert.ToString(sqlReader["millesime"]),
                            Convert.ToInt32(sqlReader["stockVin"]),
                            Convert.ToString(sqlReader["imageVin"]));
            }
            sqlReader.Close();
            return((v != null) ? 1 : 0);
        }
Esempio n. 8
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Nom,Description,Type,Millesime,Volume,Image,CouleurId,PaysId,RegionId,CaveId,Quantite")] Vin vin, int[] AlimentsId, int?Parent)
        {
            if (id != vin.Id)
            {
                return(NotFound());
            }
            if (Parent != null)
            {
                vin.CaveId = Parent.Value;
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(vin);
                    var vinaliments = await _context.VinAlments.Where(va => va.VinId == vin.Id).AsNoTracking().ToListAsync();

                    _context.VinAlments.RemoveRange(vinaliments);
                    await _context.SaveChangesAsync();

                    foreach (int aliment in AlimentsId)
                    {
                        _context.Add(new VinAliment {
                            VinId = vin.Id, AlimentId = aliment
                        });
                    }
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!VinExists(vin.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                if (Parent != null)
                {
                    return(RedirectToAction("Details", "Caves", new { id = Parent, Area = "BackOffice" }));
                }
                else
                {
                    return(RedirectToAction(nameof(Index)));
                }
            }
            ViewBag.Parent      = Parent;
            ViewBag.Caves       = new SelectList(await _context.Caves.ToListAsync(), "Id", "Nom");
            ViewBag.Couleurs    = _localization.ApplyTranslateSelectList(await _context.Couleurs.ToListAsync(), "Id", "Nom", vin.CouleurId);
            ViewBag.Pays        = _localization.ApplyTranslateSelectList(await _context.Pays.ToListAsync(), "Id", "Nom", vin.PaysId);
            ViewBag.Regions     = new SelectList(await _context.Regions.ToListAsync(), "Id", "Nom", vin.RegionId);
            ViewBag.Aliments    = _localization.ApplyTranslateSelectList(await _context.Aliments.ToListAsync(), "Id", "Nom");
            ViewBag.VinAliments = await _context.VinAlments.Where(va => va.VinId == vin.Id).AsNoTracking().Select(va => va.AlimentId).ToListAsync();

            return(View(vin));
        }
Esempio n. 9
0
        public void TestVinToString()
        {
            var testVinValue = "3N1CN7AP0GL861987";
            var testSubject  = new Vin {
                Value = testVinValue
            };

            Assert.AreEqual(testVinValue, testSubject.ToString());
        }
Esempio n. 10
0
        public void TestGetRandoManufacturerId()
        {
            var testResult = Vin.GetRandomManufacturerId();

            Assert.IsNotNull(testResult);
            System.Diagnostics.Debug.WriteLine(string.Join(" ", testResult.Item1, testResult.Item2));
            Assert.IsNotNull(testResult.Item1);
            Assert.IsFalse(string.IsNullOrWhiteSpace(testResult.Item2));
        }
Esempio n. 11
0
 private void clear_butt_Click(object sender, EventArgs e)
 {
     R1.Clear();
     Vin.Clear();
     Vout.Clear();
     MaxPower.Clear();
     R1Val.Clear();
     R2Val.Clear();
 }
Esempio n. 12
0
 public bool Equals(PsaTrace another)
 {
     if (Vin.Equals(another.Vin, StringComparison.OrdinalIgnoreCase) &&
         Date == another.Date)
     {
         return(true);
     }
     return(false);
 }
        public async Task GetTaskAsync_Verbose_ReturnsTransactionVerboseModelAsync()
        {
            this.chainState.Setup(c => c.ConsensusTip)
            .Returns(this.chain.Tip);
            ChainedHeader block       = this.chain.GetBlock(1);
            Transaction   transaction = this.CreateTransaction();
            var           txId        = new uint256(12142124);

            this.pooledTransaction.Setup(p => p.GetTransaction(txId))
            .ReturnsAsync(transaction);
            var blockStore = new Mock <IBlockStore>();

            blockStore.Setup(b => b.GetTrxBlockIdAsync(txId))
            .ReturnsAsync(block.HashBlock);
            this.fullNode.Setup(f => f.NodeFeature <IBlockStore>(false))
            .Returns(blockStore.Object);
            this.controller = new NodeController(this.fullNode.Object, this.LoggerFactory.Object,
                                                 this.dateTimeProvider.Object, this.chainState.Object, this.nodeSettings,
                                                 this.connectionManager.Object, this.chain, this.network, this.pooledTransaction.Object,
                                                 this.pooledGetUnspentTransaction.Object, this.getUnspentTransaction.Object, this.networkDifficulty.Object);
            string txid    = txId.ToString();
            bool   verbose = true;

            var json = (JsonResult)await this.controller.GetRawTransactionAsync(txid, verbose).ConfigureAwait(false);

            var resultModel = (TransactionVerboseModel)json.Value;

            Assert.NotNull(resultModel);
            var model = Assert.IsType <TransactionVerboseModel>(resultModel);

            Assert.Equal(transaction.GetHash().ToString(), model.TxId);
            Assert.Equal(transaction.GetSerializedSize(), model.Size);
            Assert.Equal(transaction.Version, model.Version);
            Assert.Equal((uint)transaction.LockTime, model.LockTime);
            Assert.Equal(transaction.ToHex(), model.Hex);
            Assert.Equal(block.HashBlock.ToString(), model.BlockHash);
            Assert.Equal(3, model.Confirmations);
            Assert.Equal(Utils.DateTimeToUnixTime(block.Header.BlockTime), model.Time);
            Assert.Equal(Utils.DateTimeToUnixTime(block.Header.BlockTime), model.BlockTime);
            Assert.NotEmpty(model.VIn);
            Vin input         = model.VIn[0];
            var expectedInput = new Vin(transaction.Inputs[0].PrevOut, transaction.Inputs[0].Sequence, transaction.Inputs[0].ScriptSig);

            Assert.Equal(expectedInput.Coinbase, input.Coinbase);
            Assert.Equal(expectedInput.ScriptSig, input.ScriptSig);
            Assert.Equal(expectedInput.Sequence, input.Sequence);
            Assert.Equal(expectedInput.TxId, input.TxId);
            Assert.Equal(expectedInput.VOut, input.VOut);
            Assert.NotEmpty(model.VOut);
            Vout output         = model.VOut[0];
            var  expectedOutput = new Vout(0, transaction.Outputs[0], this.network);

            Assert.Equal(expectedOutput.Value, output.Value);
            Assert.Equal(expectedOutput.N, output.N);
            Assert.Equal(expectedOutput.ScriptPubKey.Hex, output.ScriptPubKey.Hex);
        }
Esempio n. 14
0
        TransactionInput GetTransactionInput(Vin transactionInput, string txid, int index)
        {
            string           coinbase = transactionInput.CoinBase;
            string           txidOut  = transactionInput.TxId;
            long             indexOut = Convert.ToInt32(transactionInput.Vout);
            string           sAddress = "";
            decimal          sValue   = 0;
            TransactionInput result   = new TransactionInput();

            if (coinbase != null)
            {
                txidOut  = "0000000000000000000000000000000000000000000000000000000000000000";
                sAddress = "0000000000000000000000000000000000";
            }
            else if (txidOut == "0000000000000000000000000000000000000000000000000000000000000000")
            {
                indexOut = 0;
                sAddress = "0000000000000000000000000000000001";
            }
            else
            {
                string selectString = "SELECT [Address], [Value] FROM [TransactionOutput] WHERE [Txid] = '" + txidOut + "' AND [Index] = " + indexOut;
                using (SqlConnection conn = new SqlConnection(connString))
                {
                    using (SqlCommand comm = new SqlCommand(selectString, conn))
                    {
                        try
                        {
                            conn.Open();
                            using (SqlDataReader dr = comm.ExecuteReader())
                            {
                                while (dr.Read())
                                {
                                    sAddress = dr["Address"].ToString();
                                    sValue   = decimal.Parse(dr["Value"].ToString());
                                }
                            }
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine("SQL Error" + ex.Message);
                            throw;
                        }
                    }
                }
            }
            result.TxidIn   = txid;
            result.IndexIn  = index;
            result.TxidOut  = txidOut;
            result.IndexOut = Convert.ToInt32(indexOut);
            result.Address  = sAddress;
            result.Value    = sValue;
            return(result);
        }
Esempio n. 15
0
        public async Task GetTaskAsync_Verbose_ReturnsTransactionVerboseModelAsync()
        {
            // Add the 'txindex' setting, otherwise the transactions won't be found.
            this.nodeSettings.ConfigReader.MergeInto(new TextFileConfiguration("-txindex=1"));
            this.chainState.Setup(c => c.ConsensusTip)
            .Returns(this.chain.Tip);
            ChainedHeader block = this.chain.GetHeader(1);

            Transaction transaction = this.CreateTransaction();
            var         txId        = new uint256(12142124);

            this.pooledTransaction.Setup(p => p.GetTransaction(txId))
            .ReturnsAsync(transaction);

            this.blockStore.Setup(b => b.GetBlockIdByTransactionId(txId))
            .Returns(block.HashBlock);

            this.controller = new FullNodeController(this.LoggerFactory.Object, this.pooledTransaction.Object, this.pooledGetUnspentTransaction.Object, this.getUnspentTransaction.Object, this.networkDifficulty.Object,
                                                     this.fullNode.Object, this.nodeSettings, this.network, this.chain, this.chainState.Object, this.connectionManager.Object, this.consensusManager.Object, this.blockStore.Object);

            TransactionModel result = await this.controller.GetRawTransactionAsync(txId.ToString(), true).ConfigureAwait(false);

            Assert.NotNull(result);
            var model = Assert.IsType <TransactionVerboseModel>(result);

            Assert.Equal(transaction.GetHash().ToString(), model.TxId);
            Assert.Equal(transaction.GetSerializedSize(), model.Size);
            Assert.Equal(transaction.Version, model.Version);
            Assert.Equal((uint)transaction.LockTime, model.LockTime);
            Assert.Equal(transaction.ToHex(), model.Hex);

            Assert.Equal(block.HashBlock.ToString(), model.BlockHash);
            Assert.Equal(3, model.Confirmations);
            Assert.Equal(Utils.DateTimeToUnixTime(block.Header.BlockTime), model.Time);
            Assert.Equal(Utils.DateTimeToUnixTime(block.Header.BlockTime), model.BlockTime);

            Assert.NotEmpty(model.VIn);
            Vin input         = model.VIn[0];
            var expectedInput = new Vin(transaction.Inputs[0].PrevOut, transaction.Inputs[0].Sequence, transaction.Inputs[0].ScriptSig);

            Assert.Equal(expectedInput.Coinbase, input.Coinbase);
            Assert.Equal(expectedInput.ScriptSig, input.ScriptSig);
            Assert.Equal(expectedInput.Sequence, input.Sequence);
            Assert.Equal(expectedInput.TxId, input.TxId);
            Assert.Equal(expectedInput.VOut, input.VOut);

            Assert.NotEmpty(model.VOut);
            Vout output         = model.VOut[0];
            var  expectedOutput = new Vout(0, transaction.Outputs[0], this.network);

            Assert.Equal(expectedOutput.Value, output.Value);
            Assert.Equal(expectedOutput.N, output.N);
            Assert.Equal(expectedOutput.ScriptPubKey.Hex, output.ScriptPubKey.Hex);
        }
        public async Task <IActionResult> PostVin([FromBody] Vin vin)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            _context.Vins.Add(vin);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetVin", new { id = vin.Id }, vin));
        }
Esempio n. 17
0
        public void TestGetModelYearYyyy()
        {
            var testVinValue = "3N1CN7AP0GL861987";

            var testSubject = new Vin {
                Value = testVinValue
            };

            var testResult = testSubject.GetModelYearYyyy();

            Assert.AreEqual(2016, testResult);
        }
Esempio n. 18
0
        public void TestVINClicked(object sender, EventArgs e)
        {
            if (Vin.IsValid(VINNumber.Text) == false)
            {
                DisplayAlert("Vin Number", "VIN number is not valid", "Ok");
            }

            else
            {
                Year.Text = Vin.GetModelYear(VINNumber.Text).ToString();
                Manufacturer.SelectedItem = Vin.GetWorldManufacturer(VINNumber.Text);
            }
        }
Esempio n. 19
0
 public void VimCorrectnessTest()
 {
     Assert.False(Vin.CheckVIN("1234567890ZQROOI0"));
     Assert.True(Vin.CheckVIN("12340723423423423"));
     Assert.False(Vin.CheckVIN("123407234234234X3"));
     Assert.True(Vin.CheckVIN("JH4KB16535L011820"));
     Assert.True(Vin.CheckVIN("WBABJ7326WEA15710"));
     Assert.True(Vin.CheckVIN("KLAJB82Z2XK338143"));
     Assert.True(Vin.CheckVIN("WVWHV7AJ0AW084467"));
     Assert.False(Vin.CheckVIN("KLAVA6928XdB203010"));
     Assert.False(Vin.CheckVIN("ZZZVA6928XB203ZZZ"));
     Assert.True(Vin.CheckVIN("4Y1SL65848Z411439"));
 }
Esempio n. 20
0
        public void TestVinEquality()
        {
            var testVinValue = "3N1CN7AP0GL861987";
            var testSubject  = new Vin {
                Value = testVinValue
            };

            var compareTest = new Vin {
                Value = testVinValue
            };

            Assert.IsTrue(testSubject.Equals(compareTest));
        }
Esempio n. 21
0
        public Vin lireVinSpecifique(string idProduit)
        {
            Vin a = new Vin();

            try
            {
                a = coucheAccesBD.lireVinSpecifique(idProduit);
            }
            catch (Exception)
            {
                throw new ExceptionMetier("Il n'y a pas d'alcool avec cet id dans la db.");
            }
            return(a);
        }
Esempio n. 22
0
        void ReleaseDesignerOutlets()
        {
            if (appraisalDate != null)
            {
                appraisalDate.Dispose();
                appraisalDate = null;
            }

            if (ContainerView != null)
            {
                ContainerView.Dispose();
                ContainerView = null;
            }

            if (Mileage != null)
            {
                Mileage.Dispose();
                Mileage = null;
            }

            if (sacComment != null)
            {
                sacComment.Dispose();
                sacComment = null;
            }

            if (SacCommentsWidth != null)
            {
                SacCommentsWidth.Dispose();
                SacCommentsWidth = null;
            }

            if (Trim != null)
            {
                Trim.Dispose();
                Trim = null;
            }

            if (Vin != null)
            {
                Vin.Dispose();
                Vin = null;
            }

            if (YearMakeModel != null)
            {
                YearMakeModel.Dispose();
                YearMakeModel = null;
            }
        }
        public async Task <IActionResult> PostVinByCaveId([FromRoute] int caveid, [FromBody] Vin vin)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            if (caveid != vin.CaveId)
            {
                return(BadRequest());
            }
            _context.Vins.Add(vin);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetVinByCaveId", new { caveid = vin.CaveId, id = vin.Id }, vin));
        }
Esempio n. 24
0
        private void lvBouteilles_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (lvCaves.SelectedItem != null && lvBouteilles.SelectedItem != null)
            {
                Vin vinTrouve = gstCaves.LesCaves[lvCaves.SelectedItem as string].Find(bouteille => bouteille.IdBouteille == (lvBouteilles.SelectedItem as Bouteille).IdBouteille).LeVin;

                txtMillesime.Text = vinTrouve.MillesimeVin.ToString();
                txtNomCepage.Text = vinTrouve.LeCepage.NomCepage;
                txtCouleur.Text   = vinTrouve.LaCouleur.NomCouleur;
                txtPrix.Text      = vinTrouve.PrixDuVin.ToString();
            }
            else
            {
                txtMillesime.Text = "";
                txtNomCepage.Text = "";
                txtCouleur.Text   = "";
                txtPrix.Text      = "";
            }
        }
Esempio n. 25
0
        public void TestGetChkDigit()
        {
            var testSubject = new Vin
            {
                Wmi = new WorldManufacturerId {
                    Country = '1', RegionMaker = '1', VehicleType = '1'
                },
                Vds = new VehicleDescription {
                    Four = '1', Five = '1', Six = '1', Seven = '1', Eight = '1'
                },
                Vis = new VehicleIdSection {
                    ModelYear = '1', PlantCode = '1', SequentialNumber = "111111"
                }
            };

            var testREsult = testSubject.GetCheckDigit();

            Assert.AreEqual('1', testREsult);
        }
        public HitForm(string[] hit_info)
        {
            InitializeComponent();
            int[] colors = new int[4] {
                255, 128, 128, 128
            };
            string tmp = "";

            try
            {
                tmp = hit_info[2].Replace("Color [", "").Replace("]", "");
                string[] colors_temp = tmp.Split(',');
                colors[0] = int.Parse(colors_temp[0].Replace("A=", "").Replace(",", ""));
                colors[1] = int.Parse(colors_temp[1].Replace("R=", "").Replace(",", ""));
                colors[2] = int.Parse(colors_temp[2].Replace("G=", "").Replace(",", ""));
                colors[3] = int.Parse(colors_temp[3].Replace("B=", "").Replace(",", ""));
            }
            catch (Exception ex)
            {
            }

            label_database.BackColor = Color.FromArgb(colors[0], colors[1], colors[2], colors[3]);
            label_database.Text      = hit_info[8];
            label_vrm.Text           = hit_info[13];
            label_field1.Text        = hit_info[3];
            label_field2.Text        = hit_info[4];
            label_field3.Text        = hit_info[5];
            label_field4.Text        = hit_info[6];
            label_field5.Text        = hit_info[7];
            label_make.Text          = Vin.GetWorldManufacturer(hit_info[3]);
            label_model.Text         = Vin.GetModelYear(hit_info[3]).ToString();
            label_information.Text   = hit_info[8];

            try
            {
                System.Media.SoundPlayer player = new System.Media.SoundPlayer(@"sounds\Siren.wav");
                player.Play();
            }
            catch (Exception)
            {
            }
        }
Esempio n. 27
0
        public override string ToString()
        {
            var engine_code = (EngineCode?.Any() ?? false) ? string.Join(",", EngineCode) : "";
            var version = (Version?.Any() ?? false) ? string.Join(",", Version) : "";
            var engine_capacity = (EngineCapacity?.Any() ?? false) ? string.Join(",", EngineCapacity) : "";
            var vin = (Vin?.Any() ?? false) ? string.Join(",", Vin) : "";
            var engine_power = (EnginePower?.Any() ?? false) ? string.Join(",", EnginePower) : "";
            var gearbox = (Gearbox?.Any() ?? false) ? string.Join(",", Gearbox) : "";
            var transmission = (Transmission?.Any() ?? false) ? string.Join(",", Transmission) : "";
            var door_count = (DoorCount?.Any() ?? false) ? string.Join(",", DoorCount) : "";
            var nr_seats = (NrSeats?.Any() ?? false) ? string.Join(",", NrSeats) : "";
            var color = (Color?.Any() ?? false) ? string.Join(",", Color) : "";
            var registration = (Registration?.Any() ?? false) ? string.Join(",", Registration) : "";
            //var features = (Features?.Any() ?? false) ? string.Join(",", Features) : "";

            return string.Format("ID: " + AdId +
                "\nCena: " + PriceRaw +
                "\nTytul: " + Title +
                "\nOferta od: " + PrivateBusiness +
                "\nKategoria: " + Category +
                "\nWojewodztwo: " + Region +
                "\nMiasto: " + City +
                "\nMarka pojazdu: " + Make +
                "\nModel pojazdu: " + Model +
                "\nKod silnika: " + engine_code +
                "\nWersja: " + version +
                "\nRok produkcji: " + Year +
                "\nPrzebieg: " + Mileage +
                "\nPojemnosc skokowa: " + engine_capacity +
                "\nVin: " + vin +
                "\nRodzaj paliwa: " + FuelType +
                "\nMoc: " + engine_power +
                "\nSkrzynia biegow: " + gearbox +
                "\nNaped: " + transmission +                
                "\nTyp: " + BodyType +
                "\nLiczba drzwi: " + door_count +
                "\nLiczba miejsc: " + nr_seats +
                "\nKolor: " + color +
                "\nNumer rejestracyjny pojazdu: " + registration //+
                //"\nWyposazenie: " + features
            );
        }       
Esempio n. 28
0
        public void TestRandomVin()
        {
            for (var i = 0; i < 45; i++)
            {
                var testResult = Vin.RandomVin();
                Assert.IsNotNull(testResult);
                var testResultYear = testResult.GetModelYearYyyy();
                Assert.IsNotNull(testResultYear);
                Assert.IsTrue(testResultYear.Value <= DateTime.Today.Year);
            }

            for (var i = 0; i < 45; i++)
            {
                var byYearTestResult = Vin.RandomVin(true, 2014);
                var testResultYear   = byYearTestResult.GetModelYearYyyy();
                Assert.IsNotNull(testResultYear);
                Assert.IsTrue(testResultYear.Value <= 2014);
                System.Diagnostics.Debug.WriteLine(string.Join(" ", byYearTestResult.Value, byYearTestResult.Description, byYearTestResult.GetModelYearYyyy()));
            }
        }
Esempio n. 29
0
        public void TestVinSetValue()
        {
            var testVinValue = "3N1CN7AP0GL861987";

            var testSubject = new Vin {
                Value = testVinValue
            };

            Assert.AreEqual('3', testSubject.Wmi.Country);
            Assert.AreEqual('N', testSubject.Wmi.RegionMaker);
            Assert.AreEqual('1', testSubject.Wmi.VehicleType);

            Assert.AreEqual('C', testSubject.Vds.Four);
            Assert.AreEqual('N', testSubject.Vds.Five);
            Assert.AreEqual('7', testSubject.Vds.Six);
            Assert.AreEqual('A', testSubject.Vds.Seven);
            Assert.AreEqual('P', testSubject.Vds.Eight);

            Assert.AreEqual('G', testSubject.Vis.ModelYear);
            Assert.AreEqual('L', testSubject.Vis.PlantCode);
            Assert.AreEqual("861987", testSubject.Vis.SequentialNumber);
        }
        public async Task <IActionResult> Create([Bind("Nom,Description,Type,Millesime,Volume,Image,CouleurId,PaysId,RegionId,CaveId,Quantite")] Vin vin, int[] AlimentsId)
        {
            if (ModelState.IsValid)
            {
                _context.Add(vin);
                foreach (int aliment in AlimentsId)
                {
                    _context.Add(new VinAliment {
                        VinId = vin.Id, AlimentId = aliment
                    });
                }
                await _context.SaveChangesAsync();

                return(RedirectToAction("Details", "Caves"));
            }
            ViewBag.CaveId   = vin.CaveId;
            ViewBag.Couleurs = _localization.ApplyTranslateSelectList(await _context.Couleurs.ToListAsync(), "Id", "Nom", vin.CouleurId);
            ViewBag.Pays     = _localization.ApplyTranslateSelectList(await _context.Pays.ToListAsync(), "Id", "Nom", vin.PaysId);
            ViewBag.Regions  = new SelectList(await _context.Regions.ToListAsync(), "Id", "Nom", vin.RegionId);
            ViewBag.Aliments = _localization.ApplyTranslateSelectList(await _context.Aliments.ToListAsync(), "Id", "Nom");
            return(View(vin));
        }
 public Vehicle(Vin vin)
 {
     VinDetails = new VinDetails();
     Vin = vin;
     VinDetails.SetModelYear(Vin.ModelCode, vin.Number[8]);
 }