Ejemplo n.º 1
0
        public static List <Permit> LoadList(Database database, Cargo cargo, VehicleMark mark, string licensePlate)
        {
            string          query      = EntryControl.Resources.Doc.Permit.LoadPrevious;
            QueryParameters parameters = new QueryParameters("cargo", cargo.Id);

            if (mark != null)
            {
                parameters.Add("mark", mark.Id);
            }
            else
            {
                parameters.Add("mark", DBNull.Value);
            }
            parameters.Add("licensePlate", licensePlate);

            List <Permit> permitList = new List <Permit>();

            using (DbDataReader reader = database.ExecuteReader(query, parameters))
            {
                while (reader.Read())
                {
                    permitList.Add(new Permit(reader));
                }
                reader.Close();
            }

            return(permitList);
        }
Ejemplo n.º 2
0
        public VehicleMark LoadCopy(Database database)
        {
            VehicleMark mark = VehicleMark.Empty;

            QueryParameters parameters = new QueryParameters("id", Id);

            using (DbDataReader reader = database.ExecuteReader(LoadQuery, parameters))
            {
                if (reader.Read())
                    mark = new VehicleMark(reader);

                reader.Close();
            }

            if (mark.Equals(VehicleMark.Empty))
                throw new ArgumentException(EntryControl.Resources.Message.Error.WrongIdentifier);

            return mark;
        }
Ejemplo n.º 3
0
        public static List <Vehicle> LoadList(Database database, Contractor owner, VehicleMark mark, string license)
        {
            List <Vehicle> vehicleList = new List <Vehicle>();

            QueryParameters parameters = new QueryParameters();

            if (owner == null || owner.Equals(Contractor.Empty))
            {
                parameters.Add("owner", null);
            }
            else
            {
                parameters.Add("owner", owner.Id);
            }

            if (mark == null || mark.Equals(EntryControl.Classes.VehicleMark.Empty))
            {
                parameters.Add("mark", null);
            }
            else
            {
                parameters.Add("mark", mark.Id);
            }

            parameters.Add("license", license);

            using (DbDataReader reader = database.ExecuteReader(LoadListQuery, parameters))
            {
                while (reader.Read())
                {
                    vehicleList.Add(new Vehicle(reader));
                }

                reader.Close();
            }

            return(vehicleList);
        }
Ejemplo n.º 4
0
 protected override string StringDescription()
 {
     return(VehicleMark.ToString() + " " + LicensePlate);
 }