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

            using (SqlCommand command = new SqlCommand())
            {
                i = ExecuteNonQuery(CarForRentStringsSql.DeleteCarForRentByCar(carNumber));
            }
            return(i);
        }
Esempio n. 2
0
        public CarForRentModel AddCarForRent(CarForRentModel carForRentModel)
        {
            DataTable       dt = new DataTable();
            CarForRentModel carForRentModelSql = new CarForRentModel();

            using (SqlCommand command = new SqlCommand())
            {
                dt = GetMultipleQuery(CarForRentStringsSql.AddCarForRent(carForRentModel));
            }

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

            return(carForRentModelSql);
        }
Esempio n. 3
0
        public List <CarForRentModel> GetAllCarsForRent()
        {
            DataTable dt = new DataTable();
            List <CarForRentModel> arrCarsForRent = new List <CarForRentModel>();

            using (SqlCommand command = new SqlCommand())
            {
                dt = GetMultipleQuery(CarForRentStringsSql.GetAllCarsForRent());
            }

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

            return(arrCarsForRent);
        }
Esempio n. 4
0
        public CarForRentModel GetOneCarForRentByRentNumber(int rentNumber)
        {
            if (rentNumber < 0)
            {
                throw new ArgumentOutOfRangeException();
            }
            DataTable       dt = new DataTable();
            CarForRentModel carForRentModelSql = new CarForRentModel();

            using (SqlCommand command = new SqlCommand())
            {
                dt = GetMultipleQuery(CarForRentStringsSql.GetOneCarForRentByRentNumber(rentNumber));
            }

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

            return(carForRentModelSql);
        }
Esempio n. 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 (SqlCommand command = new SqlCommand())
            {
                dt = GetMultipleQuery(CarForRentStringsSql.GetAllCarsForRentByUserId(userID));
            }

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

            return(arrCarsForRent);
        }
Esempio n. 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 (SqlCommand command = new SqlCommand())
            {
                dt = GetMultipleQuery(CarForRentStringsSql.UpdateCarForRent(carForRentModel));
            }

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

            return(carForRentModelSql);
        }