private void pictureBox1_Click(object sender, EventArgs e)
        {
            ShowOwnersDataForm sodf = new ShowOwnersDataForm();

            sodf.Show();
            Dispose();
        }
Exemple #2
0
        private void ShowOwnersDataButton_Click(object sender, EventArgs e)
        {
            ShowOwnersDataForm sodf = new ShowOwnersDataForm();

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

            if (s != null)
            {
                DB.Owners.DeleteOnSubmit(s);
                DB.SubmitChanges();
                ShowOwnersDataForm sodf = new ShowOwnersDataForm();
                sodf.Show();
                Close();
                Dispose();
            }
            else
            {
                MessageBox.Show("Data not found");
            }
        }
        private void UpdateButton_Click(object sender, EventArgs e)
        {
            if (NameTextBox.Text != "" && PTextBox.Text != "" && PTextBox.Text != "" & MoTextBox.Text != "" &&
                HouseAddressTextBox.Text != "" && TfloorTextBox.Text != "" && TotalFlatTextBox.Text != "" &&
                FlatRentTextBox.Text != "")
            {
                if ((MoTextBox.Text.All(char.IsDigit) && MoTextBox.Text.Length == 11 && PTextBox.Text.Length >= 8 && TfloorTextBox.Text.All(char.IsDigit) && TotalFlatTextBox.Text.All(char.IsDigit) && FlatRentTextBox.Text.All(char.IsDigit)) && (MoTextBox.Text.StartsWith("017") || MoTextBox.Text.StartsWith("016") ||
                                                                                                                                                                                                                                                    MoTextBox.Text.StartsWith("015") || MoTextBox.Text.StartsWith("019") || MoTextBox.Text.StartsWith("018")))
                {
                    String id = UTextBox.Text;
                    Owner  s  = DB.Owners.SingleOrDefault(x => x.Mobile_No == id);
                    if (s != null)
                    {
                        s.Name        = NameTextBox.Text;
                        s.Password    = PTextBox.Text;
                        s.Mobile_No   = MoTextBox.Text;
                        s.Total_Floor = TfloorTextBox.Text;
                        s.Total_Flat  = TotalFlatTextBox.Text;
                        DB.SubmitChanges();

                        ShowOwnersDataForm sodf = new ShowOwnersDataForm();
                        sodf.Show();
                        Close();
                        Dispose();
                        MessageBox.Show("Updated Successful!");
                    }
                }
                else
                {
                    MessageBox.Show("Please input every field correctly");
                }
            }
            else
            {
                MessageBox.Show("Please input every field");
            }
        }