Beispiel #1
0
    IEnumerator GetCarsData()
    {
        UnityWebRequest www = UnityWebRequest.Get(serverUrl + getCarsEndpoint);

        yield return(www.SendWebRequest());

        if (www.result != UnityWebRequest.Result.Success)
        {
            Debug.Log(www.error);
        }
        else
        {
            Debug.Log(www.downloadHandler.text);
            carsData = JsonUtility.FromJson <CarsData>(www.downloadHandler.text);

            // Store the old positions for each agent
            oldPositions = new Dictionary <int, Vector3>(newPositions);

            newPositions.Clear();

            foreach (Vector4 pos in carsData.positions)
            {
                newPositions[(int)pos.w] = pos;
            }

            hold = false;
        }
    }
        public ActionResult ViewVehicelsFromDB()
        {
            IRepository rep = new Repository();
            CarsData    cd  = new CarsData();

            cd.data = rep.getAllCarsData();
            return(View(cd));
        }
 public JsonResult AddCar(CarValidation car)
 {
     using (CarsData db = new CarsData())
     {
         car.Available = true;
         return(Json(db.Add(car)));
     }
 }
 public JsonResult UpdateCar(CarValidation car, string registrationplate)
 {
     using (CarsData db = new CarsData())
     {
         bool updated = db.Update(_car => _car.registrationplate == registrationplate, car);
         return(Json(updated));
     }
 }
 public JsonResult DeleteCar(string id)
 {
     using (CarsData db = new CarsData())
     {
         bool removed = db.Delete(car => car.registrationplate == id);
         return(Json(removed));
     }
 }
        public ActionResult EditVehicelInfo(int Year, string Make, string Model, int Price, string Color, string BodyStyle, int Mpg, string DriveType, int Miles, string NewOrUsed, int Capacity, string CarId)
        {
            IRepository rep = new Repository();
            CarsData    cd  = new CarsData();

            cd.data = rep.getCarFullData(CarId);

            return(View(cd));
        }
        public ActionResult PhotoViewAdmin(string CarId)
        {
            IRepository rep = new Repository();
            CarsData    cd  = new CarsData();

            cd.data = rep.getCarFullData(CarId);

            return(View(cd));
        }
Beispiel #8
0
 public long SaveItem(CarsData item)
 {
     try
     {
         return(ctxWrite.CarsData_InsertUpdate(item.CarID, item.ChassisNo, item.InvoiceDate, item.LotNo, item.PayTypeID,
                                               item.PayPrice, item.ShipperID, item.RegionID, item.BuyerID, item.ModelID, item.WorkingStatusID, item.ColorID, item.Year,
                                               item.Notes, item.IP, item.IsDeleted, item.view_home, item.view_offer, item.view_website, item.Arrived, item.DistinationID,
                                               item.TransmissionID, item.OwnerID, item.WesitePrice, item.Visitors, item.ShippingCalcID, item.PayInvTypeID, item.UserID,
                                               item.AccidentStatusID, item.AuctionID, item.SaleTypeID, item.ToSaleClientID, item.WithoutShipping, item.IsGulfOldCars, item.SalePriceDemand));
     }
     catch { return(0); }
 }
Beispiel #9
0
 public JsonResult GetCars(SearchBy search)
 {
     if (ModelState.IsValid)
     {
         using (CarsData db = new CarsData())
         {
             CarView[] carsFromSearch = db.GetCarsByDate(search, CarView.Create);
             return(Json(carsFromSearch));
         }
     }
     return(Json(new string[0]));
 }
 public JsonResult GetCar(string search)
 {
     using (CarsData db = new CarsData())
     {
         var cars = db.GetFromSearch(search, car => new
         {
             registrationPlate = car.registrationplate,
             km        = car.km,
             available = car.available,
             branch    = car.branch,
             cartype   = car.cartype
         });
         return(Json(cars));
     }
 }
Beispiel #11
0
    void Start()
    {
        carsData     = new CarsData();
        oldPositions = new Dictionary <int, Vector3>();
        newPositions = new Dictionary <int, Vector3>();

        agents = new Dictionary <int, GameObject>();

        timer = timeToUpdate;

        for (int i = 0; i < NAgents; i++)
        {
            agents[i] = Instantiate(carPrefab, Vector3.zero, Quaternion.identity);
        }
        StartCoroutine(SendConfiguration());
    }
