예제 #1
0
        /// <summary>
        /// Method for executing the source code
        /// </summary>
        /// <param name="startPartitionKey"></param>
        /// <param name="startRowKey"></param>
        /// <param name="endPartitionKey"></param>
        /// <param name="endRowKey"></param>
        /// <param name="fileName"></param>
        public static List <LogEntity> Exec(string startPartitionKey, string startRowKey, string endPartitionKey, string endRowKey, string fileName)
        {
            //TODO: add UI for the below 3 fields.

            string tableName = "table1";

            AzureTableConnection storage = new AzureTableConnection(tableName);
            AzureLog             result  = new AzureLog();
            CloudTable           table   = storage.GetTable();

            //If table is null return error to the user. Abort the query
            List <TableQuery <LogEntity> > listOfQueries = result.GetAllQueries(startPartitionKey, startRowKey, endPartitionKey, endRowKey);

            List <LogEntity> allLogs = new List <LogEntity>();

            foreach (TableQuery <LogEntity> aQuery in listOfQueries)
            {
                aQuery.TakeCount = 100;
                TableContinuationToken token = null;
                bool first = true;

                do
                {
                    ResultPair pair = result.GetResultsAsync(aQuery, table, token, first).Result;
                    first = false;
                    token = pair.token;
                    allLogs.AddRange(pair.logs);
                }while (token != null);
            }
            //List<LogEntity> logs = await result.StartQueryAsync("2016-03-18 15:41", "16", "2016-03-18 15:41", "20");
            //List<LogEntity> logs = result.StartQueryAsync(startPartitionKey, startRowKey, endPartitionKey, endRowKey).Result;

            //WriteLogToFile(startPartitionKey, startRowKey, endPartitionKey, endRowKey, fileName, allLogs);
            return(allLogs);
        }
예제 #2
0
        public async Task TestCallRemainingTwice()
        {
            string tableName               = "Table1";
            AzureTableConnection storage   = new AzureTableConnection(tableName);
            CloudTable           table     = storage.GetTable();
            DateTime             start     = new DateTime(2016, 03, 23, 11, 23, 17, 0);
            DateTime             end       = new DateTime(2016, 03, 29, 11, 47, 52, 0);
            InputProcessor       processor = new InputProcessor(start, end, table);

            List <LogEntity> logs = await processor.RetrieveData();
        }
예제 #3
0
        private async Task <List <LogEntity> > Exec(DateTime startDate, DateTime endDate, FilterSet filter)
        {
            string tableName             = "Table1";
            AzureTableConnection storage = new AzureTableConnection(tableName);
            CloudTable           table   = storage.GetTable();

            InputProcessor   processor = new InputProcessor(startDate, endDate, table);
            List <LogEntity> data      = await processor.RetrieveData(filter);

            return(data);
        }
예제 #4
0
    public async Task <IActionResult> OnGet()
    {
        // need to validate if account exists first
        var user = await _userManager.GetUserAsync(User);

        if (user == null)
        {
            return(NotFound($"Unable to load user with ID '{_userManager.GetUserId(User)}'."));
        }

        var domainName = user.Office365DomainName;
        var id         = user.Id;
        AzureTableConnection azureTableConnection = new AzureTableConnection();

        Result = await azureTableConnection.TenantLookupAsync(azureTableConnection, domainName, id);

        return(Page());
    }
예제 #5
0
        private async void search_Click(object sender, EventArgs e)
        {
            ResetFormState();
            DisableAllButtons();
            string tableName = this.tableNameTextBox.Text;

            if (String.IsNullOrEmpty(tableName))
            {
                this.errorProvider1.SetError(this.tableNameTextBox, "Please enter the table name");
                return;
            }

            AzureTableConnection storage = new AzureTableConnection(tableName);
            CloudTable           table   = storage.GetTable();

            //Check for table existence
            bool tableExists = table.Exists();

            if (!tableExists)
            {
                this.errorProvider1.SetError(this.tableNameTextBox, "Table (" + tableName + ") cannot be found");
                return;
            }


            this.errorProvider1.Clear(); //If there was an error previously, Clear error message.

            FilterSet filteredInput = GetFilters();

            this.processor = new InputProcessor(
                this.startDateTimePicker.Value, this.endDateTimePicker.Value, table, filteredInput);

            this.searchButton.Enabled = false;
            List <LogEntity> logs = await this.processor.RetrieveData();

            this.resultListView.Clear(); //Clear prev data if any
            AddLogDataToUIList(logs);
            ChangeNextButtonState();

            UpdateRecordCount(processor.GetTotalLogCount());
            this.searchButton.Enabled = true;
        }