Created
March 23, 2016 19:19
-
-
Save esmyth01/1e8d4ed19fd952b37984 to your computer and use it in GitHub Desktop.
Final Project
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="ArtistAdd.aspx.cs" Inherits="ShowAdd" %> | |
<!DOCTYPE html> | |
<html xmlns="http://www.w3.org/1999/xhtml"> | |
<head runat="server"> | |
<title></title> | |
</head> | |
<body> | |
<form id="form1" runat="server"> | |
<div> | |
<div id="chooseArtist"> <h3>Choose an Artist!</h3> | |
<asp:DropDownList ID="DropDownListArtists" runat="server" AutoPostBack="True" OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged"></asp:DropDownList> | |
<asp:GridView ID="GridViewListArtists" runat="server"></asp:GridView></div> | |
<div id="addArtist"> <h3>Add new artist!</h3></div> | |
<table> | |
<tr> | |
<td> | |
Artist Name | |
</td> | |
<td><asp:TextBox ID="ArtistNameTextBox" runat="server"></asp:TextBox></td> | |
<td><asp:RequiredFieldValidator ID="ArtistNameRequired" runat="server" ErrorMessage="Artist Name Required" ControlToValidate="ArtistNameTextBox"></asp:RequiredFieldValidator></td> | |
</tr> | |
<tr> | |
<td> | |
Artist Email | |
</td> | |
<td><asp:TextBox ID="ArtistEmailTextBox" runat="server"></asp:TextBox></td> | |
<td> | |
<asp:RequiredFieldValidator ID="ArtistEmailRequired" runat="server" ErrorMessage="Artist Email Required" ControlToValidate="ArtistEmailTextBox"></asp:RequiredFieldValidator> | |
<asp:RegularExpressionValidator ID="EmailRequiredExpression" runat="server" ErrorMessage="Not a valid Email" ControlToValidate="ArtistEmailTextBox" ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"></asp:RegularExpressionValidator> | |
</td> | |
</tr> | |
<tr> | |
<td> | |
Artist Webpage | |
</td> | |
<td><asp:TextBox ID="ArtistWebpageTextBox" runat="server"></asp:TextBox></td> | |
<td><asp:RequiredFieldValidator ID="ArtistWebpageRequired" runat="server" ErrorMessage="Artist Webpage Required" ControlToValidate="ArtistWebpageTextBox"></asp:RequiredFieldValidator></td> | |
</tr> | |
<tr> | |
<td> | |
Artist Date Entered | |
</td> | |
<td><asp:TextBox ID="ArtistDateEnteredTextBox" runat="server"></asp:TextBox></td> | |
<td> | |
<asp:RequiredFieldValidator ID="ArtistDateEnteredRequired" runat="server" ErrorMessage="Artist Date Entered Required" ControlToValidate="ArtistDateEnteredTextBox"></asp:RequiredFieldValidator></td> | |
</tr> | |
<tr> | |
<td> | |
<asp:Button ID="ArtistButton" runat="server" Text="Add Artist" OnClick="ArtistButton_Click" /> | |
</td> | |
<td> | |
<asp:Label ID="Label1" runat="server" Text=""></asp:Label> | |
</td> | |
</tr> | |
</table> | |
<asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl="~/ShowAdd.aspx">Add Show</asp:HyperLink> | |
</div> | |
</form> | |
</body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Web; | |
using System.Web.UI; | |
using System.Web.UI.WebControls; | |
public partial class ShowAdd : System.Web.UI.Page | |
{ | |
ServiceReference1.ShowServiceClient db = new ServiceReference1.ShowServiceClient(); | |
protected void Page_Load(object sender, EventArgs e) | |
{ | |
LoadDropDownArtists(); | |
} | |
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e) | |
{ | |
FillGridArtists(); | |
} | |
protected void ArtistButton_Click(object sender, EventArgs e) | |
{ | |
AddNewArtist(); | |
} | |
protected void LoadDropDownArtists() | |
{ | |
string[] artists = db.GetArtists(); | |
DropDownListArtists.DataSource = artists; | |
DropDownListArtists.DataBind(); | |
} | |
protected void FillGridArtists() | |
{ | |
string artist = DropDownListArtists.SelectedItem.Text; | |
ServiceReference1.ShowLite[] artsy = db.ShowDetails(artist); | |
GridViewListArtists.DataSource = artsy; | |
GridViewListArtists.DataBind(); | |
} | |
protected void AddNewArtist() | |
{ | |
ServiceReference1.ShowServiceClient ssc = new ServiceReference1.ShowServiceClient(); | |
ServiceReference1.AddArtistLite aa = new ServiceReference1.AddArtistLite(); | |
aa.ArtistName = ArtistNameTextBox.Text; | |
aa.ArtistWebPage = ArtistWebpageTextBox.Text; | |
aa.ArtistEmail = ArtistEmailTextBox.Text; | |
aa.ArtistDateEntered = ArtistDateEnteredTextBox.Text; | |
bool result = ssc.AddArtist(aa); | |
if (result != true) | |
Label1.Text = "Added New Artist"; | |
else | |
Label1.Text = "Add Artist Failed"; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="FanLogin.aspx.cs" Inherits="FanLogin" %> | |
<!DOCTYPE html> | |
<html xmlns="http://www.w3.org/1999/xhtml"> | |
<head runat="server"> | |
<title></title> | |
</head> | |
<body> | |
<form id="form1" runat="server"> | |
<div> | |
<table> | |
<tr> | |
<td> User Name </td> | |
<td> | |
<asp:TextBox ID="UserNameTextBox" runat="server"></asp:TextBox></td> | |
</tr> | |
<tr> | |
<td> Password </td> | |
<td> | |
<asp:TextBox ID="PasswordTextBox" runat="server"></asp:TextBox></td> | |
</tr> | |
<tr> | |
<td> | |
<asp:Button ID="LoginButton" runat="server" Text="Push Me" OnClick="LoginButton_Click" /> | |
</td> | |
<td> | |
<asp:Label ID="ErrorLabel" runat="server" Text=""></asp:Label> | |
</td> | |
</tr> | |
</table> | |
<asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl="~/FanRegistration.aspx">Register Fan</asp:HyperLink> | |
</div> | |
</form> | |
</body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Web; | |
using System.Web.UI; | |
using System.Web.UI.WebControls; | |
public partial class FanLogin : System.Web.UI.Page | |
{ | |
protected void Page_Load(object sender, EventArgs e) | |
{ | |
} | |
protected void LoginButton_Click(object sender, EventArgs e) | |
{ | |
LoginFan(); | |
} | |
protected void LoginFan() | |
{ | |
ServiceReference1.ShowServiceClient ssc = new ServiceReference1.ShowServiceClient(); | |
int key = ssc.VenueLogin(UserNameTextBox.Text, PasswordTextBox.Text); | |
if (key != -1) | |
{ | |
ErrorLabel.Text = "Welcome"; | |
Session["userkey"] = key; | |
} | |
else | |
{ | |
ErrorLabel.Text = "Login Failed"; | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="FanRegistration.aspx.cs" Inherits="FanRegistration" %> | |
<!DOCTYPE html> | |
<html xmlns="http://www.w3.org/1999/xhtml"> | |
<head runat="server"> | |
<title></title> | |
</head> | |
<body> | |
<form id="form1" runat="server"> | |
<div> | |
<table> | |
<tr> | |
<td> | |
Fan Name | |
</td> | |
<td><asp:TextBox ID="FanNameTextBox" runat="server"></asp:TextBox></td> | |
<td><asp:RequiredFieldValidator ID="FanNameRequired" runat="server" ErrorMessage="Fan Name Required" ControlToValidate="FanNameTextBox"></asp:RequiredFieldValidator></td> | |
</tr> | |
<tr> | |
<td> | |
Fan Email | |
</td> | |
<td><asp:TextBox ID="FanEmailTextBox" runat="server"></asp:TextBox></td> | |
<td> | |
<asp:RequiredFieldValidator ID="FanEmailRequired" runat="server" ErrorMessage="Fan Email Required" ControlToValidate="FanEmailTextBox"></asp:RequiredFieldValidator> | |
<asp:RegularExpressionValidator ID="EmailRequiredExpression" runat="server" ErrorMessage="Not a valid Email" ControlToValidate="FanEmailTextBox" ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"></asp:RegularExpressionValidator> | |
</td> | |
</tr> | |
<tr> | |
<td> | |
Username | |
</td> | |
<td><asp:TextBox ID="FanUsernameTextBox" runat="server"></asp:TextBox></td> | |
<td><asp:RequiredFieldValidator ID="FanUsernameRequired" runat="server" ErrorMessage="Username Required" ControlToValidate="FanUsernameTextBox"></asp:RequiredFieldValidator></td> | |
</tr> | |
<tr> | |
<td> | |
Fan Login Password | |
</td> | |
<td><asp:TextBox ID="FanLoginPasswordPlainTextBox" runat="server" TextMode="Password"></asp:TextBox></td> | |
<td><asp:RequiredFieldValidator ID="FanLoginPasswordPlainRequired" runat="server" ErrorMessage="Password Required" ControlToValidate="FanLoginPasswordPlainTextBox"></asp:RequiredFieldValidator></td> | |
</tr> | |
<tr> | |
<td> | |
<asp:Button ID="SubmitButton" runat="server" Text="Push Me" OnClick="SubmitButton_Click" /> | |
</td> | |
<td> | |
<asp:Label ID="ResultLabel" runat="server" Text="Label"></asp:Label> | |
</td> | |
</tr> | |
</table> | |
<h2>Take a quick survey</h2> | |
<h3>Favorite type of music?</h3> | |
<asp:CheckBoxList ID="CheckBoxList1" runat="server"> | |
<asp:ListItem>Rock</asp:ListItem> | |
<asp:ListItem>Country</asp:ListItem> | |
<asp:ListItem>Jazz</asp:ListItem> | |
<asp:ListItem>Reggae</asp:ListItem> | |
</asp:CheckBoxList> | |
<h3>Choose gender</h3> | |
<asp:RadioButtonList ID="RadioButtonList1" runat="server"> | |
<asp:ListItem>Male</asp:ListItem> | |
<asp:ListItem>Female</asp:ListItem> | |
</asp:RadioButtonList> | |
<asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl="~/FanLogin.aspx">Fan Login</asp:HyperLink> | |
</div> | |
</form> | |
</body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Web; | |
using System.Web.UI; | |
using System.Web.UI.WebControls; | |
public partial class FanRegistration : System.Web.UI.Page | |
{ | |
protected void Page_Load(object sender, EventArgs e) | |
{ | |
} | |
protected void SubmitButton_Click(object sender, EventArgs e) | |
{ | |
RegisterFan(); | |
} | |
protected void RegisterFan() | |
{ | |
ServiceReference1.ShowServiceClient ssc = new ServiceReference1.ShowServiceClient(); | |
ServiceReference1.FanLite flite = new ServiceReference1.FanLite(); | |
flite.FanName = FanNameTextBox.Text; | |
flite.FanEmail = FanEmailTextBox.Text; | |
flite.FanLoginUserName = FanUsernameTextBox.Text; | |
flite.FanLoginPasswordPlain = FanLoginPasswordPlainTextBox.Text; | |
int result = ssc.RegisterFan(flite); | |
if (result != -1) | |
ResultLabel.Text = "Successfully Registered"; | |
else | |
ResultLabel.Text = "Registration Failed"; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Runtime.Serialization; | |
using System.ServiceModel; | |
using System.Text; | |
// NOTE: You can use the "Rename" command on the "Refactor" menu to change the interface name "IShowService" in both code and config file together. | |
[ServiceContract] | |
public interface IShowService | |
{ | |
[OperationContract] | |
int RegisterVenue(VenueLite v); | |
[OperationContract] | |
int FanLogin(string username, string password); | |
[OperationContract] | |
int RegisterFan(FanLite f); | |
[OperationContract] | |
int VenueLogin(string username, string password); | |
[OperationContract] | |
List<string> GetShows(); | |
[OperationContract] | |
List<string> GetArtists(); | |
[OperationContract] | |
List<string> GetVenues(); | |
[OperationContract] | |
List<ShowLite> ShowDetails(string artist); | |
[OperationContract] | |
int AddShow(AddShowLite asl); | |
[OperationContract] | |
bool AddArtist(AddArtistLite aal); | |
[OperationContract] | |
List<ShowLite> VenueDetails(string venue); | |
} | |
[DataContract] | |
public class VenueLite | |
{ | |
[DataMember] | |
public string VenueName { set; get; } | |
[DataMember] | |
public string VenueAddress { set; get; } | |
[DataMember] | |
public string VenueCity { set; get; } | |
[DataMember] | |
public string VenueState { set; get; } | |
[DataMember] | |
public string VenueZipCode { set; get; } | |
[DataMember] | |
public string VenuePhone { set; get; } | |
[DataMember] | |
public string VenueEmail { set; get; } | |
[DataMember] | |
public string VenueWebPage { set; get; } | |
[DataMember] | |
public int VenueAgeRestriction { set; get; } | |
[DataMember] | |
public string VenueLoginUserName { set; get; } | |
[DataMember] | |
public string VenueLoginPasswordPlain { set; get; } | |
} | |
[DataContract] | |
public class ShowLite | |
{ | |
[DataMember] | |
public string ShowName { set; get; } | |
[DataMember] | |
public string ShowTime { set; get; } | |
[DataMember] | |
public string ShowDate { set; get; } | |
[DataMember] | |
public string ShowTicketInfo { set; get; } | |
[DataMember] | |
public string VenueName { set; get; } | |
} | |
[DataContract] | |
public class AddShowLite | |
{ | |
[DataMember] | |
public int ShowDetailKey { set; get; } | |
[DataMember] | |
public int VenueKey { set; get; } | |
[DataMember] | |
public string ArtistName { set; get; } | |
[DataMember] | |
public System.TimeSpan ShowDetailArtistStartTime { set; get; } | |
[DataMember] | |
public string ShowDetailAdditional { set; get; } | |
[DataMember] | |
public int ShowKey { set; get; } | |
[DataMember] | |
public string ShowName { set; get; } | |
[DataMember] | |
public DateTime ShowDate { set; get; } | |
[DataMember] | |
public System.TimeSpan ShowTime { set; get; } | |
[DataMember] | |
public string ShowTicketInfo { set; get; } | |
[DataMember] | |
public string ShowDateEntered { set; get; } | |
} | |
[DataContract] | |
public class AddArtistLite | |
{ | |
[DataMember] | |
public int ArtistKey { set; get; } | |
[DataMember] | |
public string ArtistName { set; get; } | |
[DataMember] | |
public string ArtistEmail { set; get; } | |
[DataMember] | |
public string ArtistWebPage { set; get; } | |
[DataMember] | |
public string ArtistDateEntered { set; get; } | |
} | |
[DataContract] | |
public class FanLite | |
{ | |
[DataMember] | |
public string FanName { set; get; } | |
[DataMember] | |
public string FanEmail { set; get; } | |
[DataMember] | |
public string FanDateEntered { set; get; } | |
[DataMember] | |
public int FanKey { set; get; } | |
[DataMember] | |
public string FanLoginUserName { set; get; } | |
[DataMember] | |
public string FanLoginPasswordPlain { set; get; } | |
} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Login.aspx.cs" Inherits="AddShowForm" %> | |
<!DOCTYPE html> | |
<html xmlns="http://www.w3.org/1999/xhtml"> | |
<head runat="server"> | |
<title></title> | |
</head> | |
<body> | |
<form id="form1" runat="server"> | |
<div> | |
<table> | |
<tr> | |
<td> User Name </td> | |
<td> | |
<asp:TextBox ID="UserNameTextBox" runat="server"></asp:TextBox></td> | |
</tr> | |
<tr> | |
<td> Password </td> | |
<td> | |
<asp:TextBox ID="PasswordTextBox" runat="server"></asp:TextBox></td> | |
</tr> | |
<tr> | |
<td> | |
<asp:Button ID="LoginButton" runat="server" Text="Button" OnClick="LoginButton_Click" /> | |
</td> | |
<td> | |
<asp:Label ID="ErrorLabel" runat="server" Text=""></asp:Label> | |
</td> | |
</tr> | |
</table> | |
<asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl="~/VenueRegistration.aspx">Register</asp:HyperLink> | |
</div> | |
</form> | |
</body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Web; | |
using System.Web.UI; | |
using System.Web.UI.WebControls; | |
public partial class AddShowForm : System.Web.UI.Page | |
{ | |
protected void Page_Load(object sender, EventArgs e) | |
{ | |
} | |
protected void LoginButton_Click(object sender, EventArgs e) | |
{ | |
VenueLogin(); | |
} | |
protected void VenueLogin() | |
{ | |
ServiceReference1.ShowServiceClient ssc = new ServiceReference1.ShowServiceClient(); | |
int key = ssc.VenueLogin(UserNameTextBox.Text, PasswordTextBox.Text); | |
if (key != -1) | |
{ | |
ErrorLabel.Text = "Welcome"; | |
Session["userkey"] = key; | |
Response.Redirect("ArtistAdd.aspx"); | |
} | |
else | |
{ | |
ErrorLabel.Text = "Login Failed"; | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="ShowAdd.aspx.cs" Inherits="ShowAdd" %> | |
<!DOCTYPE html> | |
<html xmlns="http://www.w3.org/1999/xhtml"> | |
<head runat="server"> | |
<title></title> | |
</head> | |
<body> | |
<form id="form1" runat="server"> | |
<div> | |
<table> | |
<tr> | |
<td> | |
Show Name | |
</td> | |
<td><asp:TextBox ID="ShowNameTextBox" runat="server"></asp:TextBox></td> | |
<td><asp:RequiredFieldValidator ID="ShowNameRequired" runat="server" ErrorMessage="Show Name Required" ControlToValidate="ShowNameTextBox"></asp:RequiredFieldValidator></td> | |
</tr> | |
<tr> | |
<td> | |
<asp:DropDownList ID="DropDownListArtists" runat="server" AutoPostBack="True" OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged"></asp:DropDownList></td> | |
</tr> | |
<tr> | |
<td> | |
Artist Start Time | |
</td> | |
<td><asp:TextBox ID="ArtistStartTimeTextBox" runat="server"></asp:TextBox></td> | |
<td><asp:RequiredFieldValidator ID="ArtistStartTimeRequired" runat="server" ErrorMessage="Artist Start Time Required" ControlToValidate="ArtistStartTimeTextBox"></asp:RequiredFieldValidator></td> | |
</tr> | |
<tr> | |
<td> | |
Show Date | |
</td> | |
<td><asp:TextBox ID="ShowDateTextBox" runat="server"></asp:TextBox></td> | |
<td><asp:RequiredFieldValidator ID="ShowDateRequired" runat="server" ErrorMessage="Show Date Required" ControlToValidate="ShowDateTextBox"></asp:RequiredFieldValidator></td> | |
</tr> | |
<tr> | |
<td> | |
Show Ticket Info | |
</td> | |
<td><asp:TextBox ID="ShowTicketInfoTextBox" runat="server"></asp:TextBox></td> | |
<td> | |
<asp:RequiredFieldValidator ID="ShowTicketInfoRequired" runat="server" ErrorMessage="Show Ticket Info Required" ControlToValidate="ShowTicketInfoTextBox"></asp:RequiredFieldValidator></td> | |
</tr> | |
<tr> | |
<td> | |
Show Time | |
</td> | |
<td><asp:TextBox ID="ShowTimeTextBox" runat="server"></asp:TextBox></td> | |
<td><asp:RequiredFieldValidator ID="ShowTimeRequired" runat="server" ErrorMessage="Show Time Required" ControlToValidate="ShowTimeTextBox"></asp:RequiredFieldValidator></td> | |
</tr> | |
<tr> | |
<td> | |
Additional Info | |
</td> | |
<td><asp:TextBox ID="AdditionalInfoTextBox" runat="server"></asp:TextBox></td> | |
<td><asp:RequiredFieldValidator ID="AdditionalInfoRequired" runat="server" ErrorMessage="Additional Info Required" ControlToValidate="AdditionalInfoTextBox"></asp:RequiredFieldValidator></td> | |
</tr> | |
<tr> | |
<td> | |
<asp:Button ID="ShowButton" runat="server" Text="Add Show" OnClick="ShowButton_Click" /> | |
</td> | |
<td> | |
<asp:Label ID="ResultLabel" runat="server" Text=""></asp:Label> | |
</td> | |
</tr> | |
</table> | |
<asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl="~/ArtistAdd.aspx">Add Artist</asp:HyperLink> | |
</div> | |
</form> | |
</body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Web; | |
using System.Web.UI; | |
using System.Web.UI.WebControls; | |
public partial class ShowAdd : System.Web.UI.Page | |
{ | |
ServiceReference1.ShowServiceClient db = new ServiceReference1.ShowServiceClient(); | |
protected void Page_Load(object sender, EventArgs e) | |
{ | |
if (Session["userkey"] == null) | |
Response.Redirect("Login.aspx"); | |
LoadDropDownArtists(); | |
} | |
protected void ShowButton_Click(object sender, EventArgs e) | |
{ | |
AddNewShow(); | |
} | |
protected void LoadDropDownArtists() | |
{ | |
string[] artists = db.GetArtists(); | |
DropDownListArtists.DataSource = artists; | |
DropDownListArtists.DataBind(); | |
} | |
protected void AddNewShow() | |
{ | |
ServiceReference1.ShowServiceClient ssc = new ServiceReference1.ShowServiceClient(); | |
ServiceReference1.AddShowLite asl = new ServiceReference1.AddShowLite(); | |
asl.VenueKey = (int)Session["userkey"]; | |
asl.ArtistName = DropDownListArtists.SelectedItem.ToString(); | |
asl.ShowName = ShowNameTextBox.Text; | |
asl.ShowDate = DateTime.Parse(ShowDateTextBox.Text); | |
asl.ShowDetailArtistStartTime = TimeSpan.Parse(ArtistStartTimeTextBox.Text); | |
asl.ShowTicketInfo = ShowTicketInfoTextBox.Text; | |
asl.ShowTime = TimeSpan.Parse(ShowTimeTextBox.Text); | |
asl.ShowDetailAdditional = AdditionalInfoTextBox.Text; | |
int result = ssc.AddShow(asl); | |
if (result != -1) | |
ResultLabel.Text = "Added New Show"; | |
else | |
ResultLabel.Text = "Add Show Failed"; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Runtime.Serialization; | |
using System.ServiceModel; | |
using System.Text; | |
// NOTE: You can use the "Rename" command on the "Refactor" menu to change the class name "ShowService" in code, svc and config file together. | |
public class ShowService : IShowService | |
{ | |
AddShowEntities db = new AddShowEntities(); | |
public List<ShowLite> ShowDetails(string artist) | |
{ | |
var shws = from s in db.Shows | |
from sd in s.ShowDetails | |
where sd.Artist.ArtistName.Equals(artist) | |
select new { s.ShowName, s.ShowTime, s.ShowDate, s.Venue.VenueName, s.ShowTicketInfo }; | |
List<ShowLite> shows = new List<ShowLite>(); | |
foreach (var s in shws) | |
{ | |
ShowLite slite = new ShowLite(); | |
slite.ShowName = s.ShowName; | |
slite.ShowTime = s.ShowTime.ToString(); | |
slite.ShowDate = s.ShowDate.ToShortDateString(); | |
slite.ShowTicketInfo = s.ShowTicketInfo; | |
slite.VenueName = s.VenueName; | |
shows.Add(slite); | |
} | |
return shows; | |
} | |
public List<string> GetArtists() | |
{ | |
var art = from a in db.Artists | |
orderby a.ArtistName | |
select new { a.ArtistName }; | |
List<string> artitsts = new List<string>(); | |
foreach (var ar in art) | |
{ | |
artitsts.Add(ar.ArtistName.ToString()); | |
} | |
return artitsts; | |
} | |
public List<string> GetShows() | |
{ | |
var shw = from sh in db.Shows | |
orderby sh.ShowName | |
select new { sh.ShowName }; | |
List<string> shows = new List<string>(); | |
foreach (var sh in shw) | |
{ | |
shows.Add(sh.ShowName.ToString()); | |
} | |
return shows; | |
} | |
public List<string> GetVenues() | |
{ | |
var ven = from ve in db.Venues | |
orderby ve.VenueName | |
select new { ve.VenueName }; | |
List<string> venues = new List<string>(); | |
foreach (var ve in ven) | |
{ | |
venues.Add(ve.VenueName.ToString()); | |
} | |
return venues; | |
} | |
public List<ShowLite> VenueDetails(string venue) | |
{ | |
var ven = from v in db.Shows | |
where v.Venue.VenueName.Equals(venue) | |
select new { v.ShowName, v.ShowTime, v.ShowDate, v.ShowTicketInfo, v.Venue.VenueName }; | |
List<ShowLite> shows = new List<ShowLite>(); | |
foreach (var v in ven) | |
{ | |
ShowLite slite = new ShowLite(); | |
slite.ShowName = v.ShowName; | |
slite.ShowTime = v.ShowTime.ToString(); | |
slite.ShowDate = v.ShowDate.ToShortDateString(); | |
slite.ShowTicketInfo = v.ShowTicketInfo; | |
slite.VenueName = v.VenueName; | |
shows.Add(slite); | |
} | |
return shows; | |
} | |
public int VenueLogin(string username, string password) | |
{ | |
int key = 0; | |
int pass = db.usp_venueLogin(username, password); | |
//returns 1 if good -1 if bad | |
//I had trouble getting the stored procedure to | |
//return the userkey so we have to look it up | |
if (pass != -1) | |
{ | |
var ven = from v in db.VenueLogins | |
where v.VenueLoginUserName.Equals(username) | |
select new { v.VenueKey }; | |
foreach (var r in ven) | |
{ | |
key = (int)r.VenueKey; | |
} | |
} | |
return key; | |
} | |
public int RegisterVenue(VenueLite v) | |
{ | |
int result = db.usp_RegisterVenue | |
(v.VenueName, v.VenueAddress, v.VenueCity, v.VenueState, v.VenueZipCode, v.VenuePhone, v.VenueEmail, v.VenueWebPage, v.VenueAgeRestriction, v.VenueLoginUserName, v.VenueLoginPasswordPlain); | |
return result; | |
} | |
public int RegisterFan(FanLite f) | |
{ | |
int result = db.usp_RegisterFan | |
(f.FanName, f.FanEmail, f.FanLoginUserName, f.FanLoginPasswordPlain); | |
return result; | |
} | |
public int FanLogin(string username, string password) | |
{ | |
int key = 0; | |
int pass = db.usp_FanLogin(username, password); | |
//returns 1 if good -1 if bad | |
//I had trouble getting the stored procedure to | |
//return the userkey so we have to look it up | |
if (pass != -1) | |
{ | |
var fa = from f in db.FanLogins | |
where f.FanLoginUserName.Equals(username) | |
select new { f.FanKey }; | |
foreach (var r in fa) | |
{ | |
key = (int)r.FanKey; | |
} | |
} | |
return key; | |
} | |
public bool AddArtist(AddArtistLite aal) | |
{ | |
bool result = true; | |
try | |
{ | |
Artist art = new Artist(); | |
art.ArtistName = aal.ArtistName; | |
art.ArtistEmail = aal.ArtistEmail; | |
art.ArtistWebPage = aal.ArtistWebPage; | |
art.ArtistDateEntered = DateTime.Now; | |
db.Artists.Add(art); | |
db.SaveChanges(); | |
} | |
catch(Exception ex) | |
{ | |
result = false; | |
} | |
return result; | |
} | |
public int AddShow(AddShowLite asl) | |
{ | |
ShowDetail sd = new ShowDetail(); | |
Show s = new Show(); | |
int key = 0; | |
var aKey = (from a in db.Artists | |
where a.ArtistName == asl.ArtistName | |
select new { a.ArtistKey }); | |
foreach(var a in aKey) | |
{ | |
key = (int)a.ArtistKey; | |
} | |
s.ShowName = asl.ShowName; | |
s.ShowDate = asl.ShowDate; | |
s.ShowTime = asl.ShowTime; | |
s.ShowTicketInfo = asl.ShowTicketInfo; | |
s.ShowDateEntered = DateTime.Now; | |
s.VenueKey = asl.VenueKey; | |
sd.ArtistKey = key; | |
sd.Show = s; | |
sd.ShowDetailArtistStartTime = s.ShowTime; | |
if (db.Shows != null) | |
{ | |
foreach (var a in db.Shows) | |
{ | |
Show show = db.Shows.FirstOrDefault(x => x.ShowName == a.ShowName); | |
db.Shows.Add(show); | |
} | |
} | |
db.ShowDetails.Add(sd); | |
db.Shows.Add(s); | |
db.SaveChanges(); | |
return 1; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="VenueRegistration.aspx.cs" Inherits="VenueRegistration" %> | |
<!DOCTYPE html> | |
<html xmlns="http://www.w3.org/1999/xhtml"> | |
<head runat="server"> | |
<title></title> | |
</head> | |
<body> | |
<form id="form1" runat="server"> | |
<div> | |
<asp:GridView ID="GridViewArtists" runat="server"></asp:GridView> | |
<asp:GridView ID="GridViewShows" runat="server"></asp:GridView> | |
<asp:GridView ID="GridViewVenues" runat="server"></asp:GridView> | |
<div id="chooseArtist"> <h3>Choose an Artist!</h3> | |
<asp:DropDownList ID="DropDownListArtists" runat="server" AutoPostBack="True" OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged"></asp:DropDownList> | |
<asp:GridView ID="GridViewListArtists" runat="server"></asp:GridView></div> | |
<div id="chooseVenue"><h3>Choose a Venue!</h3> | |
<asp:DropDownList ID="DropDownListVenues" runat="server" AutoPostBack="True" OnSelectedIndexChanged="DropDownList2_SelectedIndexChanged"></asp:DropDownList> | |
<asp:GridView ID="GridViewListVenues" runat="server"></asp:GridView></div> | |
<table> | |
<tr> | |
<td> | |
Venue Name | |
</td> | |
<td><asp:TextBox ID="VenueNameTextBox" runat="server"></asp:TextBox></td> | |
<td><asp:RequiredFieldValidator ID="VenueNameRequired" runat="server" ErrorMessage="Venue Name Required" ControlToValidate="VenueNameTextBox"></asp:RequiredFieldValidator></td> | |
</tr> | |
<tr> | |
<td> | |
Venue Address | |
</td> | |
<td><asp:TextBox ID="VenueAddressTextBox" runat="server"></asp:TextBox></td> | |
<td> | |
<asp:RequiredFieldValidator ID="VenueAddressRequired" runat="server" ErrorMessage="Venue Address Required" ControlToValidate="VenueAddressTextBox"></asp:RequiredFieldValidator></td> | |
</tr> | |
<tr> | |
<td> | |
Venue Email | |
</td> | |
<td><asp:TextBox ID="VenueEmailTextBox" runat="server"></asp:TextBox></td> | |
<td> | |
<asp:RequiredFieldValidator ID="VenueEmailRequired" runat="server" ErrorMessage="Venue Email Required" ControlToValidate="VenueEmailTextBox"></asp:RequiredFieldValidator> | |
<asp:RegularExpressionValidator ID="EmailRequiredExpression" runat="server" ErrorMessage="Not a valid Email" ControlToValidate="VenueEmailTextBox" ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"></asp:RegularExpressionValidator> | |
</td> | |
</tr> | |
<tr> | |
<td> | |
Venue City | |
</td> | |
<td><asp:TextBox ID="VenueCityTextBox" runat="server"></asp:TextBox></td> | |
<td><asp:RequiredFieldValidator ID="VenueCityRequired" runat="server" ErrorMessage="Venue City Required" ControlToValidate="VenueCityTextBox"></asp:RequiredFieldValidator></td> | |
</tr> | |
<tr> | |
<td> | |
Venue State | |
</td> | |
<td><asp:TextBox ID="VenueStateTextBox" runat="server"></asp:TextBox></td> | |
<td> | |
<asp:RequiredFieldValidator ID="VenueStateRequired" runat="server" ErrorMessage="Venue State Required" ControlToValidate="VenueStateTextBox"></asp:RequiredFieldValidator></td> | |
</tr> | |
<tr> | |
<td> | |
Venue Zipcode | |
</td> | |
<td><asp:TextBox ID="VenueZipcodeTextBox" runat="server"></asp:TextBox></td> | |
<td><asp:RequiredFieldValidator ID="VenueZipcodeRequired" runat="server" ErrorMessage="Venue Zipcode Required" ControlToValidate="VenueZipcodeTextBox"></asp:RequiredFieldValidator></td> | |
</tr> | |
<tr> | |
<td> | |
Venue Phone | |
</td> | |
<td><asp:TextBox ID="VenuePhoneTextBox" runat="server"></asp:TextBox></td> | |
<td> | |
<asp:RequiredFieldValidator ID="VenuePhoneRequired" runat="server" ErrorMessage="Venue Phone Required" ControlToValidate="VenuePhoneTextBox"></asp:RequiredFieldValidator></td> | |
</tr> | |
<tr> | |
<td> | |
Venue Webpage | |
</td> | |
<td><asp:TextBox ID="VenueWebpageTextBox" runat="server"></asp:TextBox></td> | |
<td><asp:RequiredFieldValidator ID="VenueWebpageRequired" runat="server" ErrorMessage="Venue Webpage Required" ControlToValidate="VenueWebpageTextBox"></asp:RequiredFieldValidator></td> | |
</tr> | |
<tr> | |
<td> | |
Venue Age Restriction | |
</td> | |
<td><asp:TextBox ID="VenueAgeRestricitonTextBox" runat="server"></asp:TextBox></td> | |
<td><asp:RequiredFieldValidator ID="VenueAgeRestrictionRequired" runat="server" ErrorMessage="Venue Age Restriction Required" ControlToValidate="VenueWebpageTextBox"></asp:RequiredFieldValidator></td> | |
</tr> | |
<tr> | |
<td> | |
Venue Login Username | |
</td> | |
<td><asp:TextBox ID="VenueLoginUsernameTextBox" runat="server"></asp:TextBox></td> | |
<td><asp:RequiredFieldValidator ID="VenueLoginUsernameRequired" runat="server" ErrorMessage="Venue Login Username Required" ControlToValidate="VenueLoginUsernameTextBox"></asp:RequiredFieldValidator></td> | |
</tr> | |
<tr> | |
<td> | |
Venue Login Password | |
</td> | |
<td><asp:TextBox ID="VenueLoginPasswordPlainTextBox" runat="server" TextMode="Password"></asp:TextBox></td> | |
<td><asp:RequiredFieldValidator ID="VenueLoginPasswordPlainRequired" runat="server" ErrorMessage="Password Required" ControlToValidate="VenueLoginPasswordPlainTextBox"></asp:RequiredFieldValidator></td> | |
</tr> | |
<tr> | |
<td> | |
Confirm Venue Login Password | |
</td> | |
<td><asp:TextBox ID="ConfirmVenueLoginPasswordTextBox" runat="server" TextMode="Password"></asp:TextBox></td> | |
<td> <asp:CompareValidator ID="ConfirmCompare" runat="server" ErrorMessage="Passwords don't match" ControlToCompare="VenueLoginPasswordPlainTextBox" ControlToValidate="ConfirmVenueLoginPasswordTextBox"></asp:CompareValidator></td> | |
</tr> | |
<tr> | |
<td> | |
<asp:Button ID="SubmitButton" runat="server" Text="Button" OnClick="SubmitButton_Click" /> | |
</td> | |
<td> | |
<asp:Label ID="ResultLabel" runat="server" Text="Label"></asp:Label> | |
</td> | |
</tr> | |
</table> | |
<asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl="~/FanRegistration.aspx">Fan Registration</asp:HyperLink> | |
</div> | |
</form> | |
</body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Web; | |
using System.Web.UI; | |
using System.Web.UI.WebControls; | |
public partial class VenueRegistration : System.Web.UI.Page | |
{ | |
ServiceReference1.ShowServiceClient ssc = new ServiceReference1.ShowServiceClient(); | |
protected void Page_Load(object sender, EventArgs e) | |
{ | |
if (!IsPostBack) | |
{ | |
LoadDropDownVenues(); | |
LoadDropDownArtists(); | |
ArtistsGrid(); | |
ShowGrid(); | |
VenueGrid(); | |
} | |
} | |
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e) | |
{ | |
FillGridArtists(); | |
} | |
protected void DropDownList2_SelectedIndexChanged(object sender, EventArgs e) | |
{ | |
FillGridVenues(); | |
} | |
protected void ArtistsGrid() | |
{ | |
string[] artists = ssc.GetArtists(); | |
GridViewArtists.DataSource = artists; | |
GridViewArtists.DataBind(); | |
} | |
protected void ShowGrid() | |
{ | |
string[] shows = ssc.GetShows(); | |
GridViewShows.DataSource = shows; | |
GridViewShows.DataBind(); | |
} | |
protected void VenueGrid() | |
{ | |
string[] venues = ssc.GetVenues(); | |
GridViewVenues.DataSource = venues; | |
GridViewVenues.DataBind(); | |
} | |
protected void LoadDropDownArtists() | |
{ | |
string[] artists = ssc.GetArtists(); | |
DropDownListArtists.DataSource = artists; | |
DropDownListArtists.DataBind(); | |
} | |
protected void FillGridArtists() | |
{ | |
string artist = DropDownListArtists.SelectedItem.Text; | |
ServiceReference1.ShowLite[] artsy = ssc.ShowDetails(artist); | |
GridViewListArtists.DataSource = artsy; | |
GridViewListArtists.DataBind(); | |
} | |
protected void LoadDropDownVenues() | |
{ | |
string[] venues = ssc.GetVenues(); | |
DropDownListVenues.DataSource = venues; | |
DropDownListVenues.DataBind(); | |
} | |
protected void FillGridVenues() | |
{ | |
string venue = DropDownListVenues.SelectedItem.Text; | |
ServiceReference1.ShowLite[] ven = ssc.VenueDetails(venue); | |
GridViewListVenues.DataSource = ven; | |
GridViewListVenues.DataBind(); | |
} | |
protected void SubmitButton_Click(object sender, EventArgs e) | |
{ | |
SubmitVenue(); | |
} | |
protected void SubmitVenue() | |
{ | |
ServiceReference1.ShowServiceClient ssc = new ServiceReference1.ShowServiceClient(); | |
ServiceReference1.VenueLite vlite = new ServiceReference1.VenueLite(); | |
vlite.VenueName = VenueNameTextBox.Text; | |
vlite.VenueAddress = VenueAddressTextBox.Text; | |
vlite.VenueCity = VenueCityTextBox.Text; | |
vlite.VenueEmail = VenueEmailTextBox.Text; | |
vlite.VenueState = VenueStateTextBox.Text; | |
vlite.VenuePhone = VenuePhoneTextBox.Text; | |
vlite.VenueZipCode = VenueZipcodeTextBox.Text; | |
vlite.VenueWebPage = VenueWebpageTextBox.Text; | |
vlite.VenueAgeRestriction = int.Parse(VenueAgeRestricitonTextBox.Text); | |
vlite.VenueLoginUserName = VenueLoginUsernameTextBox.Text; | |
vlite.VenueLoginPasswordPlain = VenueLoginPasswordPlainTextBox.Text; | |
int result = ssc.RegisterVenue(vlite); | |
if (result != -1) | |
ResultLabel.Text = "Successfully Registered"; | |
else | |
ResultLabel.Text = "Registration Failed"; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment