private void PopulateChannelDataGrid(string channellist) { string errmsg = ""; CCDBaccess db = new CCDBaccess(); DataTable dtchannelsdb = db.GetChannelCollection(out errmsg); DataColumn newColumn; DataTable dtChannels = new DataTable(); newColumn = dtChannels.Columns.Add("Use", Type.GetType("System.Boolean")); newColumn = dtChannels.Columns.Add("Channel", Type.GetType("System.String")); ArrayList al = new ArrayList(); al.Clear(); if (channellist == "") { int publicationID = Globals.TryParse(txtPublicationID.Text, 0); if (publicationID > 0) { db.GetPublicationChannelsForPublication(publicationID, ref al, out errmsg); } } else { string [] ss = channellist.Split(','); foreach (string sss in ss) { int qq = Globals.TryParse(sss, 0); if (qq > 0) { al.Add(qq); } } } Session["ThisChannelList"] = al; foreach (DataRow row in dtchannelsdb.Rows) { DataRow newRow = dtChannels.NewRow(); newRow["Channel"] = (string)row["Name"]; newRow["Use"] = false; foreach (int no in al) { if (no == (int)row["ID"]) { newRow["Use"] = true; break; } } dtChannels.Rows.Add(newRow); } DataGridChannels.DataSource = dtChannels; DataGridChannels.DataBind(); }
private void PopulateChannelCheckBoxList() { string errmsg = ""; CCDBaccess db = new CCDBaccess(); ArrayList channelsForPublication = new ArrayList(); int productionID = 0; int pressRunID = 0; int publicationID = Globals.GetIDFromName("PublicationNameCache", RadComboBoxProduct.SelectedValue); db.GetPressRunID(publicationID, pubDate, ref editionID, sectionID, pressID, out pressRunID, out productionID, out errmsg); /* if (pressRunID == 0 || productionID == 0) * { * InjectScript.Text = "<script>CloseOnReload()</" + "script>"; * return; * }*/ txtProductionID.Text = productionID.ToString(); txtPressRunID.Text = pressRunID.ToString(); DataTable dtchannelsdb = db.GetChannelCollection(out errmsg); db.GetPublicationChannelsForPublication(publicationID, ref channelsForPublication, out errmsg); // Session["ThisChannelList"] = channelsForPublication; CheckBoxListChannels.Items.Clear(); foreach (DataRow row in dtchannelsdb.Rows) { string channel = (string)row["Name"]; int channelID = (int)row["ID"]; bool use = false; //foreach (int pubchannelID in channelsForPublication) //{ // if (pubchannelID == channelID) // { // use = true; // break; // } //} CheckBoxListChannels.Items.Add(new ButtonListItem((string)row["Name"], channelID.ToString(), true, use)); } }