Ejemplo n.º 1
0
        public RegisterNewUser()
        {
            InitializeComponent();

            _dbContext = new OITChauffer();

            // Get all vehicle types and populate combo box
            var values = Enum.GetValues(typeof(VehicleType));

            foreach (VehicleType vt in values)
            {
                if (vt != VehicleType.NoVehicle)
                {
                    VehicleTypeCB.Items.Add(vt.ToString());
                }
            }
            // set combo box as a dropdown list so it wont allow input
            this.VehicleTypeCB.DropDownStyle = ComboBoxStyle.DropDownList;

            // make all chauffer steps unaccessible untill the user indicates they are a chauffer
            VehicleTypeCB.Enabled          = false;
            VehicleTypeClearButton.Enabled = false;
            LicensePlateNumberTB.Enabled   = false;

            // have password text box hide inputed characters
            PasswordTB.PasswordChar = '*';
        }
Ejemplo n.º 2
0
 public HomePage()
 {
     InitializeComponent();
     _dbContext = new OITChauffer();
     // have password text box hide inputed characters
     PasswordTB.PasswordChar = '*';
 }
Ejemplo n.º 3
0
        public RideRequestsMenu()
        {
            _dbContext = new OITChauffer();
            InitializeComponent();

            // populate CurrentRequestsLV
            CurrentRequestsLV.Items.Clear();
            foreach (var rr in _dbContext.RideRequests)
            {
                var fullName = _dbContext.Riders.SingleOrDefault(
                    r => r.RiderId == rr.RiderId).GetFullName();

                var row = new string[] { rr.RideRequestId.ToString(), fullName, rr.PickupAddress, rr.DestinationAddress };
                var lvi = new ListViewItem(row);
                lvi.Tag = rr;
                CurrentRequestsLV.Items.Add(lvi);
            }
        }
Ejemplo n.º 4
0
        public RequesteeDetailsMenu()
        {
            _dbContext = new OITChauffer();
            InitializeComponent();

            Requestee = _dbContext.Riders.SingleOrDefault(
                r => r.RiderId == RideRequestsMenu.Request.RiderId
                );

            Payment = _dbContext.Payments.SingleOrDefault(
                p => p.RideRequestId == RideRequestsMenu.Request.RideRequestId
                );
            RiderDetailsLV.Columns.Add("Details", -2, HorizontalAlignment.Center);
            RiderDetailsLV.Items[0].Text = "Full Name: " + Requestee.GetFullName();
            RiderDetailsLV.Items[1].Text = "Pickup Time: " + RideRequestsMenu.Request.DesiredPickupTime;
            RiderDetailsLV.Items[2].Text = "Location: " + RideRequestsMenu.Request.PickupAddress;
            RiderDetailsLV.Items[3].Text = "Destination: " + RideRequestsMenu.Request.DestinationAddress;
            RiderDetailsLV.Items[4].Text = "Type: " + Payment.PaymentType.ToString();
            RiderDetailsLV.Items[5].Text = "Amount: " + Payment.Amount.ToString();
            RiderDetailsLV.Items[6].Text = "Status: " + RideRequestsMenu.Request.RideStatus;
        }
Ejemplo n.º 5
0
        public RequestChaufferMenu()
        {
            InitializeComponent();

            _dbContext = new OITChauffer();

            // Round up to the nearest half hour
            var currentTime = DateTime.Now;

            if (currentTime.Minute < 30 && currentTime.Minute != 0)
            {
                var timeIncrement = 30 - currentTime.Minute;
                currentTime = currentTime.AddMinutes(timeIncrement);
            }
            else if (currentTime.Minute > 30)
            {
                var timeIncrement = 60 - currentTime.Minute;
                currentTime = currentTime.AddMinutes(timeIncrement);
            }
            PickupTimeTB.Text = currentTime.ToShortTimeString();

            // They can only edit the pickuptime through the buttons
            PickupTimeTB.Enabled = false;

            // Get all vehicle types and populate combo box
            var values = Enum.GetValues(typeof(PaymentType));

            foreach (PaymentType pt in values)
            {
                PaymentTypeCB.Items.Add(pt.ToString());
            }
            // set combo box as a dropdown list so it wont allow input
            this.PaymentTypeCB.DropDownStyle = ComboBoxStyle.DropDownList;

            // Can only edit price through buttons
            AmountTB.Enabled = false;
            AmountTB.Text    = "0.00";
        }
        public NotificationsMenu()
        {
            _dbContext = new OITChauffer();
            InitializeComponent();

            // populate NotifcationsLV
            NotificationsLV.Items.Clear();
            foreach (var n in _dbContext.Notifications)
            {
                var chauffer = _dbContext.Chauffers.SingleOrDefault(
                    c => n.ChaufferId == c.ChaufferId
                    );
                var request = _dbContext.RideRequests.SingleOrDefault(
                    r => r.RideRequestId == n.RideRequestId
                    );

                if (n.RiderId == HomePage.CurrentUser.GetId())
                {
                    var row = new string[]
                    {
                        n.NotificationId.ToString(),
                        chauffer.FirstName,
                        chauffer.VehicleType.ToString(),
                        chauffer.LicensePlateNumber,
                        n.ETA.ToString(),
                        request.RideStatus.GetType()
                        .GetMember(request.RideStatus.ToString())
                        .First()
                        .GetCustomAttribute <DisplayAttribute>()
                        .GetName()
                    };
                    var lvi = new ListViewItem(row);
                    lvi.Tag = n;
                    NotificationsLV.Items.Add(lvi);
                }
            }
        }
