123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139 |
- using DevExpress.XtraEditors;
- using DevExpress.XtraEditors.Controls;
- using DevExpress.XtraGrid.Columns;
- using DevExpress.XtraGrid.Views.Grid;
- using ProjectBase.Data.BaseDAL;
- using ProjectBase.Data.Logs;
- using SIMDP.BLL;
- using SIMDP.Model;
- using ProjectBase.Util;
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- namespace SIMDP.View
- {
-
- public partial class FormSystemParameter : DevExpress.XtraEditors.XtraForm
- {
- public FormSystemParameter()
- {
- InitializeComponent();
- }
- private void FormSystemParameter_Load(object sender, EventArgs e)
- {
- //BlSystemParameter blPara = new BlSystemParameter();
- this.gridControlPara.DataSource = BLLFactory<BlSystemParameter>.Instance.GetAll();
- }
-
- /// <summary>
- /// 删除操作
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void RepositoryItemHyperLinkEditDelete_Click(object sender, EventArgs e)
- {
-
- try
- {
- if (DevExpress.XtraEditors.XtraMessageBox.Show("您确定删除选定的记录么?", "提示信息", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.No)
- {
- return;
- }
- MoSystemParameter para = this.gridView1.GetFocusedRow() as MoSystemParameter;
- //BlSystemParameter blSystem = new BlSystemParameter();
- BLLFactory<BlSystemParameter>.Instance.Delete(para.ParameterId, SysEnvironment.CurrentLoginID);
- this.gridControlPara.DataSource = BLLFactory<BlSystemParameter>.Instance.GetAll();
- }
- catch (Exception ex)
- {
- DevExpress.XtraEditors.XtraMessageBox.Show("删除失败。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
- LogHelper.log.Error(string.Format("删除数据库系统参数数据出现错误:{0}", ex));
- }
- }
- /// <summary>
- /// 修改操作
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void RepositoryItemHyperLinkAlter_Click(object sender, EventArgs e)
- {
- MoSystemParameter selectRow = this.gridView1.GetFocusedRow() as MoSystemParameter;
- if (selectRow == null)
- {
- DevExpress.XtraEditors.XtraMessageBox.Show("请选择一行数据!");
- return;
- }
- FormEditSystemParameter form = new FormEditSystemParameter(selectRow);
- form.StartPosition = FormStartPosition.CenterScreen;
- form.ShowDialog();
- this.gridControlPara.DataSource = null;
- //BlSystemParameter blPara = new BlSystemParameter();
- this.gridControlPara.DataSource = BLLFactory<BlSystemParameter>.Instance.GetAll();
- }
- /// <summary>
- /// 显示转换
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void CustomColumnDisplayText(object sender, DevExpress.XtraGrid.Views.Base.CustomColumnDisplayTextEventArgs e)
- {
- if (e.Column.FieldName == "ParameterType")
- {
- foreach (KeyValuePair<int, string> item in SysEnvironment.dirSysParameterType)
- {
- if (Convert.ToInt32(e.Value) == item.Key)
- {
- e.DisplayText = item.Value;
- }
- }
- }
- }
- private void simpleButtonAdd_Click(object sender, EventArgs e)
- {
- FormEditSystemParameter form = new FormEditSystemParameter(null);
- form.StartPosition = FormStartPosition.CenterScreen;
- form.ShowDialog();
- this.gridControlPara.DataSource = null;
- //BlSystemParameter blPara = new BlSystemParameter();
- this.gridControlPara.DataSource = BLLFactory<BlSystemParameter>.Instance.GetAll();
- }
- private void simpleButtonAllDelete_Click(object sender, EventArgs e)
- {
- if (DevExpress.XtraEditors.XtraMessageBox.Show("您确定删除所有的记录么?请谨慎操作。", "提示信息", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.No)
- {
- return;
- }
- try
- {
- bool flag = BLLFactory<BlSystemParameter>.Instance.DeleteByCondition(" 1 = 1");
- if (flag)
- {
- DevExpress.XtraEditors.XtraMessageBox.Show("全部删除成功。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
- this.gridControlPara.DataSource = null;
- }
- }
- catch (Exception ex)
- {
- DevExpress.XtraEditors.XtraMessageBox.Show("全部删除失败。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
- LogHelper.log.Error(string.Format("删除系统参数数据出现错误:{0}", ex));
- }
- }
- }
- }
|