コード例 #1
0
ファイル: ElectricCar.cs プロジェクト: Dadov/3rdsemproject
        public List<BookingLine> getBookingLinesForStation(int sId)
        {
            List<BookingLine> bls = new List<BookingLine>();
            BookingLineCtr blCtr = new BookingLineCtr();
            List<MBookingLine> mbls = blCtr.getBookingLinesForStation(sId, true);

            foreach (MBookingLine bl in mbls)
            {
                BookingLine b = new BookingLine();
                BatteryType bt = new BatteryType();
                b.BatteryType = bt;
                b.BatteryType.ID = bl.BatteryType.id;
                b.BatteryType.name = bl.BatteryType.name;
                b.quantity = bl.quantity.Value;
                b.time = bl.time.Value;
                b.price = bl.price.Value;
                b.bId = bl.bId;
                bls.Add(b);
            }
            return bls;
        }
コード例 #2
0
ファイル: BookingLine.cs プロジェクト: Dadov/3rdsemproject
 public BookingLine()
 {
     station = new Station();
     BatteryType = new BatteryType();
 }
コード例 #3
0
ファイル: ElectricCar.cs プロジェクト: Dadov/3rdsemproject
        public Booking getBooking(int id)
        {
            Booking bk = new Booking();
            BookingCtr bCtr = new BookingCtr();
            MBooking b = bCtr.getBooking(id, true);
            if (bk != null)
            {
                foreach (MBookingLine bl in b.bookinglines)
                {
                    BookingLine l = new BookingLine();
                    l.price = bl.price.Value;
                    l.quantity = bl.quantity.Value;
                    l.time = bl.time.Value;
                    bk.bookinglines.Add(l);

                    BatteryType bt = new BatteryType();
                    bt.ID = bl.BatteryType.id;
                    bt.name = bl.BatteryType.name;
                    l.BatteryType = bt;

                    Station s = new Station();
                    s.Id = bl.Station.Id;
                    s.Name = bl.Station.name;
                    s.Address = bl.Station.address;
                    s.Country = bl.Station.country;
                    l.station = s;

                }
                bk.startStationId = b.bookinglines.First().Station.Id;
            }
            return bk;
        }
コード例 #4
0
ファイル: ElectricCar.cs プロジェクト: Dadov/3rdsemproject
 public BatteryType getBatteryType(int id)
 {
     BatteryTypeCtr tCtr = new BatteryTypeCtr();
     MBatteryType type = tCtr.getRecord(id, true);
     BatteryType bt = new BatteryType();
     if (type != null)
     {
         bt.ID = type.id;
         bt.name = type.name;
         bt.producer = type.producer;
         bt.capacity = (int)type.capacity;
         bt.exchangeCost = (int)type.exchangeCost;
     }
     return bt;
 }
コード例 #5
0
ファイル: ElectricCar.cs プロジェクト: Dadov/3rdsemproject
        public List<Booking> getAllBookings()
        {
            List<Booking> bookings = new List<Booking>();
            BookingCtr bCtr = new BookingCtr();
            List<MBooking> bs = bCtr.getAllBooking();
            if (bs.Count != 0)
            {
                foreach (MBooking b in bs)
                {
                    Booking bk = new Booking();
                    bk.Id = b.Id;
                    bk.createDate = b.createDate.Value.ToString("dd/MM/yyyy");
                    Customer cust = new Customer() { ID = b.customer.ID, name = b.customer.FName + " " + b.customer.LName };
                    bk.customer = cust;
                    bk.cId = b.customer.ID;
                    bk.payStatus = b.creaditCard;
                    bk.totalPrice = b.totalPrice.Value;
                    bk.tripStart = b.tripStart.Value.ToString("dd/MM/yyyy HH:mm");
                    if (b.bookinglines.Count != 0)
                    {
                        foreach (MBookingLine bl in b.bookinglines)
                        {
                            BookingLine l = new BookingLine();
                            l.price = bl.price.Value;
                            l.quantity = bl.quantity.Value;
                            l.time = bl.time.Value;
                            bk.bookinglines.Add(l);
                            BatteryType bt = new BatteryType();
                            bt.ID = bl.BatteryType.id;
                            bt.name = bl.BatteryType.name;
                            l.BatteryType = bt;
                            Station s = new Station();
                            s.Id = bl.Station.Id;
                            s.Name = bl.Station.name;
                            s.Address = bl.Station.address;
                            s.Country = bl.Station.country;
                            l.station = s;

                        }
                        bk.startStationId = b.bookinglines.First().Station.Id;
                    }
                    bookings.Add(bk);
                }
            }

            return bookings;
        }
コード例 #6
0
ファイル: ElectricCar.cs プロジェクト: Dadov/3rdsemproject
 public List<BatteryType> getAllBatteryTypes()
 {
     BatteryTypeCtr tCtr = new BatteryTypeCtr();
     List<MBatteryType> types = tCtr.getAllRecord(true);
     List<BatteryType> bts = new List<BatteryType>();
     foreach (MBatteryType type in types)
     {
         BatteryType bt = new BatteryType();
         bt.ID = type.id;
         bt.name = type.name;
         bt.producer = type.producer;
         bt.capacity = (int)type.capacity;
         bt.exchangeCost = (int)type.exchangeCost;
         bts.Add(bt);
     }
     return bts;
 }
コード例 #7
0
ファイル: ElectricCar.cs プロジェクト: Dadov/3rdsemproject
        public List<BatteryType> getAllBatteryType()
        {
            List<BatteryType> bts = new List<BatteryType>();
            BatteryTypeCtr btCtr = new BatteryTypeCtr();
            List<MBatteryType> bt = btCtr.getAllRecord(false);
            if (bt.Count != 0)
            {
                foreach (MBatteryType b in bt)
                {
                    BatteryType btt = new BatteryType();
                    btt.ID = b.id;
                    btt.name = b.name;
                    btt.price = Convert.ToDouble(b.exchangeCost);
                    bts.Add(btt);
                }
            }

            return bts;
        }