示例#1
0
        private void BAddrGridView_CellValueChanged(object sender, DataGridViewCellEventArgs e)
        {
            BAddrGridView.CellValueChanged -= BAddrGridView_CellValueChanged;
            if ((e.ColumnIndex == 3) && (e.RowIndex > -1))//--------------------------------Country
            {
                DataGridViewComboBoxCell province = BAddrGridView.Rows[e.RowIndex].Cells["bProvince"] as DataGridViewComboBoxCell;
                DataTable pr = MProvState.GetFilteredList(BAddrGridView.Rows[e.RowIndex].Cells["bcountry"].Value.ToString());
                province.DataSource    = pr;
                province.DisplayMember = pr.Columns[1].ToString();
                province.ValueMember   = pr.Columns[0].ToString();
                noChanges = false;
            }
            if ((e.ColumnIndex == 4) && (e.RowIndex > -1))//--------------------------------Province
            {
                DataGridViewComboBoxCell city = BAddrGridView.Rows[e.RowIndex].Cells["bCity"] as DataGridViewComboBoxCell;
                DataTable ci = MCity.GetFilteredList(BAddrGridView.Rows[e.RowIndex].Cells["bProvince"].Value.ToString());
                city.DataSource    = ci;
                city.DisplayMember = ci.Columns[1].ToString();
                city.ValueMember   = ci.Columns[0].ToString();
                noChanges          = false;
            }
            if ((e.ColumnIndex == 5) && (e.RowIndex > -1))//--------------------------------City
            {
                noChanges = false;
            }
            else
            {
                noChanges = false;
            }

            BAddrGridView.CellValueChanged += new DataGridViewCellEventHandler(BAddrGridView_CellValueChanged);
        }
示例#2
0
        public void Add_Old_Row(String[] rowElements)
        {
            int index = ServiceAddrGridView.Rows.Add();

            SetTableButtonMetrics(index, rowElements[0]);

            DataTable country, province, city;

            country  = MCountry.GetList();
            province = MProvState.GetFilteredList(rowElements[6]);
            city     = MCity.GetFilteredList(rowElements[5]);


            //country.TableName = "country";
            var countryCell = ServiceAddrGridView.Rows[index].Cells["countryCol"] as DataGridViewComboBoxCell;

            //(ServiceAddrGridView.Rows[index].Cells[0].DataPropertyName = "Type";
            countryCell.DataSource    = country;
            countryCell.DisplayMember = "name";
            countryCell.ValueMember   = "id";

            var provCell = ServiceAddrGridView.Rows[index].Cells["provStateCol"] as DataGridViewComboBoxCell;

            provCell.DataSource    = province;
            provCell.DisplayMember = "name";
            provCell.ValueMember   = "id";

            var cityCell = ServiceAddrGridView.Rows[index].Cells["cityCol"] as DataGridViewComboBoxCell;

            cityCell.DataSource    = city;
            cityCell.DisplayMember = "name";
            cityCell.ValueMember   = "id";

            ServiceAddrGridView.Rows[index].Cells["idCol"].Value               = rowElements[0];
            ServiceAddrGridView.Rows[index].Cells["address_col"].Value         = rowElements[1];
            ServiceAddrGridView.Rows[index].Cells["postal_code_col"].Value     = rowElements[2];
            ServiceAddrGridView.Rows[index].Cells["on_site_contact_col"].Value = rowElements[3];
            try
            {
                ServiceAddrGridView.Rows[index].Cells["countryCol"].Value   = rowElements[4];
                ServiceAddrGridView.Rows[index].Cells["provStateCol"].Value = rowElements[5];
                ServiceAddrGridView.Rows[index].Cells["cityCol"].Value      = rowElements[6];
            }
            catch (Exception) { }
            ServiceAddrGridView.Rows[index].Cells["num_floors"].Value = rowElements[7];
            ServiceAddrGridView.Rows[index].Cells["roomButton"].Value = rowElements[8];
        }
示例#3
0
/************************* Add Edit Client Form Events *****************************************/

        public void Country_Changed(object sender, EventArgs e)
        {
            if (_clientForm != null)
            {
                if (_clientForm.GetCountryBox() != "System.Data.DataRowView")
                {
                    if (_clientForm.GetCountryBox() != "-1")
                    {
                        String countryID = _clientForm.GetCountryBox();
                        if (countryID != null)
                        {
                            _client.changeCountry(countryID);
                            _clientForm.SetProvStateBox(MProvState.GetFilteredList(countryID));
                        }
                    }
                }
            }
        }
示例#4
0
        public void InitializeCombos(String countryID, String ProvID, String CityID)
        {
            DataTable country = MCountry.GetList();
            DataTable province;
            DataTable city;

            if (String.Equals(countryID, "noChange"))
            {
                province = MProvState.GetFilteredList(CountryBox.SelectedValue.ToString());
            }
            else
            {
                CountryBox.SelectedValueChanged -= CountryBoxChanged;
                CountryBox.DataSource            = country;
                CountryBox.DisplayMember         = country.Columns[1].ToString();
                CountryBox.ValueMember           = country.Columns[0].ToString();
                province = MProvState.GetFilteredList(countryID);
                CountryBox.SelectedValueChanged += new EventHandler(CountryBoxChanged);
            }


            if (String.Equals(ProvID, "noChange"))
            {
                city = MCity.GetFilteredList(ProvStateBox.SelectedValue.ToString());
            }
            else
            {
                ProvStateBox.SelectedValueChanged -= ProvBoxChanged;
                ProvStateBox.DataSource            = province;
                ProvStateBox.DisplayMember         = province.Columns[1].ToString();
                ProvStateBox.ValueMember           = province.Columns[0].ToString();
                city = MCity.GetFilteredList(ProvID);
                ProvStateBox.SelectedValueChanged += new EventHandler(ProvBoxChanged);
            }


            CityBox.DataSource    = city;
            CityBox.DisplayMember = city.Columns[1].ToString();
            CityBox.ValueMember   = city.Columns[0].ToString();
        }
