Exemplo n.º 1
0
        public static void EnterMethod(int callsnumber)
        {
            for (int i = 0; i < callsnumber; i++)
            {
                int num = int.Parse(Thread.CurrentThread.Name.Substring(7));

                if (num % 2 == 0)
                {
                    try
                    {
                        IAddUserService sus  = ServiceFactoryCreator.CreateServicesFactory().CreateUserClient();
                        Test            test = new Test();
                        test.Letter = "";
                        string hash = Hashhelper.GetProperty(test);
                        test.HashCode = Hashhelper.GetMD5(hash);
                        sus.Search(test);
                    }
                    catch (Exception ex)
                    {
                        log.ErrorFormat("Search(): {0}", ex.Message);
                        throw ex;
                    }
                }
                else
                {
                    try
                    {
                        IAddUserService addu = ServiceFactoryCreator.CreateServicesFactory().CreateUserClient();
                        User            user = new User();
                        user.UserName     = RandomString(8);
                        user.Name         = RandomString(6);
                        user.SurName      = RandomString(8);
                        user.UserPassword = RandomString(9);
                        user.E_Mail       = RandomString(4) + "@" + RandomString(8);
                        string hash = Hashhelper.GetProperty(user);
                        user.HashCode = Hashhelper.GetMD5(hash);
                        addu.AddUser(user);
                    }
                    catch (Exception ex)
                    {
                        log.ErrorFormat("Search(): {0}", ex.Message);
                        throw ex;
                    }
                }
            }
            s.WaitOne();
            MessageBox.Show("End of test tool!");
            log.DebugFormat("Number of calls was: {0}", callsnumber);
            Environment.Exit(Environment.ExitCode);
            s.Release();
        }
        public bool AddUser(User user)
        {
            string hash = user.HashCode;

            string input = Hashhelper.GetProperty(user);

            if (Hashhelper.VerifyMd5Hash(input, hash))
            {
                AddUserService us    = new AddUserService();
                bool           state = us.AddUser(user);
                return(state);
            }
            return(false);
        }
Exemplo n.º 3
0
        private void button2_Click(object sender, EventArgs e)
        {
            IAddUserService adduser = ServiceFactoryCreator.CreateServicesFactory().CreateUserClient();
            User            user    = new User();

            user.UserName     = textBox1.Text;
            user.Name         = textBox2.Text;
            user.SurName      = textBox3.Text;
            user.UserPassword = textBox5.Text;
            user.E_Mail       = textBox4.Text;

            string hash = Hashhelper.GetProperty(user);

            user.HashCode = Hashhelper.GetMD5(hash);
            adduser.AddUser(user);
        }
Exemplo n.º 4
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            IAddUserService adduser = ServiceFactoryCreator.CreateServicesFactory().CreateUserClient();
            User            user    = new User();

            user.UserName     = TextBox1.Text;
            user.Name         = TextBox2.Text;
            user.SurName      = TextBox3.Text;
            user.UserPassword = TextBox5.Text;
            user.E_Mail       = TextBox4.Text;

            string hash = Hashhelper.GetProperty(user);

            user.HashCode = Hashhelper.GetMD5(hash);
            adduser.AddUser(user);
            Response.Write("User is added!");
        }
Exemplo n.º 5
0
 private void button1_Click(object sender, EventArgs e)
 {
     try
     {
         IAddUserService sus  = ServiceFactoryCreator.CreateServicesFactory().CreateUserClient();
         Test            test = new Test();
         test.Letter = textBox1.Text;
         string hash = Hashhelper.GetProperty(test);
         test.HashCode = Hashhelper.GetMD5(hash);
         //test.HashCode = "";
         dataGridView1.DataSource = sus.Search(test);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
        public IEnumerable <spSearch_Result> Search([FromBody] Test test)
        {
            string hash  = test.HashCode;
            string input = Hashhelper.GetProperty(test);

            if (Hashhelper.VerifyMd5Hash(input, hash))
            {
                AddUserService us    = new AddUserService();
                var            state = us.Search(test);
                log.DebugFormat("WebApi got letter {0}.", test.Letter);
                return(state);
            }
            else
            {
                return(null);
            }
        }