コード例 #1
0
ファイル: HomeController.cs プロジェクト: wfuser12/eventTest
		public async Task<ActionResult> LogEventSubscriptions()
		{
			var dbContext = new NotificationDb();
			var logEventSub = new LogEventSubscriptions
			{
				Id = Guid.NewGuid(),
				ObjectTypeOfEvent = Enum.ObjectTypeOfEvent.MonthlyMeeting,
				EventType = Enum.EventType.Delete,
				UserWhoSubscribed = "*****@*****.**"
			};

			dbContext.LogEventSubscriptionses.Add(logEventSub);
			await dbContext.SaveChangesAsync();
			return Content("Created new row");
		}
コード例 #2
0
ファイル: HomeController.cs プロジェクト: wfuser12/eventTest
		public async Task<ActionResult> LogEvents()
		{
			var dbContext = new NotificationDb();
			var logEvent = new LogEvents()
			{
				EventType = Enum.EventType.Delete,
				Id = Guid.NewGuid(),
				UserWhoCreatesEvent = "*****@*****.**",
				ObjectTypeOfEvent = Enum.ObjectTypeOfEvent.MonthlyMeeting
			};
			dbContext.LogEventses.Add(logEvent);
			await dbContext.SaveChangesAsync();


			var storageAccount = CloudStorageAccount.Parse(ConfigurationManager.ConnectionStrings["AzureWebJobsStorage"].ToString());
			CloudQueueClient queueClient = storageAccount.CreateCloudQueueClient();

			CloudQueue queue = queueClient.GetQueueReference("logeventslog");
			queue.CreateIfNotExists();
			var queueMessage = new CloudQueueMessage(JsonConvert.SerializeObject(logEvent));
			queue.AddMessage(queueMessage);


			//List<string> c = dbContext.LogEventSubscriptionses.Where(r => r.EventType == logEvent.EventType
			//	&& r.ObjectTypeOfEvent == logEvent.ObjectTypeOfEvent).Select(r => r.UserWhoSubscribed).ToList();

			//var mandrill = new MandrillApi(ConfigurationManager.AppSettings["MandrillApiKey"]);

			//foreach (var row in c)
			//{
			//	var email = new EmailMessage
			//	{
			//		Text = "body",
			//		FromEmail = "*****@*****.**",
			//		To = new List<EmailAddress> {new EmailAddress {Email = row}},
			//		Subject = "Sub"
			//	};

			//	await mandrill.SendMessage(new SendMessageRequest(email));
			//}

			return Content("new row created");


		}
コード例 #3
0
ファイル: HomeController.cs プロジェクト: wfuser12/eventTest
		public async Task<ActionResult> NotificationUserID()
		{
			var notificationContext = new NotificationDb();
			var notificationSignaldbSet = new NotificationSignalR()
			{
				Id = 1,
				RecipientOrganizationId = 4536,
				RecipientUserId = 2,
				Seen = false
			};

			notificationContext.NotificationSignalRs.Add(notificationSignaldbSet);
			await notificationContext.SaveChangesAsync();

			return Content("new row has been created in notificationDBSET");
		}