Ejemplo n.º 7
0
        public PastPaymentsMenu()
        {
            _dbContext = new OITChauffer();
            InitializeComponent();

            // figure out if they are a rider or a chauffer
            List <int> rideRequestIds = new List <int>();

            foreach (var rr in _dbContext.RideRequests)
            {
                if (HomePage.CurrentUser.IsRider())
                {
                    // the user is a rider do rider stuff
                    rideRequestIds.Add(rr.RideRequestId);
                }
                else if (HomePage.CurrentUser.IsChauffer())
                {
                    // the user is a chauffer do chauffer stuff
                    rideRequestIds.Add(rr.RideRequestId);
                }
            }

            foreach (var p in _dbContext.Payments)
            {
                if (rideRequestIds.Contains(p.RideRequestId))
                {
                    var request = _dbContext.RideRequests.SingleOrDefault(
                        rr => rr.RideRequestId == p.RideRequestId
                        );

                    if (request.RiderId == HomePage.CurrentUser.GetId() ||
                        request.ChaufferId == HomePage.CurrentUser.GetId())
                    {
                        var rider = _dbContext.Riders.SingleOrDefault(
                            r => r.RiderId == request.RiderId
                            );
                        var chauffer = _dbContext.Chauffers.SingleOrDefault(
                            r => r.ChaufferId == request.ChaufferId
                            );
                        string[] row;
                        if (chauffer == null)
                        {
                            row = new string[]
                            {
                                p.Amount.ToString(),
                                    p.PaymentType.GetType()
                                .GetMember(p.PaymentType.ToString())
                                .First()
                                .GetCustomAttribute <DisplayAttribute>()
                                .GetName(),
                                rider.GetFullName(),
                                "Chauffer Unassigned"
                            };
                        }
                        else
                        {
                            row = new string[]
                            {
                                p.Amount.ToString(),
                                    p.PaymentType.GetType()
                                .GetMember(p.PaymentType.ToString())
                                .First()
                                .GetCustomAttribute <DisplayAttribute>()
                                .GetName(),
                                rider.GetFullName(),
                                chauffer.GetFullName()
                            };
                        }
                        var lvi = new ListViewItem(row);
                        lvi.Tag = p;
                        PastPaymentsLV.Items.Add(lvi);
                    }
                }
            }
        }
Ejemplo n.º 8
0
        public SystemAdminMainMenu()
        {
            _dbContext = new OITChauffer();
            InitializeComponent();

            // update all riders view
            foreach (var r in _dbContext.Riders)
            {
                var row = new string[]
                {
                    r.RiderId.ToString(),
                         r.FirstName,
                         r.LastName,
                         r.UserName
                };
                var lvi = new ListViewItem(row);
                lvi.Tag = r;
                AllRidersLV.Items.Add(lvi);
            }

            // update all chauffers view
            foreach (var c in _dbContext.Chauffers)
            {
                var row = new string[]
                {
                    c.ChaufferId.ToString(),
                         c.FirstName,
                         c.LastName,
                         c.VehicleType.GetType()
                    .GetMember(c.VehicleType.ToString())
                    .First()
                    .GetCustomAttribute <DisplayAttribute>()
                    .GetName(),
                    c.LicensePlateNumber,
                    c.UserName
                };
                var lvi = new ListViewItem(row);
                lvi.Tag = c;
                AllChauffersLV.Items.Add(lvi);
            }

            // update all ride requests view
            foreach (var rr in _dbContext.RideRequests)
            {
                var row = new string[]
                {
                    rr.RideRequestId.ToString(),
                         rr.RiderId.ToString(),
                         rr.ChaufferId.ToString(),
                         rr.DesiredPickupTime.ToString(),
                         rr.PickupAddress,
                         rr.DestinationAddress,
                         rr.RideStatus.GetType()
                    .GetMember(rr.RideStatus.ToString())
                    .First()
                    .GetCustomAttribute <DisplayAttribute>()
                    .GetName()
                };
                var lvi = new ListViewItem(row);
                lvi.Tag = rr;
                AllRideRequestsLV.Items.Add(lvi);
            }

            // update all notfications view
            foreach (var n in _dbContext.Notifications)
            {
                var row = new string[]
                {
                    n.NotificationId.ToString(),
                         n.ChaufferId.ToString(),
                         n.RiderId.ToString(),
                         n.RideRequestId.ToString(),
                         n.DriverFirstName,
                         n.VehicleType.GetType()
                    .GetMember(n.VehicleType.ToString())
                    .First()
                    .GetCustomAttribute <DisplayAttribute>()
                    .GetName(),
                    n.LicensePlateNum,
                    n.ETA.ToString()
                };
                var lvi = new ListViewItem(row);
                lvi.Tag = n;
                AllNotificationsLV.Items.Add(lvi);
            }

            // update all payments view
            foreach (var p in _dbContext.Payments)
            {
                var row = new string[]
                {
                    p.PaymentId.ToString(),
                         p.RideRequestId.ToString(),
                         p.PaymentType.GetType()
                    .GetMember(p.PaymentType.ToString())
                    .First()
                    .GetCustomAttribute <DisplayAttribute>()
                    .GetName(),
                    p.Amount.ToString()
                };
                var lvi = new ListViewItem(row);
                lvi.Tag = p;
                AllPaymentsLV.Items.Add(lvi);
            }
        }