Ejemplo n.º 1
0
        /// <summary>
        ///     绑定数据到开关信息
        /// </summary>
        public void BindPowerSwitchInfoGridView()
        {
            try
            {
                Log.Info(GetType() + "->" + ApplicationCommon.GetMethodName() + "---START");

                //获得供电柜编号
                //编号
                if (string.IsNullOrEmpty(txtF_POWER_ID.Text))
                {
                    return;
                }

                //绑定数据
                var     bllPowerSwitchStatus = new ProxyBllDEV_POWER_SWITCH();
                DataSet dsPowerSwitch        = bllPowerSwitchStatus.GetList("F_POWER_ID='" + txtF_POWER_ID.Text + "'");

                //有数据情况下绑定
                if (dsPowerSwitch != null && dsPowerSwitch.Tables.Count > 0)
                {
                    gcPowerSwitchInfo.DataSource = dsPowerSwitch.Tables[0];
                }
            }
            catch (Exception ex)
            {
                Log.Error(GetType() + "->" + ApplicationCommon.GetMethodName() + "---FAILED", ex);
                throw ex;
            }
        }
        /// <summary>
        /// 绑定数据
        /// </summary>
        private void BindInputSwitchDataset()
        {
            try
            {
                Log.Info(GetType() + "->" + ApplicationCommon.GetMethodName() + "---START");

                if (gvPower.FocusedRowHandle < 0)
                {
                    return;
                }



                dtRelation.Rows.Clear();

                //获得工作站id
                string powerId = gvPower.GetFocusedRowCellValue("F_POWER_ID").ToString();


                //获得输入数据
                DataSet dsInputSwitch = new DataSet();

                dsInputSwitch = _bllDevPowerSwitch.GetList("F_POWER_ID='" + powerId + "' AND F_POWER_SWITCH_TYPE=1");
                //有数据情况下绑定
                if (dsInputSwitch != null && dsInputSwitch.Tables.Count > 0)
                {
                    gcInputSwitch.DataSource = dsInputSwitch.Tables[0];
                }

                gvInputSwitch_RowClick(this, null);
            }
            catch (Exception ex)
            {
                Log.Error(GetType() + "->" + ApplicationCommon.GetMethodName() + "---FAILED", ex);
                throw ex;
            }
        }