wfrm_User.cs
上传用户:horngjaan
上传日期:2009-12-12
资源大小:2882k
文件大小:29k
- using System;
- using System.IO;
- using System.Drawing;
- using System.Collections;
- using System.ComponentModel;
- using System.Windows.Forms;
- using System.Data;
- using System.Data.SqlClient;
- namespace LumiSoft.MailServer
- {
- /// <summary>
- /// Summary description for User_Frm.
- /// </summary>
- public class wfrm_User : System.Windows.Forms.Form
- {
- /// <summary>
- /// Required designer variable.
- /// </summary>
- private System.ComponentModel.Container components = null;
- private System.Windows.Forms.ListBox m_pAddresses;
- private LumiSoft.UI.Controls.WLabel mt_fullname;
- private LumiSoft.UI.Controls.WLabel mt_username;
- private LumiSoft.UI.Controls.WLabel mt_password;
- private LumiSoft.UI.Controls.WLabel mt_description;
- private LumiSoft.UI.Controls.WLabel mt_Emails;
- private LumiSoft.UI.Controls.WLabel mt_symbolAT;
- private LumiSoft.UI.Controls.WComboBox m_pDomains;
- private LumiSoft.UI.Controls.WEditBox m_pFullName;
- private LumiSoft.UI.Controls.WEditBox m_pLogOnName;
- private LumiSoft.UI.Controls.WEditBox m_pPassword;
- private LumiSoft.UI.Controls.WEditBox m_pDescription;
- private LumiSoft.UI.Controls.WEditBox m_pAddress;
- private LumiSoft.UI.Controls.WButton m_pGenerate;
- private LumiSoft.UI.Controls.WButton m_pAdd;
- private LumiSoft.UI.Controls.WButton m_pRemove;
- private LumiSoft.UI.Controls.WLabel mt_mailboxsize;
- private LumiSoft.UI.Controls.WLabel mt_userenabled;
- private LumiSoft.UI.Controls.WLabel wLabel3;
- private LumiSoft.UI.Controls.WSpinEdit m_pMailboxSize;
- private LumiSoft.UI.Controls.WCheckBox.WCheckBox m_pUserEnabled;
- private LumiSoft.UI.Controls.WButton m_pOk;
- private LumiSoft.UI.Controls.WButton m_pCancel;
-
- private ServerAPI m_ServerAPI = null;
- private DataRow drUser = null;
- private bool m_New = false;
- private string m_FullName = "";
- private string m_UserName = "";
- private string m_Password = "";
- private string m_Descript = "";
- private string m_Emailss = "";
- private string m_DomainID = "";
- private int m_MailboxSize = 20;
- public wfrm_User(ServerAPI serverAPI,string domainID)
- {
- //
- // Required for Windows Form Designer support
- //
- InitializeComponent();
- //
- // TODO: Add any constructor code after InitializeComponent call
- //
- try
- {
- m_ServerAPI = serverAPI;
-
- DataView dvDomains = m_ServerAPI.GetDomainList();
- foreach(DataRowView vDr in dvDomains){
- m_pDomains.Items.Add(vDr["DomainName"].ToString(),vDr["DomainID"].ToString());
- }
-
- if(m_pDomains.Items.Count > 0){
- m_pDomains.SelectedIndex = 0;
- }
- if(domainID != "ALL"){
- m_pDomains.SelectItemByTag(domainID);
- }
-
- m_New = true;
- }
- catch(Exception x)
- {
- wfrm_Error frm = new wfrm_Error(x,new System.Diagnostics.StackTrace());
- frm.ShowDialog(this);
- }
- }
- public wfrm_User(ServerAPI serverAPI,DataRow dr)
- {
- //
- // Required for Windows Form Designer support
- //
- InitializeComponent();
- //
- // TODO: Add any constructor code after InitializeComponent call
- //
-
- try
- {
- m_ServerAPI = serverAPI;
- drUser = dr;
- m_pFullName.Text = dr["FullName"].ToString();
- m_pLogOnName.Text = dr["UserName"].ToString();
- m_pPassword.Text = dr["Password"].ToString();
- m_pDescription.Text = dr["Description"].ToString();
- m_pMailboxSize.Text = dr["Mailbox_Size"].ToString();
-
- string[] addresses = dr["Emails"].ToString().Split(new char[]{';'});
- foreach(string adr in addresses){
- m_pAddresses.Items.Add(adr);
- }
- DataView dvDomains = m_ServerAPI.GetDomainList();
- foreach(DataRowView vDr in dvDomains){
- m_pDomains.Items.Add(vDr["DomainName"].ToString(),vDr["DomainID"].ToString());
- }
- if(m_pAddresses.Items.Count > 0){
- m_pDomains.SelectItemByTag(dr["DomainID"].ToString());
- m_pDomains.Enabled = false;
- }
- }
- 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()
- {
- System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(wfrm_User));
- this.m_pAddresses = new System.Windows.Forms.ListBox();
- this.mt_fullname = new LumiSoft.UI.Controls.WLabel();
- this.mt_username = new LumiSoft.UI.Controls.WLabel();
- this.mt_password = new LumiSoft.UI.Controls.WLabel();
- this.mt_description = new LumiSoft.UI.Controls.WLabel();
- this.mt_Emails = new LumiSoft.UI.Controls.WLabel();
- this.m_pFullName = new LumiSoft.UI.Controls.WEditBox();
- this.m_pLogOnName = new LumiSoft.UI.Controls.WEditBox();
- this.m_pPassword = new LumiSoft.UI.Controls.WEditBox();
- this.m_pDescription = new LumiSoft.UI.Controls.WEditBox();
- this.m_pAddress = new LumiSoft.UI.Controls.WEditBox();
- this.mt_symbolAT = new LumiSoft.UI.Controls.WLabel();
- this.m_pDomains = new LumiSoft.UI.Controls.WComboBox();
- this.m_pGenerate = new LumiSoft.UI.Controls.WButton();
- this.m_pAdd = new LumiSoft.UI.Controls.WButton();
- this.m_pRemove = new LumiSoft.UI.Controls.WButton();
- this.m_pOk = new LumiSoft.UI.Controls.WButton();
- this.mt_mailboxsize = new LumiSoft.UI.Controls.WLabel();
- this.mt_userenabled = new LumiSoft.UI.Controls.WLabel();
- this.wLabel3 = new LumiSoft.UI.Controls.WLabel();
- this.m_pMailboxSize = new LumiSoft.UI.Controls.WSpinEdit();
- this.m_pUserEnabled = new LumiSoft.UI.Controls.WCheckBox.WCheckBox();
- this.m_pCancel = new LumiSoft.UI.Controls.WButton();
- ((System.ComponentModel.ISupportInitialize)(this.m_pFullName)).BeginInit();
- ((System.ComponentModel.ISupportInitialize)(this.m_pLogOnName)).BeginInit();
- ((System.ComponentModel.ISupportInitialize)(this.m_pPassword)).BeginInit();
- ((System.ComponentModel.ISupportInitialize)(this.m_pDescription)).BeginInit();
- ((System.ComponentModel.ISupportInitialize)(this.m_pAddress)).BeginInit();
- ((System.ComponentModel.ISupportInitialize)(this.m_pDomains)).BeginInit();
- ((System.ComponentModel.ISupportInitialize)(this.m_pGenerate)).BeginInit();
- ((System.ComponentModel.ISupportInitialize)(this.m_pAdd)).BeginInit();
- ((System.ComponentModel.ISupportInitialize)(this.m_pRemove)).BeginInit();
- ((System.ComponentModel.ISupportInitialize)(this.m_pOk)).BeginInit();
- ((System.ComponentModel.ISupportInitialize)(this.m_pMailboxSize)).BeginInit();
- ((System.ComponentModel.ISupportInitialize)(this.m_pUserEnabled)).BeginInit();
- ((System.ComponentModel.ISupportInitialize)(this.m_pCancel)).BeginInit();
- this.SuspendLayout();
- //
- // m_pAddresses
- //
- this.m_pAddresses.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
- this.m_pAddresses.Location = new System.Drawing.Point(8, 216);
- this.m_pAddresses.Name = "m_pAddresses";
- this.m_pAddresses.Size = new System.Drawing.Size(264, 145);
- this.m_pAddresses.TabIndex = 13;
- //
- // mt_fullname
- //
- this.mt_fullname.Font = new System.Drawing.Font("Microsoft Sans Serif", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
- this.mt_fullname.Location = new System.Drawing.Point(8, 8);
- this.mt_fullname.Name = "mt_fullname";
- this.mt_fullname.Size = new System.Drawing.Size(104, 16);
- this.mt_fullname.TabIndex = 14;
- this.mt_fullname.Text = "Full Name";
- this.mt_fullname.TextAlign = System.Windows.Forms.HorizontalAlignment.Left;
- this.mt_fullname.UseStaticViewStyle = true;
- //
- // mt_username
- //
- this.mt_username.Font = new System.Drawing.Font("Microsoft Sans Serif", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
- this.mt_username.Location = new System.Drawing.Point(8, 48);
- this.mt_username.Name = "mt_username";
- this.mt_username.Size = new System.Drawing.Size(104, 16);
- this.mt_username.TabIndex = 15;
- this.mt_username.Text = "User Name";
- this.mt_username.TextAlign = System.Windows.Forms.HorizontalAlignment.Left;
- this.mt_username.UseStaticViewStyle = true;
- //
- // mt_password
- //
- this.mt_password.Font = new System.Drawing.Font("Microsoft Sans Serif", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
- this.mt_password.Location = new System.Drawing.Point(120, 48);
- this.mt_password.Name = "mt_password";
- this.mt_password.Size = new System.Drawing.Size(104, 16);
- this.mt_password.TabIndex = 16;
- this.mt_password.Text = "Password";
- this.mt_password.TextAlign = System.Windows.Forms.HorizontalAlignment.Left;
- this.mt_password.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, 88);
- this.mt_description.Name = "mt_description";
- this.mt_description.Size = new System.Drawing.Size(104, 16);
- this.mt_description.TabIndex = 17;
- this.mt_description.Text = "Description";
- this.mt_description.TextAlign = System.Windows.Forms.HorizontalAlignment.Left;
- this.mt_description.UseStaticViewStyle = true;
- //
- // mt_Emails
- //
- this.mt_Emails.Font = new System.Drawing.Font("Microsoft Sans Serif", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
- this.mt_Emails.Location = new System.Drawing.Point(8, 168);
- this.mt_Emails.Name = "mt_Emails";
- this.mt_Emails.Size = new System.Drawing.Size(104, 16);
- this.mt_Emails.TabIndex = 19;
- this.mt_Emails.Text = "E-mail Address";
- this.mt_Emails.TextAlign = System.Windows.Forms.HorizontalAlignment.Left;
- this.mt_Emails.UseStaticViewStyle = true;
- //
- // m_pFullName
- //
- this.m_pFullName.DecimalPlaces = 2;
- this.m_pFullName.DecMaxValue = new System.Decimal(new int[] {
- 999999999,
- 0,
- 0,
- 0});
- this.m_pFullName.DecMinValue = new System.Decimal(new int[] {
- 999999999,
- 0,
- 0,
- -2147483648});
- this.m_pFullName.Lines = new string[0];
- this.m_pFullName.Location = new System.Drawing.Point(8, 24);
- this.m_pFullName.Mask = LumiSoft.UI.Controls.WEditBox_Mask.Text;
- this.m_pFullName.MaxLength = 32767;
- this.m_pFullName.Multiline = false;
- this.m_pFullName.Name = "m_pFullName";
- this.m_pFullName.PasswordChar = ' ';
- this.m_pFullName.ReadOnly = false;
- this.m_pFullName.ScrollBars = System.Windows.Forms.ScrollBars.None;
- this.m_pFullName.Size = new System.Drawing.Size(216, 20);
- this.m_pFullName.TabIndex = 1;
- this.m_pFullName.TextAlign = System.Windows.Forms.HorizontalAlignment.Left;
- this.m_pFullName.UseStaticViewStyle = true;
- //
- // m_pLogOnName
- //
- this.m_pLogOnName.DecimalPlaces = 2;
- this.m_pLogOnName.DecMaxValue = new System.Decimal(new int[] {
- 999999999,
- 0,
- 0,
- 0});
- this.m_pLogOnName.DecMinValue = new System.Decimal(new int[] {
- 999999999,
- 0,
- 0,
- -2147483648});
- this.m_pLogOnName.Lines = new string[0];
- this.m_pLogOnName.Location = new System.Drawing.Point(8, 64);
- this.m_pLogOnName.Mask = LumiSoft.UI.Controls.WEditBox_Mask.Text;
- this.m_pLogOnName.MaxLength = 32767;
- this.m_pLogOnName.Multiline = false;
- this.m_pLogOnName.Name = "m_pLogOnName";
- this.m_pLogOnName.PasswordChar = ' ';
- this.m_pLogOnName.ReadOnly = false;
- this.m_pLogOnName.ScrollBars = System.Windows.Forms.ScrollBars.None;
- this.m_pLogOnName.Size = new System.Drawing.Size(104, 20);
- this.m_pLogOnName.TabIndex = 2;
- this.m_pLogOnName.TextAlign = System.Windows.Forms.HorizontalAlignment.Left;
- this.m_pLogOnName.UseStaticViewStyle = true;
- //
- // m_pPassword
- //
- this.m_pPassword.DecimalPlaces = 2;
- this.m_pPassword.DecMaxValue = new System.Decimal(new int[] {
- 999999999,
- 0,
- 0,
- 0});
- this.m_pPassword.DecMinValue = new System.Decimal(new int[] {
- 999999999,
- 0,
- 0,
- -2147483648});
- this.m_pPassword.Lines = new string[0];
- this.m_pPassword.Location = new System.Drawing.Point(120, 64);
- this.m_pPassword.Mask = LumiSoft.UI.Controls.WEditBox_Mask.Text;
- this.m_pPassword.MaxLength = 32767;
- this.m_pPassword.Multiline = false;
- this.m_pPassword.Name = "m_pPassword";
- this.m_pPassword.PasswordChar = ' ';
- this.m_pPassword.ReadOnly = false;
- this.m_pPassword.ScrollBars = System.Windows.Forms.ScrollBars.None;
- this.m_pPassword.Size = new System.Drawing.Size(104, 20);
- this.m_pPassword.TabIndex = 3;
- this.m_pPassword.TextAlign = System.Windows.Forms.HorizontalAlignment.Left;
- this.m_pPassword.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(352, 20);
- this.m_pDescription.TabIndex = 5;
- this.m_pDescription.TextAlign = System.Windows.Forms.HorizontalAlignment.Left;
- this.m_pDescription.UseStaticViewStyle = true;
- //
- // m_pAddress
- //
- this.m_pAddress.DecimalPlaces = 2;
- this.m_pAddress.DecMaxValue = new System.Decimal(new int[] {
- 999999999,
- 0,
- 0,
- 0});
- this.m_pAddress.DecMinValue = new System.Decimal(new int[] {
- 999999999,
- 0,
- 0,
- -2147483648});
- this.m_pAddress.Lines = new string[0];
- this.m_pAddress.Location = new System.Drawing.Point(8, 184);
- this.m_pAddress.Mask = LumiSoft.UI.Controls.WEditBox_Mask.Text;
- this.m_pAddress.MaxLength = 32767;
- this.m_pAddress.Multiline = false;
- this.m_pAddress.Name = "m_pAddress";
- this.m_pAddress.PasswordChar = ' ';
- this.m_pAddress.ReadOnly = false;
- this.m_pAddress.ScrollBars = System.Windows.Forms.ScrollBars.None;
- this.m_pAddress.Size = new System.Drawing.Size(192, 20);
- this.m_pAddress.TabIndex = 8;
- this.m_pAddress.TextAlign = System.Windows.Forms.HorizontalAlignment.Left;
- this.m_pAddress.UseStaticViewStyle = true;
- //
- // 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(200, 184);
- this.mt_symbolAT.Name = "mt_symbolAT";
- this.mt_symbolAT.Size = new System.Drawing.Size(16, 24);
- this.mt_symbolAT.TabIndex = 22;
- this.mt_symbolAT.Text = "@";
- this.mt_symbolAT.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
- this.mt_symbolAT.UseStaticViewStyle = true;
- //
- // m_pDomains
- //
- this.m_pDomains.AcceptsPlussKey = true;
- this.m_pDomains.BackColor = System.Drawing.Color.White;
- 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(216, 184);
- 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 = false;
- this.m_pDomains.SelectedIndex = -1;
- this.m_pDomains.Size = new System.Drawing.Size(144, 20);
- this.m_pDomains.TabIndex = 9;
- this.m_pDomains.UseStaticViewStyle = true;
- this.m_pDomains.VisibleItems = 5;
- //
- // m_pGenerate
- //
- this.m_pGenerate.Location = new System.Drawing.Point(232, 64);
- this.m_pGenerate.Name = "m_pGenerate";
- this.m_pGenerate.Size = new System.Drawing.Size(128, 24);
- this.m_pGenerate.TabIndex = 4;
- this.m_pGenerate.Text = "Generate Password";
- this.m_pGenerate.UseStaticViewStyle = true;
- this.m_pGenerate.ButtonPressed += new LumiSoft.UI.Controls.ButtonPressedEventHandler(this.m_pGenerate_Click);
- //
- // m_pAdd
- //
- this.m_pAdd.Location = new System.Drawing.Point(280, 216);
- this.m_pAdd.Name = "m_pAdd";
- this.m_pAdd.Size = new System.Drawing.Size(80, 24);
- this.m_pAdd.TabIndex = 10;
- this.m_pAdd.Text = "Add";
- this.m_pAdd.UseStaticViewStyle = true;
- this.m_pAdd.ButtonPressed += new LumiSoft.UI.Controls.ButtonPressedEventHandler(this.m_pAdd_Click);
- //
- // m_pRemove
- //
- this.m_pRemove.Location = new System.Drawing.Point(280, 248);
- this.m_pRemove.Name = "m_pRemove";
- this.m_pRemove.Size = new System.Drawing.Size(80, 24);
- this.m_pRemove.TabIndex = 11;
- this.m_pRemove.Text = "Remove";
- this.m_pRemove.UseStaticViewStyle = true;
- this.m_pRemove.ButtonPressed += new LumiSoft.UI.Controls.ButtonPressedEventHandler(this.m_pRemove_Click);
- //
- // m_pOk
- //
- this.m_pOk.Location = new System.Drawing.Point(280, 304);
- this.m_pOk.Name = "m_pOk";
- this.m_pOk.Size = new System.Drawing.Size(80, 24);
- this.m_pOk.TabIndex = 12;
- this.m_pOk.Text = "OK";
- this.m_pOk.UseStaticViewStyle = true;
- this.m_pOk.ButtonPressed += new LumiSoft.UI.Controls.ButtonPressedEventHandler(this.n_pOk_Click);
- //
- // mt_mailboxsize
- //
- this.mt_mailboxsize.Font = new System.Drawing.Font("Microsoft Sans Serif", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
- this.mt_mailboxsize.Location = new System.Drawing.Point(8, 136);
- this.mt_mailboxsize.Name = "mt_mailboxsize";
- this.mt_mailboxsize.Size = new System.Drawing.Size(112, 24);
- this.mt_mailboxsize.TabIndex = 18;
- this.mt_mailboxsize.Text = "Max. Mailbox Size";
- this.mt_mailboxsize.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
- this.mt_mailboxsize.UseStaticViewStyle = true;
- //
- // mt_userenabled
- //
- this.mt_userenabled.Font = new System.Drawing.Font("Microsoft Sans Serif", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
- this.mt_userenabled.Location = new System.Drawing.Point(224, 136);
- this.mt_userenabled.Name = "mt_userenabled";
- this.mt_userenabled.Size = new System.Drawing.Size(104, 24);
- this.mt_userenabled.TabIndex = 21;
- this.mt_userenabled.Text = "User Enabled";
- this.mt_userenabled.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
- this.mt_userenabled.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(176, 136);
- this.wLabel3.Name = "wLabel3";
- this.wLabel3.Size = new System.Drawing.Size(40, 24);
- this.wLabel3.TabIndex = 20;
- this.wLabel3.Text = "MB";
- this.wLabel3.TextAlign = System.Windows.Forms.HorizontalAlignment.Left;
- this.wLabel3.UseStaticViewStyle = true;
- //
- // m_pMailboxSize
- //
- this.m_pMailboxSize.BackColor = System.Drawing.Color.White;
- this.m_pMailboxSize.ButtonsAlign = LumiSoft.UI.Controls.LeftRight.Left;
- this.m_pMailboxSize.DecimalPlaces = 0;
- this.m_pMailboxSize.DecMaxValue = new System.Decimal(new int[] {
- 999999999,
- 0,
- 0,
- 0});
- this.m_pMailboxSize.DecMinValue = new System.Decimal(new int[] {
- 999999999,
- 0,
- 0,
- -2147483648});
- this.m_pMailboxSize.DecValue = new System.Decimal(new int[] {
- 20,
- 0,
- 0,
- 0});
- this.m_pMailboxSize.Location = new System.Drawing.Point(120, 136);
- this.m_pMailboxSize.Mask = LumiSoft.UI.Controls.WEditBox_Mask.Numeric;
- this.m_pMailboxSize.MaxLength = 32767;
- this.m_pMailboxSize.Name = "m_pMailboxSize";
- this.m_pMailboxSize.ReadOnly = false;
- this.m_pMailboxSize.Size = new System.Drawing.Size(56, 20);
- this.m_pMailboxSize.TabIndex = 6;
- this.m_pMailboxSize.Text = "20";
- this.m_pMailboxSize.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
- this.m_pMailboxSize.UseStaticViewStyle = true;
- //
- // m_pUserEnabled
- //
- this.m_pUserEnabled.Checked = false;
- this.m_pUserEnabled.Enabled = false;
- this.m_pUserEnabled.Location = new System.Drawing.Point(328, 136);
- this.m_pUserEnabled.Name = "m_pUserEnabled";
- this.m_pUserEnabled.ReadOnly = false;
- this.m_pUserEnabled.Size = new System.Drawing.Size(30, 22);
- this.m_pUserEnabled.TabIndex = 7;
- this.m_pUserEnabled.UseStaticViewStyle = true;
- //
- // m_pCancel
- //
- this.m_pCancel.Location = new System.Drawing.Point(280, 336);
- this.m_pCancel.Name = "m_pCancel";
- this.m_pCancel.Size = new System.Drawing.Size(80, 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_User
- //
- this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
- this.ClientSize = new System.Drawing.Size(370, 367);
- this.Controls.AddRange(new System.Windows.Forms.Control[] {
- this.m_pCancel,
- this.m_pUserEnabled,
- this.m_pMailboxSize,
- this.wLabel3,
- this.mt_userenabled,
- this.mt_mailboxsize,
- this.m_pOk,
- this.m_pRemove,
- this.m_pAdd,
- this.m_pGenerate,
- this.m_pDomains,
- this.mt_symbolAT,
- this.m_pAddress,
- this.m_pDescription,
- this.m_pPassword,
- this.m_pLogOnName,
- this.m_pFullName,
- this.mt_Emails,
- this.mt_description,
- this.mt_password,
- this.mt_username,
- this.mt_fullname,
- this.m_pAddresses});
- this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
- this.MaximizeBox = false;
- this.MinimizeBox = false;
- this.Name = "wfrm_User";
- this.ShowInTaskbar = false;
- this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
- this.Text = "User Properties";
- ((System.ComponentModel.ISupportInitialize)(this.m_pFullName)).EndInit();
- ((System.ComponentModel.ISupportInitialize)(this.m_pLogOnName)).EndInit();
- ((System.ComponentModel.ISupportInitialize)(this.m_pPassword)).EndInit();
- ((System.ComponentModel.ISupportInitialize)(this.m_pDescription)).EndInit();
- ((System.ComponentModel.ISupportInitialize)(this.m_pAddress)).EndInit();
- ((System.ComponentModel.ISupportInitialize)(this.m_pDomains)).EndInit();
- ((System.ComponentModel.ISupportInitialize)(this.m_pGenerate)).EndInit();
- ((System.ComponentModel.ISupportInitialize)(this.m_pAdd)).EndInit();
- ((System.ComponentModel.ISupportInitialize)(this.m_pRemove)).EndInit();
- ((System.ComponentModel.ISupportInitialize)(this.m_pOk)).EndInit();
- ((System.ComponentModel.ISupportInitialize)(this.m_pMailboxSize)).EndInit();
- ((System.ComponentModel.ISupportInitialize)(this.m_pUserEnabled)).EndInit();
- ((System.ComponentModel.ISupportInitialize)(this.m_pCancel)).EndInit();
- this.ResumeLayout(false);
- }
- #endregion
- #region Events handling
- #region function n_pOk_Click
- private void n_pOk_Click(object sender, System.EventArgs e)
- {
- #region validation stuff
-
- if(m_pLogOnName.Text.Length <= 0){
- MessageBox.Show("User Name cannot be Empty !!!");
- m_pLogOnName.FlashControl();
- return;
- }
- if(m_pPassword.Text.Length <= 0){
- MessageBox.Show("Password cannot be Empty !!!");
- m_pPassword.FlashControl();
- return;
- }
- if(m_pAddresses.Items.Count == 0){
- MessageBox.Show("Please add at least one Emails address !!!");
- // m_pAddresses.F
- return;
- }
- #endregion
- try
- {
- if(m_New && m_ServerAPI.MailboxExists(m_pLogOnName.Text)){
- MessageBox.Show("User alredy exists !nPlease select another User Name.");
- m_pLogOnName.FlashControl();
- return;
- }
-
- string address = "";
- foreach(string str in m_pAddresses.Items){
- address += str + ";";
- }
-
- // remove ";" from end
- address = address.Substring(0,address.Length-1);
-
- m_FullName = m_pFullName.Text;
- m_UserName = m_pLogOnName.Text;
- m_Password = m_pPassword.Text;
- m_Descript = m_pDescription.Text;
- m_Emailss = address;
- m_DomainID = m_pDomains.SelectedItem.Tag.ToString();
- m_MailboxSize = (int)m_pMailboxSize.DecValue;
- }
- catch(Exception x)
- {
- wfrm_Error frm = new wfrm_Error(x,new System.Diagnostics.StackTrace());
- frm.ShowDialog(this);
- }
- this.DialogResult = DialogResult.OK;
- this.Close();
- }
- #endregion
- #region function m_pGenerate_Click
- private void m_pGenerate_Click(object sender, System.EventArgs e)
- {
- m_pPassword.Text = Guid.NewGuid().ToString().Substring(0,8);
- }
- #endregion
- #region function m_pAdd_Click
- private void m_pAdd_Click(object sender, System.EventArgs e)
- {
- string address = m_pAddress.Text + "@" + m_pDomains.Text;
- #region Validation
- if(m_pAddress.Text.Length == 0){
- MessageBox.Show("Emails address can't be empty.");
- m_pAddress.FlashControl();
- return;
- }
- if(m_ServerAPI.EmailAddressExists(address)){
- MessageBox.Show("Emails address exists already.");
- return;
- }
- #endregion
-
- if(address.IndexOf("<") == -1){
- address = "<" + address;
- }
- if(address.IndexOf(">") == -1){
- address += ">";
- }
- m_pAddresses.Items.Add(address);
- m_pAddress.Text = "";
- m_pAddress.Focus();
- m_pDomains.Enabled = false;
- }
- #endregion
- #region function m_pRemove_Click
- private void m_pRemove_Click(object sender, System.EventArgs e)
- {
- if(m_pAddresses.SelectedIndex > -1){
- m_pAddresses.Items.RemoveAt(m_pAddresses.SelectedIndex);
-
- if(m_pAddresses.Items.Count == 0){
- m_pDomains.Enabled = true;
- }
- }
- }
- #endregion
- #region function m_pCancel_ButtonPressed
- private void m_pCancel_ButtonPressed(object sender, System.EventArgs e)
- {
- this.DialogResult = DialogResult.Cancel;
- this.Close();
- }
- #endregion
- #endregion
-
- #region Properties Implementation
- public string FullName
- {
- get{ return m_FullName; }
- }
- public string UserName
- {
- get{ return m_UserName; }
- }
- public string Password
- {
- get{ return m_Password; }
- }
- public string Description
- {
- get{ return m_Descript; }
- }
- public string Emailss
- {
- get{ return m_Emailss; }
- }
- public string DomainID
- {
- get{ return m_DomainID; }
- }
- public int MailboxSize
- {
- get{ return m_MailboxSize; }
- }
- #endregion
- }
- }