예제 #1
0
        public void SaveItem(IItemData item, IMailboxData mailboxData, IFolderData parentFolderData)
        {
            ItemEntity entity = item as ItemEntity;
            if (entity == null)
                throw new NullReferenceException("ItemEntity");

            MailboxEntity mailboxEntity = mailboxData as MailboxEntity;
            if (mailboxEntity == null)
                throw new NullReferenceException("mailboxEntity");

            string orignizeName = mailboxEntity.OrganizationName;
            string tableName = ItemEntity.GetItemTableName(orignizeName, parentFolderData.FolderId, entity.StartTime);
            tableName = TableDataAccess.ValidateTableName(tableName);
            TableDataAccess tableDataAccess = new TableDataAccess(TableClient);
            CloudTable table = tableDataAccess.CreateIfNotExist(tableName);

            TableResult tableResult = tableDataAccess.InsertEntity(table, entity);
            LogFactory.LogInstance.WriteLog(LogInterface.LogLevel.DEBUG, "Insert item to table", "Insert item {0} to table {1} result, Etag:{2}, HttpStatusCode:{3},",
                item.DisplayName, tableName, tableResult.Etag, tableResult.HttpStatusCode);
        }
예제 #2
0
        public void SaveMailbox(IMailboxData mailboxAddress)
        {
            MailboxEntity entity = mailboxAddress as MailboxEntity;
            if (entity == null)
                throw new NullReferenceException("mailboxEntity");

            string tableName = TableDataAccess.ValidateTableName(MailboxEntity.GetMailTableName(entity.OrganizationName, entity.StartTime));
            TableDataAccess tableDataAccess = new TableDataAccess(TableClient);
            CloudTable table = tableDataAccess.CreateIfNotExist(tableName);

            TableResult tableResult = tableDataAccess.InsertEntity(table, entity);
            LogFactory.LogInstance.WriteLog(LogInterface.LogLevel.DEBUG, "Insert mailbox to table", "Insert mailbox {0} to table {1} result, Etag:{2}, HttpStatusCode:{3},",
                mailboxAddress.DisplayName, tableName, tableResult.Etag, tableResult.HttpStatusCode);
        }
예제 #3
0
        public void SaveFolder(IFolderData folder, IMailboxData mailboxData, IFolderData parentFolder)
        {
            FolderEntity entity = folder as FolderEntity;
            if (entity == null)
                throw new NullReferenceException("FolderEntity");
            MailboxEntity mailboxEntity = mailboxData as MailboxEntity;
            if (mailboxEntity == null)
                throw new NullReferenceException("mailboxEntity");

            string orignizeName = mailboxEntity.OrganizationName;
            string tableName = FolderEntity.GetFolderTableName(orignizeName, mailboxData.MailAddress, entity.StartTime);
            tableName = TableDataAccess.ValidateTableName(tableName);
            TableDataAccess tableDataAccess = new TableDataAccess(TableClient);
            CloudTable table = tableDataAccess.CreateIfNotExist(tableName);

            entity.Location = tableName;

            TableResult tableResult = tableDataAccess.InsertEntity(table, entity);
            LogFactory.LogInstance.WriteLog(LogInterface.LogLevel.DEBUG, "Insert folder to table", "Insert folder {0} to table {1} result, Etag:{2}, HttpStatusCode:{3},",
                ((IItemBase)folder).DisplayName, tableName, tableResult.Etag, tableResult.HttpStatusCode);
        }