Beispiel #1
0
        public int Checkrecruiter(int __jobid)
        {
            var connreader = new MySqlConnection {
                ConnectionString = Dlconnect.Makeconn()
            };
            var passhash = new ClPwdhash();

            //string to hold data
            var __resultset = 0;

            using (connreader)
            {
                var command = new MySqlCommand("SELECT empid from jobtorecruiter where idjobs = @paramjobs limit 1;",
                                               connreader);
                command.Parameters.Add("@paramjobs", MySqlDbType.Int32).Value = __jobid;

                connreader.Open();

                var reader = command.ExecuteReader();

                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        __resultset = reader.GetInt32(0);
                    }
                }

                reader.Close();
            }

            return(__resultset);
        }
Beispiel #2
0
        //check the usertype for the main windows like is it recruiter of single user
        public int Checkusertype(string uusername, int uusertypes)
        {
            var connreader = new MySqlConnection {
                ConnectionString = Dlconnect.Makeconn()
            };

            var passhash = new ClPwdhash();

            var plhash = 0;

            using (connreader)
            {
                var command =
                    new MySqlCommand(
                        "SELECT uusertype from users where uusername = '******'and uusertype=" + uusertypes +
                        " ; ", connreader);
                connreader.Open();

                var reader = command.ExecuteReader();

                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        plhash = reader.GetInt16(0);
                    }
                }
                reader.Close();
            }

            return(plhash);
        }
Beispiel #3
0
        //jobseeker password or admin 2
        public void Chgpwdjswkey(string keyval, string pwds)
        {
            //recalc password hash
            var clpdh = new ClPwdhash();

            var hashedpwd = clpdh.GetMd5Hash(pwds);

            //
            using (var con = new MySqlConnection())
            {
                con.ConnectionString = Dlconnect.Makeconn();
                con.Open();

                using (var com = con.CreateCommand())
                {
                    com.CommandType = CommandType.Text;
                    com.CommandText = "UPDATE users set uPassword = '******' where uPasswordresetcode= '" +
                                      keyval + "' and uUserType = 2; ";

                    com.Parameters.Add("@keyval", MySqlDbType.VarChar).Value = keyval;

                    int reslt = com.ExecuteNonQuery();
                }

                con.Close();
            }
        }
Beispiel #4
0
        //check if the recruiter exists in the database
        public string Checkrecusern(string userns)
        {
            var connreader = new MySqlConnection { ConnectionString = Dlconnect.Makeconn() };

            //get hashcode
            //
            var passhash = new ClPwdhash();

            var plhash = string.Empty;

            using (connreader)
            {
                var command =
                    new MySqlCommand(
                        "SELECT uUsername FROM users where uusername='******' and uusertype = 1; ", connreader);
                connreader.Open();

                var reader = command.ExecuteReader();

                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        plhash = reader.GetString(0);
                    }
                }
                else
                {
                    return null;
                }
                reader.Close();
            }

            return plhash;
        }
        protected void Button1_Click(object sender, EventArgs e)
        {
            //insert into the usertable random key
            //recalc password hash
            var clpdh = new ClPwdhash();
            var rnd   = new Random();

            string hashedpwd = clpdh.GetMd5Hash(rnd.Next(10, 1000).ToString(CultureInfo.InvariantCulture));

            //one goes to email as hashvalue.
            var cemp = new DlEmailprocessor();

            string ebody = string.Empty;

            //second inserts into the db.
            var clog = new DlLogins();

            if (CheckBox1.Checked)
            {
                clog.Chgkeyrec(TextBox1.Text, hashedpwd);

                ebody =
                    cemp.Emailpwdnotify("https://ahrcloud.com/PwdChange.aspx?keyid=" + hashedpwd + "&utype=" + 1,
                                        TextBox1.Text).ToString();

                cemp.Clemail.Sendmailproc(TextBox1.Text, "ahrcloud: Password Reset", ebody, 2);

                //logg it as the entry for email
                cemp.Sendappemaildbupdate(TextBox1.Text, 2);
            }

            else
            {
                clog.Chgkeyuser(TextBox1.Text, hashedpwd);

                ebody =
                    cemp.Emailpwdnotify("https://ahrcloud.com/PwdChange.aspx?keyid=" + hashedpwd + "&utype=" + 2,
                                        TextBox1.Text).ToString();

                cemp.Clemail.Sendmailproc(TextBox1.Text, "ahrcloud: Password Reset", ebody, 2);

                //logg it as the entry for email
                cemp.Sendappemaildbupdate(TextBox1.Text, 2);
            }
        }
Beispiel #6
0
        //get employee id ony for employees
        public string Userwelcomename(string pusername, int uusertype, int empid)
        {
            var connreader = new MySqlConnection {
                ConnectionString = Dlconnect.Makeconn()
            };

            //get hashcode
            //
            var passhash = new ClPwdhash();

            //string to hold data
            var tmphld = string.Empty;

            using (connreader)
            {
                var command =
                    new MySqlCommand(
                        "SELECT concat(ufirstname,' ',ulastname)as names FROM users where uusername = '******' and uusertype = " + uusertype + "; ", connreader);
                connreader.Open();

                var reader = command.ExecuteReader();

                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        tmphld = reader.GetString(0);
                    }
                }
                else
                {
                    return(null);
                }
                reader.Close();
            }

            return(tmphld);
        }
