Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Here is the code I have so far: Customer.vb: Imports Microsoft.VisualBasic Publi

ID: 3725856 • Letter: H

Question

Here is the code I have so far:

Customer.vb:

Imports Microsoft.VisualBasic

Public Class Customer
    Public Property CustomerID As Integer
    Public Property Name As String
    Public Property Address As String
    Public Property City As String
    Public Property State As String
    Public Property ZipCode As String
    Public Property Phone As String
    Public Property Email As String
End Class

CustomerDisplay:

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <link href="style.css" rel="stylesheet" />
</head>
<body>
    <form id="form1" runat="server">
        <h1>Sportes Pro</h1>
    <h2>Sports Management software for sports enthusiast</h2>
        <br />
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString2 %>" SelectCommand="SELECT * FROM [Customers]"></asp:SqlDataSource>
      
        <asp:Label ID="Label1" runat="server" Text="select a customer:"></asp:Label> &nbsp
      
        <asp:DropDownList ID="customersDropDownList" runat="server" AutoPostBack="True" DataSourceID="SqlDataSource1" DataTextField="Name" DataValueField="CustomerID">
      
        </asp:DropDownList>
      
        <br />
        <br />
     
         <div class="CustomerInfo">
         <table>
                               
            <tr>  
                <td><asp:Label Text="Address:" runat="server" /> &nbsp</td>
                <td> <asp:Label ID="addressLabel" runat="server" Text=""></asp:Label></td>
            </tr>
            <tr>
                 <td><asp:Label Text="Phone:" runat="server" /> &nbsp </td>
                 <td> <asp:Label ID="phoneLabel" runat="server" Text=""></asp:Label></td>
            </tr>
             <tr>
                  <td> <asp:Label Text="Email:" runat="server" /> &nbsp </td>
                    <td><asp:Label ID="emailLabel" runat="server" Text=""></asp:Label></td>
             </tr>
            
      </div>

    </form>
</body>
</html>

Web.config:

<?xml version="1.0"?>
<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=169433
-->
<configuration>
<connectionStrings>
    <add name="ConnectionString" connectionString="Data Source=(LocalDB)MSSQLLocalDB;AttachDbFilename=|DataDirectory|TechSupport.mdf;Integrated Security=True;Connect Timeout=30"
      providerName="System.Data.SqlClient" />
    <add name="ConnectionString2" connectionString="Data Source=(LocalDB)MSSQLLocalDB;AttachDbFilename=|DataDirectory|TechSupport.mdf;Integrated Security=True;Connect Timeout=30"
      providerName="System.Data.SqlClient" />
</connectionStrings>
<system.web>
    <compilation debug="true" strict="false" explicit="true" targetFramework="4.5.1"/>
    <httpRuntime targetFramework="4.5.1"/>
</system.web>
</configuration>

7 Projects for Murach's ASP.NET. 4.6 with C# 2015 Project 1-B: Create a contact list For this project, you'll enhance the SportsPro application by adding a page named ContactDisplay.aspx that displays a list of customers to be contacted. Customers are added to this page from the Customer Display page you created in project 1-A. (Required reading: section I) The design of the enhanced Customer Display page e Project 1-A:Display Custo.. x SportsPro Sports management software for the sports enthusiast Select a customer Alexandro Alexis 3711 W Franklin Fresno, CA 93706 (559) 555-2993 Address Phone Email Add to Contact List Display Contact List The design of the Contact Display page http://localhost63186/p e Project 1-B: Create Contact-.x SportsPro Sports management software for the sports enthusiast Contact list Brian Grifin: (714) 555-9000, bgriffin@mmaazteklabel.com Emily Evan: (614) 555-4435, Emily@mma. MicroCenter.com Remove Contact Empty List Select Additional Customers

Explanation / Answer

Customer.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;

