Пример #1
0
        public static async Task <DataSourceColumnList> InsertOrMergeEntityAsync(CloudTable table, DataSourceColumnList entity)
        {
            if (entity == null)
            {
                throw new ArgumentNullException("entity");
            }
            try
            {
                // Create the InsertOrReplace table operation
                TableOperation insertOrMergeOperation = TableOperation.InsertOrMerge(entity);

                // Execute the operation.
                TableResult result = await table.ExecuteAsync(insertOrMergeOperation);

                DataSourceColumnList insertedCustomer = result.Result as DataSourceColumnList;

                // Get the request units consumed by the current operation. RequestCharge of a TableResult is only applied to Azure Cosmos DB
                if (result.RequestCharge.HasValue)
                {
                    Console.WriteLine("Request Charge of InsertOrMerge Operation: " + result.RequestCharge);
                }

                return(insertedCustomer);
            }
            catch (StorageException e)
            {
                Console.WriteLine(e.Message);
                Console.ReadLine();
                throw;
            }
        }
 public List <DataColumns> GetSpResultsetColumnNames([FromBody] DataSourceColumnList dataSourceColumnList)
 {
     return(DbNamesObj.GetSpResultsetColumnNames(ServerName: dataSourceColumnList.DbServerName, DatabaseName: dataSourceColumnList.DBName,
                                                 StoredProcedureName: dataSourceColumnList.StoredProcedureName, SpParameterValue: dataSourceColumnList.SpParameterValue,
                                                 AuthenticationType: dataSourceColumnList.AuthenticationType, UserName: dataSourceColumnList.UserName,
                                                 Password: dataSourceColumnList.Password));
 }
Пример #3
0
        public static async Task DeleteEntityAsync(CloudTable table, DataSourceColumnList deleteEntity)
        {
            try
            {
                if (deleteEntity == null)
                {
                    throw new ArgumentNullException("deleteEntity");
                }

                TableOperation deleteOperation = TableOperation.Delete(deleteEntity);
                TableResult    result          = await table.ExecuteAsync(deleteOperation);

                // Get the request units consumed by the current operation. RequestCharge of a TableResult is only applied to Azure CosmoS DB
                if (result.RequestCharge.HasValue)
                {
                    Console.WriteLine("Request Charge of Delete Operation: " + result.RequestCharge);
                }
            }
            catch (StorageException e)
            {
                Console.WriteLine(e.Message);
                Console.ReadLine();
                throw;
            }
        }
