Ejemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //check login
            int UserId = 0;

            if (Request.Cookies["VC"] != null)
            {
                string VC = Request.Cookies["VC"].Values["VC"];
                Classes.LoginSession ls = new Classes.LoginSession();
                UserId = ls.getUserId(VC);
                if (UserId == 0) //if user not logged in redirect to login
                {
                    Response.Redirect("~/Login/Notifications");
                }
                else
                {
                    Session["UserId"] = UserId.ToString();
                }
            }
            else
            {
                Response.Redirect("~/Login/Notifications");
            }

            //all read
            Classes.Notifications n = new Classes.Notifications();
            n.allRead(UserId);

            //get botifications
            DataTable dt = n.notifications(UserId);

            if (dt.Rows.Count == 0)
            {
                //LabelNoRecord.Visible = true;
            }
            else
            {
                RepeaterNotifications.DataSource = dt;
                RepeaterNotifications.DataBind();
            }
        }
Ejemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //check login
            int UserId = 0;

            if (Request.Cookies["VC"] != null)
            {
                string VC = Request.Cookies["VC"].Values["VC"];
                Classes.LoginSession ls = new Classes.LoginSession();
                UserId = ls.getUserId(VC);
                if (UserId == 0) //if user not logged in redirect to login
                {
                    Response.Redirect("~/Login/Notifications");
                }
                else
                {
                    Session["UserId"] = UserId.ToString();
                }
            }
            else
            {
                Response.Redirect("~/Login/Notifications");
            }

            //all read
            Classes.Notifications n = new Classes.Notifications();
            n.allRead(UserId);

            //get botifications
            DataTable dt = n.notifications(UserId);
            
            if (dt.Rows.Count == 0)
            {
                //LabelNoRecord.Visible = true;
            }
            else
            {
                RepeaterNotifications.DataSource = dt;
                RepeaterNotifications.DataBind();
            }
        }
Ejemplo n.º 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //check login
            int UserId = 0;
            if (Session["UserId"] != null)
            {
                UserId = Convert.ToInt32(Session["UserId"]);
            }
            else
            {
                if (Request.Cookies["VC"] != null)
                {
                    string VC = Request.Cookies["VC"].Values["VC"];
                    Classes.LoginSession ls = new Classes.LoginSession();
                    UserId = ls.getUserId(VC);
                    if (UserId == 0) //if user not logged in redirect to login
                    {
                        Response.Redirect("~/Login/Notifications");
                    }
                    else
                    {
                        Session["UserId"] = UserId.ToString();
                    }
                }
                else
                {
                    Response.Redirect("~/Login/Notifications");
                }
            }

            //check user status
            string completionValue = Session["DoneCompletion"] as string; if (String.IsNullOrEmpty(completionValue))
            {
                Classes.UserInfo ui = new Classes.UserInfo();
                int userStatus = ui.getUserStatus(UserId);
                switch (userStatus)
                {
                    case 1:
                        Session["DoneCompletion"] = "1";
                        break;
                    case 0:
                    case 4:
                        Response.Redirect("~/Completion");
                        break;
                    case 2:
                        Response.Redirect("~/Error/UserDisabled");
                        break;
                    case 3:
                        Response.Redirect("~/Error/UserDeactivated");
                        break;
                }
            }

            //all read
            Classes.Notifications n = new Classes.Notifications();
            n.allRead(UserId);

            //get notifications
            DataTable dt = n.notifications(UserId);
            
            if (dt.Rows.Count == 0)
            {
                HiddenFieldStatus.Value = "0";
            }
            else
            {
                RepeaterNotifications.DataSource = dt;
                RepeaterNotifications.DataBind();
                HiddenFieldStatus.Value = "1";
            }
        }
Ejemplo n.º 4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //check login
            int UserId = 0;

            if (Session["UserId"] != null)
            {
                UserId = Convert.ToInt32(Session["UserId"]);
            }
            else
            {
                if (Request.Cookies["VC"] != null)
                {
                    string VC = Request.Cookies["VC"].Values["VC"];
                    Classes.LoginSession ls = new Classes.LoginSession();
                    UserId = ls.getUserId(VC);
                    if (UserId == 0) //if user not logged in redirect to login
                    {
                        Response.Redirect("~/Login/Notifications");
                    }
                    else
                    {
                        Session["UserId"] = UserId.ToString();
                    }
                }
                else
                {
                    Response.Redirect("~/Login/Notifications");
                }
            }

            //check user status
            string completionValue = Session["DoneCompletion"] as string; if (String.IsNullOrEmpty(completionValue))

            {
                Classes.UserInfo ui = new Classes.UserInfo();
                int userStatus      = ui.getUserStatus(UserId);
                switch (userStatus)
                {
                case 1:
                    Session["DoneCompletion"] = "1";
                    break;

                case 0:
                case 4:
                    Response.Redirect("~/Completion");
                    break;

                case 2:
                    Response.Redirect("~/Error/UserDisabled");
                    break;

                case 3:
                    Response.Redirect("~/Error/UserDeactivated");
                    break;
                }
            }

            //all read
            Classes.Notifications n = new Classes.Notifications();
            n.allRead(UserId);

            //get notifications
            DataTable dt = n.notifications(UserId);

            if (dt.Rows.Count == 0)
            {
                HiddenFieldStatus.Value = "0";
            }
            else
            {
                RepeaterNotifications.DataSource = dt;
                RepeaterNotifications.DataBind();
                HiddenFieldStatus.Value = "1";
            }
        }