Пример #1
0
 public ParkingOperator GetOperatorInfo(int operatorId)
 {
     using (var context = new ValetDBEntities())
     {
         var result = context.sp_GetOperatorById(operatorId).FirstOrDefault();
         return((result == null) ? new ParkingOperator() :
                new ParkingOperator
         {
             OperatorName = result.OperatorName,
             Latitude = result.Latitude,
             Longitude = result.Longitude,
             Address1 = result.Address1,
             City = result.City,
             State = result.StateID,
             Zip = result.Zip,
             Phone = result.Phone,
             WebsiteUrl = result.WebsiteUrl,
             NumberOfSpaces = (int)result.NumberOfSpaces,
             InitialFee = result.InitialFee,
             InitialHours = result.InitialHours,
             SubsequentHourlyFee = result.HourlyFee,
             AcceptsCash = result.AcceptsCash,
             AcceptsCredit = result.AcceptsCredit,
             CoveredParking = result.CoveredParking,
             Open24Hours = result.Open24Hours,
             HourOpen = result.HourOpen,
             HourClosed = result.HourClosed,
             EventParking = result.EventParking,
             ParkingGarage = result.ParkingGarage,
         });
     }
 }
Пример #2
0
 public List <ParkingOperator> GetParkingInRadius(double myLat, double myLong, double radius)
 {
     using (var context = new ValetDBEntities())
     {
         var result = context.sp_GetParkingInRadius(myLat, myLong, radius);
         return((result == null) ? new List <ParkingOperator>() :
                result.Select(d =>
                              new ParkingOperator
         {
             OperatorName = d.OperatorName,
             Latitude = d.Latitude,
             Longitude = d.Longitude,
             Address1 = d.Address1,
             City = d.City,
             State = d.StateID,
             Zip = d.Zip.Trim(),
             Phone = d.Phone,
             WebsiteUrl = d.WebsiteUrl,
             NumberOfSpaces = (int)d.NumberOfSpaces,
             InitialFee = d.InitialFee,
             InitialHours = d.InitialHours,
             SubsequentHourlyFee = d.HourlyFee,
             AcceptsCash = d.AcceptsCash,
             AcceptsCredit = d.AcceptsCredit,
             CoveredParking = d.CoveredParking,
             Open24Hours = d.Open24Hours,
             HourOpen = d.HourOpen,
             HourClosed = d.HourClosed,
             EventParking = d.EventParking,
             ParkingGarage = d.ParkingGarage,
             Distance = Convert.ToDouble(d.Distance),
         }).ToList());
     }
 }
Пример #3
0
 public void UpdateExpires(string deviceId, DateTime expires)
 {
     using (var context = new ValetDBEntities())
     {
         context.sp_UpdateExpires(deviceId, expires);
     }
 }
Пример #4
0
 public void NotifyDriver(int driverId)
 {
     using (var context = new ValetDBEntities())
     {
         context.sp_DriverNotified(driverId);
     }
 }
Пример #5
0
 public void InsertDriver(string driverName, double?latitude, double?longitude, string deviceId, DateTime?expires)
 {
     using (var context = new ValetDBEntities())
     {
         context.sp_Driver_Insert(driverName, latitude, longitude, deviceId, expires);
     }
 }
Пример #6
0
 public void InsertParking(string operatorName, double?latitude, double?longitude, string addr1, string city,
                           string state,
                           string zip, string phone, string website, int?numberOfSpaces, decimal?initFee, int?initHours,
                           decimal?hourlyFee,
                           bool?acceptCash, bool?acceptCredit, bool?coveredParking, bool?open24, int?hourOpen, int?hourClosed,
                           bool?eventParking, bool?parkingGarage)
 {
     using (var context = new ValetDBEntities())
     {
         context.sp_Operator_Insert(operatorName, latitude, longitude, addr1, city, state, zip, phone, website,
                                    numberOfSpaces, initFee, initHours, hourlyFee, acceptCash, acceptCredit, coveredParking, open24,
                                    hourOpen, hourClosed, eventParking, parkingGarage);
     }
 }
Пример #7
0
 public Driver GetDriverInfo(int driverId)
 {
     using (var context = new ValetDBEntities())
     {
         var result = context.sp_DriverById(driverId).FirstOrDefault();
         return((result == null) ? new Driver() :
                new Driver
         {
             DriverName = result.DriverName,
             Latitude = result.Latitude,
             Longitude = result.Longitude,
             DeviceId = result.DeviceID,
             Expires = result.Expires,
             Notified = result.Notified
         });
     }
 }
Пример #8
0
 public List <Driver> GetAllDrivers()
 {
     using (var context = new ValetDBEntities())
     {
         var result = context.sp_GetAllDrivers();
         return((result == null) ? new List <Driver>() :
                result.Select(d =>
                              new Driver
         {
             DriverName = d.DriverName,
             Latitude = d.Latitude,
             Longitude = d.Longitude,
             DeviceId = d.DeviceID,
             Expires = d.Expires,
             Notified = d.Notified
         }).ToList());
     }
 }