Example #1
0
 public Subscription(string id, string displayName, string organizationId, bool isConnected, DateTime connectedOn, string connectedBy, bool azureAccessNeedsToBeRepaired, string displayTag, DataGenStatus dataGenStatus, DateTime dataGenDate)
 {
     Id             = id;
     DisplayName    = displayName;
     OrganizationId = organizationId;
     IsConnected    = isConnected;
     ConnectedOn    = connectedOn;
     ConnectedBy    = connectedBy;
     AzureAccessNeedsToBeRepaired = azureAccessNeedsToBeRepaired;
     DisplayTag    = displayTag;
     DataGenStatus = dataGenStatus;
     DataGenDate   = dataGenDate;
 }
Example #2
0
        public static void UpdateSubscriptionStatus(string id, DataGenStatus dgs, DateTime dt)
        {
            string        connectionString = ConfigurationManager.ConnectionStrings["ASQLConn"].ToString();
            SqlConnection connection       = new SqlConnection(connectionString);

            try
            {
                SqlCommand sqlCommand = new SqlCommand(string.Format("UPDATE Subscriptions SET DataGenStatus = {1},  DataGenDate = DATETIMEFROMPARTS({2}, {3}, {4}, {5}, {6}, {7}, {8}) WHERE Id = '{0}'", id, ((int)dgs), dt.Year, dt.Month, dt.Day, dt.Hour, dt.Minute, dt.Second, dt.Millisecond), connection);
                connection.Open();
                sqlCommand.ExecuteNonQuery();
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception (UpdateSubscriptionStatus): " + e.Message);
            }
        }
Example #3
0
        public static void UpdateSubscriptionStatus(Guid id, DataGenStatus dgs, DateTime dt)
        {
            SqlConnection connection = new SqlConnection(SqlConnectionString);
            SqlCommand    sqlCommand = new SqlCommand("set nocount off; update dbo.Subscriptions set DataGenStatus = @DataGenStatus, DataGenDate = @DataGenDate where Id = @Id", connection);

            sqlCommand.Parameters.Add("@Id", SqlDbType.UniqueIdentifier).Value   = id;
            sqlCommand.Parameters.Add("@DataGenDate", SqlDbType.DateTime2).Value = dt;
            sqlCommand.Parameters.Add("@DataGenStatus", SqlDbType.Int).Value     = (int)dgs;

            try {
                connection.Open();
                int count = sqlCommand.ExecuteNonQuery();
                if (count != 1)
                {
                    Console.WriteLine($"Subscriptions record {id} not found.");
                }
            } catch (Exception e) {
                Console.WriteLine($"Exception ({nameof(UpdateSubscriptionStatus)}): {e.Message}");
                throw;
            } finally {
                sqlCommand.Dispose();
                connection.Dispose();
            }
        }