private void LoadData() { clsCompaniesFactory fac = new clsCompaniesFactory(); DataTable comp = fac.GetAll(); DataView dv = comp.DefaultView; dv.Sort = "Company"; ddlCompany.DataSource = dv; ddlCompany.DataTextField = "Company"; ddlCompany.DataValueField = "Id"; ddlCompany.DataBind(); clsLabelsFactory facl = new clsLabelsFactory(); DataTable lbl = facl.GetAll(); DataView dv1 = lbl.DefaultView; dv1.Sort = "Title"; ddlLabel.DataSource = dv1; ddlLabel.DataTextField = "Title"; ddlLabel.DataValueField = "Id"; ddlLabel.DataBind(); clsPromotionFactory facp = new clsPromotionFactory(); DataSet prmtn = facp.GetAllWithPaging(1, 1000, "Id", string.Empty); DataTable myDataTable = prmtn.Tables[0]; DataView dv2 = myDataTable.DefaultView; dv2.Sort = "Title"; ddlPromoter.DataSource = dv2; ddlPromoter.DataTextField = "Title"; ddlPromoter.DataValueField = "Id"; ddlPromoter.DataBind(); }
//Bind your Grid View here private void BindTaskList() { clsCompaniesFactory fac = new clsCompaniesFactory(); DataSet Songs = fac.GetAllInTable(Convert.ToInt32(ViewState["PageNumber"]), 100, ViewState["SortColumn"].ToString()); DataTable myDataTable = Songs.Tables[0]; //Set your DataTable here ViewState["Count"] = Songs.Tables[1]; grd.DataSource = myDataTable; grd.DataBind(); }
protected void grd_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName.ToString() == "_Edit") { Response.Redirect("AddCompany.aspx?id=" + e.CommandArgument + ""); } else if (e.CommandName.ToString() == "_delete") { clsCompaniesFactory fac = new clsCompaniesFactory(); clsCompaniesKeys key = new clsCompaniesKeys(Convert.ToInt32(e.CommandArgument)); fac.Delete(key); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Session["User"] != null) { HtmlGenericControl ManageSongs = (HtmlGenericControl)Master.FindControl("ManageSongs"); ManageSongs.Attributes.Add("class", "select"); HtmlGenericControl ManageCompany = (HtmlGenericControl)Master.FindControl("ManageCompany"); ManageCompany.Attributes.Add("class", "current"); 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"); Session["Songs"] = null; Session["eSongs"] = null; if (Request.QueryString != null && Request.QueryString["id"] != null) { hf.Value = Request.QueryString["id"]; clsCompaniesFactory fac = new clsCompaniesFactory(); clsCompaniesKeys key = new clsCompaniesKeys(Convert.ToInt32(hf.Value)); clsCompanies Company = fac.GetByPrimaryKey(key); txtcompany.Text = Company.Company; txtFullName.Text = Company.FullName; ddlFirst.SelectedValue = Company.Data == true ? "0" : "1"; } } else { Response.Redirect("Login.aspx"); } } }
protected void btn_Click(object sender, EventArgs e) { clsCompaniesFactory fac = new clsCompaniesFactory(); if (string.IsNullOrEmpty(hf.Value)) { List <clsCompanies> lbl = fac.GetAllBy(clsCompanies.clsCompaniesFields.Company, txtcompany.Text); if (lbl != null && lbl.Count > 0) { pnlSuccess.Visible = false; pnlError.Visible = true; } else { clsCompanies Company = new clsCompanies(); Company.FullName = txtFullName.Text; Company.Company = txtcompany.Text; Company.Data = ddlFirst.SelectedValue == "1" ? false : true; fac.Insert(Company); pnlSuccess.Visible = true; lblSuccess.Text = "company added successfully"; pnlError.Visible = false; } } else { clsCompaniesKeys key = new clsCompaniesKeys(Convert.ToInt32(hf.Value)); clsCompanies Company = fac.GetByPrimaryKey(key); Company.FullName = txtFullName.Text; Company.Company = txtcompany.Text; Company.Data = ddlFirst.SelectedValue == "1" ? false : true; fac.Update(Company); pnlSuccess.Visible = true; lblSuccess.Text = "company updated successfully"; pnlError.Visible = false; } }
protected void btnCompsub_Click(object sender, EventArgs e) { clsCompaniesFactory fac = new clsCompaniesFactory(); List <clsCompanies> lbl = fac.GetAllBy(clsCompanies.clsCompaniesFields.Company, txtcompany.Text); if (lbl != null && lbl.Count > 0) { pnlSuccess.Visible = false; pnlError.Visible = true; lblError.Text = "company already exists"; } else { clsCompanies Company = new clsCompanies(); Company.FullName = txtFullName.Text; Company.Company = txtcompany.Text; Company.Data = ddlFirst.SelectedValue == "1" ? false : true; fac.Insert(Company); pnlSuccess.Visible = true; lblSuccess.Text = "company added successfully"; pnlError.Visible = false; } LoadData(); }
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"); } } }
private void LoadData() { clsCompaniesFactory fac = new clsCompaniesFactory(); DataTable comp = fac.GetAll(); DataView dv = comp.DefaultView; dv.Sort = "Company"; ddlCompany.DataSource = dv; ddlCompany.DataTextField = "Company"; ddlCompany.DataValueField = "Id"; ddlCompany.DataBind(); clsLabelsFactory facl = new clsLabelsFactory(); DataTable lbl = facl.GetAll(); DataView dv1 = lbl.DefaultView; dv1.Sort = "Title"; ddlLabel.DataSource = dv1; ddlLabel.DataTextField = "Title"; ddlLabel.DataValueField = "Id"; ddlLabel.DataBind(); clsPromotionFactory facp = new clsPromotionFactory(); DataSet prmtn = facp.GetAllWithPaging(1, 1000, "Id", string.Empty); DataTable myDataTable = prmtn.Tables[0]; DataView dv2 = myDataTable.DefaultView; dv2.Sort = "Title"; ddlPromoter.DataSource = dv2; ddlPromoter.DataTextField = "Title"; ddlPromoter.DataValueField = "Id"; ddlPromoter.SelectedValue = "11"; ddlPromoter.DataBind(); //List<clsGenre> GenreList = new List<clsGenre>(); //clsSongsFactory fac2 = new clsSongsFactory(); //List<clsSongs> Songs1 = fac2.GetAllArtists(""); //foreach (clsSongs s in Songs1) //{ // if (!string.IsNullOrEmpty(s.GENRE)) // { // if (!GenreList.Any(d => d.Value.Contains(s.GENRE)))// s.GENRE.ToLower() == "pop" || s.GENRE.ToLower() == "rock" || s.GENRE.ToLower() == "dance") // GenreList.Add(new clsGenre { Key = s.GENRE.ToLower(), Value = s.GENRE }); // } //} //GenreList = GenreList.Distinct().ToList(); //ddlGenre.DataSource = GenreList; //ddlGenre.DataTextField = "Value"; //ddlGenre.DataValueField = "Key"; //ddlGenre.DataBind(); //List<clsLanguage> LanguageList = new List<clsLanguage>(); //List<clsSongs> Songs2 = fac2.GetAllTitle(""); //foreach (clsSongs s in Songs2) //{ // if (!string.IsNullOrEmpty(s.LANGUAGE)) // { // if (s.LANGUAGE.ToLower() == "int" || s.LANGUAGE.ToLower() == "ita") // LanguageList.Add(new clsLanguage { Key = s.LANGUAGE.ToLower(), Value = s.LANGUAGE }); // } //} //LanguageList = LanguageList.Distinct().ToList(); //ddlLanguage.DataSource = LanguageList; //ddlLanguage.DataTextField = "Value"; //ddlLanguage.DataValueField = "Key"; //ddlLanguage.DataBind(); }