示例#1
0
        private void btn_Delete_Click(object sender, EventArgs e)
        {
            Street    street    = FormToStreet();
            ClientArr clientArr = new ClientArr();

            clientArr.Fill();


            if (street.Id == 0)
            {
            }
            else
            {
                if (clientArr.DoesExist(street))
                {
                    MessageBox.Show("You can not delete this street, it is connected" +
                                    " to 1 or more clients", "Can not delete street",
                                    MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else
                {
                    if (MessageBox.Show("Are you sure you want to delete this Street? ",
                                        "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
                    {
                        street.Delete();
                        ClearForm();
                        StreetArrToForm(null);
                    }
                }
            }
        }
示例#2
0
        private void btn_Delete_Click(object sender, EventArgs e)
        {
            City      city      = FormToCity();
            ClientArr clientArr = new ClientArr();

            clientArr.Fill();

            if (city.Id == 0)
            {
            }
            else
            {
                if (clientArr.DoesExist(city))
                {
                    MessageBox.Show("You can not delete this city, it is connected" +
                                    " to 1 or more clients", "Can not delete city",
                                    MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else
                {
                    if (MessageBox.Show("Are you sure you want to delete this" +
                                        " City? ", "Warning", MessageBoxButtons.YesNo,
                                        MessageBoxIcon.Warning) == DialogResult.Yes)
                    {
                        if (city.Delete())
                        {
                            ClearForm();
                            CityArrToForm(null);
                        }
                    }
                }
            }
        }
示例#3
0
        private void deleteButton_Click(object sender, EventArgs e)
        {
            City city = FormToCity();

            if (city.ID <= 0)
            {
                MessageBox.Show("חובה לבחור עיר", "אין בחירה", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            else
            {
                if (MessageBox.Show("אזהרה", "האם אתה בטוח שאתה רוצה למחוק את העיר?", MessageBoxButtons.YesNo,
                                    MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2, MessageBoxOptions.RightAlign |
                                    MessageBoxOptions.RtlReading) == DialogResult.Yes)
                {
                    //לפני המחיקה - בדיקה שהישוב לא בשימוש בישויות אחרות
                    //בדיקה עבור לקוחות

                    ClientArr clientArr = new ClientArr();
                    clientArr.Fill();
                    ProductArr productArr = new ProductArr();
                    productArr.Fill();
                    if (clientArr.DoesExist(city) && productArr.DoesExist(city))
                    {
                        MessageBox.Show("אי אפשר למחוק עיר שקשורה ליישות קיימת", "יש חיבור בין יישות לעיר", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                    else
                    if (city.Delete())
                    {
                        MessageBox.Show("נמחק", "נמחק", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        CityToFrom(null);
                        CityArrToForm(null);
                    }
                    else
                    {
                        MessageBox.Show("שגיאה");
                    }
                }
            }
        }
        private void button_deleteCity_Click(object sender, EventArgs e)
        {
            City city = FormToCity();

            if (city.ID == 0)
            {
                MessageBox.Show("You must select a city");
            }
            else
            {
                if (MessageBox.Show("Warning", "Are you sure you want to delete?", MessageBoxButtons.YesNo,
                                    MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2, MessageBoxOptions.RightAlign |
                                    MessageBoxOptions.RtlReading) == DialogResult.Yes)
                {
                    //לפני המחיקה - בדיקה שהישוב לא בשימוש בישויות אחרות
                    //בדיקה עבור לקוחות

                    ClientArr clientArr = new ClientArr();
                    clientArr.Fill();
                    if (clientArr.DoesExist(city))
                    {
                        MessageBox.Show("You can’t delete a city that is related to a client");
                    }
                    else
                    if (city.Delete())
                    {
                        MessageBox.Show("Deleted");
                        CityToForm(null);
                        CityArrToForm(city);
                    }
                    else
                    {
                        MessageBox.Show("Error");
                    }
                }
            }
        }