コード例 #1
0
        private void EditCity(string oldCityName, string oldProvince, string newCityName, string newProvinceName)
        {
            new System.Threading.Thread(() =>
            {
                bool edited = false;
                SetLoadingState(true);

                Classes.LocationManager locationManager = new Classes.LocationManager();

                if (locationManager.CanAddCity(newCityName, newProvinceName))
                {
                    if (locationManager.EditCity(oldCityName, oldProvince, newCityName, newProvinceName))
                    {
                        DisplayNotifyBox("Edited", oldCityName + "," + oldProvince + " changed to " + newCityName + "," + newProvinceName, 3);
                        edited = true;
                    }
                    else
                    {
                        DisplayNotifyBox("Could not edit", "En error occured. Please try again later", 3);
                    }
                }
                else
                {
                    DisplayNotifyBox("Could not edit", "Cannot change " + oldCityName + "," + oldProvince + " to " + newCityName + "," + newProvinceName + " because " + newCityName + "," + newProvinceName + " already exists", 4);
                }

                SetLoadingState(false);

                if (edited)
                {
                    CloseForm();
                }
            }).Start();
        }
コード例 #2
0
        private void AddCity()
        {
            if (TB_CityName.Text != "")
            {
                new System.Threading.Thread(() =>
                {
                    SetLoadingState(true);
                    Classes.LocationManager locationManager = new Classes.LocationManager();

                    if (locationManager.CanAddCity(GetCityName(), GetProvinceName()))
                    {
                        if (locationManager.AddCity(GetCityName(), GetProvinceName()))
                        {
                            DisplayNotifyBox(GetCityName() + " Added", GetCityName() + " was added in " + GetProvinceName(), 3);
                            ClearForm();
                        }
                        else
                        {
                            DisplayNotifyBox("Could not Add City", GetCityName() + " could not be added. Please try again", 3);
                        }
                    }
                    else
                    {
                        DisplayNotifyBox("Cannot Add City", GetCityName() + " already exists in " + GetProvinceName(), 3);
                    }

                    SetLoadingState(false);
                }).Start();
            }
            else
            {
                DisplayNotifyBox("ERROR", "City name cannot be empty", 2);
            }
        }
コード例 #3
0
        private void EditCity(string oldCityName, string oldProvince, string newCityName, string newProvinceName)
        {
            new System.Threading.Thread(() =>
            {
                bool edited = false;
                SetLoadingState(true);

                Classes.LocationManager locationManager = new Classes.LocationManager();

                if( locationManager.CanAddCity(newCityName,newProvinceName))
                {
                    if( locationManager.EditCity(oldCityName,oldProvince,newCityName,newProvinceName) )
                    {
                        DisplayNotifyBox("Edited", oldCityName + "," + oldProvince + " changed to " + newCityName + "," + newProvinceName, 3);
                        edited = true;
                    }
                    else
                    {
                        DisplayNotifyBox("Could not edit", "En error occured. Please try again later", 3);
                    }
                }
                else
                {
                    DisplayNotifyBox("Could not edit","Cannot change " + oldCityName + "," + oldProvince + " to " + newCityName + "," + newProvinceName + " because " + newCityName + "," + newProvinceName + " already exists",4);
                }

                SetLoadingState(false);

                if (edited)
                    CloseForm();

            }).Start();
        }