Пример #1
0
 public Booking(int id, DateTime creationDate, Mark isMarked, DateTime issueDate, double bookingSum,
                Independent.Cutter cutter,
                Independent.Client client,
                Independent.Model model,
                SingleDependable.Fabric fabric)
 {
     this.id           = id;
     this.creationDate = creationDate;
     this.isMarked     = isMarked;
     this.issueDate    = issueDate;
     this.bookingSum   = bookingSum;
     this.cutter       = cutter;
     this.client       = client;
     this.model        = model;
     this.fabric       = fabric;
 }
Пример #2
0
        public static List <Booking> Get(string request)
        {
            Shared.SQLDatabaseConnetion connection = new Shared.SQLDatabaseConnetion();
            List <Booking> resultList = new List <Booking>();

            try
            {
                SqlDataReader reader = connection.Get(request);
                while (reader.Read())
                {
                    int      id           = Convert.ToInt32(reader.GetValue(0));
                    DateTime creationDate = DateTime.Parse(Convert.ToString(reader.GetValue(1)));
                    DateTime issueDate    = DateTime.Parse(Convert.ToString(reader.GetValue(2)));
                    Mark     isMarked     = new Mark(Convert.ToString(reader.GetValue(3)));
                    double   bookingSum   = Convert.ToDouble(reader.GetValue(4));
                    int      cutterId     = Convert.ToInt32(reader.GetValue(5));
                    int      clientId     = Convert.ToInt32(reader.GetValue(6));
                    int      modelId      = Convert.ToInt32(reader.GetValue(7));
                    int      fabricId     = Convert.ToInt32(reader.GetValue(8));

                    Independent.Cutter      newCutter = getCutterById(cutterId);
                    Independent.Client      newClient = getClientById(clientId);
                    Independent.Model       newModel  = getModelById(modelId);
                    SingleDependable.Fabric newFabric = getFabricById(fabricId);

                    Booking newObject = new Booking(id, creationDate, isMarked, issueDate, bookingSum, newCutter, newClient, newModel, newFabric);
                    resultList.Add(newObject);
                }
            }
            catch (SqlException exception)
            {
                Console.WriteLine(exception.Message);
                Console.WriteLine("ModelList is Empty");
            }
            connection.closeConnection();
            return(resultList);
        }