Exemplo n.º 1
0
    protected void btnGetIncidents_Click(object sender, EventArgs e)
    {
        lstIncidents.Items.Clear();
        myView = (DataView)dsIncidents.Select(DataSourceSelectArguments.Empty);
        myView.RowFilter = "CustomerID='" + txtCustomerID.Text + "' AND  DateClosed IS NOT NULL";

        lstIncidents.Items.Add("--Select an incident--");
        lstIncidents.Items[0].Value = "None";

        if (myView.Count == 0)
        {
            Deny();
            lstIncidents.Items.Clear();
            lstIncidents.Items.Add("There are no incidents linked to this account");
        }

        else
        {
            custid = Convert.ToInt32(txtCustomerID.Text);
            int i = 1;
            foreach (DataRowView v in myView)
            {
                DataRowView rowResult = v;
                inc = new Incident(rowResult);
                lstIncidents.Items.Add(inc.CustomerIncidentDisplay());
                lstIncidents.Items[i].Value = Convert.ToString(inc.IncidentID);
                i++;
            }
            lstIncidents.Focus();
            Allow();
        }
    }
Exemplo n.º 2
0
    protected void btnIncident_Click(object sender, EventArgs e)
    {
        int cID;

        cID = int.Parse(txtBoxSurvey.Text);
        //surv = getData();
        surveyTable           = (DataView)SqlDataSource1.Select(DataSourceSelectArguments.Empty);
        surveyTable.RowFilter = "CustomerID ='" + cID + "'";

        foreach (DataRowView drv in surveyTable)
        {
            //DataRowView row = (DataRowView)surveyTable[drv];
            DataRow row = drv.Row;
            surv = getData(row);

            if (a == "")
            {
                lblincident.Text = "There is no closed incident for this customer";
            }
            else
            {
                lbSurvey.Enabled = true;
                lblincident.Text = "";
                lbSurvey.Items.Add(surv.CustomerIncidentDisplay());
                rblResponseTime.Enabled      = true;
                rblTechnicianEff.Enabled     = true;
                rblProblemResolution.Enabled = true;
                txtboxComments.Enabled       = true;
                cbContact.Enabled            = true;
                rblContactList.Enabled       = true;
            }
        }
    }
Exemplo n.º 3
0
    protected void btnCustomerID_Click(object sender, EventArgs e)
    {
        //Precondition all fields must be disabled expect for txtcustomerID and Getincident button
        //PostCondition:: checks if the user entered a proper customerID, gets the closed incidents from
        //the incident table and allows user to select a incident. Then they can complete a survey.
        DataRowView row;

        if (!(txtBoxCustomerID.Text == "" || txtBoxCustomerID.Text == null))
        {
            DataView incidentsTable = (DataView)SqlDataSource1.Select(DataSourceSelectArguments.Empty);

            //filter results by  Customer id and DateClosed is not null
            incidentsTable.RowFilter = "CustomerID = '" + Convert.ToInt32(txtBoxCustomerID.Text) + "' And DateClosed IS Not NULL";
            lBoxIncidents.Items.Clear();
            lbl3.Text = "";

            //check to see if there are incidents if not display a message
            if (incidentsTable.Count == 0)
            {
                lbl3.Text      = "There is no incident history for this customer!";
                lbl3.ForeColor = System.Drawing.Color.Red;
            }
            else
            {
                //create a list Item to store text and value
                ListItem dataItem = new ListItem();

                //loop throught incidents and create an incident object for each incident
                for (int i = 0; i < incidentsTable.Count; i++)
                {
                    row = (DataRowView)incidentsTable[i];
                    Incident incident = new Incident();
                    incident.IncidentID  = Convert.ToInt32(row["IncidentID"]);
                    incident.CustomerID  = Convert.ToInt32(row["CustomerID"]);
                    incident.ProductCode = row["ProductCode"].ToString();
                    incident.TechID      = Convert.ToInt32(row["TechID"]);
                    incident.DateOpened  = Convert.ToDateTime(row["DateOpened"]);
                    incident.DateClosed  = Convert.ToDateTime(row["DateClosed"]);
                    incident.Title       = row["Title"].ToString();

                    //store incidents in list as text and value and then insert them into the list
                    dataItem.Text  = incident.CustomerIncidentDisplay();
                    dataItem.Value = incident.IncidentID.ToString();
                    lBoxIncidents.Items.Insert(i, new ListItem(dataItem.Text, dataItem.Value));
                    //enable all other labels and radiobuttons
                    this.Enable();
                    lBoxIncidents.Focus();
                }
                dataItem.Text  = "Select an incident: ";
                dataItem.Value = "None";
                lBoxIncidents.Items.Insert(0, new ListItem(dataItem.Text, dataItem.Value));
            }
        }
    }
