Ejemplo n.º 1
0
        /// <summary>
        /// Reslects the previously chosen region for a column.
        /// </summary>
        /// <param name="cb">The region combobox</param>
        /// <param name="iSelectedHash">The hash of the previously selected region</param>
        /// <param name="iColumn">The column to reselect to</param>
        private void ReselectRegion(ComboBox cb, int iSelectedHash, int iColumn)
        {
            for (int i = 0; i < cb.Items.Count; i++)
            {
                MarketLog ml = (MarketLog)cb.Items[i];
                if (iSelectedHash == ml.RegionHash)
                {
                    switch (iColumn)
                    {
                    case 0:
                        ml.ToGridView(ref dgvSellersL, ref dgvBuyersL, ref _cmsSellersL, ref _cmsBuyersL);
                        break;

                    case 1:
                        ml.ToGridView(ref dgvSellersR, ref dgvBuyersR, ref _cmsSellersR, ref _cmsBuyersR);
                        break;

                    default:
                        break;
                    }

                    cb.SelectedIndex = i;
                    // Region selected. No need to examine the rest.
                    return;
                }
            }
        }
Ejemplo n.º 2
0
        private void cbRegionsR_SelectedIndexChanged(object sender, EventArgs e)
        {
            ComboBox cbRight = (ComboBox)sender;

            if (cbRight.SelectedIndex == 0)
            {
                if (_abDoneFirstRegionLoad[1])
                {
                    _aiRegionSelectedHash[1]  = 0;
                    _abDoneFirstRegionLoad[1] = true;
                }
                dgvSellersR.DataSource   = null;
                dgvBuyersR.DataSource    = null;
                lblDateExportedR.Visible = lblDateExportedTextR.Visible = false;
                return;
            }
            MarketLog ml = (MarketLog)cbRight.SelectedValue;

            // Save region hash for reselection if list changes
            _aiRegionSelectedHash[1] = ml.RegionHash;

            // Load log to gridviews
            ml.ToGridView(ref dgvSellersR, ref dgvBuyersR, ref _cmsSellersR, ref _cmsBuyersR);

            // Show date created
            lblDateExportedR.Visible = lblDateExportedTextR.Visible = true;
            lblDateExportedR.Text    = ml.Created.ToShortDateString();
        }