Exemplo n.º 1
0
        public FormDashboard()
        {
            InitializeComponent();
            context = new LogisticsDbEntities();

            //visual attributes
            pictureBoxLogo.SizeMode = PictureBoxSizeMode.StretchImage;
            buttonCloseForm.FlatAppearance.BorderSize      = 0;
            buttonDashboard.FlatAppearance.BorderSize      = 0;
            buttonPastDeliveries.FlatAppearance.BorderSize = 0;
            buttonTrucks.FlatAppearance.BorderSize         = 0;
            buttonDrivers.FlatAppearance.BorderSize        = 0;
            this.Width  = 805;
            this.Height = 670;
            ButtonColorDefault();
            buttonDashboard.BackColor = selectedButtonColor;

            // setting debug log
            context.Database.Log = (s => Debug.Write(s));
            context.SaveChanges();

            //bringing panelActiveDeliveries to front initially.
            panelActiveDeliveries.BringToFront();

            //defining event handlers
            textBoxCustomerName.TextChanged        += TextBoxCustomerName_TextChanged;
            textBoxCustomerAddress.TextChanged     += TextBoxCustomerAddress_TextChanged;
            textBoxCustomerNamePast.TextChanged    += TextBoxCustomerNamePast_TextChanged;
            textBoxCustomerAddressPast.TextChanged += TextBoxCustomerAddressPast_TextChanged;
        }
 /// <summary>
 /// Updates the TotalEarnings of a driver by $10
 /// </summary>
 /// <param name="driverId">DriverId</param>
 public void UpdateDriverEarnings(int driverId)
 {
     using (var context = new LogisticsDbEntities())
     {
         var findDriverQuery = context.Drivers.Where(p => p.DriverId == driverId).First();
         findDriverQuery.TotalEarnings += 10;
         context.SaveChanges();
     }
 }
Exemplo n.º 3
0
        public FormNewDelivery()
        {
            InitializeComponent();
            context = new LogisticsDbEntities();

            //changing title of the form
            this.Text = "Add New Delivery";

            //adding event listener
            listBoxAreaNames.SelectedIndexChanged += ListBoxAreaNames_SelectedIndexChanged;
        }