예제 #1
0
        private void label_Id_TextChanged(object sender, EventArgs e)
        {
            int id = int.Parse(label_Id.Text);

            if (id != 0)
            {
                groupBox_City.Text = "ערוך עיר קיימת";

                CityArr cityarr = new CityArr();
                cityarr.Fill();
                cityarr = cityarr.Filter("", id);
                if (cityarr.Count > 0)
                {
                    SelectedCity = cityarr[0] as City;
                }
                else
                {
                    SelectedCity = City.Empty;
                }
            }
            else
            {
                groupBox_City.Text = "הוסף עיר חדשה";
                SelectedCity       = City.Empty;
            }
        }
예제 #2
0
        private void textBox_Filter_TextChanged(object sender, EventArgs e)
        {
            CityArr cityArr = new CityArr();

            cityArr.Fill();

            cityArr = cityArr.Filter(textBox_Filter.Text);
            cityArr.Remove("+");

            listBox_City.DataSource = cityArr;
        }
예제 #3
0
        private void button_Delete_Click(object sender, EventArgs e)
        {
            if (label_Id.Text == "0")
            {
                MessageBox.Show("לא נבחרה עיר למחיקה.", "שגיאה", MessageBoxButtons.OK, MessageBoxIcon.Stop, MessageBoxDefaultButton.Button1, MessageBoxOptions.RtlReading);
                return;
            }


            //remove the city
            CityArr cityArr = new CityArr();

            cityArr.Fill();
            cityArr = cityArr.Filter("", int.Parse(label_Id.Text));

            if (cityArr.Count == 0)
            {
                MessageBox.Show("קרתה תקלה במציאת העיר בבסיס הנתונים.\nאנא סגור והדלק את התוכנה.", "שגיאה", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.RtlReading);
                return;
            }

            City city = cityArr[0] as City;

            if (MessageBox.Show("האם אתה בטוח שאתה רוצה למחוק את העיר שבחרת?\nפעולה זאת הינה בלתי הפיכה!", "אזהרה", MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
            {
                NomineeArr clientArr = new NomineeArr();
                clientArr.Fill();
                if (clientArr.DoesCityExist(city))
                {
                    MessageBox.Show("לא ניתן למחוק את העיר.\n העיר שנבחרה משוייכת למועמדים קיימים במערכת.", "בעיה", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1, MessageBoxOptions.RtlReading);
                }
                else
                {
                    if (city.Delete())
                    {
                        CityToForm(null);
                        CityArrToForm(null);
                        MessageBox.Show("העיר נמחקה בהצלחה", "הצלחה", MessageBoxButtons.OK, MessageBoxIcon.None, MessageBoxDefaultButton.Button1, MessageBoxOptions.RtlReading);
                    }
                    else
                    {
                        MessageBox.Show("ישנה תקלה במחיקת העיר מבסיס הנתונים.\n העיר לא נמחקה כלל.", "תקלה!", MessageBoxButtons.AbortRetryIgnore, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.RtlReading);
                    }
                }
            }
        }