private void AddButton_Click(object sender, EventArgs e)
        {
            if (NameTextBox.Text != "" && MobileNoTextBox.Text != "" && AddressTextBox.Text != "")
            {
                if (MobileNoTextBox.Text.All(char.IsDigit) && MobileNoTextBox.Text.Length == 11 && (MobileNoTextBox.Text.StartsWith("017") || MobileNoTextBox.Text.StartsWith("016") ||
                                                                                                    MobileNoTextBox.Text.StartsWith("015") || MobileNoTextBox.Text.StartsWith("019") || MobileNoTextBox.Text.StartsWith("018")))
                {
                    var s = from ob in DB.Modifieds
                            where ob.Mobile_No == MobileNoTextBox.Text
                            select ob;
                    if (s != null)
                    {
                        OwnerTenant a = new OwnerTenant();
                        Tenant      t = new Tenant();
                        Modified    m = new Modified();
                        t.Name      = NameTextBox.Text;
                        t.Mobile_No = MobileNoTextBox.Text;
                        t.Keyword   = "T";

                        DB.Tenants.InsertOnSubmit(t);
                        DB.SubmitChanges();

                        m.Mobile_No = MobileNoTextBox.Text;
                        m.Keyword   = "T";

                        DB.Modifieds.InsertOnSubmit(m);
                        DB.SubmitChanges();
                        a.Name = NameTextBox.Text;

                        a.Name      = NameTextBox.Text;
                        a.Mobile_No = MobileNoTextBox.Text;
                        a.Address   = AddressTextBox.Text;
                        DB.OwnerTenants.InsertOnSubmit(a);
                        DB.SubmitChanges();
                        MessageBox.Show("Added Successfully!");
                    }
                    else
                    {
                        MessageBox.Show("Your mobile number has already been recorded in database, try with another mobile no");
                    }
                }
                else
                {
                    MessageBox.Show("Please input every field correctly");
                }
            }
            else
            {
                MessageBox.Show("Please input every field");
            }
        }
        private void SearchButton_Click(object sender, EventArgs e)
        {
            String      id = SearchByMobileNoTextBox.Text;
            OwnerTenant s  = DB.OwnerTenants.SingleOrDefault(x => x.Mobile_No == id);

            if (s != null)
            {
                NameTextBox.Text     = s.Name;
                MobileNoTextBox.Text = s.Mobile_No;
                AddressTextBox.Text  = s.Address;
            }
            else
            {
                MessageBox.Show("Not found");
            }
        }
        private void UpdateButton_Click(object sender, EventArgs e)
        {
            if (NameTextBox.Text != "" && MobileNoTextBox.Text != "" && AddressTextBox.Text != "")
            {
                if (MobileNoTextBox.Text.All(char.IsDigit) && MobileNoTextBox.Text.Length == 11 && (MobileNoTextBox.Text.StartsWith("017") || MobileNoTextBox.Text.StartsWith("016") ||
                                                                                                    MobileNoTextBox.Text.StartsWith("015") || MobileNoTextBox.Text.StartsWith("019") || MobileNoTextBox.Text.StartsWith("018")))
                {
                    String      id = SearchByMobileNoTextBox.Text;
                    OwnerTenant s  = DB.OwnerTenants.SingleOrDefault(x => x.Mobile_No == id);
                    if (s != null)
                    {
                        s.Name      = NameTextBox.Text;
                        s.Mobile_No = MobileNoTextBox.Text;
                        s.Address   = AddressTextBox.Text;

                        DB.SubmitChanges();
                    }
                    String sid = SearchByMobileNoTextBox.Text;
                    Tenant ts  = DB.Tenants.SingleOrDefault(x => x.Mobile_No == sid);
                    if (ts != null)
                    {
                        ts.Name      = NameTextBox.Text;
                        ts.Mobile_No = MobileNoTextBox.Text;
                        ts.Address   = AddressTextBox.Text;

                        DB.SubmitChanges();
                        MessageBox.Show("Update Successful!");
                    }
                    else
                    {
                        MessageBox.Show("Not found");
                    }
                }
                else
                {
                    MessageBox.Show("Please input every field correctly");
                }
            }
            else
            {
                MessageBox.Show("Please input every field");
            }
        }
        private void DeleteButton_Click(object sender, EventArgs e)
        {
            String      id = SearchTextBox.Text;
            OwnerTenant s  = DB.OwnerTenants.SingleOrDefault(x => x.Mobile_No == id);

            if (s != null)
            {
                DB.OwnerTenants.DeleteOnSubmit(s);
                DB.SubmitChanges();
                HouseInformationForm sodf = new HouseInformationForm();
                sodf.Show();
                Close();
                Dispose();
            }
            else
            {
                MessageBox.Show("Data not found");
            }
        }
 partial void DeleteOwnerTenant(OwnerTenant instance);
 partial void UpdateOwnerTenant(OwnerTenant instance);
 partial void InsertOwnerTenant(OwnerTenant instance);