private void Page_Load(object sender, System.EventArgs e)
        {
            int Domain = Convert.ToInt32(Request.QueryString["Domain"]);

            // First Time in no Domain specified
            if (Domain == 0)
            {
                Domain = 1;
            }

            MainNavBar.Domain = Domain;

            Account account   = new Account(appEnv.GetConnection());
            int     accountID = account.GetAccountID(User.Identity.Name);

            if (!IsPostBack)
            {
                AccountProperty property   = new AccountProperty(appEnv.GetConnection());
                string          strZoneIds = property.GetValue(accountID, "ZoneCards");

                if (strZoneIds.Length <= 0)
                {
                    property.Insert(accountID, "ZoneCards", "0,0,0,0,0,0");
                }
            }

            for (int i = 0; i < 6; i++)
            {
                ZoneCards[i].Card      = i;
                ZoneCards[i].AccountID = accountID;
            }
        }
예제 #2
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            int cid = Convert.ToInt32(Request.QueryString["ID"]);
            int ver = Convert.ToInt32(Request.QueryString["Ver"]);

            if (cid == 0)
            {
                Page_Error("ContentID Missing");
            }
            if (ver == 0)
            {
                Page_Error("Version Missing");
            }
            dr = new Content(appEnv.GetConnection()).GetContentForIDVer(cid, ver);

            if (!IsPostBack)
            {
                AccountProperty property = new AccountProperty(appEnv.GetConnection());

                lbContentID.Text = dr["ContentID"].ToString();
                lbVersion.Text   = dr["Version"].ToString();
                lbHeadline.Text  = dr["Headline"].ToString();
                lbSource.Text    = dr["Source"].ToString() + "&nbsp;";
                lbByline.Text    = property.GetValue(Convert.ToInt32(dr["Byline"]),
                                                     "UserName").Trim();
                lbTeaser.Text     = dr["Teaser"].ToString() + "&nbsp;";
                lbBody.Text       = dr["Body"].ToString();
                lbTagline.Text    = dr["Tagline"].ToString() + "&nbsp;";
                lbStatus.Text     = dr["Status"].ToString();
                lbUpdateUser.Text = property.GetValue(Convert.ToInt32(dr["UpdateUserID"]),
                                                      "UserName").Trim();
                lbModifiedDate.Text = dr["ModifiedDate"].ToString();
                lbCreationDate.Text = dr["CreationDate"].ToString();
            }
        }
예제 #3
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            if (!IsPostBack)
            {
                AppEnv          appEnv   = new AppEnv(Context);
                MyContent       content  = new MyContent(appEnv.GetConnection());
                AccountProperty property = new AccountProperty(appEnv.GetConnection());

                DataRow dr = content.GetContentForIDVer(m_contentid, m_version);

                if (dr != null)
                {
                    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();
                    hlReadMore.NavigateUrl = buildDirectory(dr) +
                                             "StoryPg.aspx?ID=" + m_contentid + "&Ver=" + m_version;
                }
                else
                {
                    lbHeadline.Text    = "No Stories";
                    hlReadMore.Visible = false;
                    lbBy.Visible       = false;
                    imgPlus.Visible    = false;
                }
            }
        }
예제 #4
0
        private void BuildOrigPage()
        {
            AccountProperty property = new AccountProperty(appEnv.GetConnection());

            DataRow dr = dt.Rows[0];

            lbContentID.Text = dr["ContentID"].ToString();
            lbVersion.Text   = dr["Version"].ToString();
            tbHeadline.Text  = dr["Headline"].ToString();
            tbSource.Text    = dr["Source"].ToString();
            lbBylineNum.Text = dr["Byline"].ToString();
            lbByline.Text    = property.GetValue(Convert.ToInt32(dr["Byline"]),
                                                 "UserName").Trim();
            tbTeaser.Text    = dr["Teaser"].ToString();
            tbBody.Text      = dr["Body"].ToString();
            tbTagline.Text   = dr["Tagline"].ToString();
            lbEditorNum.Text = dr["Editor"].ToString();
            lbEditor.Text    = property.GetValue(Convert.ToInt32(dr["Editor"]),
                                                 "UserName").Trim();
            lbApproverNum.Text = dr["Approver"].ToString();
            lbApprover.Text    = property.GetValue(Convert.ToInt32(dr["Approver"]),
                                                   "UserName").Trim();
            lbStatusNum.Text    = dr["Status"].ToString();
            lbStatus.Text       = StatusCodes.ToString(Convert.ToInt32(dr["Status"]));
            lbModifiedDate.Text = dr["ModifiedDate"].ToString();
            lbCreationDate.Text = dr["CreationDate"].ToString();
        }
        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;
                }
            }
        }
