コード例 #1
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            Automobile car = new Automobile();

            if (!String.IsNullOrEmpty(Request["id"]))
            {
                String strID = Request["id"];
                Int32  id    = Int32.Parse(strID);
                car = Automobile.getCar(id);
            }
            else
            {
                car.ID = 0;
            }

            car.Manufacturer = txtManufacturer.Text;
            car.Make         = txtMake.Text;
            car.Year         = Int32.Parse(txtYear.Text);
            car.Colour       = txtColour.Text;
            car.Seating      = Int32.Parse(txtSeating.Text);

            car = car.Save();

            if (car.ID > 0)
            {
                Response.Redirect("CarInventory.aspx");
            }
        }
コード例 #2
0
        public void Insert_new_generated_record_in_Automobile_Table()
        {
            Data.Provider.Data data = Data.Provider.Data.GetNewDataInstance(new Data.DbContext(Data.Provider.ProviderType.MsSql, ConnectionStringMsSql));

            DataSet max;

            data.GetDataSet("select max(brojoglasa) from automobile", out max);
            int brOglMax;

            if (max != null && max.Tables.Count == 1 && max.Tables[0].Rows.Count == 1 && max.Tables[0].Rows[0][0] != null)
            {
                brOglMax = (int)((long)max.Tables[0].Rows[0][0]) + 1;
            }
            else
            {
                brOglMax = 1;
            }

            Automobile auto = new Automobile(data);

            auto.Save(new Procode.PolovniAutomobili.Common.Model.Vehicle.Automobile(
                          brojOglasa: brOglMax,
                          naslov: "Test used car ad",
                          cena: 1000,
                          url: "http://google.com",
                          vozilo: "vozilo",
                          marka: "Mazda",
                          model: "6",
                          godinaProizvodnje: 2006,
                          karoserija: "karoserija",
                          gorivo: "Dizel",
                          fiksnaCena: false,
                          zamena: false,
                          datumPostavljanja: DateTime.Now,
                          kubikaza: 1998,
                          snagaKW: 89,
                          snagaKS: 120,
                          kilometraza: 250000,
                          emisionaKlasa: "Euro4",
                          pogon: "prednji",
                          menjac: "manuelni",
                          brojVrata: "4/5",
                          brojSedista: 5,
                          stranaVolana: "leva",
                          klima: "ima",
                          boja: "siva",
                          registrovanDo: DateTime.Now.AddMonths(6),
                          porekloVozila: "domace",
                          opis: "Test opis.",
                          kontakt: "Test kontakt."
                          ));
        }
コード例 #3
0
        public void Save_2006_Seat_Altea_XL_1_9TDI_105ks_nova()
        {
            string adAddress = "http://www.polovniautomobili.com/putnicka-vozila/9290644/mitsubishi-carisma-19-d-nemacka";

            Common.Model.Vehicle.Automobile automobile = Common.Http.AutomobileAd.ParseAutomobileAd(
                Common.Http.HttpComm.GetPage(adAddress).ToString(),
                adAddress);

            Data.Provider.Data data = Data.Provider.Data.GetNewDataInstance(new Data.DbContext(Data.Provider.ProviderType.MsSql, ConnectionStringMsSql));

            Automobile autoDb = new Automobile(data);

            autoDb.Save(automobile);
        }