Line 1: using System;Line 2: using System.Data;Line 3: using System.Data.Sql;Line 4: using System.Data.SqlClient;Line 5: using System.Configuration;Line 6: using System.Web;Line 7: using System.Web.Security;Line 8: using System.Web.UI;Line 9: using System.Web.UI.WebControls;Line 10: using System.Web.UI.WebControls.WebParts;Line 11: using System.Web.UI.HtmlControls;Line 12: Line 13: /// Line 14: /// Summary description for productTracksLine 15: /// Line 16: public class productTracksLine 17: {Line 18: private SqlConnection con;Line 19: public Int32 TrackID = 0;Line 20: public Int32 ProductID = 0;Line 21: public Int32 PersonnelID = 0;Line 22: public Int16 TrackNumber = 0;Line 23: public string TrackName = "";Line 24: public string DiscNumber = "1";Line 25: public string TrackTime = "";Line 26: public string RecordingDate = "";Line 27: public string RecordingLocation = "";Line 28: public string ISRC = "";Line 29: public string DigitalISRC = "";Line 30: public string RealLowSnippetUrl = "";Line 31: public string RealHighSnippetUrl = "";Line 32: public string RealLowFullUrl = "";Line 33: public string RealHighFullUrl = "";Line 34: public string WinLowSnippetUrl = "";Line 35: public string WinHighSnippetUrl = "";Line 36: public string WinLowFullUrl = "";Line 37: public string WinHighFullUrl = "";Line 38: public string QTLowSnippetUrl = "";Line 39: public string QTHighSnippetUrl = "";Line 40: public string QTLowFullUrl = "";Line 41: public string QTHighFullUrl = "";Line 42: public string Mp3LowSnippetUrl = "";Line 43: public string Mp3HighSnippetUrl = "";Line 44: public string Mp3LowFullUrl = "";Line 45: public string Mp3HighFullUrl = "";Line 46: public string RealLowLoudeyeSnippetUrl = "";Line 47: public string RealLoudeyeFullUrl = "";Line 48: public string WinLowLoudeyeSnippetUrl = "";Line 49: public string WinLoudeyeFullUrl = "";Line 50: public Int16 Status = 0;Line 51: public string OnlinePurchaseUrl = "";Line 52: public bool IsParentalAdvisory = false;Line 53: public string Publisher = "";Line 54: public string Copyright = "";Line 55: public string Lyrics = "";Line 56: public Int32 hasLyrics = 0;Line 57: private string selectSQL;Line 58: private string updateSQL;Line 59: private string insertSQL;Line 60: public Exception err;Line 61: Line 62: public productTracks(long trackid)Line 63: {Line 64: con = new SqlConnection(ConfigurationManager.ConnectionStrings["umrg_net_dbConnectionString"].ToString());Line 65: Line 66: this.select(trackid);Line 67: Line 68: //Line 69: // TODO: Add constructor logic hereLine 70: //Line 71: }Line 72: Line 73: private void select()Line 74: {Line 75: //do nothingLine 76: }Line 77: Line 78: private void select(long trackid)Line 79: {Line 80: //select statementLine 81: this.selectSQL = "select t.*, l.Lyrics, l.TrackID as hasLyrics from Tracks t ";Line 82: this.selectSQL += "left outer join Lyrics l on t.TrackID = l.TrackID ";Line 83: this.selectSQL += "where t.TrackID = @intTrackID";Line 84: Line 85: SqlCommand cmdPersonnel = new SqlCommand("select PersonnelID from Personnel where productid=@pid", this.con);Line 86: cmdPersonnel.Parameters.AddWithValue("@pid", this.ProductID);Line 87: Line 88: SqlCommand cmd = new SqlCommand(selectSQL, this.con);Line 89: cmd.Parameters.AddWithValue("@intTrackID", trackid);Line 90: SqlDataReader reader;Line 91: tryLine 92: {Line 93: this.con.Open();Line 94: reader = cmd.ExecuteReader();Line 95: reader.Read();Line 96: Line 97: //fill class member variablesLine 98: this.TrackID = (Int32)reader["TrackID"];Line 99: this.TrackName = reader["TrackName"].ToString();Line 100: this.TrackNumber = (Int16)reader["TrackNumber"];Line 101: this.DiscNumber = reader["DiscNumber"].ToString();Line 102: this.TrackTime = reader["TrackTime"].ToString();Line 103: this.RecordingDate = String.Format("{0:M/d/yyyy}", reader["RecordingDate"]);Line 104: this.RecordingLocation = reader["RecordingLocation"].ToString();Line 105: this.ISRC = reader["ISRC"].ToString();Line 106: this.DigitalISRC = reader["DigitalISRC"].ToString();Line 107: this.RealLowSnippetUrl = reader["RealLowSnippetUrl"].ToString();Line 108: this.RealHighSnippetUrl = reader["RealHighSnippetUrl"].ToString();Line 109: this.RealLowFullUrl = reader["RealLowFullUrl"].ToString();Line 110: this.RealHighFullUrl = reader["RealHighFullUrl"].ToString();Line 111: this.WinLowSnippetUrl = reader["WinLowSnippetUrl"].ToString();Line 112: this.WinHighSnippetUrl = reader["WinHighSnippetUrl"].ToString();Line 113: this.WinLowFullUrl = reader["WinLowFullUrl"].ToString();Line 114: this.WinHighFullUrl = reader["WinHighFullUrl"].ToString();Line 115: this.QTLowSnippetUrl = reader["QTLowSnippetUrl"].ToString();Line 116: this.QTHighSnippetUrl = reader["QTHighSnippetUrl"].ToString();Line 117: this.QTLowFullUrl = reader["QTLowFullUrl"].ToString();Line 118: this.QTHighFullUrl = reader["QTHighFullUrl"].ToString();Line 119: this.Mp3LowSnippetUrl = reader["Mp3LowSnippetUrl"].ToString();Line 120: this.Mp3HighSnippetUrl = reader["Mp3HighSnippetUrl"].ToString();Line 121: this.Mp3LowFullUrl = reader["Mp3LowFullUrl"].ToString();Line 122: this.Mp3HighFullUrl = reader["Mp3HighFullUrl"].ToString();Line 123: this.RealLowLoudeyeSnippetUrl = reader["RealLowLoudeyeSnippetUrl"].ToString();Line 124: this.RealLoudeyeFullUrl = reader["RealLoudeyeFullUrl"].ToString();Line 125: this.WinLowLoudeyeSnippetUrl = reader["WinLowLoudeyeSnippetUrl"].ToString();Line 126: this.WinLoudeyeFullUrl = reader["WinLoudeyeFullUrl"].ToString();Line 127: this.Status = (Int16)reader["Status"];Line 128: this.OnlinePurchaseUrl = reader["OnlinePurchaseUrl"].ToString();Line 129: this.IsParentalAdvisory = (bool)reader["IsParentalAdvisory"];Line 130: this.Publisher = reader["Publisher"].ToString();Line 131: this.Copyright = reader["Copyright"].ToString();Line 132: this.Lyrics = reader["Lyrics"].ToString();Line 133: this.hasLyrics = (Int32)reader["hasLyrics"];Line 134: this.PersonnelID = (Int32)cmdPersonnel.ExecuteScalar();Line 135: Line 136: }Line 137: catch (Exception err)Line 138: {Line 139: //errorLine 140: this.err = err;Line 141: }Line 142: finallyLine 143: {Line 144: this.con.Close();Line 145: }Line 146: Line 147: }Line 148: Line 149: public void close()Line 150: {Line 151: //stuffLine 152: con.Close();Line 153: }Line 154: Line 155: public int save()Line 156: {Line 157: //saveLine 158: if (this.TrackID == 0)Line 159: {Line 160: return insert();Line 161: }Line 162: elseLine 163: {Line 164: return update();Line 165: }Line 166: }Line 167: Line 168: public int update()Line 169: {Line 170: //updateLine 171: this.updateSQL = "spUpdateTrack";Line 172: SqlCommand cmdL;Line 173: Line 174: if (this.hasLyrics > 0)Line 175: {Line 176: cmdL = new SqlCommand("spUpdateTrackLyrics", this.con);Line 177: cmdL.CommandType = CommandType.StoredProcedure;Line 178: cmdL.Parameters.AddWithValue("@intTrackID", this.TrackID);Line 179: cmdL.Parameters.AddWithValue("@strLyrics", this.Lyrics);Line 180: }Line 181: elseLine 182: {Line 183: cmdL = new SqlCommand("spAddTrackLyrics", this.con);Line 184: cmdL.CommandType = CommandType.StoredProcedure;Line 185: cmdL.Parameters.AddWithValue("@intTrackID", this.TrackID);Line 186: cmdL.Parameters.AddWithValue("@strLyrics", this.Lyrics);Line 187: }Line 188: Line 189: SqlCommand cmd = new SqlCommand(this.updateSQL, this.con);Line 190: cmd.CommandType = CommandType.StoredProcedure;Line 191: Line 192: cmd.Parameters.AddWithValue("@intTrackID", this.TrackID);Line 193: cmd.Parameters.AddWithValue("@strTrackName", this.TrackName);Line 194: cmd.Parameters.AddWithValue("@intDiscNumber", this.DiscNumber);Line 195: cmd.Parameters.AddWithValue("@intTrackNumber", this.TrackNumber);Line 196: cmd.Parameters.AddWithValue("@strTrackTime", this.TrackTime);Line 197: cmd.Parameters.AddWithValue("@datRecordingDate", this.RecordingDate);Line 198: cmd.Parameters.AddWithValue("@strRealLowSnippetUrl", this.RealLowSnippetUrl);Line 199: cmd.Parameters.AddWithValue("@strRealHighSnippetUrl", this.RealHighSnippetUrl);Line 200: cmd.Parameters.AddWithValue("@strRealLowFullUrl", this.RealLowFullUrl);Line 201: cmd.Parameters.AddWithValue("@strRealHighFullUrl", this.RealHighFullUrl);Line 202: cmd.Parameters.AddWithValue("@strWinLowSnippetUrl", this.WinLowSnippetUrl);Line 203: cmd.Parameters.AddWithValue("@strWinHighSnippetUrl", this.WinHighSnippetUrl);Line 204: cmd.Parameters.AddWithValue("@strWinLowFullUrl", this.WinLowFullUrl);Line 205: cmd.Parameters.AddWithValue("@strWinHighFullUrl", this.WinHighFullUrl);Line 206: cmd.Parameters.AddWithValue("@strQTLowSnippetUrl", this.QTLowSnippetUrl);Line 207: cmd.Parameters.AddWithValue("@strQTHighSnippetUrl", this.QTHighSnippetUrl);Line 208: cmd.Parameters.AddWithValue("@strQTLowFullUrl", this.QTLowFullUrl);Line 209: cmd.Parameters.AddWithValue("@strQTHighFullUrl", this.QTHighFullUrl);Line 210: cmd.Parameters.AddWithValue("@strMp3LowFullUrl", this.Mp3LowFullUrl);Line 211: cmd.Parameters.AddWithValue("@strMp3HighFullUrl", this.Mp3HighFullUrl);Line 212: cmd.Parameters.AddWithValue("@strMp3LowSnippetUrl", this.Mp3LowSnippetUrl);Line 213: cmd.Parameters.AddWithValue("@strMp3HighSnippetUrl", this.Mp3HighSnippetUrl);Line 214: cmd.Parameters.AddWithValue("@strRealLowLoudeyeSnippetUrl", this.RealLowLoudeyeSnippetUrl);Line 215: cmd.Parameters.AddWithValue("@strRealLoudeyeFullUrl", this.RealLoudeyeFullUrl);Line 216: cmd.Parameters.AddWithValue("@strWinLowLoudeyeSnippetUrl", this.WinLowLoudeyeSnippetUrl);Line 217: cmd.Parameters.AddWithValue("@strWinLoudeyeFullUrl", this.WinLoudeyeFullUrl);Line 218: cmd.Parameters.AddWithValue("@intStatus", this.Status);Line 219: cmd.Parameters.AddWithValue("@strOnlinePurchaseUrl", this.OnlinePurchaseUrl);Line 220: cmd.Parameters.AddWithValue("@bitIsParentalAdvisory", this.IsParentalAdvisory);Line 221: cmd.Parameters.AddWithValue("@strPublisher", this.Publisher);Line 222: cmd.Parameters.AddWithValue("@strCopyright", this.Copyright);Line 223: cmd.Parameters.AddWithValue("@strISRC", this.ISRC);Line 224: cmd.Parameters.AddWithValue("@strDigitalISRC", this.DigitalISRC);Line 225: Line 226: int updated = 0;Line 227: tryLine 228: {Line 229: this.con.Open();Line 230: cmdL.ExecuteNonQuery();Line 231: cmd.ExecuteNonQuery();Line 232: }Line 233: catch (Exception err)Line 234: {Line 235: this.err = err;Line 236: }Line 237: finallyLine 238: {Line 239: this.con.Close();Line 240: }Line 241: Line 242: return this.TrackID;Line 243: }Line 244: Line 245: public int insert()Line 246: {Line 247: //insertLine 248: this.updateSQL = "spAddTrack";Line 249: SqlCommand cmdL = new SqlCommand("spAddTrackLyrics", this.con);Line 250: cmdL.CommandType = CommandType.StoredProcedure;Line 251: Line 252: SqlCommand cmdPersonnel = new SqlCommand("select PersonnelID from Personnel where productid=@pid", this.con);Line 253: cmdPersonnel.Parameters.AddWithValue("@pid", this.ProductID);Line 254: Line 255: SqlCommand cmdPsnlTrack = new SqlCommand("spAddPersonnelTrack", this.con);Line 256: cmdPsnlTrack.CommandType = CommandType.StoredProcedure;Line 257: Line 258: SqlCommand cmd = new SqlCommand(this.updateSQL, this.con);Line 259: cmd.CommandType = CommandType.StoredProcedure;Line 260: Line 261: cmd.Parameters.AddWithValue("@strTrackName", this.TrackName);Line 262: cmd.Parameters.AddWithValue("@intDiscNumber", this.DiscNumber);Line 263: cmd.Parameters.AddWithValue("@intTrackNumber", this.TrackNumber);Line 264: cmd.Parameters.AddWithValue("@strTrackTime", this.TrackTime);Line 265: cmd.Parameters.AddWithValue("@datRecordingDate", this.RecordingDate);Line 266: cmd.Parameters.AddWithValue("@strRealLowSnippetUrl", this.RealLowSnippetUrl);Line 267: cmd.Parameters.AddWithValue("@strRealHighSnippetUrl", this.RealHighSnippetUrl);Line 268: cmd.Parameters.AddWithValue("@strRealLowFullUrl", this.RealLowFullUrl);Line 269: cmd.Parameters.AddWithValue("@strRealHighFullUrl", this.RealHighFullUrl);Line 270: cmd.Parameters.AddWithValue("@strWinLowSnippetUrl", this.WinLowSnippetUrl);Line 271: cmd.Parameters.AddWithValue("@strWinHighSnippetUrl", this.WinHighSnippetUrl);Line 272: cmd.Parameters.AddWithValue("@strWinLowFullUrl", this.WinLowFullUrl);Line 273: cmd.Parameters.AddWithValue("@strWinHighFullUrl", this.WinHighFullUrl);Line 274: cmd.Parameters.AddWithValue("@strQTLowSnippetUrl", this.QTLowSnippetUrl);Line 275: cmd.Parameters.AddWithValue("@strQTHighSnippetUrl", this.QTHighSnippetUrl);Line 276: cmd.Parameters.AddWithValue("@strQTLowFullUrl", this.QTLowFullUrl);Line 277: cmd.Parameters.AddWithValue("@strQTHighFullUrl", this.QTHighFullUrl);Line 278: cmd.Parameters.AddWithValue("@strMp3LowFullUrl", this.Mp3LowFullUrl);Line 279: cmd.Parameters.AddWithValue("@strMp3HighFullUrl", this.Mp3HighFullUrl);Line 280: cmd.Parameters.AddWithValue("@strMp3LowSnippetUrl", this.Mp3LowSnippetUrl);Line 281: cmd.Parameters.AddWithValue("@strMp3HighSnippetUrl", this.Mp3HighSnippetUrl);Line 282: cmd.Parameters.AddWithValue("@strRealLowLoudeyeSnippetUrl", this.RealLowLoudeyeSnippetUrl);Line 283: cmd.Parameters.AddWithValue("@strRealLoudeyeFullUrl", this.RealLoudeyeFullUrl);Line 284: cmd.Parameters.AddWithValue("@strWinLowLoudeyeSnippetUrl", this.WinLowLoudeyeSnippetUrl);Line 285: cmd.Parameters.AddWithValue("@strWinLoudeyeFullUrl", this.WinLoudeyeFullUrl);Line 286: cmd.Parameters.AddWithValue("@intStatus", 2);Line 287: cmd.Parameters.AddWithValue("@strOnlinePurchaseUrl", this.OnlinePurchaseUrl);Line 288: cmd.Parameters.AddWithValue("@bitIsParentalAdvisory", this.IsParentalAdvisory);Line 289: cmd.Parameters.AddWithValue("@strPublisher", this.Publisher);Line 290: cmd.Parameters.AddWithValue("@strCopyright", this.Copyright);Line 291: cmd.Parameters.AddWithValue("@strISRC", this.ISRC);Line 292: cmd.Parameters.AddWithValue("@strDigitalISRC", this.DigitalISRC);Line 293: Line 294: SqlParameter parm = new SqlParameter();Line 295: parm.Direction = ParameterDirection.ReturnValue;Line 296: cmd.Parameters.Add(parm);Line 297: Line 298: int updated = 0;Line 299: tryLine 300: {Line 301: this.con.Open();Line 302: cmd.ExecuteNonQuery();Line 303: this.TrackID = (Int32)parm.Value;Line 304: this.PersonnelID = (Int32)cmdPersonnel.ExecuteScalar();Line 305: Line 306: cmdPsnlTrack.Parameters.AddWithValue("@intPersonnelID", this.PersonnelID);Line 307: cmdPsnlTrack.Parameters.AddWithValue("@intTrackID", this.TrackID);Line 308: cmdPsnlTrack.ExecuteNonQuery();Line 309: Line 310: cmdL.Parameters.AddWithValue("@intTrackID", this.TrackID);Line 311: cmdL.Parameters.AddWithValue("@strLyrics", this.Lyrics);Line 312: cmdL.ExecuteNonQuery();Line 313: }Line 314: catch (Exception err)Line 315: {Line 316: this.err = err;Line 317: }Line 318: finallyLine 319: {Line 320: this.con.Close();Line 321: }Line 322: Line 323: return this.TrackID;Line 324: }Line 325: Line 326: public void delete()Line 327: {Line 328: tryLine 329: {Line 330: this.con.Open();Line 331: Line 332: SqlCommand cmd = new SqlCommand("spDeleteTrack", this.con);Line 333: cmd.CommandType = CommandType.StoredProcedure;Line 334: cmd.Parameters.AddWithValue("@intTrackID", this.TrackID);Line 335: cmd.ExecuteNonQuery();Line 336: Line 337: SqlCommand cmd2 = new SqlCommand("spDeletePersonnelTrack", this.con);Line 338: cmd2.CommandType = CommandType.StoredProcedure;Line 339: cmd2.Parameters.AddWithValue("@intPersonnelID", this.PersonnelID);Line 340: cmd2.Parameters.AddWithValue("@intTrackID", this.TrackID);Line 341: cmd2.ExecuteNonQuery();Line 342: }Line 343: catch (Exception err)Line 344: {Line 345: this.err = err;Line 346: }Line 347: finallyLine 348: {Line 349: this.con.Close();Line 350: }Line 351: Line 352: Line 353: }Line 354: Line 355: }Line 356: |