コード例 #1
0
ファイル: Cars.aspx.cs プロジェクト: Monchkrit/RideXpress
        private void BindData()
        {
            CarBLL carBL = new CarBLL(connectionString);

            CarList.DataSource = carBL.GetCarInventory();
            CarList.DataBind();
        }
コード例 #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                CarBLL bll = new CarBLL(connectionString);
                List <CarViewModel> cars = new List <CarViewModel>(bll.GetCarInventory());

                foreach (var car in cars)
                {
                    ddlRide.Items.Insert(cars.IndexOf(car), new ListItem(car.Name.ToString(), car.CarID.ToString()));
                }
            }
        }
コード例 #3
0
 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();
     }
 }
コード例 #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                CarBLL          carBL    = new CarBLL(connectionString);
                ReportBLL       reportBL = new ReportBLL(connectionString);
                ReportViewModel report   = reportBL.GetReportById(Convert.ToInt32(Request.QueryString["ReportID"]));

                List <CarViewModel> cars = new List <CarViewModel>(carBL.GetCarInventory());

                foreach (var car in cars)
                {
                    ddlRide.Items.Insert(cars.IndexOf(car), new ListItem(car.Name.ToString(), car.CarID.ToString()));
                }

                tbIncidentDate.Text = report.DateOfIncident.ToString();
                tbReportName.Text   = report.ReportName.ToString();
                tbDescription.Text  = report.ReportDescription;
            }
        }
コード例 #5
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;
            }
        }
コード例 #6
0
        public string GetCarName(int carID)
        {
            CarBLL entity = new CarBLL(connectionString);

            return(entity.GetCarInventory().Where(x => x.CarID == carID).Select(x => x.Name).FirstOrDefault());
        }