• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# MailServer.WSqlCommand类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中LumiSoft.MailServer.WSqlCommand的典型用法代码示例。如果您正苦于以下问题:C# WSqlCommand类的具体用法?C# WSqlCommand怎么用?C# WSqlCommand使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



WSqlCommand类属于LumiSoft.MailServer命名空间,在下文中一共展示了WSqlCommand类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: StoreMessageFlags

        /// <summary>
        /// Stores IMAP message flags (\seen,\draft, ...).
        /// </summary>
        /// <param name="accessingUser">User who accesses this method. 
        /// User needs r permission to call this method or Exception is thrown. 
        /// There is special user 'system' for which permission check is skipped.</param>
        /// <param name="folderOwnerUser">User who's folder it is.</param>
        /// <param name="folder">Folder which message flags to store. For example: Inbox,Public Folders/Documnets .</param>
        /// <param name="message">Fix ME: ???</param>
        /// <param name="msgFlags">Message flags to store.</param>
        public void StoreMessageFlags(string accessingUser,string folderOwnerUser,string folder,LumiSoft.Net.IMAP.Server.IMAP_Message message,IMAP_MessageFlags msgFlags)
        {
            /* Implementation notes:
                *) Validate values. Throw ArgumnetExcetion if invalid values.
                *) Ensure that user exists.
                *) Normalize folder. Remove '/' from folder start and end, ... .
                *) Do Shared Folders mapping.
                *) Ensure that folder exists. Throw Exception if don't.
                *) Remove all message flags which permissions user doesn't have.
                *) Store message.
            */

            //--- Validate values -------------------//
            ArgsValidator.ValidateUserName(folderOwnerUser);
            ArgsValidator.ValidateFolder(folder);
            ArgsValidator.ValidateNotNull(message);
            //---------------------------------------//

            // Ensure that user exists.
            if(!UserExists(folderOwnerUser)){
                throw new Exception("User '" + folderOwnerUser + "' doesn't exist !");
            }

            // Normalize folder. Remove '/' from folder start and end.
            folder = API_Utlis.NormalizeFolder(folder);

            // Do Shared Folders mapping.
            string originalFolder = folder;
            SharedFolderMapInfo mappedFolder = MapSharedFolder(originalFolder);
            if(mappedFolder.IsSharedFolder){
                folderOwnerUser = mappedFolder.FolderOnwer;
                folder = mappedFolder.Folder;

                if(folderOwnerUser == "" || folder == ""){
                    throw new ArgumentException("Specified root folder '" + originalFolder + "' isn't accessible !");
                }
            }

            // Ensure that folder exists. Throw Exception if don't.
            if(!FolderExists(folderOwnerUser + "/" + folder)){
                throw new Exception("Folder '" + folder + "' doesn't exist !");
            }

            // Remove all message flags which permissions user doesn't have.
            if(accessingUser != "system"){
                IMAP_ACL_Flags userACL = GetUserACL(folderOwnerUser,folder,accessingUser);
                if((userACL & IMAP_ACL_Flags.s) == 0){
                    msgFlags &= ~IMAP_MessageFlags.Seen;
                }
                else if((userACL & IMAP_ACL_Flags.d) == 0){
                    msgFlags &= ~IMAP_MessageFlags.Deleted;
                }
                else if((userACL & IMAP_ACL_Flags.s) == 0){
                    msgFlags &= (~IMAP_MessageFlags.Answered | ~IMAP_MessageFlags.Draft | ~IMAP_MessageFlags.Flagged);
                }
            }

            //--- Store message flags
            using(WSqlCommand sqlCmd = new WSqlCommand(m_ConStr,"lspr_StoreMessageFlags")){
                sqlCmd.AddParameter("_userName"     ,NpgsqlDbType.Varchar,folderOwnerUser);
                sqlCmd.AddParameter("_folder"       ,NpgsqlDbType.Varchar,folder);
                sqlCmd.AddParameter("_messageID"    ,NpgsqlDbType.Varchar,message.ID);
                sqlCmd.AddParameter("_messageFlags" ,NpgsqlDbType.Integer,(int)message.Flags);

                DataSet ds = sqlCmd.Execute();
            }
        }
开发者ID:janemiceli,项目名称:authenticated_mail_server,代码行数:77,代码来源:pgsql_API.cs


示例2: CreateFolder

        /// <summary>
        /// Creates new IMAP folder.
        /// </summary>
        /// <param name="accessingUser">User who accesses this method. 
        /// User needs r permission to call this method or Exception is thrown. 
        /// There is special user 'system' for which permission check is skipped.</param>
        /// <param name="folderOwnerUser">User who's folder it is.</param>
        /// <param name="folder">Folder what contains message to copy. For example: Inbox,Public Folders/Documnets .</param>
        public void CreateFolder(string accessingUser,string folderOwnerUser,string folder)
        {
            /* Implementation notes:
                *) Validate values. Throw ArgumnetExcetion if invalid values.
                *) Ensure that user exists.
                *) Normalize folder. Remove '/' from folder start and end, ... .
                *) Do Shared Folders mapping.
                *) Ensure that folder doesn't exists. Throw Exception if don't.
                *) See if user has sufficient permissions. User requires 'c' permission.
                    There is builtin user system, skip ACL for it.
                *) Create folder.
            */

            //--- Validate values -------------------//
            ArgsValidator.ValidateUserName(folderOwnerUser);
            ArgsValidator.ValidateFolder(folder);
            //---------------------------------------//

            // Ensure that user exists.
            if(!UserExists(folderOwnerUser)){
                throw new Exception("User '" + folderOwnerUser + "' doesn't exist !");
            }

            // Normalize folder. Remove '/' from folder start and end.
            folder = API_Utlis.NormalizeFolder(folder);

            // Do Shared Folders mapping.
            string originalFolder = folder;
            SharedFolderMapInfo mappedFolder = MapSharedFolder(originalFolder);
            if(mappedFolder.IsSharedFolder){
                folderOwnerUser = mappedFolder.FolderOnwer;
                folder = mappedFolder.Folder;

                if(folderOwnerUser == "" || folder == ""){
                    throw new ArgumentException("Specified root folder '" + originalFolder + "' isn't accessible !");
                }
            }

            // Ensure that folder doesn't exists. Throw Exception if don't.
            if(FolderExists(folderOwnerUser + "/" + folder)){
                throw new Exception("Folder '" + folder + "' already exist !");
            }

            // See if user has sufficient permissions. User requires 'c' permission.
            //  There is builtin user system, skip ACL for it.
            if(accessingUser.ToLower() != "system"){
                IMAP_ACL_Flags acl = GetUserACL(folderOwnerUser,folder,accessingUser);
                if((acl & IMAP_ACL_Flags.c) == 0){
                    throw new InsufficientPermissionsException("Insufficient permissions for folder '" + accessingUser + "/" + folder + "' !");
                }
            }

            //--- Create folder
            using(WSqlCommand sqlCmd = new WSqlCommand(m_ConStr,"lspr_CreateFolder")){
                sqlCmd.AddParameter("_folderID",NpgsqlDbType.Varchar,Guid.NewGuid().ToString());
                sqlCmd.AddParameter("_userName",NpgsqlDbType.Varchar,folderOwnerUser);
                sqlCmd.AddParameter("_folder"  ,NpgsqlDbType.Varchar,folder);

                DataSet ds = sqlCmd.Execute();
            }
        }
开发者ID:janemiceli,项目名称:authenticated_mail_server,代码行数:69,代码来源:pgsql_API.cs


示例3: DeleteFilter

        /// <summary>
        /// Deletes specified filter.
        /// </summary>
        /// <param name="filterID">FilterID of the filter which to delete.</param>
        public void DeleteFilter(string filterID)
        {
            using(WSqlCommand sqlCmd = new WSqlCommand(m_ConStr,"lspr_DeleteFilter")){
                sqlCmd.AddParameter("_filterID" ,NpgsqlDbType.Varchar,filterID);

                DataSet ds = sqlCmd.Execute();
            }
        }
开发者ID:janemiceli,项目名称:authenticated_mail_server,代码行数:12,代码来源:pgsql_API.cs


示例4: AddUserRemoteServer

        /// <summary>
        /// AAdds new remote pop3 server to user.
        /// </summary>
        /// <param name="serverID">Server ID. Suggested value is Guid.NewGuid() .</param>
        /// <param name="userName">User name. Use <see cref="IMailServerApi.GetUsers">GetUsers()</see> to get valid values.</param>
        /// <param name="description">Remote server description.</param>
        /// <param name="remoteServer">Remote server name.</param>
        /// <param name="remotePort">Remote server port.</param>
        /// <param name="remoteUser">Remote server user name.</param>
        /// <param name="remotePassword">Remote server password.</param>
        /// <param name="useSSL">Specifies if SSL must be used to connect to remote server.</param>
        /// <param name="enabled">Specifies if remote server is enabled.</param>
        /// <remarks>Throws exception if specified user remote server already exists.</remarks>
        public void AddUserRemoteServer(string serverID,string userName,string description,string remoteServer,int remotePort,string remoteUser,string remotePassword,bool useSSL,bool enabled)
        {
            if(serverID.Length == 0){
                throw new Exception("You must specify serverID");
            }
            if(userName.Length == 0){
                throw new Exception("You must specify userName");
            }

            using(WSqlCommand sqlCmd = new WSqlCommand(m_ConStr,"lspr_AddUserRemoteServer")){
                sqlCmd.AddParameter("_serverID"       ,NpgsqlDbType.Varchar,serverID);
                sqlCmd.AddParameter("_userName"       ,NpgsqlDbType.Varchar,userName);
                sqlCmd.AddParameter("_description"    ,NpgsqlDbType.Varchar,description);
                sqlCmd.AddParameter("_remoteServer"   ,NpgsqlDbType.Varchar,remoteServer);
                sqlCmd.AddParameter("_remotePort"     ,NpgsqlDbType.Integer,remotePort);
                sqlCmd.AddParameter("_remoteUserName" ,NpgsqlDbType.Varchar,remoteUser);
                sqlCmd.AddParameter("_remotePassword" ,NpgsqlDbType.Varchar,remotePassword);
                sqlCmd.AddParameter("_useSSL"         ,NpgsqlDbType.Boolean,useSSL);
                sqlCmd.AddParameter("_enabled"        ,NpgsqlDbType.Boolean,enabled);

                DataSet ds = sqlCmd.Execute();
            }
        }
开发者ID:janemiceli,项目名称:authenticated_mail_server,代码行数:36,代码来源:pgsql_API.cs


示例5: AuthUser

        /// <summary>
        /// Authenticates user.
        /// </summary>
        /// <param name="userName">User name.</param>
        /// <param name="passwData">Password data.</param>
        /// <param name="authData">Authentication specific data(as tag).</param>
        /// <param name="authType">Authentication type.</param>
        /// <returns></returns>
        public DataSet AuthUser(string userName,string passwData,string authData,AuthType authType)
        {
            DataSet retVal = new DataSet();
            DataTable dt = retVal.Tables.Add("Result");
            dt.Columns.Add("Result");
            dt.Columns.Add("ReturnData");
            DataRow drx = dt.NewRow();
            drx["Result"] = "false";
            drx["ReturnData"] = "";
            dt.Rows.Add(drx);

            using(WSqlCommand sqlCmd = new WSqlCommand(m_ConStr,"lspr_GetUserProperties")){
                sqlCmd.AddParameter("_userName",NpgsqlDbType.Varchar,userName);

                DataSet ds = sqlCmd.Execute();
                ds.Tables[0].TableName = "Users";

                if(ds.Tables["Users"].Rows.Count > 0){
                    string password = ds.Tables["Users"].Rows[0]["PASSWORD"].ToString().ToLower();

                    switch(authType)
                    {
                        case AuthType.APOP:
                            if(AuthHelper.Apop(password,authData) == passwData){
                                drx["Result"] = "true";
                                return retVal;
                            }
                            break;

                        case AuthType.CRAM_MD5:
                            if(AuthHelper.Cram_Md5(password,authData) == passwData){
                                drx["Result"] = "true";
                                return retVal;
                            }
                            break;

                        case AuthType.DIGEST_MD5:
                            string realm      = "";
                            string nonce      = "";
                            string cnonce     = "";
                            string digest_uri = "";
                            foreach(string clntRespParam in authData.Split(',')){
                                if(clntRespParam.StartsWith("realm=")){
                                    realm = clntRespParam.Split(new char[]{'='},2)[1].Replace("\"","");
                                }
                                else if(clntRespParam.StartsWith("nonce=")){
                                    nonce = clntRespParam.Split(new char[]{'='},2)[1].Replace("\"","");
                                }
                                else if(clntRespParam.StartsWith("cnonce=")){
                                    cnonce = clntRespParam.Split(new char[]{'='},2)[1].Replace("\"","");
                                }
                                else if(clntRespParam.StartsWith("digest-uri=")){
                                    digest_uri = clntRespParam.Split(new char[]{'='},2)[1].Replace("\"","");
                                }
                            }

                            if(passwData == AuthHelper.Digest_Md5(true,realm,userName,password,nonce,cnonce,digest_uri)){
                                string returnData = AuthHelper.Digest_Md5(false,realm,userName,password,nonce,cnonce,digest_uri);

                                drx["Result"] = "true";
                                drx["ReturnData"] = returnData;
                                return retVal;
                            }

                            break;

                        case AuthType.Plain:
                            if(password == passwData.ToLower()){
                                drx["Result"] = "true";
                                return retVal;
                            }
                            break;
                    }
                }
            }

            return retVal;
        }
开发者ID:janemiceli,项目名称:authenticated_mail_server,代码行数:86,代码来源:pgsql_API.cs


示例6: AddUser

        /// <summary>
        /// Adds new user to specified domain.
        /// </summary>
        /// <param name="userID">User ID. Suggested value is Guid.NewGuid() .</param>
        /// <param name="userName">User login name.</param>
        /// <param name="fullName">User full name.</param> 
        /// <param name="password">User login password.</param>
        /// <param name="description">User description.</param>
        /// <param name="domainName">Domain where to add user. Use <see cref="IMailServerApi.GetDomains">GetDomains()</see> to get valid values.</param>
        /// <param name="mailboxSize">Maximum mailbox size.</param>
        /// <param name="enabled">Sepcifies if user is enabled.</param>
        /// <param name="permissions">Specifies user permissions.</param>
        /// <remarks>Throws exception if specified user already exists.</remarks>
        public void AddUser(string userID,string userName,string fullName,string password,string description,string domainName,int mailboxSize,bool enabled,UserPermissions_enum permissions)
        {
            if(userID.Length == 0){
                throw new Exception("You must specify userID");
            }
            if(userName.Length == 0){
                throw new Exception("You must specify userName");
            }

            using(WSqlCommand sqlCmd = new WSqlCommand(m_ConStr,"lspr_AddUser")){
                sqlCmd.AddParameter("_userID"      ,NpgsqlDbType.Varchar,userID);
                sqlCmd.AddParameter("_fullName"    ,NpgsqlDbType.Varchar,fullName);
                sqlCmd.AddParameter("_userName"    ,NpgsqlDbType.Varchar,userName);
                sqlCmd.AddParameter("_password"    ,NpgsqlDbType.Varchar,password);
                sqlCmd.AddParameter("_description" ,NpgsqlDbType.Varchar,description);
                sqlCmd.AddParameter("_domainName"  ,NpgsqlDbType.Varchar,domainName);
                sqlCmd.AddParameter("_mailboxSize" ,NpgsqlDbType.Integer,mailboxSize);
                sqlCmd.AddParameter("_enabled"     ,NpgsqlDbType.Boolean,enabled);
                sqlCmd.AddParameter("_permissions" ,NpgsqlDbType.Integer,permissions);

                DataSet ds = sqlCmd.Execute();
                ds.Tables[0].TableName = "Users";
            }
        }
开发者ID:janemiceli,项目名称:authenticated_mail_server,代码行数:37,代码来源:pgsql_API.cs


示例7: AddUserMessageRule

        /// <summary>
        /// Adds new user message rule.
        /// </summary>
        /// <param name="userID">User who owns specified rule.</param>
        /// <param name="ruleID">Rule ID. Guid.NewID().ToString() is suggested.</param>
        /// <param name="cost">Cost specifies in what order rules are processed. Costs with lower values are processed first.</param>
        /// <param name="enabled">Specifies if rule is enabled.</param>
        /// <param name="checkNextRule">Specifies when next rule is checked.</param>
        /// <param name="description">Rule description.</param>
        /// <param name="matchExpression">Rule match expression.</param>
        public void AddUserMessageRule(string userID,string ruleID,long cost,bool enabled,GlobalMessageRule_CheckNextRule_enum checkNextRule,string description,string matchExpression)
        {
            if(userID == null || userID == ""){
                throw new Exception("Invalid userID value, userID can't be '' or null !");
            }
            if(ruleID == null || ruleID == ""){
                throw new Exception("Invalid ruleID value, ruleID can't be '' or null !");
            }

            using(WSqlCommand sqlCmd = new WSqlCommand(m_ConStr,"lspr_AddUserMessageRule")){
                sqlCmd.AddParameter("_userID"          ,NpgsqlDbType.Varchar,userID);
                sqlCmd.AddParameter("_ruleID"          ,NpgsqlDbType.Varchar,ruleID);
                sqlCmd.AddParameter("_cost"            ,NpgsqlDbType.Bigint  ,cost);
                sqlCmd.AddParameter("_enabled"         ,NpgsqlDbType.Boolean ,enabled);
                sqlCmd.AddParameter("_checkNextRule"   ,NpgsqlDbType.Integer ,checkNextRule);
                sqlCmd.AddParameter("_description"     ,NpgsqlDbType.Varchar,description);
                sqlCmd.AddParameter("_matchExpression" ,NpgsqlDbType.Bytea   ,System.Text.Encoding.Default.GetBytes(matchExpression));

                DataSet ds = sqlCmd.Execute();
            }
        }
开发者ID:janemiceli,项目名称:authenticated_mail_server,代码行数:31,代码来源:pgsql_API.cs


示例8: UpdateMailingList

        /// <summary>
        /// Updates specified mailing list.
        /// </summary>
        /// <param name="mailingListID">Mailing list ID.</param>
        /// <param name="mailingListName">Mailing list name name. Use <see cref="IMailServerApi.GetMailingLists">GetMailingLists()</see> to get valid values.</param>
        /// <param name="description">Mailing list description.</param>
        /// <param name="domainName">Domain name. Use <see cref="IMailServerApi.GetDomains">>GetUsers()</see> to get valid values.</param>
        /// <param name="enabled">Specifies if mailing list is enabled.</param>
        public void UpdateMailingList(string mailingListID,string mailingListName,string description,string domainName,bool enabled)
        {
            if(mailingListName.Length == 0){
                throw new Exception("You must specify mailingListName");
            }

            using(WSqlCommand sqlCmd = new WSqlCommand(m_ConStr,"lspr_UpdateMailingList")){
                sqlCmd.AddParameter("_mailingListID"   ,NpgsqlDbType.Varchar,mailingListID);
                sqlCmd.AddParameter("_mailingListName" ,NpgsqlDbType.Varchar,mailingListName);
                sqlCmd.AddParameter("_description"     ,NpgsqlDbType.Varchar,description);
                sqlCmd.AddParameter("_domainName"      ,NpgsqlDbType.Varchar,domainName);
                sqlCmd.AddParameter("_enabled"         ,NpgsqlDbType.Boolean,enabled);

                DataSet ds = sqlCmd.Execute();
            }
        }
开发者ID:janemiceli,项目名称:authenticated_mail_server,代码行数:24,代码来源:pgsql_API.cs


示例9: UpdateRecycleBinSettings

 /// <summary>
 /// Updates recycle bin settings.
 /// </summary>
 /// <param name="deleteToRecycleBin">Specifies if deleted messages are store to recycle bin.</param>
 /// <param name="deleteMessagesAfter">Specifies how old messages will be deleted.</param>
 public void UpdateRecycleBinSettings(bool deleteToRecycleBin,int deleteMessagesAfter)
 {
     using(WSqlCommand sqlCmd = new WSqlCommand(m_ConStr,"lspr_UpdateRecycleBinSettings")){
         sqlCmd.AddParameter("_deleteToRecycleBin" ,NpgsqlDbType.Boolean,deleteToRecycleBin);
         sqlCmd.AddParameter("_deleteMessagesAfter",NpgsqlDbType.Integer,deleteMessagesAfter);
         DataSet ds = sqlCmd.Execute();
     }
 }
开发者ID:janemiceli,项目名称:authenticated_mail_server,代码行数:13,代码来源:pgsql_API.cs


示例10: UpdateFilter

        /// <summary>
        /// Updates specified filter.
        /// </summary>		
        /// <param name="filterID">FilterID which to update.</param>
        /// <param name="description">Filter description</param>
        /// <param name="type">Filter type. Eg. ISmtpMessageFilter.</param>
        /// <param name="assembly">Assembly with full location. Eg. C:\MailServer\Filters\filter.dll .</param>
        /// <param name="className">Filter full class name, wih namespace. Eg. LumiSoft.MailServer.Fileters.Filter1 .</param>
        /// <param name="cost">Filters are sorted by cost and proccessed with cost value. Smallest cost is proccessed first.</param>
        /// <param name="enabled">Specifies if filter is enabled.</param>
        /// <returns></returns>
        public void UpdateFilter(string filterID,string description,string type,string assembly,string className,long cost,bool enabled)
        {
            using(WSqlCommand sqlCmd = new WSqlCommand(m_ConStr,"lspr_UpdateFilter")){
                sqlCmd.AddParameter("_filterID"    ,NpgsqlDbType.Varchar,filterID);
                sqlCmd.AddParameter("_description" ,NpgsqlDbType.Varchar,description);
                sqlCmd.AddParameter("_type"        ,NpgsqlDbType.Varchar,type);
                sqlCmd.AddParameter("_assembly"    ,NpgsqlDbType.Varchar,assembly);
                sqlCmd.AddParameter("_className"   ,NpgsqlDbType.Varchar,className);
                sqlCmd.AddParameter("_cost"        ,NpgsqlDbType.Bigint ,cost);
                sqlCmd.AddParameter("_enabled"     ,NpgsqlDbType.Boolean,enabled);

                DataSet ds = sqlCmd.Execute();
            }
        }
开发者ID:janemiceli,项目名称:authenticated_mail_server,代码行数:25,代码来源:pgsql_API.cs


示例11: UpdateGroup

        /// <summary>
        /// Updates user group info.
        /// </summary>
        /// <param name="groupID">Group ID.</param>
        /// <param name="groupName">Group name.</param>
        /// <param name="description">Group description.</param>
        /// <param name="enabled">Specifies if group is enabled.</param>
        public void UpdateGroup(string groupID,string groupName,string description,bool enabled)
        {
            /* Implementation notes:
                *) Validate values. Throw ArgumnetExcetion if invalid values.
                *) Ensure that group with specified ID does exist.  Throw Exception if doesn't.
                *) If group name is changed, ensure that new group name won't conflict
                   any other group or user name. Throw Exception if does.
                *) Udpate group.
            */

            //--- Validate values --------------------//
            if(groupID == null || groupID == ""){
                throw new Exception("Invalid groupID value, groupID can't be '' or null !");
            }
            ArgsValidator.ValidateUserName(groupName);
            ArgsValidator.ValidateNotNull(description);
            //----------------------------------------//

            /* We handle these is SQL, sql throws Excption

            *) Ensure that group with specified ID does exist.  Throw Exception if doesn't.
            *) If group name is changed, ensure that new group name won't conflict
               any other group or user name. Throw Exception if does.
            */

            // Update group
            using(WSqlCommand sqlCmd = new WSqlCommand(m_ConStr,"lspr_UpdateGroup")){
                sqlCmd.AddParameter("_groupID"     ,NpgsqlDbType.Varchar,groupID);
                sqlCmd.AddParameter("_groupName"   ,NpgsqlDbType.Varchar,groupName);
                sqlCmd.AddParameter("_description" ,NpgsqlDbType.Varchar,description);
                sqlCmd.AddParameter("_enabled"     ,NpgsqlDbType.Boolean,enabled);

                DataSet ds = sqlCmd.Execute();
                ds.Tables[0].TableName = "Groups";
            }
        }
开发者ID:janemiceli,项目名称:authenticated_mail_server,代码行数:43,代码来源:pgsql_API.cs


示例12: UpdateDomain

        /// <summary>
        /// Updates specified domain data.
        /// </summary>
        /// <param name="domainID">Domain ID which to update.</param>
        /// <param name="domainName">Domain name.</param>
        /// <param name="description">Domain description.</param>
        public void UpdateDomain(string domainID,string domainName,string description)
        {
            if(domainID.Length == 0){
                throw new Exception("You must specify domainID");
            }
            ArgsValidator.ValidateDomainName(domainName);

            using(WSqlCommand sqlCmd = new WSqlCommand(m_ConStr,"lspr_UpdateDomain")){
                sqlCmd.AddParameter("_domainID"   ,NpgsqlDbType.Varchar,domainID);
                sqlCmd.AddParameter("_domainName" ,NpgsqlDbType.Varchar,domainName);
                sqlCmd.AddParameter("_description",NpgsqlDbType.Varchar,description);

                DataSet ds = sqlCmd.Execute();
            }
        }
开发者ID:janemiceli,项目名称:authenticated_mail_server,代码行数:21,代码来源:pgsql_API.cs


示例13: UnSubscribeFolder

        /// <summary>
        /// UnSubscribes IMAP folder.
        /// </summary>
        /// <param name="userName"></param>
        /// <param name="folder"></param>
        public void UnSubscribeFolder(string userName,string folder)
        {
            using(WSqlCommand sqlCmd = new WSqlCommand(m_ConStr,"lspr_UnSubscribeFolder")){
                sqlCmd.AddParameter("_userName",NpgsqlDbType.Varchar,userName);
                sqlCmd.AddParameter("_folder"  ,NpgsqlDbType.Varchar,folder);

                DataSet ds = sqlCmd.Execute();
            }
        }
开发者ID:janemiceli,项目名称:authenticated_mail_server,代码行数:14,代码来源:pgsql_API.cs


示例14: AddMailingListAddress

        /// <summary>
        /// Add new email address to specified mailing list.
        /// </summary>
        /// <param name="addressID">Address ID. Suggested value is Guid.NewGuid() .</param>
        /// <param name="mailingListName">Mailing list name name. Use <see cref="IMailServerApi.GetMailingLists">GetMailingLists()</see> to get valid values.</param>
        /// <param name="address">Mailing list member address.</param>
        /// <remarks>Throws exception if specified mailing list member already exists.</remarks>
        public void AddMailingListAddress(string addressID,string mailingListName,string address)
        {
            if(addressID.Length == 0){
                throw new Exception("You must specify addressID");
            }
            if(mailingListName.Length == 0){
                throw new Exception("You must specify mailingListName");
            }
            if(address.Length == 0){
                throw new Exception("You must specify address");
            }

            using(WSqlCommand sqlCmd = new WSqlCommand(m_ConStr,"lspr_AddMailingListAddress")){
                sqlCmd.AddParameter("_addressID"       ,NpgsqlDbType.Varchar,addressID);
                sqlCmd.AddParameter("_mailingListName" ,NpgsqlDbType.Varchar,mailingListName);
                sqlCmd.AddParameter("_address"         ,NpgsqlDbType.Varchar,address);

                DataSet ds = sqlCmd.Execute();
            }
        }
开发者ID:janemiceli,项目名称:authenticated_mail_server,代码行数:27,代码来源:pgsql_API.cs


示例15: AddSecurityEntry

        /// <summary>
        /// Adds new IP security entry.
        /// </summary>
        /// <param name="id">IP security entry ID.</param>
        /// <param name="enabled">Specifies if IP security entry is enabled.</param>
        /// <param name="description">IP security entry description text.</param>
        /// <param name="service">Specifies service for what security entry applies.</param>
        /// <param name="action">Specifies what action done if IP matches to security entry range.</param>
        /// <param name="startIP">Range start IP.</param>
        /// <param name="endIP">Range end IP.</param>
        public void AddSecurityEntry(string id,bool enabled,string description,Service_enum service,IPSecurityAction_enum action,IPAddress startIP,IPAddress endIP)
        {
            if(id.Length == 0){
                throw new Exception("You must specify securityID");
            }

            using(WSqlCommand sqlCmd = new WSqlCommand(m_ConStr,"lspr_AddSecurityEntry")){
                sqlCmd.AddParameter("_id"          ,NpgsqlDbType.Varchar,id);
                sqlCmd.AddParameter("_enabled"     ,NpgsqlDbType.Boolean,enabled);
                sqlCmd.AddParameter("_description" ,NpgsqlDbType.Varchar,description);
                sqlCmd.AddParameter("_service"     ,NpgsqlDbType.Integer,(int)service);
                sqlCmd.AddParameter("_action"      ,NpgsqlDbType.Integer,(int)action);
                sqlCmd.AddParameter("_startIP"     ,NpgsqlDbType.Varchar,startIP.ToString());
                sqlCmd.AddParameter("_endIP"       ,NpgsqlDbType.Varchar,endIP.ToString());

                DataSet ds = sqlCmd.Execute();
            }
        }
开发者ID:janemiceli,项目名称:authenticated_mail_server,代码行数:28,代码来源:pgsql_API.cs


示例16: UpdateSecurityEntry

        /// <summary>
        /// Updates IP security entry.
        /// </summary>
        /// <param name="id">IP security entry ID.</param>
        /// <param name="enabled">Specifies if IP security entry is enabled.</param>
        /// <param name="description">IP security entry description text.</param>
        /// <param name="service">Specifies service for what security entry applies.</param>
        /// <param name="action">Specifies what action done if IP matches to security entry range.</param>
        /// <param name="startIP">Range start IP.</param>
        /// <param name="endIP">Range end IP.</param>
        public void UpdateSecurityEntry(string id,bool enabled,string description,Service_enum service,IPSecurityAction_enum action,IPAddress startIP,IPAddress endIP)
        {
            using(WSqlCommand sqlCmd = new WSqlCommand(m_ConStr,"lspr_UpdateSecurityEntry")){
                sqlCmd.AddParameter("_id"          ,NpgsqlDbType.Varchar,id);
                sqlCmd.AddParameter("_enabled"     ,NpgsqlDbType.Boolean,enabled);
                sqlCmd.AddParameter("_description" ,NpgsqlDbType.Varchar,description);
                sqlCmd.AddParameter("_service"     ,NpgsqlDbType.Integer,(int)service);
                sqlCmd.AddParameter("_action"      ,NpgsqlDbType.Integer,(int)action);
                sqlCmd.AddParameter("_startIP"     ,NpgsqlDbType.Varchar,startIP.ToString());
                sqlCmd.AddParameter("_endIP"       ,NpgsqlDbType.Varchar,endIP.ToString());

                DataSet ds = sqlCmd.Execute();
            }
        }
