/// <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> /// <param name="sender"></param> /// <param name="e"></param> private void btnEdiSwitch_Click(object sender, EventArgs e) { try { Log.Info(GetType() + "->" + ApplicationCommon.GetMethodName() + "---START"); if (txtF_POWER_ID.Text == "") { DevExpress.DXCore.Controls.XtraEditors.XtraMessageBox.Show("请先选择供电柜信息再编辑通道信息。", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } //准备数据 var modelPowerSwitchStatus = new ModelDEV_POWER_SWITCH(); //供电柜开关操作类 var bllPowerSwitchStatus = new ProxyBllDEV_POWER_SWITCH(); if (gvPowerSwitchInfo.RowCount > 0) { string powerId = gvPowerSwitchInfo.GetFocusedRowCellValue("F_POWER_ID").ToString(); string switchId = gvPowerSwitchInfo.GetFocusedRowCellValue("F_POWER_SWITCH_ID").ToString(); modelPowerSwitchStatus = bllPowerSwitchStatus.GetModel(powerId, switchId); } else { modelPowerSwitchStatus.F_POWER_ID = txtF_POWER_ID.Text; } var frm = new FrmDevPowerSwitchInfo(modelPowerSwitchStatus); frm.SaveHandler += BindPowerSwitchInfoGridView; frm.ShowDialog(); } catch (Exception ex) { Log.Error(GetType() + "->" + ApplicationCommon.GetMethodName() + "---FAILED", ex); throw ex; } }