Beispiel #12
0
        public Cars_AddEditCarResult SaveCar(CarsData item)
        {
            try
            {
                var saved = ctxWrite.Cars_AddEditCar(item.CarID, item.car_code, item.view_home, item.active, item.featured_car,
                                                     item.Auction_ID, item.Buyer_ID, item.Marker_ID, item.Model_ID, item.WorkingStatus_ID, item.TransferStatus_ID,
                                                     item.Year_ID, item.PortShipping_ID, item.ShippingCompany_ID, item.Ship_ID, item.State_ID,
                                                     item.Region_ID, item.Workshop_ID, item.Store_ID, item.chassis_no, item.container_no, item.container_code, item.booking_no, item.poly_fielding, item.lot_no, item.engine_no, item.sold,
                                                     item.exterior_color, item.interior_color, item.body_style, item.car_transmission, item.mileage, item.car_drive,
                                                     item.car_engine, item.car_capacity, item.car_options, item.car_remarks, item.Customs_No, item.checkout_date, item.expected_arrive_date, item.dubia_arrive_date, item.sharjah_arrive_date,
                                                     item.arrive_date, item.Shipping_date, item.WorkshopEntryDate, item.WorkshopExitDate, item.price_currency,
                                                     item.real_price, item.sale_price, item.cost, item.CurrencyExchange_ID, item.payement_to_who, item.sale_to,
                                                     item.show_sale, item.sale_date, item.visitors, item.main_picture, item.System_Who_Add, item.System_LastAction_IP, item.purchase_date).FirstOrDefault();

                return(saved);
            }
            catch { return(null); }
        }
 /// <summary>
 /// Add New Order Object To The Session
 /// </summary>
 /// <param name="session"></param>
 /// <param name="registrationPlate"></param>
 /// <param name="start"></param>
 /// <param name="end"></param>
 /// <returns></returns>
 public static bool SetOrder(this HttpSessionStateBase session, string registrationPlate, DateTime start, DateTime end)
 {
     using (CarsData db = new CarsData())
     {
         bool   isValid = db.IsDateValid(start, end, registrationPlate);
         string userId  = session.GetUserID();
         if (isValid && userId != string.Empty)
         {
             session["order"] = new Order()
             {
                 startdate = start,
                 enddate   = end,
                 carid     = registrationPlate,
                 userid    = userId
             };
             return(true);
         }
         return(false);
     }
 }
Beispiel #14
0
    public static object SaveInvoice(CarsData _car)
    {
        _car.IP     = SessionManager.Current.IP;
        _car.UserID = Convert.ToInt32(SessionManager.Current.ID);

        if (string.IsNullOrEmpty(_car.ModelID.ToString()))
        {
            return new { Status = false, ID = 0, Message = Resources.AdminResources_ar.CarModelRequired }
        }
        ;

        var result = new CarsDataManager().SaveItem(_car);

        if (result < 0)
        {
            return new { Status = false, ID = -1, Message = Resources.AdminResources_ar.CarExistBefore }
        }
        ;

        return(new { Status = true, ID = result, Message = Resources.AdminResources_ar.SuccessSave });
    }

    #endregion
}
Beispiel #15
0
        private void ImageComputer_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            CarsData c = new CarsData();

            c.Show();
        }
Beispiel #16
0
 public void Init()
 {
     LevelData   = AssetDatabase.LoadAssetAtPath <LevelData>(LevelDataPath);
     CarsData    = AssetDatabase.LoadAssetAtPath <CarsData>(CarsDataPath);
     WeaponsData = AssetDatabase.LoadAssetAtPath <WeaponsData>(WeaponsDataPath);
 }
