Exemplo n.º 1
0
        /// <summary>
        /// 范围查询中的确定按钮事件,目的进行数据范围查询
        /// </summary>
        public override void btnRangeSubmit_Click(object sender, EventArgs e)
        {
            if (this.rangeListView.Items.Count <= 0)
            {
                return;
            }
            this._rangeSearchList = new List <OilRangeSearchEntity>();
            try
            {
                this.StartWaiting();

                #region "显示条件集合"
                foreach (ListViewItem item in this.rangeListView.Items)
                {
                    OilRangeSearchEntity rangeSearch = new OilRangeSearchEntity();
                    rangeSearch.itemCode         = item.Tag.ToString();
                    rangeSearch.LeftParenthesis  = item.SubItems[0].Tag.ToString();
                    rangeSearch.OilTableColID    = Convert.ToInt32(item.SubItems[1].Tag.ToString());
                    rangeSearch.OilTableRowID    = item.SubItems[3].Tag.ToString();
                    rangeSearch.downLimit        = item.SubItems[5].Tag.ToString();
                    rangeSearch.upLimit          = item.SubItems[7].Tag.ToString();
                    rangeSearch.RightParenthesis = item.SubItems[8].Tag.ToString();
                    rangeSearch.FracitonName     = item.SubItems[1].Text;
                    rangeSearch.ItemName         = item.SubItems[3].Text;
                    if (this.rangeListView.Items.Count == 1)
                    {
                        rangeSearch.IsAnd = true;
                    }
                    else
                    {
                        rangeSearch.IsAnd = item.SubItems[9].Tag.ToString() == "And" ? true : false;
                    }
                    this._rangeSearchList.Add(rangeSearch);
                }
                #endregion

                #region "当前显示原油的集合"
                List <CrudeIndexIDAEntity> currentCrudeIndexIDList = new List <CrudeIndexIDAEntity>();
                foreach (DataGridViewRow row in this.gridList.Rows)
                {
                    CrudeIndexIDAEntity tempCrudeIndexIDAEntity = new CrudeIndexIDAEntity();
                    tempCrudeIndexIDAEntity.ID         = Convert.ToInt32(row.Cells["ID"].Value.ToString());
                    tempCrudeIndexIDAEntity.crudeIndex = row.Cells["原油编号"].Value.ToString();
                    tempCrudeIndexIDAEntity.crudeName  = row.Cells["原油名称"].Value.ToString();
                    currentCrudeIndexIDList.Add(tempCrudeIndexIDAEntity);
                }
                #endregion

                OilBll oilBll = new OilBll();
                this.tempRanSumDic = oilBll.GetRangOilInfoCrudeIndex(this._rangeSearchList); //从C库获取满足条件的原油编号

                GetRangeSearchResult(this.tempRanSumDic, currentCrudeIndexIDList);           //绑定控件
            }
            catch (Exception ex)
            {
                Log.Error("原油B库范围查找错误:" + ex.ToString());
                return;
            }
            finally
            {
                this.StopWaiting();
            }
        }