protected void btnSearch_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(txtArtist.Text) && string.IsNullOrEmpty(txtTitle.Text)) { pnlError.Visible = true; lblError.Text = "Please Enter Artist and Title"; } else if (string.IsNullOrEmpty(txtArtist.Text)) { pnlError.Visible = true; lblError.Text = "Please Enter Artist"; } else if (string.IsNullOrEmpty(txtTitle.Text)) { pnlError.Visible = true; lblError.Text = "Please Enter Title"; } else { pnlError.Visible = false; clsSongsFactory fac = new clsSongsFactory(); List <clsSongs> Songs = fac.GetAllByArtistsTitle(txtArtist.Text, txtTitle.Text); rpt.DataSource = Songs; rpt.DataBind(); pnlSearch.Visible = true; } pnlComapny.Visible = false; pnlAddLabel.Visible = false; }
protected void grd_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "_detail") { Session["Songs"] = null; Response.Redirect("songdetail.aspx?id=" + e.CommandArgument); } else if (e.CommandName == "_Edit") { Response.Redirect("EditSong.aspx?id=" + e.CommandArgument); } else if (e.CommandName == "_delete") { clsSongsFactory fac = new clsSongsFactory(); clsSongsKeys key = new clsSongsKeys(Convert.ToInt32(e.CommandArgument)); List<clsSongs> Songs = fac.GetAllBy(clsSongs.clsSongsFields.ParentSongId, e.CommandArgument); if (Songs != null && Songs.Count > 1) { pnlError.Visible = true; pnlSuccess.Visible = false; lblError.Text = "Can't delete this Song"; } else { fac.Delete(key); LoadData(); pnlSuccess.Visible = true; pnlError.Visible = false; lblSuccess.Text = "Song deleted successfully"; } } }
//Bind your Grid View here private void BindTaskList() { clsSongsFactory fac = new clsSongsFactory(); DataSet Songs = fac.GetAll(Convert.ToInt32(ViewState["PageNumber"]), 100, ViewState["SortColumn"].ToString(), null); DataTable myDataTable = Songs.Tables[0]; //Set your DataTable here ViewState["Count"] = Songs.Tables[1]; grd.DataSource = myDataTable; grd.DataBind(); }
public string[] GetTvShows(string prefixText, int count) { List <string> ajaxDataCollection = new List <string>(); clsSongsFactory fac = new clsSongsFactory(); List <clsSongs> songs = fac.GetAllTvShows(prefixText); foreach (clsSongs s in songs) { ajaxDataCollection.Add(s.TVSHOW); } return(ajaxDataCollection.ToArray()); }
public static List <clsArtist> GetLabelList(string artist, string title, string etichetta) { List <clsArtist> ArtistList = new List <clsArtist>(); clsSongsFactory fac = new clsSongsFactory(); var Songs = fac.GetAllByArtistsTitle(artist, title).Take(15); foreach (var item in Songs) { clsArtist ObjclsArtist = new clsArtist(); ObjclsArtist.SongID = item.IdSong; ObjclsArtist.ArtistName = item.ARTIST; ObjclsArtist.TitleName = item.TITLE; ObjclsArtist.lableName = item.LABEL; ArtistList.Add(ObjclsArtist); } return(ArtistList); }
public string[] GetLanguage(string prefixText, int count) { List <string> ajaxDataCollection = new List <string>(); clsSongsFactory fac = new clsSongsFactory(); List <clsSongs> songs = fac.GetAllTitle(prefixText); foreach (clsSongs s in songs) { ajaxDataCollection.Add(s.LANGUAGE); } if (ajaxDataCollection.Count > 0) { ajaxDataCollection = ajaxDataCollection.Distinct().ToList(); } return(ajaxDataCollection.ToArray()); }
protected void btnSearch_Click(object sender, EventArgs e) { string Keyword = txtSearch.Text; if (!string.IsNullOrEmpty(Keyword)) { clsSongsFactory fac = new clsSongsFactory(); DataSet Songs = fac.GetAll(Convert.ToInt32(ViewState["PageNumber"]), 100000, ViewState["SortColumn"].ToString(), Keyword); DataTable myDataTable = Songs.Tables[0]; //Set your DataTable here ViewState["Count"] = Songs.Tables[1]; grd.DataSource = myDataTable; grd.DataBind(); } else { BindTaskList(); } }
protected void btnSave_Click(object sender, EventArgs e) { bool error = false; if (Session["eSongs"] != null) { string previd = hfprevid.Value; List <clsSongs> Songs1 = (List <clsSongs>)Session["eSongs"]; for (int i = 0; i < Songs1.Count; i++) { if (Songs1[i].IdSong.ToString() == previd) { Songs1[i].VERSION = lblVersion.Text; string[] d = lblRadio.Text.Split('/'); DateTime date = new DateTime(Convert.ToInt16(d[2]), Convert.ToInt16(d[1]), Convert.ToInt16(d[0])); Songs1[i].RadioDate = date; //Songs1[i].GENRE = lblGenre.Text; Songs1[i].GENRE = ddlGenre.SelectedValue == "0" ? "Pop" : ddlGenre.SelectedValue == "1" ? "Rock" : ddlGenre.SelectedValue == "2" ? "Dance" : ddlGenre.SelectedValue == "3" ? "Hip Hop / Rap" : "Pop";// txtGenre.Text;; //Songs1[i].LANGUAGE = lblLanguage.Text; Songs1[i].LANGUAGE = ddlLanguage.SelectedValue == "1" ? "ita" : ddlLanguage.SelectedValue == "0" ? "int" : "int"; Songs1[i].TVSHOW = lblTvShow.Text; Songs1[i].IncludeInNewTalent = chkAbsoluteBegin.Checked; Songs1[i].AlternativeChart = chkAlternativeCharts.Checked; Songs1[i].IncludeInFirstPlay = chkFirstPlay.Checked; Songs1[i].ARTIST = lblArtist.Text; Songs1[i].TITLE = lblTitle.Text; Songs1[i].CompanyId = Convert.ToInt32(ddlCompany.SelectedValue); Songs1[i].LabelId = Convert.ToInt32(ddlLabel.SelectedValue); Songs1[i].PromotionId = Convert.ToInt32(ddlPromoter.SelectedValue); Songs1[i].LABEL = ddlLabel.SelectedItem.Text; Songs1[i].Author = lblAuthor.Text; Songs1[i].Publisher = lblPublisher.Text; Songs1[i].Duration = txtDuration.Text; Songs1[i].ISRC = txtISRC.Text; } else { Songs1[i].CompanyId = Convert.ToInt32(ddlCompany.SelectedValue); Songs1[i].LabelId = Convert.ToInt32(ddlLabel.SelectedValue); Songs1[i].PromotionId = Convert.ToInt32(ddlPromoter.SelectedValue); Songs1[i].LABEL = ddlLabel.SelectedItem.Text; Songs1[i].AlternativeChart = chkAlternativeCharts.Checked; } } Session["eSongs"] = Songs1; List <clsSongs> Songs = (List <clsSongs>)Session["eSongs"]; if (Songs.Count > 0) { foreach (clsSongs s in Songs) { if (string.IsNullOrEmpty(s.VERSION) || string.IsNullOrEmpty(s.LANGUAGE) || string.IsNullOrEmpty(s.GENRE) || string.IsNullOrEmpty(s.RadioDate.ToString()) || string.IsNullOrEmpty(s.ARTIST) || string.IsNullOrEmpty(s.TITLE)) { error = true; break; } } if (!error) { foreach (clsSongs s in Songs) { clsSongsFactory fac = new clsSongsFactory(); fac.Update(s); } Session["eSongs"] = null; Response.Redirect("Songs.aspx"); } else { pnlError.Visible = true; lblError.Text = "Please provide all data."; } } else { pnlError.Visible = true; lblError.Text = "Some error ocurred please go back anf try again"; } } else { pnlError.Visible = true; lblError.Text = "Some error ocurred please go back anf try again"; } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Session["User"] != null) { Session["Songs"] = null; HtmlGenericControl ManageSongs = (HtmlGenericControl)Master.FindControl("ManageSongs"); ManageSongs.Attributes.Add("class", "select"); HtmlGenericControl ManageCompany = (HtmlGenericControl)Master.FindControl("ManageCompany"); ManageCompany.Attributes.Add("class", "select"); HtmlGenericControl ManageLabel = (HtmlGenericControl)Master.FindControl("ManageLabel"); ManageLabel.Attributes.Add("class", "select"); HtmlGenericControl ManageEmergenti = (HtmlGenericControl)Master.FindControl("ManageEmergenti"); ManageEmergenti.Attributes.Add("class", "select"); HtmlGenericControl ImportData = (HtmlGenericControl)Master.FindControl("ImportData"); ImportData.Attributes.Add("class", "select"); HtmlGenericControl audienceFigures = (HtmlGenericControl)Master.FindControl("audienceFigures"); audienceFigures.Attributes.Add("class", "select"); HtmlGenericControl digitalData = (HtmlGenericControl)Master.FindControl("digitalData"); digitalData.Attributes.Add("class", "select"); HtmlGenericControl MoveFiles = (HtmlGenericControl)Master.FindControl("MoveFiles"); MoveFiles.Attributes.Add("class", "select"); HtmlGenericControl Promoter = (HtmlGenericControl)Master.FindControl("Promoter"); Promoter.Attributes.Add("class", "select"); if (Request.QueryString != null && Request.QueryString["id"] != null) { hf.Value = Request.QueryString["id"]; hfprevid.Value = Request.QueryString["id"]; clsSongsFactory fac = new clsSongsFactory(); List <clsSongs> Songs = fac.GetAllByVersions(Convert.ToInt32(hf.Value)); LoadData(); if (Songs != null && Songs.Count > 0 && Session["eSongs"] == null) { grd.DataSource = Songs; grd.DataBind(); Session["eSongs"] = Songs; clsSongs Song = Songs.First(x => x.IdSong == Convert.ToInt32(hf.Value)); lblVersion.Text = Song.VERSION; chkAbsoluteBegin.Checked = Song.IncludeInNewTalent; chkAlternativeCharts.Checked = Song.AlternativeChart; chkFirstPlay.Checked = Song.IncludeInFirstPlay; //lblGenre.Text = Song.GENRE; ddlGenre.SelectedValue = Song.GENRE == "Pop" ? "0" : Song.GENRE == "Rock" ? "1" : Song.GENRE == "Dance" ? "2" : Song.GENRE == "Hip Hop / Rap" ? "3" : "0"; //lblLanguage.Text = Song.LANGUAGE; ddlLanguage.SelectedValue = Song.LANGUAGE == "ita" ? "1" : Song.LANGUAGE == "int" ? "0" : "0"; lblRadio.Text = Song.RadioDate.Value.ToString("dd/MM/yyyy"); lblTvShow.Text = Song.TVSHOW; lblArtist.Text = Song.ARTIST; lblTitle.Text = Song.TITLE; ddlLabel.SelectedValue = Songs[0].LabelId.ToString(); ddlPromoter.SelectedValue = Songs[0].PromotionId.ToString(); //clsCompaniesFactory facC = new clsCompaniesFactory(); //clsCompaniesKeys k = new clsCompaniesKeys(Songs[0].CompanyId.Value); //clsCompanies c = facC.GetByPrimaryKey(k); ddlCompany.SelectedValue = Song.CompanyId.ToString(); lblAuthor.Text = Song.Author; lblPublisher.Text = Song.Publisher; txtDuration.Text = Song.Duration; txtISRC.Text = Song.ISRC; } else { Songs = (List <clsSongs>)Session["eSongs"]; grd.DataSource = Songs; grd.DataBind(); clsSongs Song = Songs.Where(x => x.IdSong == Convert.ToInt32(hf.Value)).FirstOrDefault(); lblVersion.Text = Song.VERSION; chkAbsoluteBegin.Checked = Song.IncludeInNewTalent; chkAlternativeCharts.Checked = Song.AlternativeChart; chkFirstPlay.Checked = Song.IncludeInFirstPlay; //lblGenre.Text = Song.GENRE; Song.GENRE = ddlGenre.SelectedValue == "0" ? "Pop" : ddlGenre.SelectedValue == "1" ? "Rock" : ddlGenre.SelectedValue == "2" ? "Dance" : ddlGenre.SelectedValue == "3" ? "Hip Hop / Rap" : "Pop"; // txtGenre.Text; //lblLanguage.Text = Song.LANGUAGE; Song.LANGUAGE = ddlLanguage.SelectedValue == "1" ? "ita" : ddlLanguage.SelectedValue == "0" ? "int" : "int"; // txtLanguage.Text; lblRadio.Text = Song.RadioDate.Value.ToString("dd/MM/yyyy"); lblTvShow.Text = Song.TVSHOW; lblArtist.Text = Song.ARTIST; lblTitle.Text = Song.TITLE; ddlLabel.SelectedValue = Songs[0].LabelId.ToString(); ddlPromoter.SelectedValue = Songs[0].PromotionId.ToString(); //clsCompaniesFactory facC = new clsCompaniesFactory(); //clsCompaniesKeys k = new clsCompaniesKeys(Song.CompanyId.Value); //clsCompanies c = facC.GetByPrimaryKey(k); ddlCompany.SelectedValue = Songs[0].CompanyId.ToString(); lblAuthor.Text = Song.Author; lblPublisher.Text = Song.Publisher; txtDuration.Text = Song.Duration; txtISRC.Text = Song.ISRC; } } } else { Response.Redirect("Login.aspx"); } } }
protected void btn_Click(object sender, EventArgs e) { CultureInfo cinfo = new CultureInfo("it-IT"); clsSongsFactory fac = new clsSongsFactory(); clsSongs Song = new clsSongs(); if (!String.IsNullOrEmpty(hfname.Value)) { if (IsEnglish(hfname.Value)) { if (filename.HasFile) { string FileName = Path.GetFileName(filename.PostedFile.FileName); string Extension = Path.GetExtension(filename.PostedFile.FileName); if (Extension == ".xls" || Extension == ".xlsx") { try { string FolderPath = Server.MapPath("~/ImportFiles"); if (!Directory.Exists(FolderPath)) { Directory.CreateDirectory(FolderPath); } Guid abc = Guid.NewGuid(); string FilePath = FolderPath + "/" + abc.ToString(); if (System.IO.File.Exists(FilePath)) { System.IO.File.Delete(FilePath); } filename.SaveAs(FilePath); string excelConnectionString = string.Empty; excelConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + FilePath + ";Extended Properties=\"Excel 12.0;HDR=" + "No" + ";IMEX=2\""; OleDbConnection excelConnection = new OleDbConnection(excelConnectionString); if (Extension == ".xls") { excelConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + FilePath + ";Extended Properties=\"Excel 8.0;HDR=" + "No" + ";IMEX=2\""; } else if (Extension == ".xlsx") { excelConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + FilePath + ";Extended Properties=\"Excel 12.0;HDR=" + "No" + ";IMEX=2\""; } excelConnection = new OleDbConnection(excelConnectionString); if (excelConnection.State == ConnectionState.Closed) { excelConnection.Open(); } DataSet ds = new DataSet(); DataTable dt = new DataTable(); ds = getExcelRecords(excelConnectionString, excelConnection); int totalcolumns = ds.Tables[0].Columns.Count; if (totalcolumns > 0) { dt = ds.Tables[0]; foreach (DataRow dr in dt.Rows) { try { Song.GENRE = string.IsNullOrEmpty(dr[0].ToString()) ? null : dr[0].ToString(); Song.LANGUAGE = string.IsNullOrEmpty(dr[1].ToString()) ? null : dr[1].ToString(); if (!string.IsNullOrEmpty(Song.GENRE) && !string.IsNullOrEmpty(Song.LANGUAGE)) { Song.TVSHOW = string.IsNullOrEmpty(dr[2].ToString()) ? null : dr[2].ToString(); Song.ARTIST = string.IsNullOrEmpty(dr[3].ToString()) ? null : dr[3].ToString(); Song.TITLE = string.IsNullOrEmpty(dr[4].ToString()) ? null : dr[4].ToString(); Song.VERSION = string.IsNullOrEmpty(dr[5].ToString()) ? null : dr[5].ToString(); Song.LABEL = string.IsNullOrEmpty(dr[6].ToString()) ? null : dr[6].ToString(); Song.FILENAME = string.IsNullOrEmpty(dr[7].ToString()) ? null : dr[7].ToString(); Song.Spotify = string.IsNullOrEmpty(dr[8].ToString()) ? null : dr[8].ToString(); Song.CompanyId = Convert.ToInt32(dr[9].ToString()); Song.LabelId = Convert.ToInt32(dr[10].ToString()); Song.RadioDate = Convert.ToDateTime(dr[11].ToString()); Song.IncludeInFirstPlay = dr[12].ToString() == "0" ? false : true; Song.IncludeInNewTalent = dr[13].ToString() == "0" ? false : true; Song.PromotionId = null; Song.SingRing = null; Song.FirstPlayDate = null; Song.ParentSongId = null; Song.Lyric = null; int IdSong = fac.Insert(Song); } } catch (Exception ex) { } } Response.Redirect("Songs.aspx"); } } catch (Exception ex) { pnlError.Visible = true; lblError.Text = ex.Message.ToString();// "Error occured! Please try again later."; } } else { pnlError.Visible = true; lblError.Text = "Upload only excel files."; } } } else { pnlError.Visible = true; lblError.Text = "File name contains illegal characters"; } } else { pnlError.Visible = true; lblError.Text = "Please select a file first"; } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Session["User"] != null) { Session["eSongs"] = null; HtmlGenericControl ManageSongs = (HtmlGenericControl)Master.FindControl("ManageSongs"); ManageSongs.Attributes.Add("class", "current"); HtmlGenericControl ManageCompany = (HtmlGenericControl)Master.FindControl("ManageCompany"); ManageCompany.Attributes.Add("class", "select"); HtmlGenericControl ManageLabel = (HtmlGenericControl)Master.FindControl("ManageLabel"); ManageLabel.Attributes.Add("class", "select"); HtmlGenericControl ManageEmergenti = (HtmlGenericControl)Master.FindControl("ManageEmergenti"); ManageEmergenti.Attributes.Add("class", "select"); HtmlGenericControl ImportData = (HtmlGenericControl)Master.FindControl("ImportData"); ImportData.Attributes.Add("class", "select"); HtmlGenericControl audienceFigures = (HtmlGenericControl)Master.FindControl("audienceFigures"); audienceFigures.Attributes.Add("class", "select"); HtmlGenericControl digitalData = (HtmlGenericControl)Master.FindControl("digitalData"); digitalData.Attributes.Add("class", "select"); HtmlGenericControl MoveFiles = (HtmlGenericControl)Master.FindControl("MoveFiles"); MoveFiles.Attributes.Add("class", "select"); HtmlGenericControl Promoter = (HtmlGenericControl)Master.FindControl("Promoter"); Promoter.Attributes.Add("class", "select"); if (Request.QueryString != null && Request.QueryString["id"] != null) { hf.Value = Request.QueryString["id"]; hfprevid.Value = Request.QueryString["id"]; clsSongsFactory fac = new clsSongsFactory(); List <clsSongs> Songs = fac.GetAllByVersions(Convert.ToInt32(hf.Value)); pnlButtons.Visible = true; pnlSave.Visible = false; if (Songs != null && Songs.Count > 0 && Session["Songs"] == null) { grd.DataSource = Songs; grd.DataBind(); Session["Songs"] = Songs; clsSongs Song = Songs.First(x => x.IdSong == Convert.ToInt32(hf.Value)); lblVersion.Text = Song.VERSION; chkAbsoluteBegin.Checked = Song.IncludeInNewTalent; chkAlternativeCharts.Checked = Song.AlternativeChart; chkFirstPlay.Checked = Song.IncludeInFirstPlay; lblGenre.Text = Song.GENRE; lblLanguage.Text = Song.LANGUAGE; lblRadio.Text = Song.RadioDate == null ? "" : Song.RadioDate.Value.ToString("dd/MM/yyyy"); lblTvShow.Text = Song.TVSHOW; lblArtist.Text = Song.ARTIST; lblTitle.Text = Song.TITLE; lblAuthor.Text = Song.Author; lblPublisher.Text = Song.Publisher; lblDuration.Text = Song.Duration; lblISRC.Text = Song.ISRC; lblLabel.Text = Song.LABEL; clsCompaniesFactory facC = new clsCompaniesFactory(); clsCompaniesKeys k = new clsCompaniesKeys(Songs[0].CompanyId.Value); clsCompanies c = facC.GetByPrimaryKey(k); lblCompany.Text = c.FullName; } else { Songs = (List <clsSongs>)Session["Songs"]; grd.DataSource = Songs; grd.DataBind(); clsSongs Song = Songs.Where(x => x.IdSong == Convert.ToInt32(hf.Value)).FirstOrDefault(); pnlButtons.Visible = false; pnlSave.Visible = true; lblVersion.Text = Song.VERSION; chkAbsoluteBegin.Checked = Song.IncludeInNewTalent; chkAlternativeCharts.Checked = Song.AlternativeChart; chkFirstPlay.Checked = Song.IncludeInFirstPlay; lblGenre.Text = Song.GENRE; lblLanguage.Text = Song.LANGUAGE; lblRadio.Text = Song.RadioDate.Value.ToString("dd/MM/yyyy"); lblTvShow.Text = Song.TVSHOW; lblArtist.Text = Song.ARTIST; lblTitle.Text = Song.TITLE; lblAuthor.Text = Song.Author; lblPublisher.Text = Song.Publisher; lblDuration.Text = Song.Duration; lblISRC.Text = Song.ISRC; lblLabel.Text = Song.LABEL; clsCompaniesFactory facC = new clsCompaniesFactory(); clsCompaniesKeys k = new clsCompaniesKeys(Song.CompanyId.Value); clsCompanies c = facC.GetByPrimaryKey(k); lblCompany.Text = c.FullName; } } } else { Response.Redirect("Login.aspx"); } } }
protected void btnSave_Click(object sender, EventArgs e) { bool error = false; if (Session["Songs"] != null) { string previd = hfprevid.Value; List <clsSongs> Songs1 = (List <clsSongs>)Session["Songs"]; for (int i = 0; i < Songs1.Count; i++) { if (Songs1[i].IdSong.ToString() == previd) { Songs1[i].VERSION = lblVersion.Text; string[] d = lblRadio.Text.Split('/'); DateTime date = new DateTime(Convert.ToInt16(d[2]), Convert.ToInt16(d[1]), Convert.ToInt16(d[0])); Songs1[i].RadioDate = date; Songs1[i].GENRE = lblGenre.Text; Songs1[i].LANGUAGE = lblLanguage.Text; Songs1[i].TVSHOW = lblTvShow.Text; Songs1[i].IncludeInNewTalent = chkAbsoluteBegin.Checked; Songs1[i].AlternativeChart = chkAlternativeCharts.Checked; Songs1[i].IncludeInFirstPlay = chkFirstPlay.Checked; Songs1[i].Duration = lblDuration.Text; Songs1[i].ISRC = lblISRC.Text; } } Session["Songs"] = Songs1; List <clsSongs> Songs = (List <clsSongs>)Session["Songs"]; if (Songs.Count > 0) { foreach (clsSongs s in Songs) { if (string.IsNullOrEmpty(s.VERSION) || string.IsNullOrEmpty(s.LANGUAGE) || string.IsNullOrEmpty(s.GENRE) || string.IsNullOrEmpty(s.RadioDate.ToString())) { error = true; break; } } if (!error) { foreach (clsSongs s in Songs) { clsSongsFactory fac = new clsSongsFactory(); clsSongsKeys key = new clsSongsKeys(s.IdSong); clsSongs _song = fac.GetByPrimaryKey(key); if (_song != null) { fac.Update(s); Session["SuccessMsg"] = "Record Updated Successfully."; } else { fac.Insert(s); Session["SuccessMsg"] = "Record Added Successfully."; } } Session["Songs"] = null; Response.Redirect("Songs.aspx"); } else { Session["ErrorMsg"] = "Error occured! Please try again later."; pnlError.Visible = true; lblError.Text = "Please provide all data."; } } else { pnlError.Visible = true; lblError.Text = "Some error ocurred please go back anf try again"; } } else { pnlError.Visible = true; lblError.Text = "Some error ocurred please go back anf try again"; } }
protected void btn_Click(object sender, EventArgs e) { CultureInfo cinfo = new CultureInfo("it-IT"); clsSongsFactory fac = new clsSongsFactory(); clsSongs Song = new clsSongs(); if (!String.IsNullOrEmpty(hfname.Value)) { if (IsEnglish(hfname.Value)) { if (!hfname.Value.ToLower().Contains(".part")) { Song.ARTIST = txtArtist.Text; Song.CompanyId = Convert.ToInt32(ddlCompany.SelectedValue); Song.FILENAME = hfname.Value; Song.GENRE = ddlGenre.SelectedValue == "0" ? "Pop" : ddlGenre.SelectedValue == "1" ? "Rock" : ddlGenre.SelectedValue == "2" ? "Dance" : ddlGenre.SelectedValue == "3" ? "Hip Hop / Rap" : "Pop";// txtGenre.Text; Song.IncludeInFirstPlay = ddlFirstPlayView.SelectedValue == "1" ? false : true; Song.LABEL = ddlLabel.SelectedItem.Text; Song.LabelId = Convert.ToInt32(ddlLabel.SelectedValue); Song.LANGUAGE = ddlLanguage.SelectedValue == "1" ? "ita" : ddlLanguage.SelectedValue == "0" ? "int" : "int";// txtLanguage.Text; string[] d = txtRadioDate.Text.Split('/'); DateTime date = new DateTime(Convert.ToInt16(d[2]), Convert.ToInt16(d[1]), Convert.ToInt16(d[0])); Song.RadioDate = date; Song.TITLE = txtTitle.Text; Song.Author = txtAuthor.Text; Song.Publisher = txtPublisher.Text; Song.Duration = txtDuration.Text; Song.ISRC = txtISRC.Text; Song.TVSHOW = txtTVShow.Text; Song.VERSION = txtVersion.Text; Song.IncludeInNewTalent = ddlAbsoluteBeginner.SelectedValue == "1" ? false : true; Song.PromotionId = Convert.ToInt32(ddlPromoter.SelectedValue); Song.AlternativeChart = chkAlternativeCharts.Checked; //string folderPath = ConfigurationManager.AppSettings["folder"]; int IsExist = fac.InsertExist_Check(Song); if (IsExist == 0) { int IdSong = fac.Insert(Song); if (IdSong == -1) { pnlError.Visible = true; lblError.Text = "Artist + Title + Version already exist."; } else if (IdSong == -2) { pnlError.Visible = true; lblError.Text = "File Name already exist."; } else { Response.Redirect("SongDetail.aspx?id=" + IdSong); Session["Songs"] = null; } } else if (IsExist == -1) { pnlError.Visible = true; lblError.Text = "Artist + Title already exist."; } else if (IsExist == -2) { pnlError.Visible = true; lblError.Text = "File Name already exist."; } } else { pnlError.Visible = true; lblError.Text = "filename must contains MP3."; } } else { pnlError.Visible = true; lblError.Text = "File name contains illegal characters"; } } else { pnlError.Visible = true; lblError.Text = "Please select a file first"; } }