private bool IsTypeRequested(string status, int approver) { switch (Convert.ToInt32(ddlWhichContent.SelectedItem.Value)) { case 0: return(StatusCodes.isAwaitingApproval(status)); case 1: if (approver == 0) { return(false); } return(StatusCodes.isApproved(status)); case 2: if (approver == 0) { return(false); } return(true); default: return(false); } }
private void Page_Load(object sender, System.EventArgs e) { zone = new Zone(appEnv.GetConnection()); dist = new Distribution(appEnv.GetConnection()); content = new Content(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"]); } } } // } }