private void BindSegment() { BenQGuru.eMES.Common.Domain.IDomainDataProvider provider = null; try { this.drpSegment.Items.Clear(); provider = base.DataProvider; BenQGuru.eMES.BaseSetting.BaseModelFacade facade = new BenQGuru.eMES.BaseSetting.BaseModelFacade(provider); object[] objs = facade.GetAllSegment(); if (objs != null && objs.Length > 0) { foreach (object obj in objs) { BenQGuru.eMES.Domain.BaseSetting.Segment seg = obj as BenQGuru.eMES.Domain.BaseSetting.Segment; if (seg != null) { //this.drpSegment.Items.Add(new ListItem(seg.SegmentCode,seg.ShiftTypeCode)); this.drpSegment.Items.Add(seg.SegmentCode); } } } } finally { if (provider != null) { ((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider)provider).PersistBroker.CloseConnection(); } } }
private void BindShift() { BenQGuru.eMES.Common.Domain.IDomainDataProvider provider = null; try { provider = base.DataProvider; this.drpShift.Items.Clear(); if (this.drpSegment.SelectedItem != null) { BenQGuru.eMES.BaseSetting.BaseModelFacade facade = new BenQGuru.eMES.BaseSetting.BaseModelFacade(provider); BenQGuru.eMES.Domain.BaseSetting.Segment seg = facade.GetSegment(this.drpSegment.SelectedItem.ToString()) as BenQGuru.eMES.Domain.BaseSetting.Segment; if (seg != null) { //string shifttype = seg.ShiftTypeCode; //object[] objs = provider.CustomQuery(typeof(Shift), new SQLCondition(string.Format("select {0} from TBLSHIFT where shifttypecode='{1}'order by SHIFTBTIME", DomainObjectUtility.GetDomainObjectFieldsString(typeof(Shift)),shifttype))); object[] objs = (new ShiftModelFacade(base.DataProvider)).QueryShiftBySegment("", seg.SegmentCode, 0, int.MaxValue); if (objs != null && objs.Length > 0) { foreach (object obj in objs) { Shift s = obj as BenQGuru.eMES.Domain.BaseSetting.Shift; if (s != null) { this.drpShift.Items.Add(s.ShiftCode); } } } } } this.drpShift.Items.Insert(0, new ListItem("所有", string.Empty)); } finally { if (provider != null) { ((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider)provider).PersistBroker.CloseConnection(); } } }
private void FillDropDownList() { if (_facade == null) { _facade = new WarehouseFacade(base.DataProvider); } BenQGuru.eMES.Common.MutiLanguage.LanguageWord lword = languageComponent1.GetLanguage("listItemAll"); this.drpTransStatusQuery.Items.Clear(); this.drpTransStatusQuery.Items.Add(new ListItem(lword.ControlText, string.Empty)); this.drpTransStatusQuery.Items.Add(new ListItem(languageComponent1.GetLanguage("WarehouseTransactionStatusPending").ControlText, WarehouseTicket.TransactionStatusEnum.Pending.ToString())); this.drpTransStatusQuery.Items.Add(new ListItem(languageComponent1.GetLanguage("WarehouseTransactionStatusTransaction").ControlText, WarehouseTicket.TransactionStatusEnum.Transaction.ToString())); this.drpTransStatusQuery.Items.Add(new ListItem(languageComponent1.GetLanguage("WarehouseTransactionStatusClosed").ControlText, WarehouseTicket.TransactionStatusEnum.Closed.ToString())); //初始化交易类型列表 object[] objs = this._facade.GetAllTransactionType(); this.drpTransTypeEdit.Items.Clear(); if (objs != null) { for (int i = 0; i < objs.Length; i++) { TransactionType type = (TransactionType)objs[i]; this.drpTransTypeEdit.Items.Add(new ListItem(type.TransactionTypeName, type.TransactionTypeCode + ":" + type.TransactionPrefix)); type = null; } } this.drpTransTypeEdit.Items.Insert(0, new ListItem(string.Empty, string.Empty)); //初始化工厂列表 objs = this._facade.GetAllFactory(); this.drpFactoryFromEdit.Items.Clear(); this.drpFactoryToEdit.Items.Clear(); if (objs != null) { for (int i = 0; i < objs.Length; i++) { Factory f = (Factory)objs[i]; this.drpFactoryFromEdit.Items.Add(new ListItem(f.FactoryCode, f.FactoryCode)); this.drpFactoryToEdit.Items.Add(new ListItem(f.FactoryCode, f.FactoryCode)); f = null; } } this.drpFactoryFromEdit.Items.Insert(0, new ListItem(string.Empty, string.Empty)); this.drpFactoryToEdit.Items.Insert(0, new ListItem(string.Empty, string.Empty)); //初始化工段列表 BenQGuru.eMES.BaseSetting.BaseModelFacade bmFacade = new BenQGuru.eMES.BaseSetting.BaseModelFacade(this._facade.DataProvider); objs = bmFacade.GetAllSegment(); //this.drpSegFromEdit.Items.Clear(); //this.drpSegToEdit.Items.Clear(); if (objs != null) { for (int i = 0; i < objs.Length; i++) { BenQGuru.eMES.Domain.BaseSetting.Segment seg = (BenQGuru.eMES.Domain.BaseSetting.Segment)objs[i]; //this.drpSegFromEdit.Items.Add(new ListItem(seg.SegmentCode, seg.SegmentCode)); //this.drpSegToEdit.Items.Add(new ListItem(seg.SegmentCode, seg.SegmentCode)); seg = null; } } bmFacade = null; //this.drpSegFromEdit.Items.Insert(0, new ListItem(string.Empty, string.Empty)); //this.drpSegToEdit.Items.Insert(0, new ListItem(string.Empty, string.Empty)); lword = null; this.txtUserCodeQuery.Text = this.GetUserCode(); }