示例#1
0
        public void PopulateGrid()
        {
            userService us = new userService();

            GridView1.DataSource = us.GetUsers();
            GridView1.DataBind();
        }
示例#2
0
        public static bool idExists(string id)
        {
            bool        ok = false;
            userService us = new userService();
            DataSet     ds = us.GetUser(id);

            if (ds.Tables[0].Rows.Count != 0)
            {
                ok = true;
            }
            return(ok);
        }
示例#3
0
 protected void del_Click(object sender, EventArgs e)
 {
     if (validation.idExists(idNum.Text))
     {
         userService us = new userService();
         us.LogicalDelete(idNum.Text);
         IDWrng.Text = "";
     }
     else
     {
         idNum.Text  = "";
         IDWrng.Text = "Please enter valid id number.";
     }
 }
        protected void submit_Click(object sender, EventArgs e)
        {
            string firstN   = Request.Form["fName"];
            string lastN    = Request.Form["lName"];
            string mail     = Request.Form["mail"];
            int    age      = int.Parse(Request.Form["age"]);
            string pass     = Request.Form["password"];
            string passVrfy = Request.Form["passwordConf"];
            string id       = UId.Text;

            User u1 = new User();

            u1.Addrs          = mail;
            u1.Age            = age;
            u1.Firstname      = firstN;
            u1.Lastname       = lastN;
            u1.pssWrd         = pass;
            u1.passwordVerify = passVrfy;
            u1.ID             = id;

            if (validation.CheckUser(u1))
            {
                userService us = new userService();
                DataSet     ds = us.GetUser(u1.ID);
                if (ds.Tables[0].Rows.Count == 0)
                {
                    us.InsertUser(u1);
                    Session["curUser"]      = u1;
                    Session["curUserFName"] = u1.Firstname;
                    Response.Redirect("Homepage.aspx");
                }
                else
                {
                    submit.Enabled  = false;
                    submit.CssClass = "sub1";
                    csWrong.Text    = "User already exists.";
                }
            }
            else
            {
                submit.Enabled  = false;
                submit.CssClass = "sub1";
                csWrong.Text    = "Something went wrong. Please try again.";
            }
        }
示例#5
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            string      id       = idTxt.Text;
            string      passWord = passTxt.Text;
            userService us       = new userService();
            DataSet     ds       = us.GetUsersByIdAndPas(id, passWord);

            if (ds.Tables[0].Rows.Count != 0 && bool.Parse(ds.Tables[0].Rows[0][6].ToString()))
            {
                User u = new User();
                u.ID               = ds.Tables[0].Rows[0][0].ToString();
                u.pssWrd           = ds.Tables[0].Rows[0][4].ToString();
                u.Firstname        = ds.Tables[0].Rows[0][1].ToString();
                u.Lastname         = ds.Tables[0].Rows[0][2].ToString();
                u.Addrs            = ds.Tables[0].Rows[0][3].ToString();
                u.Age              = Int32.Parse(ds.Tables[0].Rows[0][5].ToString());
                u.Manager          = bool.Parse(ds.Tables[0].Rows[0][7].ToString());
                Session["curUser"] = u;
                Response.Redirect("Homepage.aspx");
            }
            else
            {
                if (ds.Tables[0].Rows.Count == 0)
                {
                    problemShow.Text = "Please enter an existing user or sign up.";
                }
                else
                {
                    if (!bool.Parse(ds.Tables[0].Rows[0][6].ToString()))
                    {
                        problemShow.Text = "Please check with admins activity status.";
                    }
                    else
                    {
                        problemShow.Text = "Please enter an existing user or sign up.";
                    }
                }
            }
        }
示例#6
0
        protected void Submit_Click(object sender, EventArgs e)
        {
            string firstN = fNameChange.Text;
            string lastN  = lNameChange.Text;
            string email  = mailChange.Text;
            int    age;
            string pass     = passwordChnge.Text;
            string passVrfy = passwordVrfy.Text;
            string id       = ((User)Session["curUser"]).ID;

            if (string.IsNullOrEmpty(fNameChange.Text))
            {
                firstN = ((User)Session["curUser"]).Firstname;
            }

            if (string.IsNullOrEmpty(lNameChange.Text))
            {
                lastN = ((User)Session["curUser"]).Lastname;
            }

            if (string.IsNullOrEmpty(mailChange.Text))
            {
                email = ((User)Session["curUser"]).Addrs;
            }

            if (string.IsNullOrEmpty(ageChange.Text))
            {
                age = ((User)Session["curUser"]).Age;
            }
            else
            {
                age = int.Parse(ageChange.Text);
            }

            if (string.IsNullOrEmpty(passwordChnge.Text))
            {
                pass     = ((User)Session["curUser"]).pssWrd;
                passVrfy = pass;
            }

            User u1 = new User();

            u1.Addrs          = email;
            u1.Age            = age;
            u1.Firstname      = firstN;
            u1.Lastname       = lastN;
            u1.pssWrd         = pass;
            u1.passwordVerify = passVrfy;
            u1.ID             = id;

            if (validation.CheckUser(u1))
            {
                userService us = new userService();
                us.UpdateUser(u1);
                Session["curUser"]      = u1;
                Session["curUserFName"] = u1.Firstname;
                Response.Redirect("Homepage.aspx");
            }
            else
            {
                Submit.CssClass = "sub1";
                csWrng.Text     = "Something went wrong. Please check your input fits the description and try again..";
            }
        }