Пример #1
0
        private void BackHomebtn_Click(object sender, EventArgs e)
        {
            MainPageForm mainPage = new MainPageForm();

            mainPage.Show();
            this.Hide();
        }
        ///
        ///HANDLE THE LOGIN
        ///
        public void initLogin()
        {
            var dt = accountServices.GetUserByPhone(model.Username);

            if (dt.Rows.Count <= 0)
            {
                MessageBox.Show("Incorrect Phone Number", "Account Login", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else
            {
                foreach (DataRow dataRow in dt.Rows)
                {
                    Boolean match = hashpassword.VerifyPassword(model.Password, dataRow["password"].ToString());
                    if (match)
                    {
                        if (dataRow["isActive"].ToString() != "Activate")
                        {
                            MessageBox.Show("Account not Active,please contact admin", "InActive Account", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            return;
                        }
                        else
                        {
                            model.Username = dataRow["username"].ToString();
                            model.Phone    = dataRow["phone"].ToString();
                            model.IsActive = dataRow["isActive"].ToString();
                            model.IsAdmin  = dataRow["isAdmin"].ToString();
                            model.Id       = dataRow["id"].ToString();
                            model.SetAccountDetails(dt);
                            SetAccountDetails(model);
                            //MessageBox.Show(match, "results", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            MainPageForm homepage = new MainPageForm();
                            homepage.Show();
                            this.Hide();
                        }
                    }
                    else
                    {
                        MessageBox.Show("Incorrect Phone Number", "Account Login", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }
            }
        }