Exemple #1
0
 public dynamic getAllDriver()
 {
     using (DODataContext db_ = new DODataContext())
     {
         return(db_.CarDrivers.ToList());
     }
 }
Exemple #2
0
            public void UpdateDriver(string ProductID, string TakerID)
            {
                using (DODataContext db_ = new DODataContext())
                {
                    var products = db_.Products.Where(x => x.ID == ProductID).ToList();
                    var drivers  = db_.CarDrivers.Where(x => x.ID == TakerID).ToList();
                    if (products.Count > 0 && drivers.Count > 0)
                    {
                        var product = products.FirstOrDefault();
                        var driver  = drivers.FirstOrDefault();

                        product.Status   = "Delivering";
                        product.TakeDate = DateTime.Now;
                        product.TakeBy   = TakerID;



                        driver.Working = true;
                    }
                    db_.SubmitChanges();
                }



                //Console.WriteLine("Drive the Scooter : " + product.ToString() + "km");
            }
Exemple #3
0
            public void InsertDriver(string userID, string Name, string gender, DateTime bd, string drivinglicence, DateTime expiryDate)
            {
                using (DODataContext db_ = new DODataContext())
                {
                    operation op     = new operation();
                    CarDriver driver = new CarDriver()
                    {
                        ID                   = op.NewID(),
                        BirthDate            = bd,
                        drivingLicenceNumber = drivinglicence,
                        expiryDate           = expiryDate,
                        Gender               = gender,
                        StaffName            = Name,
                        UserID               = userID,
                        Working              = false
                    };


                    db_.CarDrivers.InsertOnSubmit(driver);

                    db_.SubmitChanges();
                }



                //Console.WriteLine("Drive the Scooter : " + product.ToString() + "km");
            }
Exemple #4
0
            public void DriverIsFree(string driverID)
            {
                using (DODataContext db_ = new DODataContext())
                {
                    var drivers = db_.CarDrivers.Where(x => x.ID == driverID).ToList();
                    if (drivers.Count > 0)
                    {
                        var driver = drivers.FirstOrDefault();

                        driver.Working = false;
                    }
                    db_.SubmitChanges();
                }
            }