| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208 |
- using Core.Mes.Client.Comm.Tool;
- using CoreFS.CA06;
- using Infragistics.Win.UltraWinEditors;
- using Infragistics.Win.UltraWinGrid;
- using System;
- using System.Collections;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Windows.Forms;
- namespace Core.StlMes.Client.Qcm
- {
- public partial class CtrlBaseStdRSpec : UserControl
- {
- private OpeBase _ob;
- public OpeBase Ob
- {
- get { return _ob; }
- set { _ob = value; }
- }
- private IQueryable<UltraGridRow> _queryableRows;
- public IQueryable<UltraGridRow> QueryableRows
- {
- get { return _queryableRows; }
- set { _queryableRows = value; }
- }
- private DtBaseStdRSpec _dtBaseStdRSpec;
- private BaseStdRSpecEntity _queryCondition;
- public BaseStdRSpecEntity QueryCondition
- {
- get { return _queryCondition; }
- set { _queryCondition = value; }
- }
- private UltraComboEditor[] _cmbs = new UltraComboEditor[2];
- public CtrlBaseStdRSpec(System.Windows.Forms.Control container, OpeBase ob)
- {
- InitializeComponent();
- _ob = ob;
- container.Controls.Add(this);
- this.Dock = DockStyle.Fill;
- _queryableRows = ultraGrid1.Rows.AsQueryable().Where("Chk = 'True'");
- _dtBaseStdRSpec = new DtBaseStdRSpec(this);
- LoadBaseData();
- }
- private void LoadBaseData()
- {
- for (int i = 0; i < 2; i++)
- {
- _cmbs[i] = new UltraComboEditor();
- _cmbs[i].Visible = false;
- this.Controls.Add(_cmbs[i]);
- }
- QcmBaseInfo.Fill_SpecType(_cmbs[0], false);
- DataTable dtSpecType = (DataTable)_cmbs[0].DataSource;
- dtSpecType.DefaultView.RowFilter = "ID <> 'D'";
- ultraGrid1.DisplayLayout.Bands[0].Columns["MscStyle"].EditorComponent = _cmbs[0];
- ultraGrid1.DisplayLayout.Bands[0].Columns["MscStyle"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList;
- QcmBaseQuery.NitializeSpec(_cmbs[1], "C", true, _ob);
- ultraGrid1.DisplayLayout.Bands[0].Columns["SpecCode"].EditorComponent = _cmbs[1];
- ultraGrid1.DisplayLayout.Bands[0].Columns["SpecCode"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList;
- }
- public void Query(BaseStdRSpecEntity queryCondition)
- {
- _queryCondition = queryCondition;
- _dtBaseStdRSpec.DoQuery("Query");
- }
- public void Save()
- {
- _dtBaseStdRSpec.DoAction(ActionType.Save);
- }
- public void Delete()
- {
- _dtBaseStdRSpec.DoAction(ActionType.Delete);
- }
- public void Resume()
- {
- _dtBaseStdRSpec.DoAction(ActionType.Resume);
- }
- public void Clear()
- {
- this.baseStdRSpecEntityBindingSource.Clear();
- }
- public ArrayList GetNoQueryParms(ActionType actionType, out string msg)
- {
- return _dtBaseStdRSpec.GetNoQueryParms(actionType, out msg);
- }
- private void ultraGrid1_InitializeLayout(object sender, Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs e)
- {
- EntityHelper.ShowGridCaption<BaseStdRSpecEntity>(e.Layout.Bands[0]);
- }
- private void ultraGrid1_AfterRowInsert(object sender, RowEventArgs e)
- {
- BaseStdRSpecEntity baseStdRSpec = (BaseStdRSpecEntity)e.Row.ListObject;
- baseStdRSpec.StdCode = _queryCondition.StdCode.ToString();
- baseStdRSpec.StdName = _queryCondition.StdName.ToString();
- }
- private void ultraGrid1_BeforeRowInsert(object sender, BeforeRowInsertEventArgs e)
- {
- if (_queryCondition.ValidflagName.ToString() == "")
- {
- e.Cancel = true;
- }
- }
- private void ultraGrid1_InitializeRow(object sender, InitializeRowEventArgs e)
- {
- BaseStdRSpecEntity baseStdRSpec = (BaseStdRSpecEntity)e.Row.ListObject;
- if (baseStdRSpec.Validflag.ToString() == "0")
- {
- e.Row.Appearance.ForeColor = Color.Red;
- }
- else
- {
- e.Row.Appearance.ForeColor = Color.Black;
- }
- }
- public void ControlGridEdit(UltraGridRow row)
- {
- if (row.GetValue("Chk") == "True")
- {
- row.Cells["MinD"].Activation = Activation.AllowEdit;
- row.Cells["MaxD"].Activation = Activation.AllowEdit;
- row.Cells["MinH"].Activation = Activation.AllowEdit;
- row.Cells["MaxH"].Activation = Activation.AllowEdit;
- row.Cells["Memo"].Activation = Activation.AllowEdit;
- row.Cells["MscStyle"].Activation = Activation.AllowEdit;
- row.Cells["SpecCode"].Activation = Activation.AllowEdit;
- }
- else
- {
- row.Cells["MinD"].Activation = Activation.ActivateOnly;
- row.Cells["MaxD"].Activation = Activation.ActivateOnly;
- row.Cells["MinH"].Activation = Activation.ActivateOnly;
- row.Cells["MaxH"].Activation = Activation.ActivateOnly;
- row.Cells["Memo"].Activation = Activation.ActivateOnly;
- row.Cells["MscStyle"].Activation = Activation.ActivateOnly;
- row.Cells["SpecCode"].Activation = Activation.ActivateOnly;
- }
- if (row.GetValue("MscStyle") == "A" && row.GetValue("Chk") == "True")
- {
- row.Cells["MinD"].Activation = Activation.AllowEdit;
- row.Cells["MaxD"].Activation = Activation.AllowEdit;
- row.Cells["MinH"].Activation = Activation.AllowEdit;
- row.Cells["MaxH"].Activation = Activation.AllowEdit;
- row.Cells["SpecCode"].Activation = Activation.ActivateOnly;
- row.Cells["SpecCode"].Value = "";
- row.Cells["SpecName"].Value = "";
- }
- else if (row.GetValue("MscStyle") == "B" && row.GetValue("Chk") == "True")
- {
- row.Cells["MinD"].Activation = Activation.AllowEdit;
- row.Cells["MaxD"].Activation = Activation.AllowEdit;
- row.Cells["MinH"].Activation = Activation.ActivateOnly;
- row.Cells["MaxH"].Activation = Activation.ActivateOnly;
- row.Cells["SpecCode"].Activation = Activation.ActivateOnly;
- row.Cells["MinH"].Value = null;
- row.Cells["MaxH"].Value = null;
- row.Cells["SpecCode"].Value = "";
- row.Cells["SpecName"].Value = "";
- }
- else if (row.GetValue("MscStyle") == "C" && row.GetValue("Chk") == "True")
- {
- row.Cells["MinD"].Activation = Activation.ActivateOnly;
- row.Cells["MaxD"].Activation = Activation.ActivateOnly;
- row.Cells["MinH"].Activation = Activation.ActivateOnly;
- row.Cells["MaxH"].Activation = Activation.ActivateOnly;
- row.Cells["SpecCode"].Activation = Activation.AllowEdit;
- row.Cells["MinD"].Value = null;
- row.Cells["MaxD"].Value = null;
- row.Cells["MinH"].Value = null;
- row.Cells["MaxH"].Value = null;
- }
- }
- private void ultraGrid1_CellChange(object sender, CellEventArgs e)
- {
- this.ultraGrid1.UpdateData();
- if (e.Cell.Column.Key == "SpecCode")
- {
- e.Cell.Row.Cells["SpecName"].Value = e.Cell.Text;
- }
- ControlGridEdit(e.Cell.Row);
- }
- }
- }
|