Beispiel #17
0
    /// <summary>
    /// Add new Car to db.
    /// </summary>
    private void SaveCarInformation()
    {
        CarsData CarToSave = new CarsData();

        try
        {
            if (hfID.Value != "")
            {
                CarToSave.CarID = Convert.ToInt32(hfID.Value);
            }
            CarToSave.TransferStatus_ID = ((hfTransferStatus.Value.Length > 0) ? (Convert.ToInt32(hfTransferStatus.Value)) : (1)); // 'new' status ==> 'in Checkout status'.
            CarToSave.container_no      = txtcontainer_no.Text;
            CarToSave.container_code    = txtContainerCode.Text;
            CarToSave.poly_fielding     = txtPolyFielding.Text;
            CarToSave.booking_no        = txtBookingNo.Text;

            if (txtcontainer_no.Text != "")
            {
                CarToSave.TransferStatus_ID = 2;
            }                                                                    // shipping status
            if (txtShippingDate.Text != "")
            {
                CarToSave.Shipping_date = Convert.ToDateTime(txtShippingDate.Text);
            }                                                                                                       // CarToSave.TransferStatus_ID = 2; } // 'shipping status'

            if (txtArrivael_Date.Text != "")
            {
                CarToSave.arrive_date = Convert.ToDateTime(txtArrivael_Date.Text); CarToSave.TransferStatus_ID = 3;
            }                                                                                                                                        // 'In UAE' status.
            if (txtSaleDate.Text != "")
            {
                CarToSave.sale_date = Convert.ToDateTime(txtSaleDate.Text);
            }                                                                                           // CarToSave.TransferStatus_ID = 3; } // 'In UAE' status.

            if (txtDubiaArrivalDate.Text != "")
            {
                CarToSave.dubia_arrive_date = Convert.ToDateTime(txtDubiaArrivalDate.Text);
            }
            if (txtSharjahArrivalDate.Text != "")
            {
                CarToSave.sharjah_arrive_date = Convert.ToDateTime(txtSharjahArrivalDate.Text);
            }
            if (txtExpectedArrivalDate.Text != "")
            {
                CarToSave.expected_arrive_date = Convert.ToDateTime(txtExpectedArrivalDate.Text);
            }


            CarToSave.active = cbActive.Checked;
            //if (ddlAuctions.SelectedIndex > 0) { CarToSave.Auction_ID = Convert.ToInt32(ddlAuctions.SelectedValue); }
            if (ddlbody_style.SelectedIndex > 0)
            {
                CarToSave.body_style = Convert.ToInt32(ddlbody_style.SelectedValue);
            }
            //if (ddlBuyers.SelectedIndex > 0) { CarToSave.Buyer_ID = Convert.ToInt32(ddlBuyers.SelectedValue); }
            if (ddlcar_capacity.SelectedIndex > 0)
            {
                CarToSave.car_capacity = Convert.ToInt32(ddlcar_capacity.SelectedValue);
            }
            if (txtCode.Text != "")
            {
                CarToSave.car_code = Convert.ToInt32(txtCode.Text);
            }
            if (ddlCar_drive.SelectedIndex > 0)
            {
                CarToSave.car_drive = Convert.ToInt32(ddlCar_drive.SelectedValue);
            }
            if (ddlCar_engine.SelectedIndex > 0)
            {
                CarToSave.car_engine = Convert.ToInt32(ddlCar_engine.SelectedValue);
            }
            CarToSave.car_options = GetOptionStr();
            CarToSave.car_remarks = txtRemarks.Text;
            if (ddlcar_transmission.SelectedIndex > 0)
            {
                CarToSave.car_transmission = Convert.ToInt32(ddlcar_transmission.SelectedValue);
            }
            CarToSave.chassis_no = txtchassis_no.Text;

            if (txtCost.Text != "")
            {
                CarToSave.cost = Convert.ToDecimal(txtCost.Text);
            }
            if (ddlCurrency.SelectedIndex > 0)
            {
                CarToSave.CurrencyExchange_ID = Convert.ToInt32(ddlCurrency.SelectedValue);
            }
            CarToSave.engine_no = txtEngine_no.Text;
            if (ddlexterior_color.SelectedIndex > 0)
            {
                CarToSave.exterior_color = Convert.ToInt32(ddlexterior_color.SelectedValue);
            }
            if (ddlinterior_color.SelectedIndex > 0)
            {
                CarToSave.interior_color = Convert.ToInt32(ddlinterior_color.SelectedValue);
            }
            CarToSave.lot_no = txtLot_no.Text;
            //CarToSave.main_picture
            if (ddlMarkers.SelectedIndex > 0)
            {
                CarToSave.Marker_ID = Convert.ToInt32(ddlMarkers.SelectedValue);
            }
            CarToSave.mileage = txtMileage.Text;
            if (ddlModels.SelectedIndex > 0)
            {
                CarToSave.Model_ID = Convert.ToInt32(ddlModels.SelectedValue);
            }
            CarToSave.payement_to_who = txtSaleTo.Text;
            if (ddlPortShipping_ID.SelectedIndex > 0)
            {
                CarToSave.PortShipping_ID = Convert.ToInt32(ddlPortShipping_ID.SelectedValue);
            }
            //CarToSave.price_currency
            if (txtreal_price.Text != "")
            {
                CarToSave.real_price = Convert.ToDecimal(txtreal_price.Text);
            }
            //if (ddlRegion_ID.SelectedIndex > 0) { CarToSave.Region_ID = Convert.ToInt32(ddlRegion_ID.SelectedValue); }

            CarToSave.Store_ID = 1;
            if (ddlStores.SelectedIndex > 0)
            {
                CarToSave.Store_ID = Convert.ToInt32(ddlStores.SelectedValue);
            }                                                                                                  // <--
            //if (ddlTransferes.SelectedIndex > 0) { CarToSave.Transport_ID = Convert.ToInt32(ddlTransferes.SelectedValue); }

            if (txtSalePrice.Text != "")
            {
                CarToSave.sale_price = Convert.ToDecimal(txtSalePrice.Text);
            }
            CarToSave.sale_to = txtSaleTo.Text;
            if (ddlShip_ID.SelectedIndex > 0)
            {
                CarToSave.Ship_ID = Convert.ToInt32(ddlShip_ID.SelectedValue);
            }
            if (ddlShippingCompany_ID.SelectedIndex > 0)
            {
                CarToSave.ShippingCompany_ID = Convert.ToInt32(ddlShippingCompany_ID.SelectedValue);
            }
            //if (ddlState_ID.SelectedIndex > 0) { CarToSave.State_ID = Convert.ToInt32(ddlState_ID.SelectedValue); }
            CarToSave.featured_car = Convert.ToBoolean(rblFeatures.SelectedValue);

            CarToSave.Customs_No = txtCustomsNo.Text;
            if (txtCheckoutDate.Text != "")
            {
                CarToSave.checkout_date = Convert.ToDateTime(txtCheckoutDate.Text);
            }
            if (txtWorkshopEntryDate.Text != "")
            {
                CarToSave.WorkshopEntryDate = Convert.ToDateTime(txtWorkshopEntryDate.Text);
            }
            if (txtWorkshopExitDate.Text != "")
            {
                CarToSave.WorkshopExitDate = Convert.ToDateTime(txtWorkshopExitDate.Text);
            }

            if (ddlWorkshop_ID.SelectedIndex > 0)
            {
                CarToSave.Workshop_ID = Convert.ToInt32(ddlWorkshop_ID.SelectedValue);
            }
            if (ddlYears.SelectedIndex > 0)
            {
                CarToSave.Year_ID = Convert.ToInt32(ddlYears.SelectedValue);
            }
            CarToSave.visitors = Convert.ToInt64(hfVisitors.Value);

            CarToSave.sold             = false;// (txtSaleDate.Text != "" ? true : false); // change sold status where sale date was set.
            CarToSave.WorkingStatus_ID = Convert.ToInt32(ddlWorkingStatus_ID.SelectedValue);
            if (!string.IsNullOrEmpty(txtPurchaseDate.Text))
            {
                CarToSave.purchase_date = Convert.ToDateTime(txtPurchaseDate.Text);
            }

            if (hfMain_Picture.Value != "")
            {
                CarToSave.main_picture = hfMain_Picture.Value;
            }

            CarToSave.System_Add_Date      = DateTime.Now;
            CarToSave.System_Who_Add       = ClientSession.Current.loginId;
            CarToSave.System_LastAction_IP = ClientSession.Current.IP;

            // perform saving method.
            var result = new CarsManager().SaveCar(CarToSave);
            if (result != null)
            {
                // go to Cars images list.
                string url = ResolveClientUrl("Images.aspx?categoryType=cars&masterId=") + result.CarID; //"CarsView.aspx";
                Response.Redirect(url);
            }
            else
            {
                lblError.Text = Resources.AdminResources_en.ErrorSave;
            }
        }
        catch { lblError.Text = Resources.AdminResources_en.ErrorSave; }
    }
 public CarsController(CarsData carsData)
 {
     _carsData = carsData;
 }