ivr流程编辑器

CtlIVROutbound.cs 3.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Drawing;
  5. using System.Data;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Windows.Forms;
  9. using HySoft.IVRFlowEditor.Model;
  10. using HySoft.IVRFlowEditor.IVRControlUtility;
  11. using HySoft.IVRFlowEditor.Utility;
  12. namespace HySoft.IVRFlowEditor.Propretity
  13. {
  14. public partial class CtlIVROutbound : UserControl
  15. {
  16. public CtlIVROutbound()
  17. {
  18. InitializeComponent();
  19. this.Load += new EventHandler(CtlIVROutbound_Load);
  20. }
  21. void CtlIVROutbound_Load(object sender, EventArgs e)
  22. {
  23. this.cmb_CalleeNumType.DataSource = System.Enum.GetNames(typeof(NumberType));
  24. this.cmb_CallerNumType.DataSource = System.Enum.GetNames(typeof(NumberType));
  25. this.cmb_CallerNumType.SelectedItem = _IVRControl.CallerNumType.ToString();
  26. this.cmb_CalleeNumType.SelectedItem = _IVRControl.CalleeNumType.ToString();
  27. this.tb_NodeID.Text = _IVRControl.Pos;
  28. this.tb_NodeName.Text = _IVRControl.Name;
  29. this.rtb_Note.Text = _IVRControl.Note;
  30. this.cmb_CalleeNum.Text = _IVRControl.CalleeNum;
  31. this.cmb_CallerNum.Text = _IVRControl.CallerNum;
  32. this.tb_TimeOut.Text = _IVRControl.Timeout.ToString();
  33. this.cmb_successNextNode.DataSource = GlobalController.GetComBoBoxofIVR();
  34. this.cmb_successNextNode.DisplayMember = "Note";//2017-5-8将Name改为Note
  35. this.cmb_successNextNode.ValueMember = "ID";
  36. if (_IVRControl.SuccessPos != null)
  37. this.cmb_successNextNode.SelectedItem = _IVRControl.SuccessPos;
  38. this.cmb_failNextNode.DataSource = GlobalController.GetComBoBoxofIVR();
  39. this.cmb_failNextNode.DisplayMember = "Note";//2017-5-8将Name改为Note
  40. this.cmb_failNextNode.ValueMember = "ID";
  41. if (_IVRControl.FailPos != null)
  42. this.cmb_failNextNode.SelectedItem = _IVRControl.FailPos;
  43. }
  44. public IVROutbound _IVRControl;
  45. public CtlIVROutbound(IVROutbound obj)
  46. {
  47. InitializeComponent();
  48. _IVRControl = obj;
  49. this.Load += new EventHandler(CtlIVROutbound_Load);
  50. }
  51. private void btn_enter_Click(object sender, EventArgs e)
  52. {
  53. _IVRControl.Name = tb_NodeName.Text;
  54. _IVRControl.Note = rtb_Note.Text;
  55. _IVRControl.CalleeNum = this.cmb_CalleeNum.Text;
  56. _IVRControl.CalleeNumType = (NumberType)Enum.Parse(typeof(NumberType),this.cmb_CalleeNumType.Text);
  57. _IVRControl.CallerNum = this.cmb_CallerNum.Text;
  58. _IVRControl.CallerNumType = (NumberType)Enum.Parse(typeof(NumberType), this.cmb_CallerNumType.Text);
  59. _IVRControl.Timeout = Int32.Parse(this.tb_TimeOut.Text);
  60. if (this.cmb_successNextNode.SelectedItem != null)
  61. _IVRControl.SuccessPos = (this.cmb_successNextNode.SelectedItem as IVRControlBase);
  62. if (this.cmb_failNextNode.SelectedItem != null)
  63. _IVRControl.FailPos = (this.cmb_failNextNode.SelectedItem as IVRControlBase);
  64. this.FindForm().DialogResult = DialogResult.OK;
  65. this.FindForm().Close();
  66. }
  67. private void btn_cancel_Click(object sender, EventArgs e)
  68. {
  69. this.FindForm().DialogResult = DialogResult.No;
  70. this.FindForm().Close();
  71. }
  72. private void cmb_NumberType_SelectedIndexChanged(object sender, EventArgs e)
  73. {
  74. GlobalController.BindComboBoxOFVar(this.cmb_CalleeNum, GlobalController.GetEnumByComBoBoxValueOFDesc<NumberType>(this.cmb_CalleeNumType.Text));
  75. }
  76. private void cmb_CallerNumType_SelectedIndexChanged(object sender, EventArgs e)
  77. {
  78. GlobalController.BindComboBoxOFVar(this.cmb_CallerNumType, GlobalController.GetEnumByComBoBoxValueOFDesc<NumberType>(this.cmb_CallerNumType.Text));
  79. }
  80. }
  81. }