예제 #1
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            cid    = Convert.ToInt32(Request.QueryString["ContentID"]);
            origin = Request.QueryString["Origin"];

            if (cid == 0)
            {
                Page_Error("ContentID Missing");
            }

            if (IsPostBack)
            {
                Page.Validate();

                if (Page.IsValid)
                {
                    try
                    {
                        Account      account = new Account(appEnv.GetConnection());
                        ContentNotes notes   = new ContentNotes(appEnv.GetConnection());
                        notes.Insert(cid, tbNote.Text, account.GetAccountID(User.Identity.Name));
                    }
                    catch (Exception err)
                    {
                        Page_Error("The following error occured: " + err.Message);
                    }

                    Response.Redirect("NoteList.aspx?ContentID=" + cid + "&Origin=" + origin);
                }
            }
            else
            {
                lbWho.Text = origin;
            }
        }
        private void Page_Load(object sender, System.EventArgs e)
        {
            nid    = Convert.ToInt32(Request.QueryString["NoteID"]);
            origin = Request.QueryString["Origin"];

            if (nid == 0)
            {
                Page_Error("NoteID Missing");
            }

            if (!IsPostBack)
            {
                Account         account  = new Account(appEnv.GetConnection());
                AccountProperty property = new AccountProperty(appEnv.GetConnection());
                DataRow         dr       = new ContentNotes(appEnv.GetConnection()).GetNote(nid);

                lbWho.Text = origin;

                lbContentID.Text = dr["ContentID"].ToString();

                lbNote.Text   = dr["Note"].ToString();
                lbAuthor.Text = property.GetValue(Convert.ToInt32(dr["Author"]),
                                                  "UserName").Trim();
                lbModifiedDate.Text = dr["ModifiedDate"].ToString();
                lbCreationDate.Text = dr["CreationDate"].ToString();

                if (account.GetAccountID(User.Identity.Name) != Convert.ToInt32(dr["Author"]))
                {
                    bnUpdate.Visible = false;
                    bnRemove.Visible = false;
                }
            }
        }
예제 #3
0
        private void BuildOrigPage()
        {
            AccountProperty property = new AccountProperty(appEnv.GetConnection());

            DataRow dr = new ContentNotes(appEnv.GetConnection()).GetNote(nid);

            lbContentID.Text = dr["ContentID"].ToString();
            tbNote.Text      = dr["Note"].ToString();
            lbAuthor.Text    = property.GetValue(Convert.ToInt32(dr["Author"]),
                                                 "UserName").Trim();
            lbModifiedDate.Text = dr["ModifiedDate"].ToString();
            lbCreationDate.Text = dr["CreationDate"].ToString();
        }
예제 #4
0
        protected void bnUpdate_Click(object sender, System.EventArgs e)
        {
            if (Page.IsValid)
            {
                try
                {
                    ContentNotes note = new ContentNotes(appEnv.GetConnection());
                    note.Update(nid, tbNote.Text);
                }
                catch (Exception err)
                {
                    Page_Error("The following error occured: " + err.Message);
                }

                Response.Redirect("NoteList.aspx?ContentID=" + lbContentID.Text + "&origin=" + origin);
            }
        }
예제 #5
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            nid    = Convert.ToInt32(Request.QueryString["NoteID"]);
            origin = Request.QueryString["Origin"];

            if (nid == 0)
            {
                Page_Error("NoteID Missing");
            }

            notes = new ContentNotes(appEnv.GetConnection());
            DataRow dr = notes.GetNote(nid);

            lbWho.Text = origin;

            lbContentID.Text = dr["ContentID"].ToString();
            lbWhichNote.Text = dr["Note"].ToString();
        }
예제 #6
0
        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);
                        }
                    }
                }
            }
        }
        private void Page_Load(object sender, System.EventArgs e)
        {
            cid    = Convert.ToInt32(Request.QueryString["ContentID"]);
            origin = Request.QueryString["Origin"];

            if (cid == 0)
            {
                Page_Error("ContentID Missing");
            }

            AccountProperty property = new AccountProperty(appEnv.GetConnection());

            account = new Account(appEnv.GetConnection());
            note    = new ContentNotes(appEnv.GetConnection());

            DataTable dt = note.GetNotesForID(cid);

            LiteralControl lit;
            TableCell      cell;

            lbWho.Text = origin;

            foreach (DataRow dr in dt.Rows)
            {
                TableRow row = new TableRow();
                tblView.Rows.Add(row);

                lit            = new LiteralControl(dr["ModifiedDate"].ToString());
                cell           = new TableCell();
                cell.Font.Size = new FontUnit(FontSize.XSmall);
                cell.Controls.Add(lit);
                row.Cells.Add(cell);

                lit = new LiteralControl(property.GetValue(Convert.ToInt32(dr["Author"]),
                                                           "UserName").Trim());
                cell = new TableCell();
                cell.Controls.Add(lit);
                cell.HorizontalAlign = HorizontalAlign.Center;
                row.Cells.Add(cell);

                string tmp = dr["Note"].ToString();

                if (tmp.Length > 80)
                {
                    tmp  = tmp.Substring(0, 80);
                    tmp += "...";
                }

                lit  = new LiteralControl(tmp);
                cell = new TableCell();
                cell.Controls.Add(lit);
                row.Cells.Add(cell);

                BuildImageButton(row, "NoteView.aspx?NoteID=" + dr["NoteID"].ToString() + "&Origin=" + origin);

                if (account.GetAccountID(User.Identity.Name) == Convert.ToInt32(dr["Author"]))
                {
                    BuildImageButton(row, "NoteUpdate.aspx?NoteID=" + dr["NoteID"].ToString() + "&Origin=" + origin);
                    BuildImageButton(row, "NoteRemove.aspx?NoteID=" + dr["NoteID"].ToString() + "&Origin=" + origin);
                }
                else
                {
                    BuildImageButton(row, null);
                    BuildImageButton(row, null);
                }
            }
        }