예제 #6
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            account  = new Account(appEnv.GetConnection());
            property = new AccountProperty(appEnv.GetConnection());

            DataTable dt = account.GetAccounts();

            LiteralControl lit;
            TableCell      cell;

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

                lit  = new LiteralControl(dr["UserName"].ToString());
                cell = new TableCell();
                cell.Controls.Add(lit);
                row.Cells.Add(cell);

                lit  = new LiteralControl(property.GetValue(Convert.ToInt32(dr["AccountID"]), "UserName") + "&nbsp;");
                cell = new TableCell();
                cell.Controls.Add(lit);
                row.Cells.Add(cell);

                lit  = new LiteralControl(dr["Email"].ToString());
                cell = new TableCell();
                cell.Controls.Add(lit);
                row.Cells.Add(cell);

                if (dr["AccountID"].ToString().Trim().Equals("1"))
                {
                    int i = 0;

                    // is the cuurent user the administrator allow viewing and updating
                    if (dr["UserName"].ToString().Trim().Equals(User.Identity.Name.Trim()))
                    {
                        BuildImageButton(row, "AdmAcntView.aspx?AccountID=" + dr["AccountID"].ToString());
                        BuildImageButton(row, "AdmAcntUpdate.aspx?AccountID=" + dr["AccountID"].ToString());
                        i = 2;
                    }

                    // never allow delete button for administrator account
                    for ( ; i < 3; i++)
                    {
                        lit  = new LiteralControl("&nbsp;");
                        cell = new TableCell();
                        cell.Controls.Add(lit);
                        row.Cells.Add(cell);
                    }
                }
                else
                {
                    BuildImageButton(row, "AdmAcntView.aspx?AccountID=" + dr["AccountID"].ToString());
                    BuildImageButton(row, "AdmAcntUpdate.aspx?AccountID=" + dr["AccountID"].ToString());
                    BuildImageButton(row, "AdmAcntRemove.aspx?AccountID=" + dr["AccountID"].ToString());
                }
            }
        }
예제 #7
0
        public async Task SetProperty(AccountProperty property)
        {
            var account = await _store.Load(property.AccountId);

            if (account != null)
            {
                await SetProperties(account.Id, new AccountProperty[] { property });
            }
        }
