示例#1
0
        public List <string> GetAllVehicleNumbers()
        {
            DataTable dt = new DataTable();

            using (OleDbCommand command = new OleDbCommand())
            {
                dt = GetMultipleQuery(VehicleStringsInner.GetAllVehicleNumbers());
            }

            List <VehicleModel> arrVehicle = new List <VehicleModel>();

            foreach (DataRow ms in dt.Rows)
            {
                arrVehicle.Add(VehicleModel.ToObject(ms));
            }

            List <string> vehicleNumbers = new List <string>();

            foreach (var vehicle in arrVehicle)
            {
                vehicleNumbers.Add(vehicle.vehicleNumber);
            }

            return(vehicleNumbers);
        }
示例#2
0
        public int DeleteVehicleByOwnerId(string ownerId)
        {
            int i = 0;

            using (OleDbCommand command = new OleDbCommand())
            {
                i = ExecuteNonQuery(VehicleStringsInner.DeleteVehicleByOwnerId(ownerId));
            }

            return(i);
        }
示例#3
0
        public int DeleteVehicleByNumber(string vehicleNumber)
        {
            int i = 0;

            using (OleDbCommand command = new OleDbCommand())
            {
                i = ExecuteNonQuery(VehicleStringsInner.DeleteVehicleByNumber(vehicleNumber));
            }

            return(i);
        }
示例#4
0
        public VehicleModel UpdateVehicle(VehicleModel vehicleModel)
        {
            int i = -1;

            using (OleDbCommand command = new OleDbCommand())
            {
                i = ExecuteNonQuery(VehicleStringsInner.UpdateVehicle(vehicleModel));
            }

            return(GetOneVehicleByNumber(vehicleModel.vehicleNumber));
        }
示例#5
0
        public List <VehicleModel> GetAllVehicles()
        {
            DataTable dt = new DataTable();

            using (OleDbCommand command = new OleDbCommand())
            {
                dt = GetMultipleQuery(VehicleStringsInner.GetAllVehicles());
            }

            List <VehicleModel> arrVehicle = new List <VehicleModel>();

            foreach (DataRow ms in dt.Rows)
            {
                arrVehicle.Add(VehicleModel.ToObject(ms));
            }

            return(arrVehicle);
        }
示例#6
0
        public VehicleModel GetOneVehicleByOwnerId(string personId)
        {
            DataTable dt = new DataTable();

            if (personId.Equals(string.Empty) || personId.Equals(""))
            {
                throw new ArgumentOutOfRangeException();
            }
            VehicleModel vehicleModel = new VehicleModel();

            using (OleDbCommand command = new OleDbCommand())
            {
                dt = GetMultipleQuery(VehicleStringsInner.GetOneVehicleByOwnerId(personId));
            }

            foreach (DataRow ms in dt.Rows)
            {
                vehicleModel = VehicleModel.ToObject(ms);
            }
            return(vehicleModel);
        }