Ejemplo n.º 1
0
 private void cbo_country_EditValueChanged(object sender, EventArgs e)
 {
     try
     {
         if (cbo_country.EditValue != null)
         {
             using (DataTable dt = new BL_City().selectByCountry(new OBALog.Model.ML_City {
                 CountryKey = Convert.ToInt32(cbo_country.EditValue)
             }))
             {
                 cbo_city.Clear();
                 cbo_city.Properties.DataSource    = dt;
                 cbo_city.Properties.DisplayMember = "City";
                 cbo_city.Properties.ValueMember   = "CityKey";
                 cbo_city.SelectFirstIndex();
             }
             FormDirty = true;
         }
     }
     catch (Exception ex)
     {
         AuditFactory.AuditLog(ex);
         ApplicationUtilities.ShowMessage(UniversalEnum.MessageTypes.Error, ex.Message);
     }
 }
        public JsonResult ShowCity()
        {
            BL_City city = new BL_City();

            return(new JsonResult {
                Data = city.SelectAllCity(), JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }
Ejemplo n.º 3
0
        private void btn_save_city_Click(object sender, EventArgs e)
        {
            try
            {
                if (!IsNewCity && !hasAccessUpdate)
                {
                    ApplicationUtilities.ShowMessage(UniversalEnum.MessageTypes.Error, "You have no save rights.", "Access Denied");
                    return;
                }

                if (txt_new_city.IsNotEmpty())
                {
                    using (DataTable Table = new BL_City().select(new ML_City {
                        City = txt_new_city.Text
                    }))
                    {
                        if (Table.Rows.Count < 1)
                        {
                            if (IsNewCity)
                            {
                                new BL_City().insert(new ML_City {
                                    CountryKey = CountryID, City = txt_new_city.Text
                                });
                            }
                            else if (CityID > 0)
                            {
                                new BL_City().update(new ML_City {
                                    Key = CityID, City = txt_new_city.Text
                                });
                            }

                            LastCountry = lst_country.Text;
                            LastCity    = txt_new_city.Text;

                            ResetCityForm();
                            lst_country_SelectedIndexChanged(this, new EventArgs());
                            SetPrevious();
                        }
                        else
                        {
                            ApplicationUtilities.ShowMessage(UniversalEnum.MessageTypes.Error, "The entered city is already in the database. Please re-check!", "Error");
                        }
                    }
                }
                else
                {
                    ApplicationUtilities.ShowMessage(UniversalEnum.MessageTypes.Exclamation, "Null value detected for city. Please re-check!", "Error!");
                }
            }
            catch (Exception ex)
            {
                AuditFactory.AuditLog(ex);
                ApplicationUtilities.ShowMessage(UniversalEnum.MessageTypes.Error, ex.Message);
            }
        }
Ejemplo n.º 4
0
 private int BindCity(int CountryID)
 {
     using (DataTable dt = new BL_City().selectByCountry(new ML_City {
         CountryKey = CountryID
     }))
     {
         cbo_city.Properties.DataSource    = dt;
         cbo_city.Properties.DisplayMember = "City";
         cbo_city.Properties.ValueMember   = "CityKey";
         cbo_city.ItemIndex = dt.Rows.Count > 0 ? 0 : -1;
         return(dt.Rows.Count);
     }
 }
Ejemplo n.º 5
0
        private int BindCity(int CountryID)
        {
            using (DataTable dt = new BL_City().selectByCountry(new ML_City {
                CountryKey = CountryID
            }))
            {
                txt_new_city.Clear();
                lst_city.UnSelectAll();
                lst_city.DataSource    = dt;
                lst_city.DisplayMember = "City";
                lst_city.ValueMember   = "CityKey";

                return(dt.Rows.Count);
            }
        }