コード例 #1
0
        private void DisplayClosedIncidents()
        {
            // To format date
            DateTime myDateTime;
            String   output;

            lstIncidents.Items.Add(new ListItem("--Select an incident--", "None"));
            foreach (DataRowView row in incidentsTable)
            {
                //create a new product object and load with data from row
                Incident i = new Incident();
                this.Title    = Title;
                i.IncidentID  = (int)row["IncidentID"];
                i.CustomerID  = (int)row["CustomerID"];
                i.ProductCode = row["ProductCode"].ToString();
                i.TechID      = (int)row["TechID"];
                i.DateOpened  = row["DateOpened"].ToString();
                myDateTime    = DateTime.Parse(i.DateOpened);
                output        = myDateTime.ToShortDateString();
                i.DateOpened  = output;
                i.DateClosed  = row["DateClosed"].ToString();
                myDateTime    = DateTime.Parse(i.DateClosed);
                output        = myDateTime.ToShortDateString();
                i.DateClosed  = output;
                i.Title       = row["Title"].ToString();
                String text  = i.CustomerIncidentDisplay();
                String value = i.IncidentID.ToString();
                lstIncidents.Items.Add(new ListItem(text, value));
            }
            lstIncidents.SelectedIndex = 0;
            lblError.Text = "";
        }
コード例 #2
0
 private void DisplayClosedIncidents()
 {
     lstIncidents.Items.Add(new ListItem("--Select an incident--", ""));
     foreach (DataRowView row in incidentsTable)
     {
         Incident incident = new Incident();
         incident.IncidentID  = Convert.ToInt32(row["IncidentID"]);
         incident.ProductCode = row["ProductCode"].ToString();
         incident.DateClosed  = Convert.ToDateTime(row["DateClosed"]);
         incident.Title       = row["Title"].ToString();
         lstIncidents.Items.Add(new ListItem(
                                    incident.CustomerIncidentDisplay(), incident.IncidentID.ToString()));
     }
     lstIncidents.SelectedIndex = 0;
     lblNoIncidents.Text        = "";
 }
コード例 #3
0
        private void getSelectedCustomer()
        {
            DataView incidentTable = (DataView)SqlDataSource1.Select(DataSourceSelectArguments.Empty);

            incidentTable.RowFilter = "DateClosed is not NULL AND CustomerID = '" + int.Parse(txtCustId.Text) + "'";
            Incident inc      = new Incident();
            int      rowIndex = 0;

            lstIncidents.Items.Add(new ListItem("--Select an Incident--", null));
            foreach (DataRowView iRows in incidentTable)
            {
                DataRowView incRow = incidentTable[0];
                inc.CustomerID  = (int)iRows["CustomerID"];
                inc.IncidentId  = (int)iRows["IncidentID"];
                inc.ProductCode = iRows["ProductCode"].ToString();
                inc.TechID      = (int)iRows["TechID"];
                inc.Title       = (string)iRows["Title"];
                inc.DateOpened  = (DateTime)iRows["DateOpened"];
                inc.DateClosed  = (DateTime)iRows["DateClosed"];
                rowIndex        = rowIndex + 1;
                lstIncidents.Items.Add(inc.CustomerIncidentDisplay());
            }
        }