Beispiel #7
0
        //this is admin user
        //1 is admin
        public string Getuser(string userns, string pwds)
        {
            var connreader = new MySqlConnection {
                ConnectionString = Dlconnect.Makeconn()
            };

            //get hashcode
            //
            var passhash = new ClPwdhash();

            //string to hold data
            var tmphld = string.Empty;

            using (connreader)
            {
                var command =
                    new MySqlCommand(
                        "SELECT uUsername FROM users where upassword = '******' and uusername='******' and uusertype = 1; ", connreader);
                connreader.Open();

                var reader = command.ExecuteReader();

                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        tmphld = reader.GetString(0);
                    }
                }
                else
                {
                    return(null);
                }
                reader.Close();
            }

            return(tmphld);
        }
Beispiel #8
0
        //check the password key against the database
        public string Getkeyuser(string keyids, int utype)
        {
            var connreader = new MySqlConnection {
                ConnectionString = Dlconnect.Makeconn()
            };

            //get hashcode
            //
            var passhash = new ClPwdhash();

            //string to hold data
            var tmphld = string.Empty;

            using (connreader)
            {
                var command =
                    new MySqlCommand(
                        "SELECT upasswordresetcode FROM users where upasswordresetcode = '" + keyids +
                        "' and uusertype = " + utype + "; ", connreader);
                connreader.Open();

                var reader = command.ExecuteReader();

                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        tmphld = reader.GetString(0);
                    }
                }
                else
                {
                    return(null);
                }
                reader.Close();
            }

            return(tmphld);
        }
Beispiel #9
0
        //check if the candidate exists in the database
        public string Checkcanusern(string userns)
        {
            var connreader = new MySqlConnection {
                ConnectionString = Dlconnect.Makeconn()
            };

            //get hashcode
            //
            var passhash = new ClPwdhash();

            var plhash = string.Empty;

            using (connreader)
            {
                var command =
                    new MySqlCommand(
                        "SELECT uUsername FROM users where uusername='******' and uusertype = 2; ", connreader);
                connreader.Open();

                var reader = command.ExecuteReader();

                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        plhash = reader.GetString(0);
                    }
                }
                else
                {
                    return(null);
                }
                reader.Close();
            }

            return(plhash);
        }
Beispiel #10
0
        //get employee id ony for employees
        public string Userwelcomename(string pusername, int uusertype, int empid)
        {
            var connreader = new MySqlConnection { ConnectionString = Dlconnect.Makeconn() };

            //get hashcode
            //
            var passhash = new ClPwdhash();

            //string to hold data
            var tmphld = string.Empty;

            using (connreader)
            {
                var command =
                    new MySqlCommand(
                        "SELECT concat(ufirstname,' ',ulastname)as names FROM users where uusername = '******' and uusertype = " + uusertype + "; ", connreader);
                connreader.Open();

                var reader = command.ExecuteReader();

                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        tmphld = reader.GetString(0);
                    }
                }
                else
                {
                    return null;
                }
                reader.Close();
            }

            return tmphld;
        }
Beispiel #11
0
        //this is admin user
        //1 is admin
        public string Getuser(string userns, string pwds)
        {
            var connreader = new MySqlConnection { ConnectionString = Dlconnect.Makeconn() };

            //get hashcode
            //
            var passhash = new ClPwdhash();

            //string to hold data
            var tmphld = string.Empty;

            using (connreader)
            {
                var command =
                    new MySqlCommand(
                        "SELECT uUsername FROM users where upassword = '******' and uusername='******' and uusertype = 1; ", connreader);
                connreader.Open();

                var reader = command.ExecuteReader();

                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        tmphld = reader.GetString(0);
                    }
                }
                else
                {
                    return null;
                }
                reader.Close();
            }

            return tmphld;
        }
Beispiel #12
0
        //check the password key against the database
        public string Getkeyuser(string keyids, int utype)
        {
            var connreader = new MySqlConnection { ConnectionString = Dlconnect.Makeconn() };

            //get hashcode
            //
            var passhash = new ClPwdhash();

            //string to hold data
            var tmphld = string.Empty;

            using (connreader)
            {
                var command =
                    new MySqlCommand(
                        "SELECT upasswordresetcode FROM users where upasswordresetcode = '" + keyids +
                        "' and uusertype = " + utype + "; ", connreader);
                connreader.Open();

                var reader = command.ExecuteReader();

                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        tmphld = reader.GetString(0);
                    }
                }
                else
                {
                    return null;
                }
                reader.Close();
            }

            return tmphld;
        }
Beispiel #13
0
        //change passwords with keys.....
        //change passwords
        //rec password or admin 1
        public void Chgpwdrecwkey(string keyval, string pwds)
        {
            //recalc password hash
            var clpdh = new ClPwdhash();

            var hashedpwd = clpdh.GetMd5Hash(pwds);

            //
            using (var con = new MySqlConnection())
            {
                con.ConnectionString = Dlconnect.Makeconn();
                con.Open();

                using (var com = con.CreateCommand())
                {
                    com.CommandType = CommandType.Text;
                    com.CommandText = "UPDATE users set uPassword = '******' where upasswordresetcode= '" +
                                      keyval + "' and uUserType = 1;";

                    com.Parameters.Add("@keyval", MySqlDbType.VarChar).Value = keyval;

                    int reslt = com.ExecuteNonQuery();
                }

                con.Close();
            }
        }
Beispiel #14
0
        //check the usertype for the main windows like is it recruiter of single user
        public int Checkusertype(string uusername, int uusertypes)
        {
            var connreader = new MySqlConnection { ConnectionString = Dlconnect.Makeconn() };

            var passhash = new ClPwdhash();

            var plhash = 0;

            using (connreader)
            {
                var command =
                    new MySqlCommand(
                        "SELECT uusertype from users where uusername = '******'and uusertype=" + uusertypes +
                        " ; ", connreader);
                connreader.Open();

                var reader = command.ExecuteReader();

                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        plhash = reader.GetInt16(0);
                    }
                }
                reader.Close();
            }

            return plhash;
        }