| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186 |
- using Core.Mes.Client.Comm.Control;
- using CoreFS.CA06;
- using Infragistics.Win.UltraWinGrid;
- using System;
- using System.Collections.Generic;
- using System.Data;
- using System.Drawing;
- namespace Core.StlMes.Client.Qcm
- {
- /// <summary>
- /// 已被弃用。
- /// </summary>
- public class FrmBaseQcm : FrmBase
- {
- public DtBaseQcm _dtBaseQcm = null;
- /// <summary>
- /// 用于其他界面引用的时候,调用加载方法。
- /// </summary>
- public void QcmLoad()
- {
- base.OnLoad(EventArgs.Empty);
- }
- public override void ToolBar_Click(object sender, string ToolbarKey)
- {
- bool actionResult = false;
- base.ToolBar_Click(sender, ToolbarKey);
- switch (ToolbarKey)
- {
- case "Query":
- _dtBaseQcm.DoQuery("DefaultQuery");
- break;
- case "Add":
- BeginDoAction(ActionType.Add);
- actionResult = _dtBaseQcm.DoAction(ActionType.Add);
- if (actionResult == true)
- {
- SuccessDoAction(ActionType.Add);
- }
- break;
- case "Save":
- BeginDoAction(ActionType.Save);
- actionResult = _dtBaseQcm.DoAction(ActionType.Save);
- if (actionResult == true)
- {
- SuccessDoAction(ActionType.Save);
- }
- break;
- case "Modify":
- BeginDoAction(ActionType.Modify);
- actionResult = _dtBaseQcm.DoAction(ActionType.Modify);
- if (actionResult == true)
- {
- SuccessDoAction(ActionType.Modify);
- }
- break;
- case "Audit":
- BeginDoAction(ActionType.Audit);
- actionResult = _dtBaseQcm.DoAction(ActionType.Audit);
- if (actionResult == true)
- {
- SuccessDoAction(ActionType.Audit);
- }
- break;
- case "Delete":
- BeginDoAction(ActionType.Delete);
- actionResult = _dtBaseQcm.DoAction(ActionType.Delete);
- if (actionResult == true)
- {
- SuccessDoAction(ActionType.Delete);
- }
- break;
- case "Resume":
- BeginDoAction(ActionType.Resume);
- actionResult = _dtBaseQcm.DoAction(ActionType.Resume);
- if (actionResult == true)
- {
- SuccessDoAction(ActionType.Resume);
- }
- break;
- case "Refresh":
- LoadBaseInfo();
- break;
- case "Close":
- this.Close();
- break;
- }
- }
- /// <summary>
- /// 开始执行非查询时所要调用的方法
- /// </summary>
- /// <param name="actionType">非查询类型</param>
- protected virtual void BeginDoAction(ActionType actionType)
- { }
- /// <summary>
- /// 执行非查询成功时所要调用的方法
- /// </summary>
- /// <param name="actionType">非查询类型</param>
- protected virtual void SuccessDoAction(ActionType actionType)
- { }
- /// <summary>
- /// 加载基础信息
- /// </summary>
- protected virtual void LoadBaseInfo()
- { }
- public void SetDeleteColor(InitializeRowEventArgs e, string strDeleteKey, string strDeleteValue)
- {
- if (e.Row.Cells[strDeleteKey].Value.ToString() == strDeleteValue)
- {
- e.Row.Appearance.ForeColor = Color.Red;
- }
- else
- {
- e.Row.Appearance.ForeColor = Color.Black;
- }
- }
- public void ControlGridSelectEdit(InitializeRowEventArgs e, List<string> listNoEdit, List<string> listDrop, string CkbKey)
- {
- if (e.Row.Cells[CkbKey].Value.ToString() == "True")
- {
- foreach (UltraGridCell cell in e.Row.Cells)
- {
- if (cell.Column.Header.Caption == "选择") continue;
- if (listNoEdit.Contains(cell.Column.Header.Caption))
- {
- cell.Activation = Activation.ActivateOnly;
- }
- else if (listDrop.Contains(cell.Column.Header.Caption))
- {
- cell.Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList;
- cell.Activation = Activation.AllowEdit;
- }
- else
- {
- cell.Activation = Activation.AllowEdit;
- }
- }
- }
- else
- {
- foreach (UltraGridCell cell in e.Row.Cells)
- {
- if (cell.Column.Header.Caption == "选择") continue;
- if (listDrop.Contains(cell.Column.Header.Caption))
- {
- cell.Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDown;
- cell.Activation = Activation.ActivateOnly;
- }
- else
- {
- cell.Activation = Activation.ActivateOnly;
- }
- }
- }
- }
- public void SetGridRowActiveWithKey(UltraGrid grid, string key, string value)
- {
- UltraGridRow[] rows = GridHelper.GetRowsWithKey(grid,
- new string[] { key }, new string[] { value });
- if (rows.Length > 0)
- {
- rows[0].Activate();
- }
- }
- public void SetGridRowActiveWithKey(UltraGrid grid, string key, string createNameKey, string createTimeKey)
- {
- DataTable dt = ((DataSet)grid.DataSource).Tables[grid.DataMember];
- DataRow[] drs = dt.Select(createNameKey + "= '" + UserInfo.GetUserName() + "'", createTimeKey + " DESC");
- if (drs.Length > 0)
- {
- string value = drs[0][key].ToString();
- SetGridRowActiveWithKey(grid, key, value);
- }
- }
- }
- }
|