| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203 |
- using Core.Mes.Client.Comm.Tool;
- using CoreFS.CA06;
- using Infragistics.Win.UltraWinEditors;
- using Infragistics.Win.UltraWinGrid;
- using System;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Windows.Forms;
- namespace Core.StlMes.Client.Qcm
- {
- public partial class CtrlMscRBlSpec : 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 ComMscRBlSpecEntity _queryCondition;
- public ComMscRBlSpecEntity QueryCondition
- {
- get { return _queryCondition; }
- set { _queryCondition = value; }
- }
- private DtMscRBlSpec _dtMscRBlSpec;
- private UltraComboEditor _cmbSpec;
- public UltraComboEditor CmbSpec
- {
- get { return _cmbSpec; }
- set { _cmbSpec = value; }
- }
- public CtrlMscRBlSpec(System.Windows.Forms.Control container, OpeBase ob)
- {
- InitializeComponent();
- _ob = ob;
- container.Controls.Add(this);
- _queryableRows = ultraGrid1.Rows.AsQueryable().Where("Chk = 'True'");
- _dtMscRBlSpec = new DtMscRBlSpec(this);
- this.Dock = DockStyle.Fill;
- InitUi();
- }
- protected override void OnLoad(EventArgs e)
- {
- base.OnLoad(e);
- _cmbSpec.AutoCompleteMode = Infragistics.Win.AutoCompleteMode.SuggestAppend;
- }
- private void InitUi()
- {
- _cmbSpec = new UltraComboEditor();
- _cmbSpec.Visible = false;
- _cmbSpec.DropDownListWidth = -1;
- QcmBaseQuery.NitializeSpec(_cmbSpec, "C", false, _ob);
- this.Controls.Add(_cmbSpec);
- ultraGrid1.DisplayLayout.Bands[0].Columns["SpecCode"].EditorComponent = _cmbSpec;
- ultraGrid1.DisplayLayout.Bands[0].Columns["SpecCode"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDown;
- EntityHelper.ShowGridCaption<ComMscRBlSpecEntity>(ultraGrid1.DisplayLayout.Bands[0]);
- }
- public void Query(ComMscRBlSpecEntity queryCondition)
- {
- _queryCondition = queryCondition;
- _dtMscRBlSpec.DoQuery("Get");
- }
- public void QueryHead(ComMscRBlSpecEntity queryCondition)
- {
- _queryCondition = queryCondition;
- _dtMscRBlSpec.DoQuery("GetHead");
- }
- public void Save()
- {
- _dtMscRBlSpec.DoAction(ActionType.Save);
- }
- public void Delete()
- {
- _dtMscRBlSpec.DoAction(ActionType.Delete);
- }
- public void Resume()
- {
- _dtMscRBlSpec.DoAction(ActionType.Resume);
- }
- public void Clear()
- {
- mscRBlSpecSrc.Clear();
- }
- private void ultraGrid1_CellChange(object sender, CellEventArgs e)
- {
- ultraGrid1.UpdateData();
- ControlUltraGrid1Edit(e.Cell.Row);
- }
- public void ControlUltraGrid1Edit(UltraGridRow row)
- {
- if (row.Band.Columns["Chk"].Hidden == false)
- {
- if (row.GetValue("Chk") == "True")
- {
- row.Cells["SpecCode"].Activation = Activation.AllowEdit;
- 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;
- }
- else
- {
- row.Cells["SpecCode"].Activation = Activation.ActivateOnly;
- 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;
- }
- }
- }
- public void SetInvalidColor(UltraGridRow row)
- {
- if (row.GetValue("Validflag") == "0")
- {
- row.Appearance.ForeColor = Color.Red;
- }
- else
- {
- row.Appearance.ForeColor = Color.Black;
- }
- }
- private void ultraTextEditor8_EditorButtonClick(object sender, EditorButtonEventArgs e)
- {
- if (ultraGrid1.ActiveCell.Column.Key == "SpecName")
- {
- string specs = ultraGrid1.GetActiveRowValue("SPECCODE");
- PopupSpecificationsBasics popup = new PopupSpecificationsBasics(specs, _ob);
- DialogResult result = popup.ShowDialog();
- if (result == DialogResult.OK)
- {
- string specCodes = "";
- string specDescs = "";
- foreach (string[] strs in popup.ChoiceSpecs)
- {
- if (specCodes == "")
- {
- specCodes += strs[0];
- specDescs += strs[1];
- }
- else
- {
- specCodes += ";" + strs[0];
- specDescs += ";" + strs[1];
- }
- }
- ultraGrid1.ActiveRow.Cells["specCode"].Value = specCodes;
- ultraGrid1.ActiveRow.Cells["specName"].Value = specDescs;
- }
- }
- else if (ultraGrid1.ActiveCell.Column.Key == "ModelDesc")
- {
- UltraGridRow row = this.ultraGrid1.DisplayLayout.ActiveRow;
- FrmModel frms = new FrmModel();
- frms.Desc = row.Cells["ModelDesc"].Value.ToString();
- frms.FrmOb = _ob;
- frms.ShowDialog();
- row.Cells["ModelCode"].Value = frms.Code;
- row.Cells["ModelDesc"].Value = frms.Desc;
- }
- ultraGrid1.ActiveRow.Update();
- }
- private void ultraGrid1_AfterRowInsert(object sender, RowEventArgs e)
- {
- e.Row.Cells["MinD"].Value = null;
- e.Row.Cells["MaxD"].Value = null;
- e.Row.Cells["MinH"].Value = null;
- e.Row.Cells["MaxH"].Value = null;
- }
- }
- }
|