using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Data; using System.Linq; using System.Text; using System.Windows.Forms; using HySoft.IVRFlowEditor.IVRControlUtility; using HySoft.IVRFlowEditor.Utility; namespace HySoft.IVRFlowEditor.IVRControl { public partial class CtlIVRRecordSet : UserControl { IVRRecordSet _IVRRecordSet; public CtlIVRRecordSet(IVRRecordSet obj) { InitializeComponent(); _IVRRecordSet = obj; this.Load += new EventHandler(CtlIVRRecordSet_Load); } void CtlIVRRecordSet_Load(object sender, EventArgs e) { this.tb_NodeID.Text = _IVRRecordSet.Pos; this.tb_NodeName.Text = _IVRRecordSet.Name; this.rtb_Note.Text = _IVRRecordSet.Note; this.cmb_EPos.DataSource = GlobalController.GetComBoBoxofIVR(); this.cmb_EPos.DisplayMember = "Note";//2017-5-8将Name改为Note this.cmb_EPos.ValueMember = "ID"; if (_IVRRecordSet.EPos != null) cmb_EPos.SelectedItem = _IVRRecordSet.EPos; this.cmb_GPos.DataSource = GlobalController.GetComBoBoxofIVR(); this.cmb_GPos.DisplayMember = "Note";//2017-5-8将Name改为Note this.cmb_GPos.ValueMember = "ID"; if (_IVRRecordSet.GPos != null) cmb_GPos.SelectedItem = _IVRRecordSet.GPos; this.cmb_LPos.DataSource = GlobalController.GetComBoBoxofIVR(); this.cmb_LPos.DisplayMember = "Note";//2017-5-8将Name改为Note this.cmb_LPos.ValueMember = "ID"; if (_IVRRecordSet.LPos != null) cmb_LPos.SelectedItem = _IVRRecordSet.LPos; CtlVar = null; CtlVar = new CtlDefaultListVar(); CtlVar.SetData(_IVRRecordSet.Map.Count > 0 ? _IVRRecordSet.Map.Select(a => a.Var).ToList() : new List()); this.groupBox1.Controls.Clear(); this.groupBox1.Controls.Add(CtlVar); CtlVar.Dock = DockStyle.Fill; } CtlDefaultListVar CtlVar; private void btn_enter_Click(object sender, EventArgs e) { _IVRRecordSet.LPos = this.cmb_LPos.SelectedItem as IVRControlBase; _IVRRecordSet.GPos = this.cmb_GPos.SelectedItem as IVRControlBase; _IVRRecordSet.EPos = this.cmb_EPos.SelectedItem as IVRControlBase; _IVRRecordSet.Pos = this.tb_NodeID.Text; _IVRRecordSet.Name = this.tb_NodeName.Text; _IVRRecordSet.Note = this.rtb_Note.Text; _IVRRecordSet.Map = CtlVar.GetListVar(); this.FindForm().DialogResult = DialogResult.OK; this.FindForm().Close(); } private void btn_cancel_Click(object sender, EventArgs e) { this.FindForm().DialogResult = DialogResult.No; this.FindForm().Close(); } } }