Exemplo n.º 4
0
 private void DisplayClosedIncidents()
 {
     lstIncidents.Items.Add(new ListItem("--Select an incident--", "None"));
     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        = "";
 }
Exemplo n.º 5
0
        private void GetSelectedIncident()
        {
            DataView incidentTable = (DataView)SqlDataSource1.Select(DataSourceSelectArguments.Empty);

            incidentTable.RowFilter = "DateClosed is NOT NULL and CustomerID ='" + customerID.Text + "'";

            Incident incident = new Incident();

            lstIncident.Items.Add(new ListItem("--Select an Incident--", null));
            foreach (DataRowView incidentRows in incidentTable)
            {
                DataRowView row = incidentTable[0];
                incident.CustomerID     = Convert.ToInt32(incidentRows["CustomerID"]);
                incident.IncidentID     = Convert.ToInt32(incidentRows["IncidentID"]);
                incident.ProductCode    = incidentRows["ProductCode"].ToString();
                incident.TechEfficiency = Convert.ToInt32(incidentRows["TechID"]);
                incident.Title          = incidentRows["Title"].ToString();
                incident.DateClosed     = incidentRows["DateClosed"].ToString();
                incident.DateOpened     = incidentRows["DateOpened"].ToString();

                lstIncident.Items.Add(incident.CustomerIncidentDisplay());
            }
        }
Exemplo n.º 6
0
    private bool GetSelectedCustomerIncidents(string strCustomerID)
    {
        Incident objIncident;
        bool     blnResult = false;

        DataView customerIncidents = (DataView)AccessDataSource1.Select(DataSourceSelectArguments.Empty);

        customerIncidents.RowFilter = "(CustomerID = " + strCustomerID + ") AND (DateClosed IS NOT NULL)";

        lstIncidents.Items.Clear();

        if (customerIncidents.Count > 0)
        {
            //Add instruction item
            lstIncidents.Items.Add(new ListItem("--Select an incident--", "None"));

            foreach (DataRowView row in customerIncidents)
            {
                objIncident             = new Incident();
                objIncident.ID          = (int)row["IncidentID"];
                objIncident.CustomerID  = (int)row["CustomerID"];
                objIncident.ProductCode = row["ProductCode"].ToString();
                objIncident.TechID      = (int)row["TechID"];
                objIncident.DateOpened  = (DateTime)row["DateOpened"];
                objIncident.DateClosed  = (DateTime)row["DateClosed"];
                objIncident.Title       = row["Title"].ToString();

                lstIncidents.Items.Add(new ListItem(objIncident.CustomerIncidentDisplay(),
                                                    objIncident.ID.ToString()));
            }

            lstIncidents.SelectedValue = "None";
            blnResult = true;
        }

        return(blnResult);
    }
Exemplo n.º 7
0
    private bool GetSelectedCustomerIncidents(string strCustomerID)
    {
        Incident objIncident;
        bool blnResult = false;

        DataView customerIncidents = (DataView)AccessDataSource1.Select(DataSourceSelectArguments.Empty);
        customerIncidents.RowFilter = "(CustomerID = " + strCustomerID + ") AND (DateClosed IS NOT NULL)";

        lstIncidents.Items.Clear();

        if (customerIncidents.Count > 0)
        {
            //Add instruction item
            lstIncidents.Items.Add(new ListItem("--Select an incident--", "None"));

            foreach (DataRowView row in customerIncidents)
            {
                objIncident = new Incident();
                objIncident.ID = (int)row["IncidentID"];
                objIncident.CustomerID = (int)row["CustomerID"];
                objIncident.ProductCode = row["ProductCode"].ToString();
                objIncident.TechID = (int)row["TechID"];
                objIncident.DateOpened = (DateTime)row["DateOpened"];
                objIncident.DateClosed = (DateTime)row["DateClosed"];
                objIncident.Title = row["Title"].ToString();

                lstIncidents.Items.Add(new ListItem(objIncident.CustomerIncidentDisplay(),
                                                    objIncident.ID.ToString()));
            }

            lstIncidents.SelectedValue = "None";
            blnResult = true;
        }

        return blnResult;
    }