Пример #1
0
        private void pictureBox1_Click(object sender, EventArgs e)
        {
            ShowTenantsDataForm stdf = new ShowTenantsDataForm();

            stdf.Show();
            Dispose();
        }
Пример #2
0
        private void ShowTenantsDataButton_Click(object sender, EventArgs e)
        {
            ShowTenantsDataForm stdf = new ShowTenantsDataForm();

            stdf.Show();
            Close();
            Dispose();
        }
        private void DeleteButton_Click(object sender, EventArgs e)
        {
            String id = SearchByMobileNoTextBox.Text;
            Tenant s  = DB.Tenants.SingleOrDefault(x => x.Mobile_No == id);

            if (s != null)
            {
                DB.Tenants.DeleteOnSubmit(s);
                DB.SubmitChanges();
                ShowTenantsDataForm sodf = new ShowTenantsDataForm();
                sodf.Show();
                Close();
                Dispose();
            }
            else
            {
                MessageBox.Show("Data not found");
            }
        }
Пример #4
0
        private void UpdateButton_Click(object sender, EventArgs e)
        {
            if (NameTextBox.Text != "" && PasswordTextBox.Text != "" && MobileNoTextBox.Text != "" && AddressTextBox.Text != "")
            {
                if (MobileNoTextBox.Text.Length == 11 && MobileNoTextBox.Text.All(char.IsDigit) && PasswordTextBox.Text.Length >= 8 && (MobileNoTextBox.Text.StartsWith("016") || MobileNoTextBox.Text.StartsWith("017") || MobileNoTextBox.Text.StartsWith("018") ||
                                                                                                                                        MobileNoTextBox.Text.StartsWith("019") || MobileNoTextBox.Text.StartsWith("015")))
                {
                    String id = UpdaterMoTextBox.Text;
                    Tenant s  = DB.Tenants.SingleOrDefault(x => x.Mobile_No == id);
                    if (s != null)
                    {
                        s.Name      = NameTextBox.Text;
                        s.Password  = PasswordTextBox.Text;
                        s.Mobile_No = MobileNoTextBox.Text;
                        s.Address   = AddressTextBox.Text;

                        //s.Flat_Rent=aho.
                        DB.SubmitChanges();

                        ShowTenantsDataForm sodf = new ShowTenantsDataForm();
                        sodf.Show();
                        Close();
                        Dispose();
                        MessageBox.Show("Update Successful!");
                    }
                }
                else
                {
                    MessageBox.Show("Please input all field correctly");
                }
            }
            else
            {
                MessageBox.Show("Please input all field");
            }
        }