コード例 #1
0
        public GroupNotification add(GroupNotification store)
        {
            logger.Info("Add Store: ");
            try
            {
                if (store == null)
                {
                    throw new ArgumentNullException("Store");
                }
                List <Customer> customers = new List <Customer>();
                foreach (var item in store.Customer)
                {
                    Customer cuslist = context.Customers.Where(x => x.CustomerId == item.CustomerId).FirstOrDefault();
                    customers.Add(cuslist);
                }
                store.Customer = customers;
                context.AddGroupNotification(store);
                logger.Info("End  Add Store: ");
                return(store);
            }
            catch (Exception ex)
            {
                logger.Error("Error in Add Store " + ex.Message);

                return(null);
            }
        }
コード例 #2
0
        public JsonResult Edit(GroupNotification notifi)
        {
            var db = new VITVSecondContext();

            db.Entry(notifi).State = System.Data.Entity.EntityState.Modified;
            db.SaveChanges();
            return(Json(new { success = true }));
        }
コード例 #3
0
        public JsonResult Add(GroupNotification notifi)
        {
            var db = new VITVSecondContext();

            db.GroupNotifications.Add(notifi);
            db.SaveChanges();
            return(Json(new { success = true }));
        }
コード例 #4
0
        public virtual void Subscribe(EmailSubscriptionViewModel subscription)
        {
            if (Request.IsAjaxRequest())
            {
                try
                {
                    // Add logic to add subscr
                    var isGroup = subscription.SubscriptionType.Contains("Group");
                    var isTag   = subscription.SubscriptionType.Contains("tag");
                    var id      = subscription.Id;
                    var dbUser  = MembershipService.GetUser(User.Identity.Name);

                    if (isGroup)
                    {
                        // get the Group
                        var cat = _groupService.Get(id);

                        if (cat != null)
                        {
                            // Create the notification
                            var GroupNotification = new GroupNotification
                            {
                                Group = cat,
                                User  = dbUser
                            };
                            //save

                            _notificationService.Add(GroupNotification);
                        }
                    }
                    else if (isTag)
                    {
                        // get the tag
                        var tag = _topicTagService.Get(id);

                        if (tag != null)
                        {
                            // Create the notification
                            var tagNotification = new TagNotification
                            {
                                Tag  = tag,
                                User = dbUser
                            };
                            //save

                            _notificationService.Add(tagNotification);
                        }
                    }
                    else
                    {
                        // get the Group
                        var topic = _topicService.Get(id);

                        // check its not null
                        if (topic != null)
                        {
                            // Create the notification
                            var topicNotification = new TopicNotification
                            {
                                Topic = topic,
                                User  = dbUser
                            };
                            //save

                            _notificationService.Add(topicNotification);
                        }
                    }

                    Context.SaveChanges();
                }
                catch (Exception ex)
                {
                    Context.RollBack();
                    LoggingService.Error(ex);
                    throw new Exception(LocalizationService.GetResourceString("Errors.GenericMessage"));
                }
            }
            else
            {
                throw new Exception(LocalizationService.GetResourceString("Errors.GenericMessage"));
            }
        }
コード例 #5
0
 /// <inheritdoc />
 public GroupNotification Add(GroupNotification Group)
 {
     return(_context.GroupNotification.Add(Group));
 }
コード例 #6
0
 /// <inheritdoc />
 public void Delete(GroupNotification notification)
 {
     _context.GroupNotification.Remove(notification);
 }