/// <summary> /// 点击事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void tlModule_FocusedNodeChanged(object sender, DevExpress.XtraTreeList.FocusedNodeChangedEventArgs e) { try { Log.Info(this.GetType() + "->" + ApplicationCommon.GetMethodName() + "---START"); if (tlModule.AllNodesCount < 0) { return; } if (tlModule.FocusedNode == null) { return; } ModelSYSTEM_MODULE modelSystemModule = new ModelSYSTEM_MODULE(); modelSystemModule = _bllSystemModule.GetModel(tlModule.FocusedNode["F_MODULE_ID"].ToString()); txtF_MODULE_NAME.Text = modelSystemModule.F_MODULE_NAME; txtF_MODULE_ID.Text = modelSystemModule.F_MODULE_ID; txtF_PARENT_MODULE_ID.Text = modelSystemModule.F_PARENT_MODULE_ID; txtModuleForm.Text = modelSystemModule.F_PATH; txtF_ACTION.Text = modelSystemModule.F_ACTION; txtF_ORDNO.Text = modelSystemModule.F_ORDNO.ToString(); chkF_ISADMINONLY.Checked = (modelSystemModule.F_ISADMINONLY == "1"); } catch (Exception ex) { Log.Error(this.GetType() + "->" + ApplicationCommon.GetMethodName() + "---FAILED", ex); throw ex; } }
/// <summary> /// 绑定表格 /// </summary> private void BindGridview() { try { Log.Info(this.GetType() + "->" + ApplicationCommon.GetMethodName() + "---START"); string typeCode = lueParameterType.EditValue.ToString(); //如果为空则返回 if (string.IsNullOrEmpty(typeCode)) { return; } DataSet dsParameterMonitorcomm = _bllteTestTtaskParvalue.GetList("F_TYPE_CODE='" + typeCode + "'"); //有数据情况下绑定 if (dsParameterMonitorcomm != null && dsParameterMonitorcomm.Tables.Count > 0) { gcList.DataSource = dsParameterMonitorcomm.Tables[0]; } } catch (Exception ex) { Log.Error(this.GetType() + "->" + ApplicationCommon.GetMethodName() + "---FAILED", ex); throw ex; } }
/// <summary> /// 表格点击 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void gvList_RowClick(object sender, DevExpress.XtraGrid.Views.Grid.RowClickEventArgs e) { try { Log.Info(this.GetType() + "->" + ApplicationCommon.GetMethodName() + "---START"); if (gvList.FocusedRowHandle < 0 || gvList.FocusedRowHandle >= gvList.RowCount) { return; } //将当前数据显示在界面上 txtF_USER_ID.Text = gvList.GetRowCellValue(gvList.FocusedRowHandle, "F_USER_ID").ToString(); txtF_USER_NAME.Text = gvList.GetRowCellValue(gvList.FocusedRowHandle, "F_USER_NAME").ToString(); txtF_PHONE.Text = gvList.GetRowCellValue(gvList.FocusedRowHandle, "F_PHONE").ToString(); string password = ""; password = gvList.GetRowCellValue(gvList.FocusedRowHandle, "F_PASSWORD").ToString(); txtF_PASSWORD.Text = RelayTest.Util.DBUtility.DESEncrypt.Decrypt(password); txtRepeatPassword.Text = txtF_PASSWORD.Text; //是否是上位机用户 decimal isSwj; decimal.TryParse(gvList.GetRowCellValue(gvList.FocusedRowHandle, "F_ISSWJ").ToString(), out isSwj); chkF_ISSWJ.EditValue = isSwj; } catch (Exception ex) { Log.Error(this.GetType() + "->" + ApplicationCommon.GetMethodName() + "---FAILED", ex); throw ex; } }
private void btnQuery_Click(object sender, EventArgs e) { //根据界面内容生成查询条件 string query_con = ""; query_con = getQueryCon(); ProxyBllTEST_INFO blltest_Info = new ProxyBllTEST_INFO(); DataSet _dsCommandInfo = new DataSet(); try { Log.Info(GetType() + "->" + ApplicationCommon.GetMethodName() + "---START"); //绑定数据 _dsCommandInfo = blltest_Info.GetDevStatusInfoByQueryCondition(query_con); //有数据情况下绑定 if (_dsCommandInfo != null && _dsCommandInfo.Tables.Count > 0) { gcList.DataSource = _dsCommandInfo.Tables[0]; } } catch (Exception ex) { Log.Error(GetType() + "->" + ApplicationCommon.GetMethodName() + "---FAILED", ex); throw ex; } }
/// <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> /// query data from database and bind to gridview /// </summary> private void BindGridview() { try { Log.Info(GetType() + "->" + ApplicationCommon.GetMethodName() + "---START"); //绑定数据 _dsPowerbaseInfo = _bllDevPowerInfo.GetAllList(); //有数据情况下绑定 if (_dsPowerbaseInfo != null && _dsPowerbaseInfo.Tables.Count > 0) { gcList.DataSource = _dsPowerbaseInfo.Tables[0]; } //(ApplicationCommon.GetRepositoryItemLookUpEditControl("T_WORKSTATION_INFO", "FMasterId", "F_MASTER_NAME","")); gvList_RowClick(this, null); } catch (Exception ex) { Log.Error(GetType() + "->" + ApplicationCommon.GetMethodName() + "---FAILED", ex); throw ex; } }
/// <summary> /// 绑定所有列表信息 /// </summary> private void FillAllSelectedControls() { try { Log.Info(GetType() + "->" + ApplicationCommon.GetMethodName() + "---START"); //供电柜开关状态 colF_POWER_SWITCH_STATUS.ColumnEdit = ApplicationCommon.GetRepositoryItemLookUpEditControl("T_SYSTEM_LIST", "F_VALUE", "F_DISPLAY", "F_TYPE='F_POWER_SWITCH_STATUS'"); //输入输出状态 colF_POWER_SWITCH_TYPE.ColumnEdit = ApplicationCommon.GetRepositoryItemLookUpEditControl("T_SYSTEM_LIST", "F_VALUE", "F_DISPLAY", "F_TYPE='F_POWER_SWITCH_TYPE'"); //禁用状态 colF_DEL.ColumnEdit = ApplicationCommon.GetRepositoryItemLookUpEditControl("T_SYSTEM_LIST", "F_VALUE", "F_DISPLAY", "F_TYPE='ALLOWUSE'"); //开关禁用状态 colSwitchF_DEL.ColumnEdit = ApplicationCommon.GetRepositoryItemLookUpEditControl("T_SYSTEM_LIST", "F_VALUE", "F_DISPLAY", "F_TYPE='ALLOWUSE'"); } catch (Exception ex) { Log.Error(GetType() + "->" + ApplicationCommon.GetMethodName() + "---FAILED", ex); throw ex; } }
/// <summary> /// 将具体信息显示在编辑控件 /// </summary> private void FillDataToDisplayControls() { try { Log.Info(this.GetType() + "->" + ApplicationCommon.GetMethodName() + "---START"); //编号 txtCode.Text = gvList.GetFocusedRowCellValue("F_CODE").ToString(); //名称 txtName.Text = gvList.GetFocusedRowCellValue("F_NAME").ToString(); //描述 txtDescription.Text = gvList.GetFocusedRowCellValue("F_DESCRIPTION").ToString(); //禁用状态 radioAllowUse.EditValue = int.Parse(gvList.GetFocusedRowCellValue("F_DEL").ToString()); } catch (Exception ex) { Log.Error(this.GetType() + "->" + ApplicationCommon.GetMethodName() + "---FAILED", ex); throw ex; } }
/// <summary> /// 启动其中的一条记录 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnEnabled_Click(object sender, EventArgs e) { try { Log.Info(this.GetType() + "->" + ApplicationCommon.GetMethodName() + "---START"); //检查必填字段 bool isAllOk = CheckNotNullField(); if (!isAllOk) { return; } //准备要存储的数据 ModelDEV_POWER_SWITCH modelDevPowerSwitch = PreparePowerSwitchinfo(); //更新数据 bool status = _bllDevPowerSwitch.Enabled(modelDevPowerSwitch.F_POWER_ID, modelDevPowerSwitch.F_POWER_SWITCH_ID); if (status) { XtraMessageBox.Show("此数据已启用。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { XtraMessageBox.Show("没有数据被更新。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } catch (Exception ex) { Log.Error(this.GetType() + "->" + ApplicationCommon.GetMethodName() + "---FAILED", ex); throw ex; } }
/// <summary> /// 将数据显示在控件中 /// </summary> private void ShowDataInEditControls() { try { Log.Info(this.GetType() + "->" + ApplicationCommon.GetMethodName() + "---START"); if (_modelDevPowerChannelInfo == null) { return; } //负载柜编号 txtF_LOAD_ID.Text = _modelDevPowerChannelInfo.F_LOAD_ID; //通道序号 txtF_LOAD_CHANNEL_ID.Text = _modelDevPowerChannelInfo.F_LOAD_CHANNEL_ID; //通道名称 txtF_LOAD_CHANNEL_NAME.Text = _modelDevPowerChannelInfo.F_LOAD_CHANNEL_ID; //校准编号 txtF_LOAD_CHANNEL_CALIBRATION.Text = _modelDevPowerChannelInfo.F_LOAD_CHANNEL_CALIBRATION; //负载可用状态 lueF_LOAD_CHANNEL_STATUS.EditValue = (decimal)_modelDevPowerChannelInfo.F_LOAD_CHANNEL_STATUS; } catch (Exception ex) { Log.Error(this.GetType() + "->" + ApplicationCommon.GetMethodName() + "---FAILED", ex); throw ex; } }
private void gvList_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e) { try { Log.Info(GetType() + "->" + ApplicationCommon.GetMethodName() + "---START"); if (gvList.FocusedRowHandle < 0) { return; } string tempId = ""; string tempWorktypeName = ""; string tempProgrammCode = ""; tempId = gvList.GetFocusedRowCellValue("F_ID").ToString(); tempWorktypeName = gvList.GetFocusedRowCellValue("F_WORKTYPE_NAME").ToString(); tempProgrammCode = gvList.GetFocusedRowCellValue("F_PROGRAMM_CODE").ToString(); string QueryCon = ""; QueryCon = " F_WORKTYPE_NAME='" + tempWorktypeName + "' and F_PROGRAMM_CODE='" + tempProgrammCode + "' "; //绑定数据 _dsCommandStartPar = _bllCommandStartPar.GetList(QueryCon); //有数据情况下绑定 if (_dsCommandStartPar != null && _dsCommandStartPar.Tables.Count > 0) { gcStartPar.DataSource = _dsCommandStartPar.Tables[0]; } } catch (Exception ex) { Log.Error(GetType() + "->" + ApplicationCommon.GetMethodName() + "---FAILED", ex); throw ex; } }
/// <summary> /// 绑定所有列表信息 /// </summary> private void FillAllSelectedControls() { try { Log.Info(GetType() + "->" + ApplicationCommon.GetMethodName() + "---START"); //绑定设备类型 ApplicationCommon.GetLookUpEditControl(lueF_DEV_TYPE, "T_SYSTEM_LIST", "F_VALUE", "编码", "F_DISPLAY", "设备类型", "F_TYPE='F_DEV_TYPE' and F_VALUE<>6"); //工作状态选择 ApplicationCommon.GetLookUpEditControl(lueF_SENSOR_STATUS, "T_SYSTEM_LIST", "F_VALUE", "编码", "F_DISPLAY", "设备类型", "F_TYPE='F_SENSOR_STATUS'"); //设备类型 colF_DEV_TYPE.ColumnEdit = ApplicationCommon.GetRepositoryItemLookUpEditControl("T_SYSTEM_LIST", "F_VALUE", "F_DISPLAY", "F_TYPE='F_DEV_TYPE'"); //禁用状态 colF_DEL.ColumnEdit = ApplicationCommon.GetRepositoryItemLookUpEditControl("T_SYSTEM_LIST", "F_VALUE", "F_DISPLAY", "F_TYPE='ALLOWUSE'"); //工作状态 colF_SENSOR_STATUS.ColumnEdit = ApplicationCommon.GetRepositoryItemLookUpEditControl("T_SYSTEM_LIST", "F_VALUE", "F_DISPLAY", "F_TYPE='F_SENSOR_STATUS'"); } catch (Exception ex) { Log.Error(GetType() + "->" + ApplicationCommon.GetMethodName() + "---FAILED", ex); throw ex; } }
/// <summary> /// 检查必填段 /// </summary> /// <returns></returns> private bool CheckNotNullField() { try { Log.Info(this.GetType() + "->" + ApplicationCommon.GetMethodName() + "---START"); //编号 if (string.IsNullOrEmpty(txtTypeCode.Text)) { XtraMessageBox.Show("编码不能为空。", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } //名称 if (string.IsNullOrEmpty(txtTypeName.Text)) { XtraMessageBox.Show("名称不能为空。", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } return(true); } catch (Exception ex) { Log.Error(this.GetType() + "->" + ApplicationCommon.GetMethodName() + "---FAILED", ex); throw ex; } }
private void FrmQueryTestAttatch_Load(object sender, EventArgs e) { lbl_testCode.Text = "任务编号:" + now_taskID; lst_attatch.Items.Clear(); //查询选择任务编号是否存在附件信息 ProxyBllTEST_PREPARE_ATTATCH blltest_attatch = new ProxyBllTEST_PREPARE_ATTATCH(); DataSet _dsCommandInfo = new DataSet(); try { //绑定数据 _dsCommandInfo = blltest_attatch.GetList(" F_TEST_TASK_ID='" + now_taskID + "' "); if (_dsCommandInfo != null && _dsCommandInfo.Tables.Count > 0) { for (int i = 0; i < _dsCommandInfo.Tables[0].Rows.Count; i++) { lst_attatch.Items.Add(_dsCommandInfo.Tables[0].Rows[i]["F_ATTATCHNAME"].ToString()); } } } catch (Exception ex) { Log.Error(GetType() + "->" + ApplicationCommon.GetMethodName() + "---FAILED", ex); throw ex; } }
/// <summary> /// 检查必填段 /// </summary> /// <returns></returns> private bool CheckNotNullField() { try { Log.Info(GetType() + "->" + ApplicationCommon.GetMethodName() + "---START"); //编号 if (string.IsNullOrEmpty(txtF_LOADPOWER_ID.Text)) { DevExpress.DXCore.Controls.XtraEditors.XtraMessageBox.Show("编码不能为空。", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } //名称 if (string.IsNullOrEmpty(txtF_LOADPOWER_NAME.Text)) { DevExpress.DXCore.Controls.XtraEditors.XtraMessageBox.Show("名称不能为空。", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } return(true); } catch (Exception ex) { Log.Error(GetType() + "->" + ApplicationCommon.GetMethodName() + "---FAILED", ex); throw ex; } }
private void FrmTaskForSubSendp_Load(object sender, EventArgs e) { try { Log.Info(this.GetType() + "->" + ApplicationCommon.GetMethodName() + "---START"); //初始化 initData(); //初始化试验样品数据表。 InitSampleTable(_TestSampleTable); //初始化开始命令参数表 InitStartParValueTable(_TestCommStartPar); //读取未开始试验的试验任务 BindGridview(); //如果试验任务编号列表不为空,默认选中第一项任务编号 if (lstTasklist.Items.Count > 0) { lstTasklist.SelectedIndex = 0; } } catch (Exception ex) { Log.Error(this.GetType() + "->" + ApplicationCommon.GetMethodName() + "---FAILED", ex); throw ex; } }
private void gvList_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e) { try { Log.Info(GetType() + "->" + ApplicationCommon.GetMethodName() + "---START"); if (gvList.FocusedRowHandle < 0) { return; } //命令id txtId.Text = gvList.GetFocusedRowCellValue("F_COMMAND_ID").ToString(); //命令编码 txtCode.Text = gvList.GetFocusedRowCellValue("F_COMMAND_CODE").ToString(); //命令描述 txtDesc.Text = gvList.GetFocusedRowCellValue("F_COMMAND_DESC").ToString(); //备注 txtMemo.Text = gvList.GetFocusedRowCellValue("F_COMMAND_MEMO").ToString(); } catch (Exception ex) { Log.Error(GetType() + "->" + ApplicationCommon.GetMethodName() + "---FAILED", ex); throw ex; } }
/// <summary> /// 绑定数据到开关信息 /// </summary> public void BindPowerSwitchInfoGridView() { try { Log.Info(GetType() + "->" + ApplicationCommon.GetMethodName() + "---START"); //获得负载柜编号 //编号 if (string.IsNullOrEmpty(txtF_LOAD_ID.Text)) { return; } //绑定数据 ProxyBllDEV_LOAD_CHANNEL_INFO bllDevLoadChannelInfo = new ProxyBllDEV_LOAD_CHANNEL_INFO(); DataSet dsLoadChannel = bllDevLoadChannelInfo.GetList("F_LOAD_ID='" + txtF_LOAD_ID.Text + "'"); //有数据情况下绑定 if (dsLoadChannel != null && dsLoadChannel.Tables.Count > 0) { gcLoadChannel.DataSource = dsLoadChannel.Tables[0]; } } catch (Exception ex) { Log.Error(GetType() + "->" + ApplicationCommon.GetMethodName() + "---FAILED", ex); throw ex; } }
private void gvList_RowClick(object sender, DevExpress.XtraGrid.Views.Grid.RowClickEventArgs e) { try { Log.Info(GetType() + "->" + ApplicationCommon.GetMethodName() + "---START"); if (gvLoad.FocusedRowHandle < 0) { return; } //获得负载柜id string workstationId = gvLoad.GetFocusedRowCellValue("F_LOAD_ID").ToString(); //上位机与下位机绑定数据 gcSubordinate.DataSource = _bllDevLoadInfo.GetSubordinatesRelatedToLoad(workstationId).Tables[0]; gvSubordinate.ActiveFilterString = "F_CHECK = 1"; //上位机与线圈电源绑定数据 gcCoilPower.DataSource = _bllDevLoadInfo.GetCoilPowersRelatedToLoad(workstationId).Tables[0]; gvCoilPower.ActiveFilterString = "F_CHECK = 1"; } catch (Exception ex) { Log.Error(GetType() + "->" + ApplicationCommon.GetMethodName() + "---FAILED", ex); throw ex; } }
private void btnQuery_Click(object sender, EventArgs e) { if (!detBegintime1.Text.Trim().Equals("") && !detBegintime2.Text.Trim().Equals("")) { if (detBegintime1.Text.CompareTo(detBegintime2.Text) > 0) { MessageBox.Show("查询条件中开始时间结束日期不能大于起始日期!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Information); } } if (!txtFZDY1.Text.Trim().Equals("") && !txtFZDY2.Text.Trim().Equals("")) { if (Convert.ToInt16(txtFZDY1.Text.Trim()) > Convert.ToInt16(txtFZDY2.Text.Trim())) { MessageBox.Show("查询条件负载电压范围中后值不能大于前值!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Information); } } if (!txtFZDL1.Text.Trim().Equals("") && !txtFZDL2.Text.Trim().Equals("")) { if (Convert.ToInt16(txtFZDL1.Text.Trim()) > Convert.ToInt16(txtFZDL2.Text.Trim())) { MessageBox.Show("查询条件负载电流范围中后值不能大于前值!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Information); } } //根据界面内容生成查询条件 string query_con = ""; query_con = getQueryCon(); ProxyBllTEST_INFO blltest_Info = new ProxyBllTEST_INFO(); DataSet _dsCommandInfo = new DataSet(); try { Log.Info(GetType() + "->" + ApplicationCommon.GetMethodName() + "---START"); //绑定数据 _dsCommandInfo = blltest_Info.GetTestTaskInfoByQueryCondition(query_con); //有数据情况下绑定 if (_dsCommandInfo != null && _dsCommandInfo.Tables.Count > 0) { gcList.DataSource = _dsCommandInfo.Tables[0]; } if (gvList.RowCount > 0) { btnExport.Enabled = true; } else { btnExport.Enabled = false; } } catch (Exception ex) { Log.Error(GetType() + "->" + ApplicationCommon.GetMethodName() + "---FAILED", ex); throw ex; } }
/// <summary> /// 绑定所有列表信息 /// </summary> private void FillAllSelectedControls() { try { Log.Info(GetType() + "->" + ApplicationCommon.GetMethodName() + "---START"); //编辑区负载类型 ApplicationCommon.GetLookUpEditControl(lueF_LOAD_TYPE, "T_SYSTEM_LIST", "F_VALUE", "编码", "F_DISPLAY", "类型", "F_TYPE='F_LOAD_TYPE'"); //编辑区电压类型 ApplicationCommon.GetLookUpEditControl(lueF_LOAD_VOLTAGE_TYPE, "T_SYSTEM_LIST", "F_VALUE", "编码", "F_DISPLAY", "类型", "F_TYPE='F_LOAD_VOLTAGE_TYPE'"); //禁用状态 colF_DEL.ColumnEdit = ApplicationCommon.GetRepositoryItemLookUpEditControl("T_SYSTEM_LIST", "F_VALUE", "F_DISPLAY", "F_TYPE='ALLOWUSE'"); colChannelF_DEL.ColumnEdit = ApplicationCommon.GetRepositoryItemLookUpEditControl("T_SYSTEM_LIST", "F_VALUE", "F_DISPLAY", "F_TYPE='ALLOWUSE'"); //负载类型 colF_LOAD_TYPE.ColumnEdit = ApplicationCommon.GetRepositoryItemLookUpEditControl("T_SYSTEM_LIST", "F_VALUE", "F_DISPLAY", "F_TYPE='F_LOAD_TYPE'"); //负载电压类型 colF_LOAD_VOLTAGE_TYPE.ColumnEdit = ApplicationCommon.GetRepositoryItemLookUpEditControl("T_SYSTEM_LIST", "F_VALUE", "F_DISPLAY", "F_TYPE='F_LOAD_VOLTAGE_TYPE'"); //负载可用状态 colF_LOAD_CHANNEL_STATUS.ColumnEdit = ApplicationCommon.GetRepositoryItemLookUpEditControl("T_SYSTEM_LIST", "F_VALUE", "F_DISPLAY", "F_TYPE='F_LOAD_CHANNEL_STATUS'"); } catch (Exception ex) { Log.Error(GetType() + "->" + ApplicationCommon.GetMethodName() + "---FAILED", ex); throw ex; } }
/// <summary> /// 绑定表格 /// </summary> private void BindGridview() { try { Log.Info(this.GetType() + "->" + ApplicationCommon.GetMethodName() + "---START"); if (lueF_WORKSTATION_ID.EditValue == null) { return; } string wrokstationId = lueF_WORKSTATION_ID.EditValue.ToString(); //如果为空则返回 if (string.IsNullOrEmpty(wrokstationId)) { return; } DataSet dsCom232Settings = _bllComSettings.GetList("F_WORKSTATION_ID='" + wrokstationId + "'"); //有数据情况下绑定 if (dsCom232Settings != null && dsCom232Settings.Tables.Count > 0) { gcList.DataSource = dsCom232Settings.Tables[0]; } } catch (Exception ex) { Log.Error(this.GetType() + "->" + ApplicationCommon.GetMethodName() + "---FAILED", ex); throw ex; } }
/// <summary> /// 表格点击 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void gvList_RowClick(object sender, DevExpress.XtraGrid.Views.Grid.RowClickEventArgs e) { try { Log.Info(this.GetType() + "->" + ApplicationCommon.GetMethodName() + "---START"); if (gvList.FocusedRowHandle < 0 || gvList.FocusedRowHandle >= gvList.RowCount) { txtF_ROLE_ID.Text = ""; txtF_ROLE_NAME.Text = ""; txtF_DESC.Text = ""; return; } //将当前数据显示在界面上 txtF_ROLE_ID.Text = gvList.GetRowCellValue(gvList.FocusedRowHandle, "F_ROLE_ID").ToString(); txtF_ROLE_NAME.Text = gvList.GetRowCellValue(gvList.FocusedRowHandle, "F_ROLE_NAME").ToString(); txtF_DESC.Text = gvList.GetRowCellValue(gvList.FocusedRowHandle, "F_DESC").ToString(); } catch (Exception ex) { Log.Error(this.GetType() + "->" + ApplicationCommon.GetMethodName() + "---FAILED", ex); throw ex; } }
/// <summary> /// 授权 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnAuth_Click(object sender, EventArgs e) { try { Log.Info(this.GetType() + "->" + ApplicationCommon.GetMethodName() + "---START"); //如果没有选择任何数据则退出 if (chklistAllModules.SelectedItems.Count == 0) { XtraMessageBox.Show("请至少选择一个操作内容。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } //准备要存储的用户角色关联信息 List <ModelSYSTEM_USER_ROLE> modelSystemUserRoles = PrepareUserRoleList(); //准备要存储的角色模块关联信息 List <ModelSYSTEM_ROLE_AUTH> modelSystemRoleAuths = PrepareRoleAuthList(); //保存数据 _bllSystemRoleAuth.Auth(lueRole.EditValue.ToString(), modelSystemUserRoles, modelSystemRoleAuths); XtraMessageBox.Show("授权完成。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception ex) { Log.Error(this.GetType() + "->" + ApplicationCommon.GetMethodName() + "---FAILED", ex); throw ex; } }
/// <summary> /// 彻底删除一条记录,一旦删除无法恢复,建议不要使用此功能 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnDelete_Click(object sender, EventArgs e) { try { Log.Info(GetType() + "->" + ApplicationCommon.GetMethodName() + "---START"); //删除前判断 DialogResult dialogResult = XtraMessageBox.Show("此操作将永久删除数据并有可能导致其他关联数据出错,是否继续?", "选择", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dialogResult == DialogResult.No) { return; } //检查必填字段 bool isAllOk = CheckNotNullField(); if (!isAllOk) { return; } //准备要存储的数据 ModelDEV_WORKSTATION_INFO modelWorkstationInfo = PreModelWorkstationInfo(); //判断是否有关系 bool hasRelation = _bllDevWorkstationInfo.HasRelation(modelWorkstationInfo.F_WORKSTATION_ID); if (hasRelation) { XtraMessageBox.Show("此设备有和其他设备的关系,不能删除。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } //更新数据 bool status = _bllDevWorkstationInfo.Drop(modelWorkstationInfo.F_WORKSTATION_ID); //获得当前rowhandle int rowhandle = gvList.FocusedRowHandle; //绑定数据 BindGridview(); //设置焦点行 gvList.FocusedRowHandle = rowhandle; if (status) { XtraMessageBox.Show("此数据已删除。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { XtraMessageBox.Show("没有数据被更新。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } catch (Exception ex) { Log.Error(GetType() + "->" + ApplicationCommon.GetMethodName() + "---FAILED", ex); throw ex; } }
/// <summary> /// 点击表格 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void gvList_RowClick(object sender, DevExpress.XtraGrid.Views.Grid.RowClickEventArgs e) { try { Log.Info(GetType() + "->" + ApplicationCommon.GetMethodName() + "---START"); if (gvList.FocusedRowHandle < 0) { return; } //编号 txtF_COILPOWER_ID.Text = gvList.GetFocusedRowCellValue("F_COILPOWER_ID").ToString(); //名称 txtF_COILPOWER_NAME.Text = gvList.GetFocusedRowCellValue("F_COILPOWER_NAME").ToString(); //校验编号 txtF_COILPOWER_CALIBRATION.Text = gvList.GetFocusedRowCellValue("F_COILPOWER_CALIBRATION").ToString(); //端口 txtF_COM_ADDRESS.Text = gvList.GetFocusedRowCellValue("F_COM_ADDRESS").ToString(); //地址 txtF_COILPOWER_ADDRESS.Text = gvList.GetFocusedRowCellValue("F_COILPOWER_ADDRESS").ToString(); //电压上限 txtF_COILPOWER_VOLTAGE_CEILING.Text = gvList.GetFocusedRowCellValue("F_COILPOWER_VOLTAGE_CEILING").ToString(); //电压下限 txtF_COILPOWER_VOLTAGE_FLOOR.Text = gvList.GetFocusedRowCellValue("F_COILPOWER_VOLTAGE_FLOOR").ToString(); //电流上限 txtF_COILPOWER_CURRENT_CEILING.Text = gvList.GetFocusedRowCellValue("F_COILPOWER_CURRENT_CEILING").ToString(); //电压下限 txtF_COILPOWER_CURRENT_FLOOR.Text = gvList.GetFocusedRowCellValue("F_COILPOWER_CURRENT_FLOOR").ToString(); //输出功率 txtF_COILPOWER_POWER.Text = gvList.GetFocusedRowCellValue("F_COILPOWER_POWER").ToString(); //状态 lueF_COILPOWER_RUN_STATUS.EditValue = decimal.Parse(gvList.GetFocusedRowCellValue("F_COILPOWER_RUN_STATUS").ToString()); //描述信息 txtF_COILPOWER_MEMO.Text = gvList.GetFocusedRowCellValue("F_COILPOWER_MEMO").ToString(); //禁用状态 rdoF_DEL.EditValue = decimal.Parse(gvList.GetFocusedRowCellValue("F_DEL").ToString()); } catch (Exception ex) { Log.Error(GetType() + "->" + ApplicationCommon.GetMethodName() + "---FAILED", ex); throw ex; } }
/// <summary> /// 更新信息 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnSave_Click(object sender, EventArgs e) { try { Log.Info(this.GetType() + "->" + ApplicationCommon.GetMethodName() + "---START"); //检查必填字段 bool isAllOk = CheckNotNullField(); if (!isAllOk) { return; } //准备要存储的数据 ModelDEV_POWER_SWITCH modelDevPowerSwitch = PreparePowerSwitchinfo(); //判断此数据是否已经存在 bool isDataExist = _bllDevPowerSwitch.Exists(modelDevPowerSwitch.F_POWER_ID, modelDevPowerSwitch.F_POWER_SWITCH_ID); if (isDataExist) { //已经存在判断是否更新 DialogResult dialogResult = XtraMessageBox.Show("当前数据已存在,是否更新?", "选择", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dialogResult == DialogResult.No) { return; } //更新数据 bool status = _bllDevPowerSwitch.Update(modelDevPowerSwitch); if (status) { XtraMessageBox.Show("此数据已更新。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { XtraMessageBox.Show("没有数据被更新,操作中断。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } else { _bllDevPowerSwitch.Add(modelDevPowerSwitch); XtraMessageBox.Show("此数据已增加。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } OnSaveBuutonClickedChange(); } catch (Exception ex) { Log.Error(this.GetType() + "->" + ApplicationCommon.GetMethodName() + "---FAILED", ex); throw ex; } }
/// <summary> /// 准备要操作Model /// </summary> /// <returns></returns> private ModelDEV_SUBORDINATE_INFO PrepareModelSubordinateInfo() { try { Log.Info(GetType() + "->" + ApplicationCommon.GetMethodName() + "---START"); ModelDEV_SUBORDINATE_INFO modelDevSubordinateInfo = new ModelDEV_SUBORDINATE_INFO(); // 下位机编号 modelDevSubordinateInfo.F_SUBORDINATE_ID = txtF_SUBORDINATE_ID.Text; // 下位机名称 modelDevSubordinateInfo.F_SUBORDINATE_NAME = txtF_SUBORDINATE_NAME.Text; //校准编号 modelDevSubordinateInfo.F_SUBORDINATE_CALIBRATION = txtF_SUBORDINATE_CALIBRATION.Text; //端口 modelDevSubordinateInfo.F_COM_ADDRESS = txtF_COM_ADDRESS.Text.ToUpper(); //通信地址 decimal subordinateAddress; decimal.TryParse(txtF_SUBORDINATE_ADDRESS.Text, out subordinateAddress); //通信地址 modelDevSubordinateInfo.F_SUBORDINATE_ADDRESS = subordinateAddress; // 下位机状态 modelDevSubordinateInfo.F_SUBORDINATE_STATUS = decimal.Parse(lueF_SUBORDINATE_STATUS.EditValue.ToString()); // 备注 modelDevSubordinateInfo.F_SUBORDINATE_MEMO = txtF_SUBORDINATE_MEMO.Text; //创建时间 DateTime optDateTime = DateTime.Now; modelDevSubordinateInfo.F_CREATE_TIME = optDateTime; //操作员 modelDevSubordinateInfo.F_OPERATOR_ID = AppGlobal.GUserId; //操作时间 modelDevSubordinateInfo.F_OPERATIONTIME = optDateTime; //是否删除 modelDevSubordinateInfo.F_DEL = 0; return(modelDevSubordinateInfo); } catch (Exception ex) { Log.Error(GetType() + "->" + ApplicationCommon.GetMethodName() + "---FAILED", ex); throw ex; } }
/// <summary> /// 准备要存储的数据 /// </summary> /// <returns></returns> private ModelCOM_SETTINGS PrepaireModelCOM232_SETTINGS() { try { Log.Info(this.GetType() + "->" + ApplicationCommon.GetMethodName() + "---START"); //创建数据实例 ModelCOM_SETTINGS modelCom232Settings = new ModelCOM_SETTINGS(); //上位机编码 modelCom232Settings.F_WORKSTATION_ID = lueF_WORKSTATION_ID.EditValue.ToString(); //串口类型 modelCom232Settings.F_TYPE = cbbF_TYPE.Text; //串口号 modelCom232Settings.F_COM_CODE = txtF_COM_CODE.Text.ToUpper(); //波特率 modelCom232Settings.F_BAUDRATE = decimal.Parse(cbbF_BAUDRATE.Text); //数据位 modelCom232Settings.F_DATABIT = decimal.Parse(cbbF_DATABIT.Text); //奇偶校验 modelCom232Settings.F_ODDEVENCHECK = cbbF_ODDEVENCHECK.SelectedIndex; //停止位 modelCom232Settings.F_STOPBIT = decimal.Parse(cbbF_STOPBIT.Text) * 10; //据流控制 modelCom232Settings.F_STREAMCONTROL = cbbF_STREAMCONTROL.SelectedIndex; //创建时间 DateTime opTime = DateTime.Now; modelCom232Settings.F_CREATE_TIME = opTime; //操作员 modelCom232Settings.F_OPERATOR_ID = AppGlobal.GUserId; //操作时间 modelCom232Settings.F_OPERATIONTIME = opTime; //是否删除 modelCom232Settings.F_DEL = 0; return(modelCom232Settings); } catch (Exception ex) { Log.Error(this.GetType() + "->" + ApplicationCommon.GetMethodName() + "---FAILED", ex); throw ex; } }
/// <summary> /// 创建相应要保存的数据类 /// </summary> /// <returns></returns> private List <ModelDEVRelationComm> PrepareModels() { try { Log.Info(GetType() + "->" + ApplicationCommon.GetMethodName() + "---START"); List <ModelDEVRelationComm> modelDevRelationComms = new List <ModelDEVRelationComm>(); DateTime optDateTime = DateTime.Now; foreach (DataRow dataRow in dtRelation.Rows) { if (dataRow["F_CHECK"].ToString() == "1") { ModelDEVRelationComm model = new ModelDEVRelationComm(); //负载电源 if (cbbDevType.SelectedIndex == 0) { model.F_MASTER_ID = gvDevice.GetFocusedRowCellValue("F_LOADPOWER_ID").ToString(); model.F_MASTER_NAME = gvDevice.GetFocusedRowCellValue("F_LOADPOWER_NAME").ToString(); } //负载 else if (cbbDevType.SelectedIndex == 1) { model.F_MASTER_ID = gvDevice.GetFocusedRowCellValue("F_LOAD_ID").ToString(); model.F_MASTER_NAME = gvDevice.GetFocusedRowCellValue("F_LOAD_NAME").ToString(); } model.F_AFFILIATION_ID = dataRow["F_POWER_SWITCH_ID"].ToString(); model.F_CREATE_TIME = optDateTime; //操作员 model.F_OPERATOR_ID = AppGlobal.GUserId; //操作时间 model.F_OPERATIONTIME = optDateTime; //是否删除 model.F_DEL = 0; modelDevRelationComms.Add(model); } } return(modelDevRelationComms); } catch (Exception ex) { Log.Error(GetType() + "->" + ApplicationCommon.GetMethodName() + "---FAILED", ex); throw ex; } }