Esempio n. 1
0
        protected void ReportAddButton_Click(object sender, EventArgs e)
        {
            if (Page.IsValid)
            {
                ReportBLL                bll            = new ReportBLL(connectionString);
                ReportViewModel          report         = new ReportViewModel();
                Dictionary <string, int> CarOwner_CarID = GetCarNameFromCarID();

                int i;

                for (i = 0; i < CarOwner_CarID.Count; i++)
                {
                    if (CarOwner_CarID.Keys.ToList()[i].Equals(CarIDList.SelectedItem.Text))
                    {
                        break;
                    }
                }

                report.CarID             = CarOwner_CarID.Values.ToList()[i];
                report.DateOfIncident    = DateOfIncident.Text;
                report.ReportName        = ReportName.Text;
                report.ReportDescription = ReportDescription.Text;
                report.DateOfReport      = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff");
                bll.AddIncidentReport(report);
                Response.Redirect("~/Reports.aspx");
            }
        }