示例#1
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (Client)
            {
                try
                {
                    Client Log_Client = new Client(UName.Text, 0, 0, "a", 0, "a", UPassword.Text, "Dormitory");

                    ClientRepository repository = new ClientRepository();

                    if (repository.FindById(Log_Client))
                    {
                        Log_Client.Construct();

                        UserWall myUserWall = new UserWall(Client, StrTextBox, Log_Client);

                        myUserWall.Show();

                        Close();
                    }
                    else
                    {
                        MessageBox.Show("Incorrect User Name or Password");
                    }
                }
                catch (Exception E) {
                    MessageBox.Show("Error:" + E);
                }
            }
            if (!Client)
            {
                try {
                    Seller log_Seller = new Seller(UName.Text, UPassword.Text, 0, 0, "a", 0, "Email", "Dormitory");

                    SellerRepository repository = new SellerRepository();

                    if (repository.FindById(log_Seller))
                    {
                        log_Seller.Construct();

                        SellerWall mySellerWall = new SellerWall(log_Seller);

                        mySellerWall.Show();

                        Close();
                    }
                    else
                    {
                        MessageBox.Show("Incorrect User Name or Password");
                    }
                }catch {
                    MessageBox.Show("Please fill up the forum correctly");
                }
            }
        }
示例#2
0
        private void button2_Click(object sender, EventArgs e)
        {
            if (Client)
            {
                try
                {
                    Client           newClient  = new Client(UName.Text, System.Convert.ToInt32(Room_Number.Text), System.Convert.ToInt32(Course.Text), PhoneNumber.Text, System.Convert.ToInt32(Age.Text), Email.Text, UPassword.Text, Dormitory.Text);
                    ClientRepository repository = new ClientRepository();
                    if (repository.Add(newClient))
                    {
                        MessageBox.Show("Registering proccess was succesful");
                    }
                    else
                    {
                        MessageBox.Show("We could't register");
                    }

                    Form1 Log_in = new Form1(StrTextBox, Client);
                    Log_in.Show();
                    Close();
                }
                catch {
                    MessageBox.Show("Please fill up the form correctly");
                }
            }
            else
            {
                try {
                    Seller           newSeller  = new Seller(UName.Text, UPassword.Text, System.Convert.ToInt32(Room_Number.Text), System.Convert.ToInt32(Course.Text), PhoneNumber.Text, System.Convert.ToInt32(Age.Text), Email.Text, Dormitory.Text);
                    SellerRepository repository = new SellerRepository();
                    if (repository.Add(newSeller))
                    {
                        MessageBox.Show("Registering proccess was succesful");
                    }
                    else
                    {
                        MessageBox.Show("We could't register");
                    }
                    Form1 Log_in = new Form1(StrTextBox, Client);
                    Log_in.Show();
                    Close();
                }
                catch {
                    MessageBox.Show("Please fill up the form correctly");
                }
            }
        }