示例#5
0
        void ServiceAddrGridView_CellValueChanged(object sender, DataGridViewCellEventArgs e)
        {
            if ((e.ColumnIndex == 4) && e.RowIndex > -1)//------------------------------CountryBox
            {
                try
                {
                    String countryID = ServiceAddrGridView.Rows[e.RowIndex].Cells["countryCol"].Value.ToString();
                    var    provCell  = ServiceAddrGridView.Rows[e.RowIndex].Cells["provStateCol"] as DataGridViewComboBoxCell;

                    DataTable provList = MProvState.GetFilteredList(countryID);
                    provCell.DataSource    = provList;
                    provCell.DisplayMember = "name";
                    provCell.ValueMember   = "id";
                    noChanges = false;
                }
                catch (Exception) { }
            }

            if ((e.ColumnIndex == 5) && e.RowIndex > -1)//-------------------------------- ProvBox
            {
                try
                {
                    String    provID   = ServiceAddrGridView.Rows[e.RowIndex].Cells["provStateCol"].Value.ToString();
                    var       cityCell = ServiceAddrGridView.Rows[e.RowIndex].Cells["cityCol"] as DataGridViewComboBoxCell;
                    DataTable cityList = MCity.GetFilteredList(provID);

                    cityCell.DataSource    = cityList;
                    cityCell.DisplayMember = "name";
                    cityCell.ValueMember   = "id";
                    noChanges = false;
                }
                catch (Exception) { }
            }

            if ((e.ColumnIndex == 6) && e.RowIndex > -1)//---------------------------------- City
            {
                noChanges = false;
            }
        }
示例#6
0
        public void PopulateBAddrsGridView(DataTable Addrs)
        {
            DataGridViewComboBoxCell country;
            DataTable co = MCountry.GetList();
            DataGridViewComboBoxCell province;
            DataTable pr;
            DataGridViewComboBoxCell city;
            DataTable ci;
            int       n = Addrs.Rows.Count, index;

            for (int i = 0; i < n; i++)
            {
                index = BAddrGridView.Rows.Add();
                BAddrGridView.Rows[index].Cells["locID"].Value   = Addrs.Rows[i]["location_id"];
                BAddrGridView.Rows[index].Cells["bAddr"].Value   = Addrs.Rows[i]["address"];
                BAddrGridView.Rows[index].Cells["bPostal"].Value = Addrs.Rows[i]["postal_code"];

                country               = BAddrGridView.Rows[index].Cells["bCountry"] as DataGridViewComboBoxCell;
                country.DataSource    = co;
                country.DisplayMember = co.Columns[1].ToString();
                country.ValueMember   = co.Columns[0].ToString();
                country.Value         = Addrs.Rows[i]["country_id"];

                province               = BAddrGridView.Rows[index].Cells["bProvince"] as DataGridViewComboBoxCell;
                pr                     = MProvState.GetFilteredList(Addrs.Rows[i]["country_id"].ToString());
                province.DataSource    = pr;
                province.DisplayMember = pr.Columns[1].ToString();
                province.ValueMember   = pr.Columns[0].ToString();
                province.Value         = Addrs.Rows[i]["province_id"];

                city               = BAddrGridView.Rows[index].Cells["bCity"] as DataGridViewComboBoxCell;
                ci                 = MCity.GetFilteredList(Addrs.Rows[i]["province_id"].ToString());
                city.DataSource    = ci;
                city.DisplayMember = ci.Columns[1].ToString();
                city.ValueMember   = ci.Columns[0].ToString();
                city.Value         = Addrs.Rows[i]["city_id"];
            }
        }
示例#7
0
        private void AddAddrButton_Click(object sender, EventArgs e)
        {
            int i = BAddrGridView.Rows.Add();
            DataGridViewComboBoxCell country = BAddrGridView.Rows[i].Cells["bCountry"] as DataGridViewComboBoxCell;
            DataTable co = MCountry.GetList();

            country.DataSource    = co;
            country.DisplayMember = co.Columns[1].ToString();
            country.ValueMember   = co.Columns[0].ToString();

            DataGridViewComboBoxCell province = BAddrGridView.Rows[i].Cells["bProvince"] as DataGridViewComboBoxCell;
            DataTable pr = MProvState.GetFilteredList("1");

            province.DataSource    = pr;
            province.DisplayMember = pr.Columns[1].ToString();
            province.ValueMember   = pr.Columns[0].ToString();

            DataGridViewComboBoxCell city = BAddrGridView.Rows[i].Cells["bCity"] as DataGridViewComboBoxCell;
            DataTable ci = MCity.GetFilteredList("1");

            city.DataSource    = ci;
            city.DisplayMember = ci.Columns[1].ToString();
            city.ValueMember   = ci.Columns[0].ToString();
        }