private void ucTBusinessEditor_Load(object sender, EventArgs e) { this.comboBox1.DataSource = dicBll.GetModelList(DictionaryString.AppointmentType); this.comboBox1.DisplayMember = "Name"; this.comboBox1.ValueMember = "Value"; this.comboBox1.DropDownStyle = ComboBoxStyle.DropDownList; if (this.comboBox1.Items.Count > 0) { this.comboBox1.SelectedIndex = 0; } unitList = new BLL.TUnitBLL().GetModelList(); SearchPanel srhUnit = new SearchPanel(); srhUnit.Init(this.txtUnit, this.sdgUnitGrid); this.txtUnit.TextChanged += (s, a) => { var list = unitList.Where(p => p.unitName.Contains(this.txtUnit.Text.Trim())).ToList(); this.sdgUnitGrid.DataSource = list; }; this.txtUnit.ValueInit += val => { var unit = unitList.Where(p => p.unitSeq == val.ToString()).FirstOrDefault(); if (unit != null) { this.txtUnit.Text = unit.unitName; } }; this.sdgUnitGrid.SearchDone += () => { if (this.sdgUnitGrid.CurrentRow == null) { return; } dynamic data = this.sdgUnitGrid.CurrentRow.DataBoundItem; this.txtUnit.Text = data.unitName; this.txtUnit.Value = data.unitSeq; }; }
private void ucTLedWindowEditor_Load(object sender, EventArgs e) { this.Column7.DataSource = new BLL.TDictionaryBLL().GetModelList(DictionaryString.WorkState); this.Column7.DisplayMember = "Name"; this.Column7.ValueMember = "Value"; this.txtController.ValueInit += val => { this.txtController.Text = this.controllerBll.GetModel(Convert.ToInt32(val)).Name; }; windowList = this.windowBll.GetModelList(); #region windowSearch SearchPanel srhWindow = new SearchPanel(); srhWindow.Init(this.txtWindow, this.sdgWindowGrid); this.txtWindow.ValueInit += val => { var win = this.windowList.Where(p => p.Number == val.ToString()).FirstOrDefault(); if (win != null) { this.txtWindow.Text = win.Name; } }; this.txtWindow.TextChanged += (s, a) => { var list = windowList.Where(p => p.Name.Contains(this.txtWindow.Text.Trim())).ToList(); this.sdgWindowGrid.DataSource = list; }; this.sdgWindowGrid.SearchDone += () => { if (this.sdgWindowGrid.CurrentRow == null) { return; } dynamic data = this.sdgWindowGrid.CurrentRow.DataBoundItem; this.txtWindow.Text = data.Name; this.txtWindow.Value = data.Number; }; #endregion }
private void ucTWindowEditor_Load(object sender, System.EventArgs e) { areaList = areaBll.GetModelList(); this.comboBox1.DataSource = dicBll.GetModelList(DictionaryString.WorkState); this.comboBox1.DisplayMember = "Name"; this.comboBox1.ValueMember = "Value"; this.comboBox1.DropDownStyle = ComboBoxStyle.DropDownList; if (this.comboBox1.Items.Count > 0) { this.comboBox1.SelectedIndex = 0; } SearchPanel srhArea = new SearchPanel(); srhArea.Init(this.textBox7, this.searchDataGrid1); this.textBox7.TextChanged += (s, a) => { var list = areaList.Where(p => p.areaName.Contains(this.textBox7.Text.Trim())).ToList(); this.searchDataGrid1.DataSource = list; }; this.textBox7.ValueInit += val => { var area = areaBll.GetModel(Convert.ToInt32(val)); if (area != null) { this.textBox7.Text = area.areaName; } }; this.searchDataGrid1.SearchDone += () => { if (this.searchDataGrid1.CurrentRow == null) { return; } dynamic data = this.searchDataGrid1.CurrentRow.DataBoundItem; this.textBox7.Text = data.areaName; this.textBox7.Value = data.id; }; }
private void ucTWindowBusinessEditor_Load(object sender, EventArgs e) { this.txtWindow.ValueInit += val => { var win = windowBll.GetModel(Convert.ToInt32(val)); if (win != null) { this.txtWindow.Text = win.Name; } }; unitList = new BLL.TUnitBLL().GetModelList(); busiList = new BLL.TBusinessBLL().GetModelList(); #region unitSearch SearchPanel srhUnit = new SearchPanel(); srhUnit.Init(this.txtUnit, this.sdgUnitGrid); this.txtUnit.TextChanged += (s, a) => { var list = unitList.Where(p => p.unitName.Contains(this.txtUnit.Text.Trim())).ToList(); this.sdgUnitGrid.DataSource = list; }; this.txtUnit.ValueInit += val => { var unit = unitList.Where(p => p.unitSeq == val.ToString()).FirstOrDefault(); if (unit != null) { this.txtUnit.Text = unit.unitName; } }; this.sdgUnitGrid.SearchDone += () => { if (this.sdgUnitGrid.CurrentRow == null) { return; } dynamic data = this.sdgUnitGrid.CurrentRow.DataBoundItem; this.txtUnit.Text = data.unitName; this.txtUnit.Value = data.unitSeq; }; #endregion #region businessSearch SearchPanel srhBusi = new SearchPanel(); srhBusi.Init(this.txtBusi, this.sdgBusiGrid); this.txtBusi.TextChanged += (s, a) => { if (this.txtUnit.Value == null) { return; } var list = this.busiList.Where(p => p.unitSeq == this.txtUnit.Value.ToString() && p.busiName.Contains(this.txtBusi.Text.Trim())).ToList(); this.sdgBusiGrid.DataSource = list; }; this.txtBusi.ValueInit += val => { var busi = busiList.Where(p => p.busiSeq == val.ToString()).FirstOrDefault(); if (busi != null) { this.txtBusi.Text = busi.busiName; } }; this.sdgBusiGrid.SearchDone += () => { if (this.sdgBusiGrid.CurrentRow == null) { return; } dynamic data = this.sdgBusiGrid.CurrentRow.DataBoundItem; this.txtBusi.Text = data.busiName; this.txtBusi.Value = data.busiSeq; }; #endregion }