Esempio n. 1
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            string username = tbUsername.Text.Trim();
            string password = tbPassword.Text.Trim();

            //check if fields are empty
            if(String.IsNullOrEmpty(username) || String.IsNullOrEmpty(password))
            {
                lblOutput.Text = "Please enter username and password";
                return;
            }

            try
            {
                clientAdmin = new EFlatsServiceReference.WcfEFlatsServiceAdminClient("NetTcpBinding_IWcfEFlatsServiceAdmin");
                switch (clientAdmin.AdminLogin(username, password))
                {
                    //1 - success, 2 - passwords dont match, 3 - emails dont match, else - not connected to wcf or db
                    case 1: { this.Hide(); MainForm mainForm = new MainForm(); mainForm.ShowDialog(); break; }
                    case 2: { lblOutput.Text = "Incorrect Username or Password"; break; }
                    case 3: { lblOutput.Text = "Incorrect Username or Password"; break; }
                    default: { lblOutput.Text = "Unable to connect - Try again"; break; }
                }
            }
            catch
            {
                lblOutput.Text = "Unable to connect - Restart application and Try again";
                return;
            }
        }
Esempio n. 2
0
        private void btnBack_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("Changes will be discarded\nDo you wish to proceed?",
                "Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
            return;

            this.Hide();
            MainForm mainForm = new MainForm();
            mainForm.ShowDialog();
        }
Esempio n. 3
0
 private void btnBack_Click(object sender, EventArgs e)
 {
     this.Hide();
     MainForm mainForm = new MainForm();
     mainForm.ShowDialog();
 }