protected void btnSubmit_Click(object sender, EventArgs e)
        {
            int    vehicleID   = Parsers.ParseInt(drpVehicle.SelectedValue);
            int    startYear   = Parsers.ParseInt(drpStartYear.SelectedValue);
            int    startMonth  = Parsers.ParseInt(drpStartMonth.SelectedValue);
            int    startDay    = Parsers.ParseInt(txtStartDay.Text);
            string description = txtDescription.Text.Trim();

            DateTime effectiveDate = new DateTime(startYear, startMonth, startDay);
            DateTime expiryDate    = effectiveDate.AddYears(1);

            VehicleInspectionRepository vir = new VehicleInspectionRepository();

            vir.Add(vehicleID, description, effectiveDate, expiryDate);
        }
Exemplo n.º 2
0
        protected void btnAddInspection_Click(object sender, EventArgs e)
        {
            // Parse the dates
            int    ID          = Parsers.ParseInt(txtVehicleID.Value);
            string description = txtNewInspectionDescription.Text;

            DateTime inspectionEffectiveDate = DateTime.ParseExact(txtEffectiveDate.Text, "yyyy-MM-dd", CultureInfo.InvariantCulture);
            DateTime inspectionExpires       = DateTime.ParseExact(txtExpiryDate.Text, "yyyy-MM-dd", CultureInfo.InvariantCulture);

            VehicleInspectionRepository vir = new VehicleInspectionRepository();
            VehicleInspection           i   = vir.Add(ID, description, inspectionEffectiveDate, inspectionExpires);

            if (i != null)
            {
                tblInspections.Rows.Add(addRow(i));
            }
        }