public EditLicenceViewModel()
        {
            DriversLicences = new BindableCollection <DriversLicence>();
            List <DriversLicence> data = DriversLicenceProcessor.LoadDriversLicences();

            foreach (var item in data)
            {
                DriversLicences.Add(item);
            }
        }
示例#2
0
        public void SaveButton(string firstName, string middleName, string lastName, string licenceNumber, int licenceClass, string expiryDate, string streetAddress, string city,
                               string province, string postalCode, string sex, string eyeColour, string hairColour, string dob, int height, int weight)
        {
            // get Id
            int id = DriversLicenceProcessor.LoadDriversLicences().Count() + 1;

            // get expiryDate parts
            String[] dobParts = dob.Split('/');
            int      dobDay   = Int32.Parse(dobParts[0]);
            int      dobMonth = Int32.Parse(dobParts[1]);
            int      dobYear  = Int32.Parse(dobParts[2]);

            // get DOB parts
            String[] expiryDateParts = expiryDate.Split('/');
            int      expiryDay       = Int32.Parse(expiryDateParts[0]);
            int      expiryMonth     = Int32.Parse(expiryDateParts[1]);
            int      expiryYear      = Int32.Parse(expiryDateParts[2]);

            DriversLicenceProcessor.CreateDriversLicence(id, firstName, lastName, middleName, licenceNumber, licenceClass, streetAddress, city, province, postalCode, sex,
                                                         eyeColour, hairColour, dobDay, dobMonth, dobYear, height, weight, expiryDay, expiryMonth, expiryYear);


            // reset
            FirstName     = "";
            MiddleName    = "";
            LastName      = "";
            LicenceNumber = "";
            LicenceClass  = 0;
            ExpiryDate    = "";
            StreetAddress = "";
            City          = "";
            Province      = "";
            PostalCode    = "";
            Sex           = "";
            EyeColour     = "";
            HairColour    = "";
            Dob           = "";
            Height        = 0;
            Weight        = 0;
        }
示例#3
0
        public ActionResult ViewDriversLicences()
        {
            ViewBag.Message = "Licence List";
            var data = DriversLicenceProcessor.LoadDriversLicences();
            List <DriversLicence> Licences = new List <DriversLicence>();

            foreach (var row in data)
            {
                Licences.Add(new DriversLicence
                {
                    Id            = row.Id,
                    FirstName     = row.FirstName,
                    LastName      = row.LastName,
                    MiddleName    = row.MiddleName,
                    LicenceNumber = row.LicenceNumber,
                    LicenceClass  = row.LicenceClass,
                    StreetAddress = row.StreetAddress,
                    City          = row.City,
                    Province      = row.Province,
                    PostalCode    = row.PostalCode,
                    Sex           = row.Sex,
                    EyeColour     = row.EyeColour,
                    HairColour    = row.HairColour,
                    DobDay        = row.DobDay,
                    DobMonth      = row.DobMonth,
                    DobYear       = row.DobYear,
                    Height        = row.Height,
                    Weight        = row.Weight,
                    ExpiryDay     = row.ExpiryDay,
                    ExpiryMonth   = row.ExpiryMonth,
                    ExpiryYear    = row.ExpiryYear
                });
            }

            return(View(Licences));
        }
示例#4
0
 // GET: api/DriversLicence
 public List <DriversLicence> Get()
 {
     return(DriversLicenceProcessor.LoadDriversLicences());
 }