private bool IsTypeRequested(string status, int editor) { switch (Convert.ToInt32(ddlWhichContent.SelectedItem.Value)) { case 0: return(StatusCodes.isAwaitingEdit(status) || StatusCodes.isEditing(status)); case 1: if (editor == 0) { return(false); } return(StatusCodes.isAwaitingEdit(status) || StatusCodes.isRequiresUpdate(status) || StatusCodes.isEditing(status) || StatusCodes.isAwaitingApproval(status)); case 2: if (editor == 0) { return(false); } return(true); default: return(false); } }
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; } bnEdit.Visible = (cver == 0 && (StatusCodes.isAwaitingEdit(dr["Status"].ToString()) || StatusCodes.isEditing(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) { int cid = Convert.ToInt32(Request.QueryString["ContentID"]); if (cid == 0) { Page_Error("ContentID Missing"); } dt = new MyContent(appEnv.GetConnection()).GetContentForID(cid); if (!IsPostBack) { if (StatusCodes.isAwaitingEdit(dt.Rows[0]["Status"].ToString())) { SetAsEditor(); } BuildOrigPage(); } }
private void Page_Load(object sender, System.EventArgs e) { account = new Account(appEnv.GetConnection()); content = new Content(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.GetHeadlinesForEdit(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(), Convert.ToInt32(dr["Editor"]))) { 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, "EdView.aspx?ContentID=" + dr["ContentID"].ToString(), -1); BuildImageButton(row, "../Note/NoteList.aspx?ContentID=" + dr["ContentID"].ToString() + "&Origin=Editor", notes.CountNotesForID(Convert.ToInt32(dr["ContentID"]))); if (StatusCodes.isAwaitingEdit(dr["Status"].ToString()) || StatusCodes.isEditing(dr["Status"].ToString())) { BuildImageButton(row, "EdEdit.aspx?ContentID=" + dr["ContentID"].ToString(), -1); } else { BuildImageButton(row, null, -1); } if (StatusCodes.isEditing(dr["Status"].ToString())) { BuildImageButton(row, "EdWithdraw.aspx?ContentID=" + dr["ContentID"].ToString(), -1); BuildImageButton(row, "EdSubmit.aspx?ContentID=" + dr["ContentID"].ToString(), -1); BuildImageButton(row, "EdReturn.aspx?ContentID=" + dr["ContentID"].ToString(), -1); } else { BuildImageButton(row, null, -1); BuildImageButton(row, null, -1); BuildImageButton(row, null, -1); } } } } }