protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         CarBLL entity = new CarBLL(connectionString);
         List <CarViewModel> CarList  = new List <CarViewModel>();
         List <string>       CarNames = new List <string>();
         CarList = entity.GetCarInventory();
         foreach (CarViewModel Car in CarList)
         {
             CarNames.Add(Car.Name.ToString());
         }
         RideDropDownList.DataSource = CarNames;
         RideDropDownList.DataBind();
     }
 }
Example #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                CarBLL entity = new CarBLL(connectionString);
                List <CarViewModel> CarList  = new List <CarViewModel>();
                List <string>       CarNames = new List <string>();
                CarList = entity.GetCarInventory();
                foreach (CarViewModel Car in CarList)
                {
                    CarNames.Add(Car.Name.ToString());
                }
                RideDropDownList.DataSource = CarNames;
                RideDropDownList.DataBind();

                ReportBLL       bll    = new ReportBLL(connectionString);
                ReportViewModel report = bll.GetReportById(Convert.ToInt32(Request.QueryString["ReportID"]));
                RideDropDownList.SelectedValue = GetCarName(report.CarID);
                DateOfIncident.Text            = Convert.ToDateTime(report.DateOfIncident).ToString("yyyy-MM-dd");
                ReportName.Text        = report.ReportName;
                ReportDescription.Text = report.ReportDescription;
            }
        }