UserEmailAccount.cs :  » Content-Management-Systems-CMS » mojoPortal » SiteOffice » Business » ExternalMail » C# / CSharp Open Source

Home
C# / CSharp Open Source
1.2.6.4 mono .net core
2.2.6.4 mono core
3.Aspect Oriented Frameworks
4.Bloggers
5.Build Systems
6.Business Application
7.Charting Reporting Tools
8.Chat Servers
9.Code Coverage Tools
10.Content Management Systems CMS
11.CRM ERP
12.Database
13.Development
14.Email
15.Forum
16.Game
17.GIS
18.GUI
19.IDEs
20.Installers Generators
21.Inversion of Control Dependency Injection
22.Issue Tracking
23.Logging Tools
24.Message
25.Mobile
26.Network Clients
27.Network Servers
28.Office
29.PDF
30.Persistence Frameworks
31.Portals
32.Profilers
33.Project Management
34.RSS RDF
35.Rule Engines
36.Script
37.Search Engines
38.Sound Audio
39.Source Control
40.SQL Clients
41.Template Engines
42.Testing
43.UML
44.Web Frameworks
45.Web Service
46.Web Testing
47.Wiki Engines
48.Windows Presentation Foundation
49.Workflows
50.XML Parsers
C# / C Sharp
C# / C Sharp by API
C# / CSharp Tutorial
C# / CSharp Open Source » Content Management Systems CMS » mojoPortal 
mojoPortal » SiteOffice » Business » ExternalMail » UserEmailAccount.cs
using System;
using System.Data;
using SiteOffice.Data;

namespace SiteOffice.Business.ExternalMail{
    /// <summary>
    /// Author:          Joe Audette
    /// Created:        2006-08-20
    /// Last Modified:      2007-06-17
    /// 
    /// The use and distribution terms for this software are covered by the 
    /// Common Public License 1.0 (http://opensource.org/licenses/cpl.php)  
    /// which can be found in the file CPL.TXT at the root of this distribution.
    /// By using this software in any fashion, you are agreeing to be bound by 
    /// the terms of this license.
    ///
    /// You must not remove this notice, or any other, from this software.
    /// </summary>
    public class UserEmailAccount
    {

        #region Constructors

        public UserEmailAccount()
        { }


        public UserEmailAccount(
            Guid iD)
        {
            GetUserEmailAccount(
                iD);
        }

        #endregion

        #region Private Properties

        private Guid iD = Guid.Empty;
        private Guid userGuid;
        private string accountName;
        private string userName;
        private string email;
        private string password;
        private string pop3Server;
        private int pop3Port;
        private string smtpServer;
        private int smtpPort;
        private bool useSSL = true;



        #endregion

        #region Public Properties

        public Guid ID
        {
            get { return iD; }
            set { iD = value; }
        }
        public Guid UserGuid
        {
            get { return userGuid; }
            set { userGuid = value; }
        }
        public string AccountName
        {
            get { return accountName; }
            set { accountName = value; }
        }
        public string UserName
        {
            get { return userName; }
            set { userName = value; }
        }
        public string Email
        {
            get { return email; }
            set { email = value; }
        }
        public string Password
        {
            get { return password; }
            set { password = value; }
        }
        public string Pop3Server
        {
            get { return pop3Server; }
            set { pop3Server = value; }
        }
        public int Pop3Port
        {
            get { return pop3Port; }
            set { pop3Port = value; }
        }
        public string SmtpServer
        {
            get { return smtpServer; }
            set { smtpServer = value; }
        }
        public int SmtpPort
        {
            get { return smtpPort; }
            set { smtpPort = value; }
        }

        public bool UseSsl
        {
            get { return useSSL; }
            set { useSSL = value; }
        }

        #endregion

        #region Private Methods

        private void GetUserEmailAccount(Guid iD)
        {
            IDataReader reader = DBUserEmailAccount.GetUserEmailAccount(iD);

            if (reader.Read())
            {
                this.iD = new Guid(reader["ID"].ToString());
                this.userGuid = new Guid(reader["UserGuid"].ToString());
                this.accountName = reader["AccountName"].ToString();
                this.userName = reader["UserName"].ToString();
                this.email = reader["Email"].ToString();
                this.password = reader["Password"].ToString();
                this.pop3Server = reader["Pop3Server"].ToString();
                this.pop3Port = Convert.ToInt32(reader["Pop3Port"]);
                this.smtpServer = reader["SmtpServer"].ToString();
                this.smtpPort = Convert.ToInt32(reader["SmtpPort"]);
                this.useSSL = Convert.ToBoolean(reader["UseSSL"]);

            }

            reader.Close();

        }

        private bool Create()
        {
            Guid newID = Guid.NewGuid();

            this.iD = newID;

            int rowsAffected = DBUserEmailAccount.AddUserEmailAccount(
                this.iD,
                this.userGuid,
                this.accountName,
                this.userName,
                this.email,
                this.password,
                this.pop3Server,
                this.pop3Port,
                this.smtpServer,
                this.smtpPort,
                this.useSSL);

            return (rowsAffected > 0);

        }



        private bool Update()
        {

            return DBUserEmailAccount.UpdateUserEmailAccount(
                this.iD,
                this.accountName,
                this.userName,
                this.email,
                this.password,
                this.pop3Server,
                this.pop3Port,
                this.smtpServer,
                this.smtpPort,
                this.useSSL);

        }


        #endregion

        #region Public Methods


        public bool Save()
        {
            if (this.iD != Guid.Empty)
            {
                return Update();
            }
            else
            {
                return Create();
            }
        }





        #endregion


        #region Static Methods

        public static IDataReader GetUserEmailAccountByUser(Guid userGuid)
        {
            return DBUserEmailAccount.GetUserEmailAccountByUser(userGuid);

        }

        public static bool Delete(Guid id)
        {
            return DBUserEmailAccount.DeleteUserEmailAccount(id);

        }



        #endregion


    }
}
www.java2v.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.