예제 #8
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            aid = Convert.ToInt32(Request.QueryString["AccountID"]);

            if (aid == 0)
            {
                Page_Error("AccountID Missing");
            }

            if (aid == 1)
            {
                bnRemove.Visible = false;
            }

            account  = new Account(appEnv.GetConnection());
            property = new AccountProperty(appEnv.GetConnection());
            roles    = new AccountRoles(appEnv.GetConnection());

            dr = account.GetAccountForID(aid);

            if (!IsPostBack)
            {
                tbUserID.Text   = dr["UserName"].ToString().Trim();
                tbUserName.Text = property.GetValue(aid, "UserName").Trim();
                tbEmail.Text    = dr["Email"].ToString().Trim();

                DataTable roledt = roles.GetRolesForID(aid);

                string         Cmd   = "Select * FROM Roles";
                SqlDataAdapter DAdpt = new SqlDataAdapter(Cmd, appEnv.GetConnection());

                DataSet ds = new DataSet();
                DAdpt.Fill(ds, "Roles");

                DataTable allRolesdt = ds.Tables["Roles"];

                foreach (DataRow drr in allRolesdt.Rows)
                {
                    ListItem li = new ListItem(drr["Role"].ToString());

                    foreach (DataRow adr in roledt.Rows)
                    {
                        if (drr["Role"].ToString().Equals(adr["Role"].ToString()))
                        {
                            li.Selected = true;
                        }
                    }
                    lbRoles.Items.Add(li);
                }
                if (aid == 1)
                {
                    bnRemove.Visible = false;
                    lbRoles.Enabled  = false;
                }
            }
        }
        private void Page_Load(object sender, System.EventArgs e)
        {
            if (!IsPostBack)
            {
                string         Cmd   = "Select * FROM Roles";
                SqlDataAdapter DAdpt = new SqlDataAdapter(Cmd, appEnv.GetConnection());

                DataSet ds = new DataSet();
                DAdpt.Fill(ds, "Roles");

                DataTable dt = ds.Tables["Roles"];

                foreach (DataRow dr in dt.Rows)
                {
                    lbRoles.Items.Add(dr["Role"].ToString());
                }
            }
            else
            {
                account      = new Account(appEnv.GetConnection());
                property     = new AccountProperty(appEnv.GetConnection());
                accountRoles = new AccountRoles(appEnv.GetConnection());

                Page.Validate();

                if (Page.IsValid)
                {
                    try
                    {
                        if (account.GetAccountID(tbUserID.Text) > 0)
                        {
                            lblError.Text = "UserID already in use";
                        }
                    }
                    catch (Exception)
                    {
                        try
                        {
                            account.Insert(tbUserID.Text, tbPassword.Text, tbEmail.Text);
                            int AccountID = account.GetAccountID(tbUserID.Text);
                            ProcessUserName(AccountID);
                            ProcessAccountRoles(AccountID);
                        }
                        catch (Exception err)
                        {
                            Page_Error("The following error occurred " + err.Message);
                        }

                        Response.Redirect("AdmAcntList.aspx");
                    }
                }
            }
        }
예제 #10
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();
        }
예제 #11
0
        override protected void OnInit(EventArgs e)
        {
            //
            // CODEGEN: This call is required by the ASP.NET Web Form Designer.
            //
            InitializeComponent();
            base.OnInit(e);

            SqlConnection connection = new AppEnv(Context).GetConnection();

            account  = new Account(connection);
            property = new AccountProperty(connection);
            role     = new AccountRoles(connection);
        }
예제 #12
0
        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() + "&nbsp;";
            lbByline.Text    = property.GetValue(Convert.ToInt32(dr["Byline"]),
                                                 "UserName").Trim();
            lbTeaser.Text  = dr["Teaser"].ToString() + "&nbsp;";
            lbBody.Text    = dr["Body"].ToString();
            lbTagline.Text = dr["Tagline"].ToString() + "&nbsp;";
            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 void Page_Load(object sender, System.EventArgs e)
        {
            appEnv   = new AppEnv(Context);
            zone     = new Zone(appEnv.GetConnection());
            property = new AccountProperty(appEnv.GetConnection());

            if (!IsPostBack)
            {
                DataTable dtz = zone.GetAllZones();

                ddlZones.Items.Add(new ListItem("Select a zone", "0"));

                foreach (DataRow dr in dtz.Rows)
                {
                    ddlZones.Items.Add(new ListItem(dr["Title"].ToString(),
                                                    dr["ZoneID"].ToString()));
                }
            }

            strZoneIds = property.GetValue(AccountID, "ZoneCards").Split(',');
            ZoneID     = Convert.ToInt32(strZoneIds[Card]);

            if (ZoneID == 0)
            {
                pnlTitle.Visible   = false;
                pnlBody.Visible    = false;
                ibnEditNew.Visible = true;
                lbEmpty.Visible    = true;

                return;
            }

            if (ZoneID > 0)
            {
                DataRow drz = zone.GetZone(ZoneID);
                hlZoneName.Text        = drz["Title"].ToString();
                hlZoneName.NavigateUrl = "ZonePg.aspx?zone=" + drz["ZoneID"];
                BuildBody();
            }
            else
            {
                DataRow drz = zone.GetZone(-ZoneID);
                hlZoneName.Text        = drz["Title"].ToString();
                hlZoneName.NavigateUrl = "ZonePg.aspx?zone=" + drz["ZoneID"];
                pnlBody.Visible        = false;
            }
        }
