Ejemplo n.º 1
0
        public static List <ContractorContact> LoadList(Database database, Contractor contractor)
        {
            Enumeration contactTypeList = new Enumeration(database, "contactType");

            List <ContractorContact> contactList = new List <ContractorContact>();

            string          query      = EntryControl.Resources.Ref.Contractor.ContactLoadList;
            QueryParameters parameters = new QueryParameters("contractor", contractor.Id);

            using (DbDataReader reader = database.ExecuteReader(query, parameters))
            {
                while (reader.Read())
                {
                    contactList.Add(new ContractorContact(contractor, contactTypeList, reader));
                }
                reader.Close();
            }

            return(contactList);
        }
Ejemplo n.º 2
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.º 3
0
        public Contractor LoadCopy(Database database)
        {
            Contractor contractor = Contractor.Empty;

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

            using (DbDataReader reader = database.ExecuteReader(LoadQuery, parameters))
            {
                if (reader.Read())
                {
                    contractor = new Contractor(reader);
                }

                reader.Close();
            }

            if (contractor.Equals(Contractor.Empty))
            {
                throw new ArgumentException(EntryControl.Resources.Message.Error.WrongIdentifier);
            }

            return(contractor);
        }
Ejemplo n.º 4
0
 protected override string StringDescription()
 {
     return(Contractor.ToString());
 }
Ejemplo n.º 5
0
 protected override void ReadProperties(DbDataReader reader)
 {
     contractor = new Contractor((int)reader["contractor"], (string)reader["contractorName"]);
     dateFrom   = (DateTime)reader["dateFrom"];
     dateTo     = (DateTime)reader["dateTo"];
 }
Ejemplo n.º 6
0
 public ContractorContact(Contractor contractor, Enumeration typeList, DbDataReader reader)
 {
     Contractor   = contractor;
     ContactType  = typeList[(int)reader["id"]];
     ContactValue = (DBNull.Value.Equals(reader["contactValue"]) ? "" : (string)reader["contactValue"]);
 }
Ejemplo n.º 7
0
 public ContractorGroup(Contractor contractor, Enumeration groupList, DbDataReader reader)
 {
     Contractor = contractor;
     Group      = groupList[(int)reader["id"]];
     IsIncluded = ((int)reader["cnt"]) > 0;
 }