Ejemplo n.º 1
0
        // For user registration
        protected void RegisterUser_CreatedUser(object sender, EventArgs e)
        {
            BusinessLayer.LogInInfoCalc m = new BusinessLayer.LogInInfoCalc();
            if (m.DuplicateUserInfoRec(UserName.Text) == 0)
            {
                List <string> strlist = new List <string>();
                strlist.Add(UserName.Text);
                strlist.Add(Password.Text);
                strlist.Add(Email.Text);

                m.InsertRecord(strlist);
                int noofRecord = m.GetUserInfoRecord(UserName.Text, Password.Text);
                Session["Reviews"] = m.GetReviews();
                Session.Add("UserID", noofRecord);
                Session.Add("UserName", UserName.Text);
                if (UserName.Text.ToUpper() == "ADMINISTRATOR" || UserName.Text.ToUpper() == "ADMIN")
                {
                    Response.Redirect("~/AdminPanel.aspx");
                }
                else
                {
                    Response.Redirect("~/Programming.aspx");
                }
            }
        }
Ejemplo n.º 2
0
        protected void LoginButton_Click(object sender, EventArgs e)
        {
            BusinessLayer.LogInInfoCalc m = new BusinessLayer.LogInInfoCalc();
            int noofRecord = m.GetUserInfoRecord(LoginUser.UserName, LoginUser.Password);

            if (noofRecord >= 1)
            {
                Session.Add("UserName", LoginUser.UserName);
                Session.Add("UserID", noofRecord);
                Response.Redirect("~/Tool.aspx");
            }
        }
        protected void ChangePasswordPushButton_Click(object sender, EventArgs e)
        {
            Label1.Text = "";
            string str = Session["UserName"].ToString().Trim();

            BusinessLayer.LogInInfoCalc m = new BusinessLayer.LogInInfoCalc();
            int noofRecord = m.GetUserInfoRecord(str, CurrentPassword.Text.Trim());

            if (noofRecord > 0)
            {
                int ID = int.Parse(Session["UserID"].ToString());
                m.UserpasswordUpdate(NewPassword.Text.Trim(), ID);
                Response.Redirect("~/Account/ChangePasswordSuccess.aspx");
            }
            else
            {
                Label1.Text = "Current Password incorrect";
            }
        }
Ejemplo n.º 4
0
        // To login
        protected void LoginButton_Click(object sender, EventArgs e)
        {
            BusinessLayer.LogInInfoCalc m = new BusinessLayer.LogInInfoCalc();
            int UserID = m.GetUserInfoRecord(LoginUser.UserName, LoginUser.Password);

            if (UserID >= 1)
            {
                Session["Reviews"] = m.GetReviews();
                Session.Add("UserID", UserID);
                Session.Add("UserName", LoginUser.UserName.Trim());

                if (LoginUser.UserName.ToUpper() == "ADMINISTRATOR" || LoginUser.UserName.ToUpper() == "ADMIN")
                {
                    Session["Reviews"] = "NotShow";
                    Response.Redirect("~/AdminPanel.aspx");
                }
                else
                {
                    BusinessLayer.PrResultSummary pr = new BusinessLayer.PrResultSummary();
                    DataTable dtProg     = pr.GetProg_Selection(UserID);
                    DataTable dtTool     = pr.GetTool_Selection(UserID);
                    DataTable dtmath     = pr.GetMathmetic_Selection(UserID);
                    DataTable dtresearch = pr.GetResearch_Selection(UserID);

                    if (dtProg.Rows.Count == 0 && dtTool.Rows.Count == 0 && dtmath.Rows.Count == 0 && dtresearch.Rows.Count == 0)
                    {
                        Response.Redirect("~/Programming.aspx");
                    }
                    else
                    {
                        Session["Programing"]  = dtProg;
                        Session["ResearchExp"] = dtresearch;
                        Session["Mathmetic"]   = dtmath;
                        Session["TOOL"]        = dtTool;
                        Response.Redirect("~/ResultSummary.aspx");
                    }
                }
            }
        }
Ejemplo n.º 5
0
        protected void btnOkay_Click(object sender, EventArgs e)
        {
            string msg = TextBox1.Text.Trim();

            if (msg.Length > 0 && Session["UserID"] != null)
            {
                int id = (int)Session["UserID"];
                BusinessLayer.LogInInfoCalc m = new BusinessLayer.LogInInfoCalc();
                Session["Reviews"] = msg;
                m.UserReviewsUpdate(msg, id);
            }
            if (Session["call"] != null)
            {
                if (Session["call"].ToString() == "LOG")
                {
                    btnLogout.Visible    = false;
                    btnContactUs.Visible = false;
                    btnChgPswd.Visible   = false;
                    lblUserName.Text     = "";
                    Response.Redirect("~/LogIn.aspx");
                }
            }
        }