Exemple #1
0
        protected void btnLogin_Click(object sender, EventArgs e)
        {
            string email = tbemail.Text;
            string pwd   = tbpwd.Text;

            DataSet1 ds = new DataSet1();

            DataSet1TableAdapters.UsersTableTableAdapter taUser =
                new DataSet1TableAdapters.UsersTableTableAdapter();
            taUser.Fill(ds.UsersTable);
            DataRow[] dr   = ds.UsersTable.Select("Email='" + email + "'");
            Users     user = new Users();

            if (dr.Count() == 0)
            {
                Label1.Visible = true;
                Label1.Text    = "User Doesnt exists!! Sign Up first";
            }
            else if ((string)(dr[0]["Password"]) != pwd)
            {
                Label1.Visible = true;
                Label1.Text    = "Invalid Password !!!!";
            }
            else if ((string)(dr[0]["UserType"]) == "Employer")
            {
                user.FirstName = (string)dr[0]["FirstName"];
                user.LastName  = (string)dr[0]["LastName"];
                user.Password  = (string)dr[0]["Password"];
                user.userid    = (int)dr[0]["userid"];
                user.UserType  = (string)dr[0]["UserType"];
                // if ((string)dr[0]["Skillset"] != null)
                //{
                //      user.SkillSet = (string)dr[0]["Skillset"];
                //  }
                Session["user"]   = user;
                Session["userid"] = user.userid;
                Response.Redirect("~/OrganizationSide/OrgShowAllProj.aspx");
            }
            else if ((string)(dr[0]["UserType"]) == "Student")
            {
                user.FirstName     = (string)dr[0]["FirstName"];
                user.LastName      = (string)dr[0]["LastName"];
                user.Password      = (string)dr[0]["Password"];
                user.userid        = (int)dr[0]["userid"];
                user.UserType      = (string)dr[0]["UserType"];
                Session["student"] = user;
                Session["message"] = null;
                Response.Redirect("~/Index.aspx");
            }
        }
Exemple #2
0
        protected void btnregister_Click(object sender, EventArgs e)
        {
            DataSet1 ds = new DataSet1();

            DataSet1TableAdapters.UsersTableTableAdapter taUsers =
                new DataSet1TableAdapters.UsersTableTableAdapter();
            taUsers.Fill(ds.UsersTable);
            DataSet1.UsersTableRow urow = ds.UsersTable.NewUsersTableRow();

            Users  user    = new Users();
            string session = "";

            user.FirstName = tbfname.Text;
            user.LastName  = tblname.Text;
            user.Email     = tbemail.Text;
            user.Password  = tbcpwd.Text;
            user.SkillSet  = tbskills.Text;

            if (rbemp.Checked)
            {
                user.UserType = rbemp.Text;
                session       = "user";
            }
            else
            {
                user.UserType = rbstu.Text;
                session       = "student";
            }

            urow.FirstName = user.FirstName;
            urow.LastName  = user.LastName;
            urow.Email     = user.Email;
            urow.Password  = user.Password;
            urow.UserType  = user.UserType;
            urow.Skillset  = user.SkillSet;

            ds.UsersTable.Rows.Add(urow);
            taUsers.Update(ds.UsersTable);
            Session["message"] = "Registration successful. Proceed to log in.";
            Response.Redirect("LoginPage.aspx");
        }