/// <summary>
/// Summary description for Customer
/// </summary>
public class Customer
{
    public int customerID;
    public string name;
    public string address;
    public string city;
    public string state;
    public string zipcode;
    public string phone;
    public string email;
   public Customer(DataRowView customer)
   {
        customerID = int.Parse(customer[0].ToString());
        name = customer[1].ToString();
        address = customer[2].ToString();
        city = customer[3].ToString();
        state = customer[4].ToString();
        zipcode = customer[5].ToString();
        phone = customer[6].ToString();
        email = customer[7].ToString();
   }

    public override String ToString()
    {
        return name + ": " + phone + "; " + email;
    }
}


Incident.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;

/// <summary>
/// Summary description for Incident
/// </summary>
public class Incident
{
    public int IncidentID;
    public int CustomerID;
    public string ProductCode;
    public string DateOpened;
    public string DateClosed;
    public string title;
    public int techID;

   public Incident(DataRowView incident)
   {
        IncidentID = int.Parse(incident[0].ToString());
        CustomerID = int.Parse(incident[1].ToString());
        ProductCode = incident[2].ToString();
        techID = int.Parse(incident[3].ToString());
        DateOpened = incident[4].ToString();
        DateClosed = incident[5].ToString();
        title = incident[6].ToString();

       //
       // TODO: Add constructor logic here
       //
   }
    public String CustomerIncidentDisplay()
    {
        return "Incident for product " + ProductCode + " closed " + DateClosed + "(" + title + ")";

    }
}

CustomerList.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

/// <summary>
/// Summary description for CustomerList
/// </summary>
public class CustomerList
{
    private static List<Customer> customerList;
   public CustomerList()
   {
        customerList = new List<Customer>();
   }

    public int Count(){
        return customerList.Count;
    }
    public Customer this[int index]
    {
        get { return customerList[index]; }
        set { customerList[index] = value; }
    }

    public Customer this[string name]
    {
        get {
            foreach(Customer cust in customerList){
                if (cust.name.Equals(name))
                {
                    return cust;
                }
            };
            return null;
        }
    }

    public static CustomerList GetCustomers()
    {
        CustomerList customerList = (CustomerList)HttpContext.Current.Session["contactsList"];
        if (customerList == null)
            HttpContext.Current.Session["contactsList"] = new CustomerList();
        return (CustomerList)HttpContext.Current.Session["contactsList"];
    }

    public void AddItem(Customer customer)
    {
        customerList.Add(customer);
    }

    public void RemoveAt(int index)
    {
        try
        {
            customerList.RemoveAt(index);
        }
        catch
        {
            return;
        }
    }

    public void Clear()
    {
        customerList = null;
        HttpContext.Current.Session["contactsList"] = null;
    }
}

Survey.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

/// <summary>
/// Summary description for CustomerList
/// </summary>
public class CustomerList
{
    private static List<Customer> customerList;
   public CustomerList()
   {
        customerList = new List<Customer>();
   }

    public int Count(){
        return customerList.Count;
    }
    public Customer this[int index]
    {
        get { return customerList[index]; }
        set { customerList[index] = value; }
    }

    public Customer this[string name]
    {
        get {
            foreach(Customer cust in customerList){
                if (cust.name.Equals(name))
                {
                    return cust;
                }
            };
            return null;
        }
    }

    public static CustomerList GetCustomers()
    {
        CustomerList customerList = (CustomerList)HttpContext.Current.Session["contactsList"];
        if (customerList == null)
            HttpContext.Current.Session["contactsList"] = new CustomerList();
        return (CustomerList)HttpContext.Current.Session["contactsList"];
    }

    public void AddItem(Customer customer)
    {
        customerList.Add(customer);
    }

    public void RemoveAt(int index)
    {
        try
        {
            customerList.RemoveAt(index);
        }
        catch
        {
            return;
        }
    }

    public void Clear()
    {
        customerList = null;
        HttpContext.Current.Session["contactsList"] = null;
    }
}