123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Text;
- using System.Linq;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- using DevExpress.XtraEditors;
- using ProjectBase.Data.BaseDAL;
- using SIMDP.BLL;
- using SIMDP.Util;
- using SIMDP.Model;
- using ProjectBase.Data.Logs;
- namespace SIMDP
- {
- public partial class FormUserParameter : DevExpress.XtraEditors.XtraForm
- {
- public FormUserParameter()
- {
- InitializeComponent();
- }
- private void FormUserParameter_Load(object sender, EventArgs e)
- {
- this.gridControl_UserPara.DataSource = BLLFactory<BlUserParameter>.Instance.GetAll();
- }
- /// <summary>
- /// 显示转换
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void gridView_UserPara_CustomColumnDisplayText(object sender, DevExpress.XtraGrid.Views.Base.CustomColumnDisplayTextEventArgs e)
- {
- //if (e.Column.FieldName == "UserParaType")
- //{
- // foreach (KeyValuePair<int, string> item in SysEnvironment.dirSysParameterType)
- // {
- // if (Convert.ToInt32(e.Value) == item.Key)
- // {
- // e.DisplayText = item.Value;
- // }
- // }
- //}
- }
- /// <summary>
- /// 删除操作
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void repositoryItemHyperLinkDelete_Click(object sender, EventArgs e)
- {
- try
- {
- if (DevExpress.XtraEditors.XtraMessageBox.Show("您确定删除选定的记录么?", "提示信息", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.No)
- {
- return;
- }
- MoUserParameter para = this.gridView_UserPara.GetFocusedRow() as MoUserParameter;
- //BlSystemParameter blSystem = new BlSystemParameter();
- BLLFactory<BlUserParameter>.Instance.Delete(para.UserParaId, SysEnvironment.CurrentLoginID);
- this.gridControl_UserPara.DataSource = BLLFactory<BlUserParameter>.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_Click(object sender, EventArgs e)
- {
- MoUserParameter selectRow = this.gridView_UserPara.GetFocusedRow() as MoUserParameter;
- if (selectRow == null)
- {
- DevExpress.XtraEditors.XtraMessageBox.Show("请选择一行数据!");
- return;
- }
- FormEditUserParameter form = new FormEditUserParameter(selectRow);
- form.StartPosition = FormStartPosition.CenterScreen;
- form.ShowDialog();
- this.gridControl_UserPara.DataSource = null;
- this.gridControl_UserPara.DataSource = BLLFactory<BlUserParameter>.Instance.GetAll();
- }
- private void btn_Add_Click(object sender, EventArgs e)
- {
- FormEditUserParameter form = new FormEditUserParameter(null);
- form.StartPosition = FormStartPosition.CenterScreen;
- form.ShowDialog();
- this.gridControl_UserPara.DataSource = null;
- this.gridControl_UserPara.DataSource = BLLFactory<BlUserParameter>.Instance.GetAll();
- }
- private void btn_DeleteAll_Click(object sender, EventArgs e)
- {
- if (DevExpress.XtraEditors.XtraMessageBox.Show("您确定删除所有的记录么?请谨慎操作。", "提示信息", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.No)
- {
- return;
- }
- try
- {
- bool flag = BLLFactory<BlUserParameter>.Instance.DeleteByCondition(" 1 = 1");
- if (flag)
- {
- DevExpress.XtraEditors.XtraMessageBox.Show("全部删除成功。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
- this.gridControl_UserPara.DataSource = null;
- }
- }
- catch (Exception ex)
- {
- DevExpress.XtraEditors.XtraMessageBox.Show("全部删除失败。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
- LogHelper.log.Error(string.Format("删除用户参数数据出现错误:{0}", ex));
- }
- }
- }
- }
|