protected void Page_Load(object sender, System.EventArgs e) { account = new Account(appEnv.GetConnection()); content = new MyContent(appEnv.GetConnection()); notes = new ContentNotes(appEnv.GetConnection()); DataTable dt; int accountNo = account.GetAccountID(User.Identity.Name); if (accountNo == 1) // Admin sees all { dt = content.GetHeadlines(); } else { dt = content.GetHeadlinesForAuth(accountNo); } LiteralControl lit; TableCell cell; int prv = -1; int cur; foreach (DataRow dr in dt.Rows) { cur = Convert.ToInt32(dr["ContentID"]); if (cur != prv) { prv = cur; if (IsTypeRequested(dr["Status"].ToString())) { TableRow row = new TableRow(); tblView.Rows.Add(row); lit = new LiteralControl(dr["ContentID"].ToString()); cell = new TableCell(); cell.Controls.Add(lit); cell.HorizontalAlign = HorizontalAlign.Center; row.Cells.Add(cell); lit = new LiteralControl(dr["Version"].ToString()); cell = new TableCell(); cell.Controls.Add(lit); cell.HorizontalAlign = HorizontalAlign.Center; row.Cells.Add(cell); lit = new LiteralControl(dr["Headline"].ToString()); cell = new TableCell(); cell.Controls.Add(lit); row.Cells.Add(cell); lit = new LiteralControl(StatusCodes.ToString( Convert.ToInt32(dr["Status"]))); cell = new TableCell(); cell.Font.Size = new FontUnit(FontSize.XSmall); cell.HorizontalAlign = HorizontalAlign.Center; cell.Controls.Add(lit); row.Cells.Add(cell); BuildImageButton(row, "AutView.aspx?ContentID=" + dr["ContentID"].ToString(), -1); BuildImageButton(row, "../Note/NoteList.aspx?ContentID=" + dr["ContentID"].ToString() + "&Origin=Author", notes.CountNotesForID(Convert.ToInt32(dr["ContentID"]))); if (StatusCodes.isCreating(dr["Status"].ToString())) { BuildImageButton(row, "AutUpdate.aspx?ContentID=" + dr["ContentID"].ToString(), -1); BuildImageButton(row, "AutSubmit.aspx?ContentID=" + dr["ContentID"].ToString(), -1); BuildImageButton(row, "AutRemove.aspx?ContentID=" + dr["ContentID"].ToString(), -1); } else { BuildImageButton(row, null, -1); BuildImageButton(row, null, -1); BuildImageButton(row, null, -1); } } } } }
protected void Page_Load(object sender, System.EventArgs e) { zone = new Zone(appEnv.GetConnection()); dist = new Distribution(appEnv.GetConnection()); content = new MyContent(appEnv.GetConnection()); LiteralControl lit; TableCell cell; DropDownList ddlRank; DataTable AllRanks = null; string inZone = Request.QueryString["Zone"]; DataTable dtz = zone.GetAllZones(); DataTable dt = content.GetHeadlines(); if (dt.Rows.Count > 0) { int prv = -1; int cur; foreach (DataRow dr in dt.Rows) { cur = Convert.ToInt32(dr["ContentID"]); if (cur != prv) { prv = cur; if (StatusCodes.isApproved(dr["Status"].ToString())) { TableRow row = new TableRow(); tblNewContent.Rows.Add(row); lit = new LiteralControl(dr["Headline"].ToString()); cell = new TableCell(); cell.Controls.Add(lit); row.Cells.Add(cell); BuildImageButton(row, "DeployView.aspx?ID=" + dr["ContentID"] + "&Ver=" + dr["Version"]); BuildImageButton(row, "DeployDeploy.aspx?ID=" + dr["ContentID"] + "&Ver=" + dr["Version"]); BuildImageButton(row, "DeployReturn.aspx?ID=" + dr["ContentID"] + "&Ver=" + dr["Version"]); } } } } if (!IsPostBack) { if (inZone == null) { inZone = "None"; } ListItem item; ddlZones.Items.Add(new ListItem("None")); ddlZones.Items.Add(item = new ListItem("All")); if (inZone.Equals("All")) { item.Selected = true; } foreach (DataRow dr in dtz.Rows) { ddlZones.Items.Add(item = new ListItem(dr["Title"].ToString())); if (dr["Title"].ToString().Trim().Equals(inZone)) { item.Selected = true; } } } // else // { foreach (DataRow dr in dtz.Rows) { DataTable dtd = dist.GetOrdered(Convert.ToInt32(dr["ZoneID"])); if (ddlZones.SelectedItem.Text.Equals("All") || ddlZones.SelectedItem.Text.Equals(dr["Title"])) { if (dtd.Rows.Count == 0) { TableRow row = new TableRow(); tblSiteContent.Rows.Add(row); lit = new LiteralControl(dr["Title"].ToString()); cell = new TableCell(); cell.Controls.Add(lit); row.Cells.Add(cell); lit = new LiteralControl("No Content"); cell = new TableCell(); cell.ColumnSpan = 4; cell.Controls.Add(lit); row.Cells.Add(cell); } foreach (DataRow drd in dtd.Rows) { TableRow row = new TableRow(); tblSiteContent.Rows.Add(row); lit = new LiteralControl(dr["Title"].ToString()); cell = new TableCell(); cell.Controls.Add(lit); row.Cells.Add(cell); DataRow drc = content.GetContentForIDVer(Convert.ToInt32(drd["ContentID"]), Convert.ToInt32(drd["Version"])); lit = new LiteralControl(drc["Headline"].ToString()); cell = new TableCell(); cell.Controls.Add(lit); row.Cells.Add(cell); if (AllRanks == null) { AllRanks = new ContentRank(appEnv.GetConnection()).GetRanks(); } cell = new TableCell(); ddlRank = new DropDownList(); foreach (DataRow drr in AllRanks.Rows) { ddlRank.Items.Add(new ListItem(drr["Rank"].ToString(), drr["RankID"].ToString())); } ddlRank.Items.FindByValue(drd["Ranking"].ToString()).Selected = true; cell.Controls.Add(ddlRank); row.Cells.Add(cell); BuildImageButton(row, "DeployView.aspx?ID=" + drd["ContentID"] + "&Ver=" + drd["Version"]); BuildImageButton(row, "DeployArchive.aspx?ID=" + drd["ContentID"] + "&Ver=" + drd["Version"]); } } } // } }