public void Converts_notifications_with_sms_and_email_successfully() { //Arrange var sms = new Sms("99999999"); var email = new Email("*****@*****.**"); var source = new Notifications(sms, email); var expected = new notifications { Items = new object[] { new email { address = email.Address }, new sms { number = sms.Number } } }; //Act var actual = DataTransferObjectConverter.ToDataTransferObject(source); //Assert var comparator = new Comparator(); IEnumerable <IDifference> differences; comparator.AreEqual(expected, actual, out differences); Assert.Empty(differences); }
public async Task SQL_Notification_NotificationUpdate_doesGetUpdated() { Random rnd = new Random(); notifications aNote1 = new notifications { WorkflowState = Constants.WorkflowStates.Created, CreatedAt = DateTime.Now, UpdatedAt = DateTime.Now, NotificationUid = "0", MicrotingUid = rnd.Next(1, 255), Activity = Constants.Notifications.UnitActivate }; dbContext.notifications.Add(aNote1); await dbContext.SaveChangesAsync().ConfigureAwait(false); // Act await sut.NotificationUpdate(aNote1.NotificationUid, (int)aNote1.MicrotingUid, aNote1.WorkflowState, aNote1.Exception, ""); List <notifications> notificationResult = dbContext.notifications.AsNoTracking().ToList(); var versionedMatches = dbContext.notifications.AsNoTracking().ToList(); // Assert Assert.AreEqual(aNote1.NotificationUid, notificationResult[0].NotificationUid); Assert.AreEqual(aNote1.MicrotingUid, notificationResult[0].MicrotingUid); }
public API() { AuthToken = string.Empty; IsDesktopApplication = true; InstalledCulture = CultureInfo.InstalledUICulture; _auth = new auth(this); _marketplace = new marketplace(this); _admin = new admin(this); _photos = new photos(this); _friends = new friends(this); _users = new users(this); _events = new events(this); _groups = new groups(this); _notifications = new notifications(this); _profile = new profile(this); _fbml = new fbml(this); _feed = new feed(this); _fql = new fql(this); _liveMessage = new liveMessage(this); _batch = new batch(this); _pages = new pages(this); _application = new application(this); _data = new data(this); _permissions = new permissions(this); }
public System.Threading.Tasks.Task <notificationsResponse1> notificationsAsync(notifications notifications) { notificationsRequest inValue = new notificationsRequest(); inValue.notifications = notifications; return(((NotificationPort)(this)).notificationsAsync(inValue)); }
notificationsResponse INotificationBinding.notifications(notifications notifications1) { try { SforceService.SforceService client = new SforceService.SforceService(); client.Url = notifications1.EnterpriseUrl; client.SessionHeaderValue = new SforceService.SessionHeader(); client.SessionHeaderValue.sessionId = notifications1.SessionId; List <SforceService.Opportunity> Opps = new List <SforceService.Opportunity>(); foreach (OpportunityNotification item in notifications1.Notification) { SforceService.Opportunity Opp = new SforceService.Opportunity(); Opp.Id = item.sObject.Id; Opp.TrackingNumber__c = "Tracking Number (WF .NET) - " + item.Id; Opps.Add(Opp); } if (Opps.Count > 0) { client.update(Opps.ToArray()); } } catch (Exception Ex) { ddebug("Exception: " + Ex.Message); } notificationsResponse response = new notificationsResponse(); response.Ack = true; return(response); }
notificationsResponse INotificationBinding.notifications(notifications notifications1) { try { SforceService.SforceService client = new SforceService.SforceService(); client.Url = notifications1.EnterpriseUrl; client.SessionHeaderValue = new SforceService.SessionHeader(); client.SessionHeaderValue.sessionId = notifications1.SessionId; List<SforceService.Opportunity> Opps = new List<SforceService.Opportunity>(); foreach (OpportunityNotification item in notifications1.Notification) { SforceService.Opportunity Opp = new SforceService.Opportunity(); Opp.Id = item.sObject.Id; Opp.TrackingNumber__c = "Tracking Number (WF .NET) - " + item.Id; Opps.Add(Opp); } if (Opps.Count > 0) { client.update(Opps.ToArray()); } } catch (Exception Ex) { ddebug("Exception: " + Ex.Message); } notificationsResponse response = new notificationsResponse(); response.Ack = true; return response; }
public notificationsResponse notifications(notifications notifications1) { notificationsRequest inValue = new notificationsRequest(); inValue.notifications = notifications1; notificationsResponse1 retVal = ((NotificationPort)(this)).notifications(inValue); return(retVal.notificationsResponse); }
public ActionResult edit(notifications model, string feild) { try { var C_ID = User.Identity.GetUserId(); ViewBag.screen = dbcontext.Screen.Where(m => m.parent_screen == 0).Select(m => new { ID = m.ID, code = m.name }).ToList(); ViewBag.users = dbcontext.Users.Where(m => m.active == true).Select(m => new { ID = m.Id, code = m.UserName }).ToList(); var edit_model = dbcontext.notifications.FirstOrDefault(m => m.ID == model.ID); if (model.until != null && model.until.Value.Year != 0001) { if (model.until < DateTime.Now.Date) { TempData["Message"] = "Error in until date"; return(View(model)); } } if (model.type_field == type_field.date_field || model.type_field == type_field.normal_field) { if (feild == null || feild == "0") { TempData["Message"] = "you must choose field"; return(View(model)); } else { edit_model.Field = feild; } } if (model.type_field != type_field.date_field && (model.Action == HR.Models.user.Action.after_due_Date || model.Action == HR.Models.user.Action.before_due_Date)) { TempData["Message"] = "you can't choose date before or after with normal field"; return(View(model)); } if (model.type_field == 0 || model.Action == 0) { return(View(model)); } edit_model.Action = model.Action; // edit_model.Field = model.Field; edit_model.Form = model.Form; edit_model.Message = model.Message; edit_model.send_to_ID_user = model.send_to_ID_user; edit_model.Subject = model.Subject; edit_model.type_field = model.type_field; edit_model.until = model.until; edit_model.number = model.number; dbcontext.SaveChanges(); return(RedirectToAction("index")); } catch (Exception) { return(View(model)); } }
/// <summary> /// Initializes FacebookNotificationInfo object /// </summary> internal FacebookNotificationInfo(notifications info) { this.messages = info.messages; this.pokes = info.pokes; this.shares = info.shares; this.friend_requests = info.friend_requests; this.group_invites = info.group_invites; this.event_invites = info.event_invites; this.messages = info.messages; }
public void Eliminar(int id) { notifications oNotification = new notifications { notification_id = id, }; oRepositorio.Delete(oNotification); oUnitOfWork.SaveChanges(); }
public void ActualizarLeido(int notification_id) { notifications ousers = new notifications { notification_id = notification_id, notified = true, }; oRepositorio.Update(ousers, a => a.notification_id, a => a.notified ); oUnitOfWork.SaveChanges(); }
public static void Add(string to, string from, string subject, string body, int priority = 1) { rekursosEntities db = new rekursosEntities(); notifications notification = new notifications(); notification.from = from; notification.to = to; notification.subject = subject; notification.body = body; notification.created_on = DateTime.Now; notification.priority = priority; db.notifications.Add(notification); db.SaveChanges(); }
public ActionResult create() { try { // var C_ID = User.Identity.GetUserId(); ViewBag.screen = dbcontext.Screen.Where(m => m.parent_screen == 0).Select(m => new { ID = m.ID, code = m.name }).ToList(); ViewBag.users = dbcontext.Users.Where(m => m.active == true).Select(m => new { ID = m.Id, code = m.UserName }).ToList(); var model = new notifications(); return(View(model)); } catch (Exception) { return(RedirectToAction("index")); } }
public void Agregar(NotificationViewModel pNotificationViewModel) { notifications onotifications = new notifications { notification_id = 0, user_id = pNotificationViewModel.user_id, date_created = DateTime.Now, user_id_created = pNotificationViewModel.user_id_created, url = pNotificationViewModel.url, message = pNotificationViewModel.message, notified = false, }; oRepositorio.Add(onotifications); oUnitOfWork.SaveChanges(); }
public void Modificar(NotificationViewModel pNotificationViewModel) { notifications onotifications = oRepositorio.FindById(pNotificationViewModel.notification_id); onotifications.user_id = pNotificationViewModel.user_id; onotifications.user_id_modified = pNotificationViewModel.user_id_modified; onotifications.url = pNotificationViewModel.url; onotifications.message = pNotificationViewModel.message; onotifications.date_modified = DateTime.Now; oRepositorio.Update(onotifications); oUnitOfWork.SaveChanges(); }
internal ContactInformation(notifications notifications) { foreach (var item in notifications.Items) { if (item is email && !IsEmailSpecified) { Email = new Email(((email)item).address); } else if (item is sms && !IsSmsSpecified) { var number = ((sms)item).number; Sms = new Sms(number); } else { throw new ArgumentException($"Unable to create {nameof(ContactInformation)} from notification elements. Only one of each is allowed."); } } }
public void Seen(int id) { notifications notification = new notifications(); history h = new history(); using (wardenEntities wardenEntity = new wardenEntities()) { notification = wardenEntity.notifications.Where(x => x.idn == id).FirstOrDefault(); wardenEntity.notifications.Remove(notification); h.idn = id; h.idb = notification.idb; h.ninfo = notification.ninfo; h.ntype = notification.ntype; h.status = this.HttpContext.User.Identity.Name; h.time = notification.time; wardenEntity.history.Add(h); wardenEntity.SaveChanges(); } }
public void ThrowsExceptionOnIllegalNotifications() { const string address = "*****@*****.**"; var source = new notifications { Items = new object[] { new email { address = address }, new email { address = address } } }; var argumentException = Assert.Throws <ArgumentException>(() => new ContactInformation(source)); Assert.Contains("Unable to create ContactInformation", argumentException.Message); }
public void FromXmlObject() { const string number = "11111111"; const string address = "*****@*****.**"; var source = new notifications { Items = new object[] { new sms { number = number }, new email { address = address } } }; var actual = new ContactInformation(source); Assert.Equal(number, actual.Sms.Number); Assert.Equal(address, actual.Email.Address); }
public void SQL_Notification_NotificationReadFirst_doesReadFirst() { notifications aNote1 = new notifications(); aNote1.workflow_state = Constants.WorkflowStates.Created; aNote1.created_at = DateTime.Now; aNote1.updated_at = DateTime.Now; aNote1.notification_uid = "0"; aNote1.microting_uid = "1"; aNote1.activity = Constants.Notifications.UnitActivate; DbContext.notifications.Add(aNote1); DbContext.SaveChanges(); //Act sut.NotificationReadFirst(); List <notifications> notificationResult = DbContext.notifications.AsNoTracking().ToList(); var versionedMatches = DbContext.notifications.AsNoTracking().ToList(); //assert Assert.AreEqual(Constants.WorkflowStates.Created, notificationResult[0].workflow_state); }
private void GetCompleted(notifications actual, object state, FacebookException e) { Assert.IsNotNull(actual); EnqueueTestComplete(); }
Result iTool.Execute(Job job) { Result result = new Result(job.Id); config permConfig = new config(); notifications siteNotifications = new notifications(); permConfig.ReadConfig(job.DownloadAttachment()); List <site> sites = new List <site>(); foreach (alertsite permSite in permConfig.alertSites) { using (SPWeb web = new SPSite(permSite.source).OpenWeb()) { try { Console.WriteLine(web.Url); site site = new site(permSite.source, permSite.target); SPListCollection siteLists = web.Lists; SPAlertCollection allAlerts = web.Alerts; Console.WriteLine(allAlerts.Count); foreach (SPAlert spAlert in allAlerts) { try { if (spAlert.AlertType == SPAlertType.List) { string filterpath = spAlert.Properties["Filterpath"] as string; string objectType = "list"; bool isFolder = !String.IsNullOrEmpty(filterpath); Helper helper = Helper.Instance; if (!string.IsNullOrEmpty(filterpath)) { filterpath = helper.MapServerRelativeUrl( string.Format("/{0}", filterpath).ToLower(), permSite.source, permSite.target); objectType = "folder"; } site.AddAlert(spAlert.Title, spAlert.User.LoginName, spAlert.List.Title, spAlert.EventType.ToString(), spAlert.AlertFrequency.ToString(), spAlert.AlertType.ToString(), filterpath, objectType); } else { string url = (spAlert.List.BaseType == SPBaseType.DocumentLibrary) ? spAlert.Item.File.ServerRelativeUrl : spAlert.Item.Url; string objectType = (spAlert.List.BaseType == SPBaseType.DocumentLibrary) ? "file" : "item"; Helper helper = Helper.Instance; string updatedUrl = helper.MapServerRelativeUrl(url, permSite.source, permSite.target); url = updatedUrl; site.AddAlert(spAlert.Title, spAlert.User.LoginName, spAlert.List.Title, spAlert.EventType.ToString(), spAlert.AlertFrequency.ToString(), spAlert.AlertType.ToString(), spAlert.ItemID, url, objectType); } } catch (Exception ex) { Console.WriteLine(ex.Message); } } siteNotifications.sites.Add(site); } catch (Exception ex) { Console.WriteLine(ex.Message); } } } XmlSerializer serializer = new XmlSerializer(typeof(notifications)); string tmpFile = Scheduler.Instance.CreateTmpFile(); using (TextWriter writer = new StreamWriter(tmpFile)) { serializer.Serialize(writer, siteNotifications); } result.AddFile(tmpFile); return(result); }
public notificationsRequest(notifications notifications) { this.notifications = notifications; }