Пример #4
0
        public static async Task <DataSourceColumnList> RetrieveEntityUsingPointQueryAsync(CloudTable table, string partitionKey, string rowKey)
        {
            try
            {
                TableOperation retrieveOperation = TableOperation.Retrieve <DataSourceColumnList>(partitionKey, rowKey);
                TableResult    result            = await table.ExecuteAsync(retrieveOperation);

                DataSourceColumnList customer = result.Result as DataSourceColumnList;
                if (customer != null)
                {
                    Console.WriteLine("\t{0}\t{1}\t{2}\t{3}", customer.PartitionKey, customer.RowKey, customer.DataSourceType, customer.Source);
                }

                // Get the request units consumed by the current operation. RequestCharge of a TableResult is only applied to Azure CosmoS DB
                if (result.RequestCharge.HasValue)
                {
                    Console.WriteLine("Request Charge of Retrieve Operation: " + result.RequestCharge);
                }

                return(customer);
            }
            catch (StorageException e)
            {
                Console.WriteLine(e.Message);
                Console.ReadLine();
                throw;
            }
        }
 public List <string> GetStoredProcedureParameterNames([FromBody] DataSourceColumnList dataSourceColumnList)
 {
     // string ServerName = HttpContext.Request.Query["ServerName"];
     // string DatabaseName = HttpContext.Request.Query["DatabaseName"];
     // string StoredProcedureName = HttpContext.Request.Query["StoredProcedureName"];
     // string AuthenticationType = HttpContext.Request.Query["AuthenticationType"];
     // string UserName = HttpContext.Request.Query["UserName"];
     // string Password = HttpContext.Request.Query["Password"];
     return(DbNamesObj.GetStoredProcedureParameterNames(ServerName: dataSourceColumnList.DbServerName, DatabaseName: dataSourceColumnList.DBName,
                                                        StoredProcedureName: dataSourceColumnList.StoredProcedureName, AuthenticationType: dataSourceColumnList.AuthenticationType,
                                                        UserName: dataSourceColumnList.UserName, Password: dataSourceColumnList.Password));
 }
 public List <DataColumns> GetQueryResultsetColumnNames([FromBody] DataSourceColumnList dataSourceColumnList)
 {
     // string ServerName = HttpContext.Request.Query["ServerName"];
     // string DatabaseName = HttpContext.Request.Query["DatabaseName"];
     // string SqlQuery = HttpContext.Request.Query["SqlQuery"];
     // string AuthenticationType = HttpContext.Request.Query["AuthenticationType"];
     // string UserName = HttpContext.Request.Query["UserName"];
     // string Password = HttpContext.Request.Query["Password"];
     return(DbNamesObj.GetQueryResultsetColumnNames(ServerName: dataSourceColumnList.DbServerName, DatabaseName: dataSourceColumnList.DBName,
                                                    SqlQuery: dataSourceColumnList.SqlQuery, AuthenticationType: dataSourceColumnList.AuthenticationType, UserName: dataSourceColumnList.UserName,
                                                    Password: dataSourceColumnList.Password));
 }
        public void GetScheduledDBReport(DataSourceColumnList DBobj1, DataSourceColumnList DBobj2)
        {
            DataTable         ColumnValues1   = dBServiceRepoObj.GetColumnData(DBobj1.DbServerName, DBobj1.DBName, DBobj1.TableName, DBobj1.SqlQuery, DBobj1.ColumnName, DBobj1.DatabaseObjectType, DBobj1.StoredProcedureName, DBobj1.SpParameterValue, DBobj1.AuthenticationType, DBobj1.UserName, DBobj1.Password);
            DataTable         ColumnValues2   = dBServiceRepoObj.GetColumnData(DBobj2.DbServerName, DBobj2.DBName, DBobj2.TableName, DBobj2.SqlQuery, DBobj2.ColumnName, DBobj2.DatabaseObjectType, DBobj2.StoredProcedureName, DBobj2.SpParameterValue, DBobj2.AuthenticationType, DBobj2.UserName, DBobj2.Password);
            ComparisionOutput ListObj         = new ComparisionOutput();
            IDBSourceBL       stringMetricObj = new DBSourceBL();

            ListObj = stringMetricObj.CompareColumnValues(ColumnValues1, ColumnValues2, "scheduledjob");
            string FilePath = "E:\\ScheduledDBReport\\";
            string FileName = FilePath + "ScheduledDBReport_" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".xlsx";
            IExcelDocumentService excelDocumentServiceObj = new ExcelDocumentService();

            excelDocumentServiceObj.DataTableToExcel(ListObj.RowSet, FileName);
        }
 public List <DataColumns> GetQueryResultsetColumnNames([FromBody] DataSourceColumnList dataSourceColumnList)
 {
     return(DbNamesObj.GetQueryResultsetColumnNames(ServerName: dataSourceColumnList.DbServerName, DatabaseName: dataSourceColumnList.DBName,
                                                    SqlQuery: dataSourceColumnList.SqlQuery, AuthenticationType: dataSourceColumnList.AuthenticationType, UserName: dataSourceColumnList.UserName,
                                                    Password: dataSourceColumnList.Password));
 }
 public List <DataColumns> GetTableColumnNames([FromBody] DataSourceColumnList dataSourceColumnList)
 {
     return(DbNamesObj.GetTableColumnNames(ServerName: dataSourceColumnList.DbServerName, DatabaseName: dataSourceColumnList.DBName,
                                           TableName: dataSourceColumnList.TableName, AuthenticationType: dataSourceColumnList.AuthenticationType,
                                           UserName: dataSourceColumnList.UserName, Password: dataSourceColumnList.Password));
 }
 public List <string> GetDatabaseStoredProcedureNames([FromBody] DataSourceColumnList dataSourceColumnList)
 {
     return(DbNamesObj.GetDatabaseStoredProcedureNames(ServerName: dataSourceColumnList.DbServerName, DatabaseName: dataSourceColumnList.DBName,
                                                       AuthenticationType: dataSourceColumnList.AuthenticationType, UserName: dataSourceColumnList.UserName, Password: dataSourceColumnList.Password));
 }