Created
February 17, 2016 20:03
-
-
Save esmyth01/e8ec604ea389fbe80065 to your computer and use it in GitHub Desktop.
Assignment 5
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 "IVenueService" in both code and config file together. | |
[ServiceContract] | |
public interface IVenueService | |
{ | |
[OperationContract] | |
int RegisterVenue(VenueLite v); | |
[OperationContract] | |
int VenueLogin(string username, string password); | |
} | |
[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; } | |
} |
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 "VenueService" in code, svc and config file together. | |
public class VenueService : IVenueService | |
{ | |
ShowTrackerEntities db = new ShowTrackerEntities(); | |
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; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment