当前位置: 首页>>代码示例>>C++>>正文


C++ shared_ptr::GetAdminLevel方法代码示例

本文整理汇总了C++中boost::shared_ptr::GetAdminLevel方法的典型用法代码示例。如果您正苦于以下问题:C++ shared_ptr::GetAdminLevel方法的具体用法?C++ shared_ptr::GetAdminLevel怎么用?C++ shared_ptr::GetAdminLevel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在boost::shared_ptr的用法示例。


在下文中一共展示了shared_ptr::GetAdminLevel方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Account

bool
PersistentAccount::SaveObject(boost::shared_ptr<Account> pAccount, String &sErrorMessage, bool createInbox)
{
    if (!PreSaveLimitationsCheck::CheckLimitations(pAccount, sErrorMessage))
        return false;

    __int64 iID = pAccount->GetID();
    if (iID > 0)
    {
        // First read the domain to see if we've changed its name.
        boost::shared_ptr<Account> tempAccount = boost::shared_ptr<Account>(new Account());
        if (!PersistentAccount::ReadObject(tempAccount, iID))
            return false;

        if (tempAccount->GetAddress().CompareNoCase(pAccount->GetAddress()) != 0)
        {
            // Check if this account contains messages with full path. If so, the user cannot
            // rename it at this point.
            // Disallow change, if not all files are partial in the database.
            if (!PersistentMessage::GetAllMessageFilesArePartialNames())
            {
                sErrorMessage = "As of hMailServer 5.4, partial file names are stored in the database, rather than the full path\r\n"
                                "To be able to rename the account, you must first migrate your database to the new partial paths scheme. To do\r\n"
                                "this, run Data Directory Synchronizer.";
                return false;
            }

            // Name has been changed. Rename all sub objects first.
            NameChanger nameChanger;
            if (!nameChanger.RenameAccount(tempAccount->GetAddress(), pAccount, sErrorMessage))
                return false;

            // Remove the old account from the cache.
            Cache<Account, PersistentAccount>::Instance()->RemoveObject(tempAccount->GetAddress());
        }
    }

    SQLStatement oStatement;
    oStatement.AddColumnInt64("accountdomainid", pAccount->GetDomainID());
    oStatement.AddColumn("accountaddress", pAccount->GetAddress());
    oStatement.AddColumn("accountpassword", pAccount->GetPassword());
    oStatement.AddColumn("accountactive", pAccount->GetActive());
    oStatement.AddColumn("accountisad", pAccount->GetIsAD());
    oStatement.AddColumn("accountaddomain", pAccount->GetADDomain());
    oStatement.AddColumn("accountadusername", pAccount->GetADUsername());
    oStatement.AddColumn("accountmaxsize", pAccount->GetAccountMaxSize());

    oStatement.AddColumn("accountvacationmessageon", pAccount->GetVacationMessageIsOn());
    oStatement.AddColumn("accountvacationmessage", pAccount->GetVacationMessage());
    oStatement.AddColumn("accountvacationsubject", pAccount->GetVacationSubject());
    oStatement.AddColumn("accountvacationexpires", pAccount->GetVacationExpires());
    oStatement.AddColumn("accountvacationexpiredate", pAccount->GetVacationExpiresDate());

    oStatement.AddColumn("accountpwencryption", pAccount->GetPasswordEncryption());
    oStatement.AddColumn("accountadminlevel", pAccount->GetAdminLevel());

    oStatement.AddColumn("accountforwardenabled", pAccount->GetForwardEnabled());
    oStatement.AddColumn("accountforwardaddress", pAccount->GetForwardAddress());
    oStatement.AddColumn("accountforwardkeeporiginal", pAccount->GetForwardKeepOriginal());

    oStatement.AddColumn("accountenablesignature", pAccount->GetEnableSignature());
    oStatement.AddColumn("accountsignatureplaintext", pAccount->GetSignaturePlainText());
    oStatement.AddColumn("accountsignaturehtml", pAccount->GetSignatureHTML());

    oStatement.AddColumn("accountlastlogontime", pAccount->GetLastLogonTime());

    oStatement.AddColumn("accountpersonfirstname", pAccount->GetPersonFirstName());
    oStatement.AddColumn("accountpersonlastname", pAccount->GetPersonLastName());

    oStatement.SetTable("hm_accounts");


    if (pAccount->GetID() == 0)
    {
        oStatement.SetStatementType(SQLStatement::STInsert);
        oStatement.SetIdentityColumn("accountid");
    }
    else
    {
        oStatement.SetStatementType(SQLStatement::STUpdate);

        String sWhere;
        sWhere.Format(_T("accountid = %I64d"), pAccount->GetID());

        oStatement.SetWhereClause(sWhere);

    }

    bool bNewObject = pAccount->GetID() == 0;

    // Save and fetch ID
    __int64 iDBID = 0;
    bool bRetVal = Application::Instance()->GetDBManager()->Execute(oStatement, bNewObject ? &iDBID : 0);
    if (bRetVal && bNewObject)
    {
        pAccount->SetID((long) iDBID);

        if (createInbox)
        {
            if (!CreateInbox(*pAccount))
//.........这里部分代码省略.........
开发者ID:nberardi,项目名称:hMailServer,代码行数:101,代码来源:PersistentAccount.cpp


注:本文中的boost::shared_ptr::GetAdminLevel方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。