Esempio n. 1
0
        public string DeleteCar(string carNumber)
        {
            int i = 0;

            using (SqlCommand command = new SqlCommand())
            {
                i = ExecuteNonQuery(CarStringsSql.DeleteCar(carNumber));
            }
            return(i.ToString());
        }
Esempio n. 2
0
        public CarModel UpdateCar(CarModel carModel)
        {
            DataTable dt          = new DataTable();
            CarModel  carModelSql = new CarModel();

            using (SqlCommand command = new SqlCommand())
            {
                dt = GetMultipleQuery(CarStringsSql.UpdateCar(carModel));
            }
            foreach (DataRow ms in dt.Rows)
            {
                carModelSql = CarModel.ToObject(ms);
            }

            return(carModelSql);
        }
Esempio n. 3
0
        public List <CarModel> GetAllCars()
        {
            DataTable       dt      = new DataTable();
            List <CarModel> arrCars = new List <CarModel>();

            using (SqlCommand command = new SqlCommand())
            {
                dt = GetMultipleQuery(CarStringsSql.GetAllCars());
            }

            foreach (DataRow ms in dt.Rows)
            {
                CarModel carModel = CarModel.ToObject(ms);

                arrCars.Add(carModel);
            }

            return(arrCars);
        }
Esempio n. 4
0
        public CarPictureModel GetNumberOfCarWithImage(string pictureName)
        {
            if (pictureName.Equals(""))
            {
                throw new ArgumentOutOfRangeException();
            }
            DataTable       dt = new DataTable();
            CarPictureModel carPictureModelSql = new CarPictureModel();

            using (SqlCommand command = new SqlCommand())
            {
                dt = GetMultipleQuery(CarStringsSql.GetNumberOfCarWithImage(pictureName));
            }
            foreach (DataRow ms in dt.Rows)
            {
                carPictureModelSql = CarPictureModel.ToObject(ms);
            }

            return(carPictureModelSql);
        }
Esempio n. 5
0
        public CarModel GetOneCar(string carNumber)
        {
            if (carNumber.Equals(""))
            {
                throw new ArgumentOutOfRangeException();
            }
            DataTable dt          = new DataTable();
            CarModel  carModelSql = new CarModel();

            using (SqlCommand command = new SqlCommand())
            {
                dt = GetMultipleQuery(CarStringsSql.GetOneCarByNumber(carNumber));
            }

            foreach (DataRow ms in dt.Rows)
            {
                carModelSql = CarModel.ToObject(ms);
            }

            return(carModelSql);
        }
Esempio n. 6
0
        public CarModel UploadCarImage(string carNumber, string img)
        {
            DataTable dt          = new DataTable();
            CarModel  carModel    = GetOneCar(carNumber);
            CarModel  carModelSql = new CarModel();

            if (carModel == null)
            {
                return(carModel);
            }
            carModel.carPicture = img;

            using (SqlCommand command = new SqlCommand())
            {
                dt = GetMultipleQuery(CarStringsSql.UpdateCar(carModel));
            }
            foreach (DataRow ms in dt.Rows)
            {
                carModelSql = CarModel.ToObject(ms);
            }

            return(carModelSql);
        }