wfrm_Domain.cs
上传用户:horngjaan
上传日期:2009-12-12
资源大小:2882k
文件大小:9k
- using System;
- using System.Drawing;
- using System.Collections;
- using System.ComponentModel;
- using System.Windows.Forms;
- using System.Data;
- namespace LumiSoft.MailServer
- {
- /// <summary>
- /// Summary description for Domain_Frm.
- /// </summary>
- public class wfrm_Domain : System.Windows.Forms.Form
- {
- private LumiSoft.UI.Controls.WLabel mt_domain;
- private LumiSoft.UI.Controls.WLabel mt_description;
- private LumiSoft.UI.Controls.WEditBox m_pDomain;
- private LumiSoft.UI.Controls.WEditBox m_pDescription;
- private LumiSoft.UI.Controls.WButton m_pCancel;
- private LumiSoft.UI.Controls.WButton m_pAdd;
- /// <summary>
- /// Required designer variable.
- /// </summary>
- private System.ComponentModel.Container components = null;
- private ServerAPI m_ServerAPI = null;
- private DataRow m_DataRow = null;
- /// <summary>
- /// Default constructor.
- /// </summary>
- /// <param name="serverAPI"></param>
- public wfrm_Domain(ServerAPI serverAPI)
- {
- //
- // Required for Windows Form Designer support
- //
- InitializeComponent();
- //
- // TODO: Add any constructor code after InitializeComponent call
- //
- try
- {
- m_ServerAPI = serverAPI;
- }
- catch(Exception x)
- {
- wfrm_Error frm = new wfrm_Error(x,new System.Diagnostics.StackTrace());
- frm.ShowDialog(this);
- }
- }
- #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()
- {
- this.mt_domain = new LumiSoft.UI.Controls.WLabel();
- this.mt_description = new LumiSoft.UI.Controls.WLabel();
- this.m_pDomain = new LumiSoft.UI.Controls.WEditBox();
- this.m_pDescription = new LumiSoft.UI.Controls.WEditBox();
- this.m_pCancel = new LumiSoft.UI.Controls.WButton();
- this.m_pAdd = new LumiSoft.UI.Controls.WButton();
- ((System.ComponentModel.ISupportInitialize)(this.m_pDomain)).BeginInit();
- ((System.ComponentModel.ISupportInitialize)(this.m_pDescription)).BeginInit();
- ((System.ComponentModel.ISupportInitialize)(this.m_pCancel)).BeginInit();
- ((System.ComponentModel.ISupportInitialize)(this.m_pAdd)).BeginInit();
- this.SuspendLayout();
- //
- // mt_domain
- //
- this.mt_domain.Font = new System.Drawing.Font("Microsoft Sans Serif", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
- this.mt_domain.Location = new System.Drawing.Point(8, 8);
- this.mt_domain.Name = "mt_domain";
- this.mt_domain.Size = new System.Drawing.Size(104, 16);
- this.mt_domain.TabIndex = 4;
- this.mt_domain.Text = "Domain";
- this.mt_domain.TextAlign = System.Windows.Forms.HorizontalAlignment.Left;
- this.mt_domain.UseStaticViewStyle = true;
- //
- // mt_description
- //
- this.mt_description.Font = new System.Drawing.Font("Microsoft Sans Serif", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
- this.mt_description.Location = new System.Drawing.Point(8, 48);
- this.mt_description.Name = "mt_description";
- this.mt_description.Size = new System.Drawing.Size(104, 16);
- this.mt_description.TabIndex = 5;
- this.mt_description.Text = "Description";
- this.mt_description.TextAlign = System.Windows.Forms.HorizontalAlignment.Left;
- this.mt_description.UseStaticViewStyle = true;
- //
- // m_pDomain
- //
- this.m_pDomain.DecimalPlaces = 2;
- this.m_pDomain.DecMaxValue = new System.Decimal(new int[] {
- 999999999,
- 0,
- 0,
- 0});
- this.m_pDomain.DecMinValue = new System.Decimal(new int[] {
- 999999999,
- 0,
- 0,
- -2147483648});
- this.m_pDomain.Lines = new string[0];
- this.m_pDomain.Location = new System.Drawing.Point(8, 24);
- this.m_pDomain.Mask = LumiSoft.UI.Controls.WEditBox_Mask.Text;
- this.m_pDomain.MaxLength = 32767;
- this.m_pDomain.Multiline = false;
- this.m_pDomain.Name = "m_pDomain";
- this.m_pDomain.PasswordChar = ' ';
- this.m_pDomain.ReadOnly = false;
- this.m_pDomain.ScrollBars = System.Windows.Forms.ScrollBars.None;
- this.m_pDomain.Size = new System.Drawing.Size(136, 20);
- this.m_pDomain.TabIndex = 1;
- this.m_pDomain.TextAlign = System.Windows.Forms.HorizontalAlignment.Left;
- this.m_pDomain.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, 64);
- 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(280, 20);
- this.m_pDescription.TabIndex = 2;
- this.m_pDescription.TextAlign = System.Windows.Forms.HorizontalAlignment.Left;
- this.m_pDescription.UseStaticViewStyle = true;
- //
- // m_pCancel
- //
- this.m_pCancel.Location = new System.Drawing.Point(208, 96);
- 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_Click);
- //
- // m_pAdd
- //
- this.m_pAdd.Location = new System.Drawing.Point(128, 96);
- this.m_pAdd.Name = "m_pAdd";
- this.m_pAdd.Size = new System.Drawing.Size(72, 24);
- this.m_pAdd.TabIndex = 3;
- this.m_pAdd.Text = "OK";
- this.m_pAdd.UseStaticViewStyle = true;
- this.m_pAdd.ButtonPressed += new LumiSoft.UI.Controls.ButtonPressedEventHandler(this.m_pAdd_Click);
- //
- // wfrm_Domain
- //
- this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
- this.ClientSize = new System.Drawing.Size(298, 127);
- this.Controls.AddRange(new System.Windows.Forms.Control[] {
- this.m_pAdd,
- this.m_pCancel,
- this.m_pDescription,
- this.m_pDomain,
- this.mt_description,
- this.mt_domain});
- this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
- this.MaximizeBox = false;
- this.MinimizeBox = false;
- this.Name = "wfrm_Domain";
- this.ShowInTaskbar = false;
- this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
- this.Text = "New Domain";
- ((System.ComponentModel.ISupportInitialize)(this.m_pDomain)).EndInit();
- ((System.ComponentModel.ISupportInitialize)(this.m_pDescription)).EndInit();
- ((System.ComponentModel.ISupportInitialize)(this.m_pCancel)).EndInit();
- ((System.ComponentModel.ISupportInitialize)(this.m_pAdd)).EndInit();
- this.ResumeLayout(false);
- }
- #endregion
- #region Events handling
- #region function m_pAdd_Click
- private void m_pAdd_Click(object sender, System.EventArgs e)
- {
- try
- {
- if(m_pDomain.Text.Length <= 0){
- MessageBox.Show("Domain Name Cannot be Empty !!!");
- m_pDomain.FlashControl();
- return;
- }
- if(m_ServerAPI.DomainExists(m_pDomain.Text)){
- MessageBox.Show("Domain already exists.");
- return;
- }
- m_DataRow = m_ServerAPI.AddDomain(m_pDomain.Text,m_pDescription.Text);
- if(m_DataRow == null){
- MessageBox.Show("Error creating domain.");
- return;
- }
- this.DialogResult = DialogResult.OK;
- this.Close();
- }
- catch(Exception x)
- {
- wfrm_Error frm = new wfrm_Error(x,new System.Diagnostics.StackTrace());
- frm.ShowDialog(this);
- }
- }
- #endregion
- #region function m_pCancel_Click
- private void m_pCancel_Click(object sender, System.EventArgs e)
- {
- this.Close();
- }
- #endregion
- #endregion
- #region Properties Implementation
- public DataRow wp_Dr
- {
- get{ return m_DataRow; }
- }
- #endregion
- }
- }