Пример #1
0
        public int DeleteCarForRent(string carNumber)
        {
            int i = 0;

            using (MySqlCommand command = new MySqlCommand())
            {
                i = ExecuteNonQuery(CarForRentStringsMySql.DeleteCarForRentByCar(carNumber));
            }
            return(i);
        }
Пример #2
0
        public CarForRentModel AddCarForRent(CarForRentModel carForRentModel)
        {
            DataTable       dt = new DataTable();
            CarForRentModel carForRentModelSql = new CarForRentModel();

            using (MySqlCommand command = new MySqlCommand())
            {
                dt = GetMultipleQuery(CarForRentStringsMySql.AddCarForRent(carForRentModel));
            }

            foreach (DataRow ms in dt.Rows)
            {
                carForRentModelSql = CarForRentModel.ToObject(ms);
            }

            return(carForRentModelSql);
        }
Пример #3
0
        public List <CarForRentModel> GetAllCarsForRent()
        {
            DataTable dt = new DataTable();
            List <CarForRentModel> arrCarsForRent = new List <CarForRentModel>();

            using (MySqlCommand command = new MySqlCommand())
            {
                dt = GetMultipleQuery(CarForRentStringsMySql.GetAllCarsForRent());
            }

            foreach (DataRow ms in dt.Rows)
            {
                arrCarsForRent.Add(CarForRentModel.ToObject(ms));
            }

            return(arrCarsForRent);
        }
Пример #4
0
        public CarForRentModel GetOneCarForRentByRentNumber(int rentNumber)
        {
            if (rentNumber < 0)
            {
                throw new ArgumentOutOfRangeException();
            }
            DataTable       dt = new DataTable();
            CarForRentModel carForRentModelSql = new CarForRentModel();

            using (MySqlCommand command = new MySqlCommand())
            {
                dt = GetMultipleQuery(CarForRentStringsMySql.GetOneCarForRentByRentNumber(rentNumber));
            }

            foreach (DataRow ms in dt.Rows)
            {
                carForRentModelSql = CarForRentModel.ToObject(ms);
            }

            return(carForRentModelSql);
        }
Пример #5
0
        public List <FullCarDataModel> GetCarsForRentByUserId(string userID)
        {
            if (userID.Equals(""))
            {
                throw new ArgumentOutOfRangeException();
            }
            DataTable dt = new DataTable();
            List <FullCarDataModel> arrCarsForRent = new List <FullCarDataModel>();

            using (MySqlCommand command = new MySqlCommand())
            {
                dt = GetMultipleQuery(CarForRentStringsMySql.GetAllCarsForRentByUserId(userID));
            }

            foreach (DataRow ms in dt.Rows)
            {
                arrCarsForRent.Add(FullCarDataModel.ToObject(ms));
            }

            return(arrCarsForRent);
        }
Пример #6
0
        public CarForRentModel UpdateCarForRent(CarForRentModel carForRentModel)
        {
            string id = "";

            //string id = HttpContext.Current.User.Identity.Name;
            carForRentModel.userID = id;

            DataTable       dt = new DataTable();
            CarForRentModel carForRentModelSql = new CarForRentModel();

            using (MySqlCommand command = new MySqlCommand())
            {
                dt = GetMultipleQuery(CarForRentStringsMySql.UpdateCarForRent(carForRentModel));
            }

            foreach (DataRow ms in dt.Rows)
            {
                carForRentModelSql = CarForRentModel.ToObject(ms);
            }

            return(carForRentModelSql);
        }