wfrm_Route.cs
上传用户:horngjaan
上传日期:2009-12-12
资源大小:2882k
文件大小:14k
- using System;
- using System.Data;
- using System.Drawing;
- using System.Collections;
- using System.ComponentModel;
- using System.Windows.Forms;
- namespace LumiSoft.MailServer
- {
- /// <summary>
- /// Summary description for Route_Frm.
- /// </summary>
- public class wfrm_Route : System.Windows.Forms.Form
- {
- private LumiSoft.UI.Controls.WLabel wLabel1;
- private LumiSoft.UI.Controls.WLabel wLabel2;
- private LumiSoft.UI.Controls.WLabel wLabel3;
- private LumiSoft.UI.Controls.WEditBox m_pPattern;
- private LumiSoft.UI.Controls.WEditBox m_pDescription;
- private LumiSoft.UI.Controls.WButton m_pOk;
- private LumiSoft.UI.Controls.WComboBox m_pRouteTo;
- private LumiSoft.UI.Controls.WComboBox m_pDomains;
- private LumiSoft.UI.Controls.WLabel mt_symbolAT;
- private LumiSoft.UI.Controls.WButton m_pCancel;
- /// <summary>
- /// Required designer variable.
- /// </summary>
- private System.ComponentModel.Container components = null;
- private ServerAPI m_ServerAPI = null;
- private string m_Pattern = "";
- private string m_MailBox = "";
- private string m_Description = "";
- private string m_DomainID = "";
- private string m_DomainName = "";
- /// <summary>
- /// Add new constructor.
- /// </summary>
- /// <param name="serverAPI"></param>
- public wfrm_Route(ServerAPI serverAPI) : this(serverAPI,null)
- {
- }
- /// <summary>
- /// Edit constructor.
- /// </summary>
- /// <param name="serverAPI"></param>
- /// <param name="dr"></param>
- public wfrm_Route(ServerAPI serverAPI,DataRow dr)
- {
- //
- // Required for Windows Form Designer support
- //
- InitializeComponent();
- //
- // TODO: Add any constructor code after InitializeComponent call
- //
- m_ServerAPI = serverAPI;
- foreach(DataRowView drV in serverAPI.GetDomainList()){
- m_pDomains.Items.Add(drV["DomainName"].ToString(),drV["DomainID"].ToString());
- }
-
- if(dr != null){
- m_pDomains.SelectItemByTag(dr["DomainID"].ToString());
- m_pPattern.Text = dr["Pattern"].ToString();
- m_pRouteTo.Text = dr["Mailbox"].ToString();
- m_pDescription.Text = dr["Description"].ToString();
- }
- }
- #region function Dispose
- /// <summary>
- /// Clean up any resources being used.
- /// </summary>
- protected override void Dispose( bool disposing )
- {
- if( disposing )
- {
- if(components != null)
- {
- components.Dispose();
- }
- }
- base.Dispose( disposing );
- }
- #endregion
- #region Windows Form Designer generated code
- /// <summary>
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- /// </summary>
- private void InitializeComponent()
- {
- System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(wfrm_Route));
- this.wLabel1 = new LumiSoft.UI.Controls.WLabel();
- this.m_pPattern = new LumiSoft.UI.Controls.WEditBox();
- this.wLabel2 = new LumiSoft.UI.Controls.WLabel();
- this.wLabel3 = new LumiSoft.UI.Controls.WLabel();
- this.m_pDescription = new LumiSoft.UI.Controls.WEditBox();
- this.m_pOk = new LumiSoft.UI.Controls.WButton();
- this.m_pRouteTo = new LumiSoft.UI.Controls.WComboBox();
- this.m_pDomains = new LumiSoft.UI.Controls.WComboBox();
- this.mt_symbolAT = new LumiSoft.UI.Controls.WLabel();
- this.m_pCancel = new LumiSoft.UI.Controls.WButton();
- ((System.ComponentModel.ISupportInitialize)(this.m_pPattern)).BeginInit();
- ((System.ComponentModel.ISupportInitialize)(this.m_pDescription)).BeginInit();
- ((System.ComponentModel.ISupportInitialize)(this.m_pOk)).BeginInit();
- ((System.ComponentModel.ISupportInitialize)(this.m_pRouteTo)).BeginInit();
- ((System.ComponentModel.ISupportInitialize)(this.m_pDomains)).BeginInit();
- ((System.ComponentModel.ISupportInitialize)(this.m_pCancel)).BeginInit();
- this.SuspendLayout();
- //
- // wLabel1
- //
- this.wLabel1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
- this.wLabel1.Location = new System.Drawing.Point(8, 8);
- this.wLabel1.Name = "wLabel1";
- this.wLabel1.Size = new System.Drawing.Size(150, 16);
- this.wLabel1.TabIndex = 6;
- this.wLabel1.Text = "Match Pattern";
- this.wLabel1.TextAlign = System.Windows.Forms.HorizontalAlignment.Left;
- this.wLabel1.UseStaticViewStyle = true;
- //
- // m_pPattern
- //
- this.m_pPattern.DecimalPlaces = 2;
- this.m_pPattern.DecMaxValue = new System.Decimal(new int[] {
- 999999999,
- 0,
- 0,
- 0});
- this.m_pPattern.DecMinValue = new System.Decimal(new int[] {
- 999999999,
- 0,
- 0,
- -2147483648});
- this.m_pPattern.Lines = new string[0];
- this.m_pPattern.Location = new System.Drawing.Point(8, 24);
- this.m_pPattern.Mask = LumiSoft.UI.Controls.WEditBox_Mask.Text;
- this.m_pPattern.MaxLength = 32767;
- this.m_pPattern.Multiline = false;
- this.m_pPattern.Name = "m_pPattern";
- this.m_pPattern.PasswordChar = ' ';
- this.m_pPattern.ReadOnly = false;
- this.m_pPattern.ScrollBars = System.Windows.Forms.ScrollBars.None;
- this.m_pPattern.Size = new System.Drawing.Size(152, 20);
- this.m_pPattern.TabIndex = 1;
- this.m_pPattern.TextAlign = System.Windows.Forms.HorizontalAlignment.Left;
- this.m_pPattern.UseStaticViewStyle = true;
- //
- // wLabel2
- //
- this.wLabel2.Font = new System.Drawing.Font("Microsoft Sans Serif", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
- this.wLabel2.Location = new System.Drawing.Point(8, 48);
- this.wLabel2.Name = "wLabel2";
- this.wLabel2.Size = new System.Drawing.Size(144, 16);
- this.wLabel2.TabIndex = 7;
- this.wLabel2.Text = "Route to MailBox";
- this.wLabel2.TextAlign = System.Windows.Forms.HorizontalAlignment.Left;
- this.wLabel2.UseStaticViewStyle = true;
- //
- // wLabel3
- //
- this.wLabel3.Font = new System.Drawing.Font("Microsoft Sans Serif", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
- this.wLabel3.Location = new System.Drawing.Point(8, 88);
- this.wLabel3.Name = "wLabel3";
- this.wLabel3.Size = new System.Drawing.Size(150, 16);
- this.wLabel3.TabIndex = 8;
- this.wLabel3.Text = "Description";
- this.wLabel3.TextAlign = System.Windows.Forms.HorizontalAlignment.Left;
- this.wLabel3.UseStaticViewStyle = true;
- //
- // m_pDescription
- //
- this.m_pDescription.DecimalPlaces = 2;
- this.m_pDescription.DecMaxValue = new System.Decimal(new int[] {
- 999999999,
- 0,
- 0,
- 0});
- this.m_pDescription.DecMinValue = new System.Decimal(new int[] {
- 999999999,
- 0,
- 0,
- -2147483648});
- this.m_pDescription.Lines = new string[0];
- this.m_pDescription.Location = new System.Drawing.Point(8, 104);
- this.m_pDescription.Mask = LumiSoft.UI.Controls.WEditBox_Mask.Text;
- this.m_pDescription.MaxLength = 32767;
- this.m_pDescription.Multiline = false;
- this.m_pDescription.Name = "m_pDescription";
- this.m_pDescription.PasswordChar = ' ';
- this.m_pDescription.ReadOnly = false;
- this.m_pDescription.ScrollBars = System.Windows.Forms.ScrollBars.None;
- this.m_pDescription.Size = new System.Drawing.Size(312, 20);
- this.m_pDescription.TabIndex = 4;
- this.m_pDescription.TextAlign = System.Windows.Forms.HorizontalAlignment.Left;
- this.m_pDescription.UseStaticViewStyle = true;
- //
- // m_pOk
- //
- this.m_pOk.Location = new System.Drawing.Point(160, 136);
- this.m_pOk.Name = "m_pOk";
- this.m_pOk.Size = new System.Drawing.Size(72, 24);
- this.m_pOk.TabIndex = 5;
- this.m_pOk.Text = "OK";
- this.m_pOk.UseStaticViewStyle = true;
- this.m_pOk.ButtonPressed += new LumiSoft.UI.Controls.ButtonPressedEventHandler(this.m_pOk_ButtonPressed);
- //
- // m_pRouteTo
- //
- this.m_pRouteTo.AcceptsPlussKey = true;
- this.m_pRouteTo.BackColor = System.Drawing.Color.FromArgb(((System.Byte)(228)), ((System.Byte)(224)), ((System.Byte)(220)));
- this.m_pRouteTo.ButtonIcon = ((System.Drawing.Icon)(resources.GetObject("m_pRouteTo.ButtonIcon")));
- this.m_pRouteTo.ButtonWidth = 18;
- this.m_pRouteTo.DropDownWidth = 152;
- this.m_pRouteTo.Location = new System.Drawing.Point(8, 64);
- this.m_pRouteTo.Mask = LumiSoft.UI.Controls.WEditBox_Mask.Text;
- this.m_pRouteTo.MaxLength = 32767;
- this.m_pRouteTo.Name = "m_pRouteTo";
- this.m_pRouteTo.ReadOnly = true;
- this.m_pRouteTo.SelectedIndex = -1;
- this.m_pRouteTo.Size = new System.Drawing.Size(152, 20);
- this.m_pRouteTo.TabIndex = 3;
- this.m_pRouteTo.UseStaticViewStyle = true;
- this.m_pRouteTo.VisibleItems = 10;
- //
- // m_pDomains
- //
- this.m_pDomains.AcceptsPlussKey = true;
- this.m_pDomains.BackColor = System.Drawing.Color.FromArgb(((System.Byte)(228)), ((System.Byte)(224)), ((System.Byte)(220)));
- this.m_pDomains.ButtonIcon = ((System.Drawing.Icon)(resources.GetObject("m_pDomains.ButtonIcon")));
- this.m_pDomains.ButtonWidth = 18;
- this.m_pDomains.DropDownWidth = 144;
- this.m_pDomains.Location = new System.Drawing.Point(176, 24);
- this.m_pDomains.Mask = LumiSoft.UI.Controls.WEditBox_Mask.Text;
- this.m_pDomains.MaxLength = 32767;
- this.m_pDomains.Name = "m_pDomains";
- this.m_pDomains.ReadOnly = true;
- this.m_pDomains.SelectedIndex = -1;
- this.m_pDomains.Size = new System.Drawing.Size(144, 20);
- this.m_pDomains.TabIndex = 2;
- this.m_pDomains.UseStaticViewStyle = true;
- this.m_pDomains.VisibleItems = 5;
- this.m_pDomains.SelectedIndexChanged += new System.EventHandler(this.m_pDomains_SelectedIndexChanged);
- //
- // mt_symbolAT
- //
- this.mt_symbolAT.Font = new System.Drawing.Font("Microsoft Sans Serif", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
- this.mt_symbolAT.Location = new System.Drawing.Point(160, 24);
- this.mt_symbolAT.Name = "mt_symbolAT";
- this.mt_symbolAT.Size = new System.Drawing.Size(16, 24);
- this.mt_symbolAT.TabIndex = 9;
- this.mt_symbolAT.Text = "@";
- this.mt_symbolAT.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
- this.mt_symbolAT.UseStaticViewStyle = true;
- //
- // m_pCancel
- //
- this.m_pCancel.Location = new System.Drawing.Point(240, 136);
- this.m_pCancel.Name = "m_pCancel";
- this.m_pCancel.Size = new System.Drawing.Size(72, 24);
- this.m_pCancel.TabIndex = 0;
- this.m_pCancel.Text = "Cancel";
- this.m_pCancel.UseStaticViewStyle = true;
- this.m_pCancel.ButtonPressed += new LumiSoft.UI.Controls.ButtonPressedEventHandler(this.m_pCancel_ButtonPressed);
- //
- // wfrm_Route
- //
- this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
- this.ClientSize = new System.Drawing.Size(330, 167);
- this.Controls.AddRange(new System.Windows.Forms.Control[] {
- this.m_pCancel,
- this.m_pDomains,
- this.mt_symbolAT,
- this.m_pRouteTo,
- this.m_pOk,
- this.m_pDescription,
- this.wLabel3,
- this.wLabel2,
- this.m_pPattern,
- this.wLabel1});
- this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
- this.MaximizeBox = false;
- this.MinimizeBox = false;
- this.Name = "wfrm_Route";
- this.ShowInTaskbar = false;
- this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
- this.Text = "Routing Properties";
- ((System.ComponentModel.ISupportInitialize)(this.m_pPattern)).EndInit();
- ((System.ComponentModel.ISupportInitialize)(this.m_pDescription)).EndInit();
- ((System.ComponentModel.ISupportInitialize)(this.m_pOk)).EndInit();
- ((System.ComponentModel.ISupportInitialize)(this.m_pRouteTo)).EndInit();
- ((System.ComponentModel.ISupportInitialize)(this.m_pDomains)).EndInit();
- ((System.ComponentModel.ISupportInitialize)(this.m_pCancel)).EndInit();
- this.ResumeLayout(false);
- }
- #endregion
- #region Events handling
- #region function m_pOk_ButtonPressed
- private void m_pOk_ButtonPressed(object sender, System.EventArgs e)
- {
- if(m_pPattern.Text.Length < 2){
- m_pPattern.FlashControl();
- return;
- }
- if(m_pRouteTo.Text.Length < 2){
- m_pRouteTo.FlashControl();
- return;
- }
- m_Pattern = m_pPattern.Text;
- m_MailBox = m_pRouteTo.Text;
- m_Description = m_pDescription.Text;
- m_DomainID = m_pDomains.SelectedItem.Tag.ToString();
- m_DomainName = m_pDomains.SelectedItem.Text;
- this.DialogResult = DialogResult.OK;
- }
- #endregion
- #region function m_pCancel_ButtonPressed
- private void m_pCancel_ButtonPressed(object sender, System.EventArgs e)
- {
- this.DialogResult = DialogResult.Cancel;
- }
- #endregion
- #region function m_pDomains_SelectedIndexChanged
- private void m_pDomains_SelectedIndexChanged(object sender, System.EventArgs e)
- {
- FillMailboxList();
- }
- #endregion
- #endregion
- #region function FillMailboxList
- private void FillMailboxList()
- {
- if(m_pDomains.SelectedItem != null){
- m_pRouteTo.Items.Clear();
- foreach(DataRowView drV in m_ServerAPI.GetUserList(m_pDomains.SelectedItem.Tag.ToString())){
- m_pRouteTo.Items.Add(drV["UserName"].ToString());
- }
- }
- }
- #endregion
-
- #region Properties Implementation
- /// <summary>
- ///
- /// </summary>
- public string Pattern
- {
- get{ return m_Pattern; }
- }
- /// <summary>
- ///
- /// </summary>
- public string MailBox
- {
- get{ return m_MailBox; }
- }
- /// <summary>
- ///
- /// </summary>
- public string Description
- {
- get{ return m_Description; }
- }
- /// <summary>
- ///
- /// </summary>
- public string DomainID
- {
- get{ return m_DomainID; }
- }
- /// <summary>
- ///
- /// </summary>
- public string DomainName
- {
- get{ return m_DomainName; }
- }
- #endregion
-
- }
- }