Exemple #1
0
        private void btnEditRegionCity_Click(object sender, EventArgs e)
        {
            VW_RegionCity rc = (VW_RegionCity)cboCity.SelectedItem;

            My.MyProject.Forms.FrmAddEditRegionCity.PopulateInfo(rc, false);
            MdlLoadingSetting.showDialogForm(My.MyProject.Forms.FrmAddEditRegionCity, this);
            using (var db = new WTCCeresEntities())
            {
                cboCity.DataSource = RegionCityService.GetRegionCityVWByCountryId(Conversions.ToInteger(country1ComboBox1.SelectedValue), db);
            }
        }
Exemple #2
0
        private void btnAddRegionCity_Click(object sender, EventArgs e)
        {
            var rcvw = new VW_RegionCity();

            rcvw.CountryId   = Conversions.ToInteger(country1ComboBox1.SelectedValue);
            rcvw.CountryName = country1ComboBox1.Text;
            My.MyProject.Forms.FrmAddEditRegionCity.PopulateInfo(rcvw, true);
            MdlLoadingSetting.showDialogForm(My.MyProject.Forms.FrmAddEditRegionCity, this);
            using (var db = new WTCCeresEntities())
            {
                GetRegionCities();
            }
        }
Exemple #3
0
        public void PopulateInfo(VW_RegionCity vw, bool isNewRecord)
        {
            using (var db = new WTCCeresEntities())
            {
                {
                    var withBlock = cboRegionCode;
                    withBlock.DataSource    = CountryRegionService.GetByCountryId(vw.CountryId, db);
                    withBlock.DisplayMember = "RegionCode";
                    withBlock.ValueMember   = "CountryRegionId";
                }
            }

            if (isNewRecord)
            {
                tbCityCode.Text             = "";
                tbCityName.Text             = "";
                cboRegionCode.SelectedIndex = 0;
                lblCountry.Text             = vw.CountryName;
                cr           = new CountryRegion();
                rc           = new RegionCity();
                cr.CountryId = vw.CountryId;
            }
            else
            {
                using (var db = new WTCCeresEntities())
                {
                    cr = CountryRegionService.GetById(vw.CountryRegionId, db);
                    rc = new RegionCity();
                    rc = RegionCityService.GetById(vw.RegionCityId, db);
                    cboRegionCode.SelectedValue = vw.CountryRegionId;
                    tbCityCode.Text             = vw.CityCode;
                    lblCountry.Text             = vw.CountryName;
                    tbCityName.Text             = vw.CityName;
                }
            }
        }