예제 #14
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            aid = Convert.ToInt32(Request.QueryString["AccountID"]);

            if (aid == 0)
            {
                Page_Error("AccountID Missing");
            }

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

            dr = account.GetAccountForID(aid);

            lbUserID.Text   = dr["UserName"].ToString();
            lbUserName.Text = property.GetValue(Convert.ToInt32(dr["AccountID"]), "UserName");
            lbEmail.Text    = dr["Email"].ToString();
        }
예제 #15
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            int curId  = Convert.ToInt32(Request.QueryString["ID"]);
            int curVer = Convert.ToInt32(Request.QueryString["Ver"]);

            if (!Request.IsAuthenticated)
            {
                ucLogin.Visible = true;
            }
            else
            {
                ucLogout.Visible = true;
            }

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

            DataRow dr = content.GetContentForIDVer(curId, curVer);

            if (Convert.ToInt32(dr["Protected"]) > 0)
            {
                if (!Request.IsAuthenticated)
                {
                    Response.Redirect("../Login.aspx?URL=" + HttpUtility.UrlEncode(Request.RawUrl));
                }
            }

            if (dr != null)
            {
                lbHeadline.Text = dr["Headline"].ToString();
                lbSource.Text   = dr["Source"].ToString();
                lbByline.Text   = property.GetValue(Convert.ToInt32(dr["Byline"]), "UserName").Trim();
                lbDate.Text     = dr["ModifiedDate"].ToString();
                lbTeaser.Text   = dr["Teaser"].ToString();
                lbBody.Text     = dr["Body"].ToString();
                lbTagline.Text  = dr["Tagline"].ToString();
            }
            else
            {
                lbHeadline.Text  = "No Stories";
                lbBy.Visible     = false;
                lbDashes.Visible = false;
            }
        }
예제 #16
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            aid = Convert.ToInt32(Request.QueryString["AccountID"]);

            if (aid == 0)
            {
                Page_Error("AccountID Missing");
            }

            if (aid == 1)
            {
                bnRemove.Visible = false;
            }

            account  = new Account(appEnv.GetConnection());
            property = new AccountProperty(appEnv.GetConnection());
            roles    = new AccountRoles(appEnv.GetConnection());

            dr = account.GetAccountForID(aid);

            lbUserID.Text   = dr["UserName"].ToString();
            lbUserName.Text = property.GetValue(aid, "UserName");
            lbEmail.Text    = dr["Email"].ToString();

            DataTable roledt = roles.GetRolesForID(aid);

            foreach (DataRow drr in roledt.Rows)
            {
                lbRoles.Items.Add(drr["Role"].ToString());
            }

            if (roledt.Rows.Count == 0)
            {
                lbRoles.Items.Add("User");
            }
        }
예제 #17
0
        public async Task <HttpResponseMessage> DeleteAccountProperty(string accountName, [FromBody] AccountProperty property)
        {
            try
            {
                using (var db = new Database())
                {
                    await ThrowIfNotAValidAccount(db, accountName);

                    await db.SetAccountProperty(accountName, property.Key, string.Empty);
                }

                return(CreateNoContentResponse());
            }
            catch (Exception ex)
            {
                return(CreateExceptionResponse(ex));
            }
        }
예제 #18
0
 set => SetValue(AccountProperty, value);
예제 #19
0
        public async Task <IActionResult> SetProperty([FromBody] AccountProperty property)
        {
            await _svc.SetProperty(property);

            return(Ok());
        }
        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);
                }
            }
        }