public ActionResult AddNewList(SubscriptionFactory subscriptionList)
        {

            try
            {
                //var memId = RDN.Library.Classes.Account.User.GetMemberId();
                //var league = MemberCache.GetLeagueOfMember(memId);
                //sponsor.SponsorForLeague = league.LeagueId;
                //sponsor.SponsorAddByMember = memId;
            
                bool execute = RDN.Library.Classes.EmailServer.SubscriptionFactory.Add_New_SubscriptionList(subscriptionList);
                return Redirect(Url.Content("~/subscriptions/Lists?u=" + SiteMessagesEnum.sac));
            }
            catch (Exception exception)
            {
                ErrorDatabaseManager.AddException(exception, exception.GetType());
            }

            return Redirect(Url.Content("~/?u=" + SiteMessagesEnum.sww));
        }
        public ActionResult SubscriptionEdit(SubscriptionFactory subscription)
        {
            try
            {
                bool execute = RDN.Library.Classes.EmailServer.SubscriptionFactory.UpdateListInfo(subscription);
                return Redirect(Url.Content("~/subscriptions/Lists?u=" + SiteMessagesEnum.sac));

            }
            catch (Exception exception)
            {
                ErrorDatabaseManager.AddException(exception, exception.GetType());
            }

            return Redirect(Url.Content("?u=" + SiteMessagesEnum.su));
        }
        public ActionResult EmailBlast(SubscriptionFactory subscriber)
        {
            
            return View();

        }
        public ActionResult SubscriberAdd(SubscriptionFactory subscriber)
        {

            try
            {
                var memId = RDN.Library.Classes.Account.User.GetMemberId();
                var league = MemberCache.GetLeagueOfMember(memId);
                subscriber.LeagueOwner = league.LeagueId;
                
                bool execute = RDN.Library.Classes.EmailServer.SubscriptionFactory.Add_New_Subscriber(subscriber);

                return Redirect(Url.Content("~/subscriptions/View/"+ subscriber.listId +"/"+ subscriber.ListName +"?u=" + SiteMessagesEnum.sac));

            }
            catch (Exception exception)
            {
                ErrorDatabaseManager.AddException(exception, exception.GetType());
            }

            return Redirect(Url.Content("?u=" + SiteMessagesEnum.sac));
        }
        public ActionResult SubscriberAdd(long listId,string listName)
        {
            var subscriptionData = RDN.Library.Classes.EmailServer.SubscriptionFactory.GetData(listId);
            
            SubscriptionFactory initialData = new SubscriptionFactory();
            initialData.listId = listId;
            initialData.ListName = listName;
            initialData.SubscriberTypeEnum = subscriptionData.SubscriberTypeEnum;
            return View(initialData);

        }
 private static SubscriptionFactory DisplaySubscriberData(DataModels.EmailServer.Subscriptions.Subscriber oData)
 {
     SubscriptionFactory bl = new SubscriptionFactory();
     bl.listId = oData.List.ListId;
     bl.BounceCount = oData.BounceCount;
     bl.EmailsSent = oData.EmailsSent;
     bl.IsRemoved = oData.IsRemoved;
     bl.Name = oData.Name;
     bl.Data = oData.Data;
     bl.OptedOut = oData.OptedOut;
     bl.SubscriberId = oData.SubscriberId;
   //  bl.SubscriberTypeEnum = oData.SubscriberTypeEnum;
    // bl.OptedOutDateTime = oData.OptedOutDateTime;
     
     return bl;
 }
        private static SubscriptionFactory DisplayData(DataModels.EmailServer.Subscriptions.SubscriptionList oData)
        {
            SubscriptionFactory bl = new SubscriptionFactory();
            bl.listId = oData.ListId;
            bl.ListName = oData.ListName;
            bl.SubscriberTypeEnum = oData.SubscriberTypeEnum;
            bl.IsRemoved = oData.IsRemoved; 

            return bl;
        }