private void BuildPage(int cver) { AccountProperty property = new AccountProperty(appEnv.GetConnection()); DataRow dr = dt.Rows[cver]; lbContentID.Text = dr["ContentID"].ToString(); lbVersion.Text = dr["Version"].ToString(); lbHeadline.Text = dr["Headline"].ToString(); lbSource.Text = dr["Source"].ToString() + " "; lbByline.Text = property.GetValue(Convert.ToInt32(dr["Byline"]), "UserName").Trim(); lbTeaser.Text = dr["Teaser"].ToString() + " "; lbBody.Text = dr["Body"].ToString(); lbTagline.Text = dr["Tagline"].ToString() + " "; lbStatus.Text = StatusCodes.ToString(Convert.ToInt32(dr["Status"])); lbEditor.Text = property.GetValue(Convert.ToInt32(dr["Editor"]), "UserName").Trim(); lbApprover.Text = property.GetValue(Convert.ToInt32(dr["Approver"]), "UserName").Trim(); lbUpdateUser.Text = property.GetValue(Convert.ToInt32(dr["UpdateUserID"]), "UserName").Trim(); lbModifiedDate.Text = dr["ModifiedDate"].ToString(); lbCreationDate.Text = dr["CreationDate"].ToString(); if (cver > 0) { bnNext.Enabled = true; int tmp = cver - 1; bnNext.CommandArgument = tmp.ToString(); } else { bnNext.Enabled = false; } if (cver < dt.Rows.Count - 1) { bnPrevious.Enabled = true; int tmp = cver + 1; bnPrevious.CommandArgument = tmp.ToString(); } else { bnPrevious.Enabled = false; } bnUpdate.Visible = (cver == 0 && StatusCodes.isCreating(dr["Status"].ToString())); bnRemove.Visible = (cver == 0 && StatusCodes.isCreating(dr["Status"].ToString())); }
private bool IsTypeRequested(string status) { switch (Convert.ToInt32(ddlWhichContent.SelectedItem.Value)) { case 0: return(StatusCodes.isCreating(status)); case 1: return(StatusCodes.isCreating(status) || StatusCodes.isAwaitingEdit(status) || StatusCodes.isEditing(status)); case 2: return(true); default: return(false); } }
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); } } } } }