开发者ID:janemiceli,项目名称:authenticated_mail_server,代码行数:24,代码来源:pgsql_API.cs


示例17: AddSharedFolderRoot

        /// <summary>
        /// Add shared folder root.
        /// </summary>
        /// <param name="rootID">Root folder ID. Guid.NewID().ToString() is suggested.</param>
        /// <param name="enabled">Specifies if root folder is enabled.</param>
        /// <param name="folder">Folder name which will be visible to public.</param>
        /// <param name="description">Description text.</param>
        /// <param name="rootType">Specifies what type root folder is.</param>
        /// <param name="boundedUser">User which to bound root folder.</param>
        /// <param name="boundedFolder">Folder which to bound to public folder.</param>
        public void AddSharedFolderRoot(string rootID,bool enabled,string folder,string description,SharedFolderRootType_enum rootType,string boundedUser,string boundedFolder)
        {
            /* Implementation notes:
                *) Validate values. Throw ArgumnetExcetion if invalid values.
                *) Ensure that root ID doesn't exists.
                *) Ensure that root doesn't exists.
                *) Add root folder.
            */

            if(rootID == null || rootID == ""){
                throw new Exception("Invalid rootID value, rootID can't be '' or null !");
            }

            //--- Validate values -------------------------------------//
            ArgsValidator.ValidateNotNull(rootID);
            ArgsValidator.ValidateSharedFolderRoot(folder);
            ArgsValidator.ValidateNotNull(description);
            if(rootType == SharedFolderRootType_enum.BoundedRootFolder){
                ArgsValidator.ValidateUserName(boundedUser);
                ArgsValidator.ValidateFolder(boundedFolder);
            }
            //---------------------------------------------------------//

            /* We handle these is SQL, sql returns these errors in ErrorText

                *) Ensure that root ID doesn't exists.
                *) Ensure that root doesn't exists.
            */

            // Insert group
            using(WSqlCommand sqlCmd = new WSqlCommand(m_ConStr,"lspr_AddSharedFolderRoot")){
                sqlCmd.AddParameter("_rootID"        ,NpgsqlDbType.Varchar,rootID);
                sqlCmd.AddParameter("_enabled"       ,NpgsqlDbType.Boolean,enabled);
                sqlCmd.AddParameter("-folder"        ,NpgsqlDbType.Varchar,folder);
                sqlCmd.AddParameter("_description"   ,NpgsqlDbType.Varchar,description);
                sqlCmd.AddParameter("_rootType"      ,NpgsqlDbType.Integer,rootType);
                sqlCmd.AddParameter("_boundedUser"   ,NpgsqlDbType.Varchar,boundedUser);
                sqlCmd.AddParameter("_boundedFolder" ,NpgsqlDbType.Varchar,boundedFolder);

                DataSet ds = sqlCmd.Execute();
            }
        }
开发者ID:janemiceli,项目名称:authenticated_mail_server,代码行数:52,代码来源:pgsql_API.cs


示例18: UpdateSettings

        /// <summary>
        /// Updates server settings.
        /// </summary>
        public void UpdateSettings(DataRow settings)
        {
            /*
            DataRow row = GetSettings();
            foreach(DataColumn dc in row.Table.Columns){
                row[dc.ColumnName] = settings[dc.ColumnName];
            }*/

            using(MemoryStream strm = new MemoryStream()){
                settings.Table.DataSet.WriteXml(strm);

                using(WSqlCommand sqlCmd = new WSqlCommand(m_ConStr,"lspr_UpdateSettings")){
                    sqlCmd.AddParameter("_settings" ,NpgsqlDbType.Bytea,strm.ToArray());

                    DataSet ds = sqlCmd.Execute();
                }
            }
        }
开发者ID:janemiceli,项目名称:authenticated_mail_server,代码行数:21,代码来源:pgsql_API.cs


示例19: AddUserAddress

该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IO.SmartStream类代码示例发布时间:2022-05-26
下一篇:
C# Util.OpenBitSet类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap