/// <summary>
        /// collection of emailaddress for peticular list
        /// </summary>
        /// <param name="userID">collection of list ids for perticular user</param>
        /// <returns></returns>
        public List <string> getSubscribers(string userID)
        {
            subscriberEmail = new List <string>();
            listIds         = new List <int?>();
            listIds         = M_List.GetListIds(userID);
            using (dbcontext = new ApplicationDbContext())
            {
                foreach (var item in listIds)
                {
                    try
                    {
                        subscriberEmail.Add(dbcontext.M_Subscribers.Where(l => l.ListID == item).Select(s => s.EmailAddress).FirstOrDefault());
                    }
                    catch (SqlException ex)
                    {
                        obj = new M_CustomException((int)ErorrTypes.SqlExceptions, ex.Message, ex.StackTrace, ErorrTypes.SqlExceptions.ToString(), Utlities.GetURL(), ex.LineNumber);

                        obj.LogException();
                        throw obj;
                    }
                    catch (Exception ex)
                    {
                        obj = new M_CustomException((int)ErorrTypes.others, ex.Message, ex.StackTrace, ErorrTypes.others.ToString(), Utlities.GetURL());
                        obj.LogException();
                        throw obj;
                    }
                }
            }
            return(subscriberEmail);
        }
        /// <summary>
        /// if listid is null get all subscribers
        /// </summary>
        /// <param name="userID"></param>
        /// <returns></returns>
        public List <M_Subscriber> GetAllSubscribers(string userID)
        {
            List <M_Subscriber> subscribersList = new List <M_Subscriber>();
            List <M_Subscriber> sub             = null;

            listIds = new List <int?>();
            listIds = M_List.GetListIds(userID);
            foreach (var item in listIds)
            {
                sub = new List <M_Subscriber>();
                sub = GetSubscribersbyListID(item);
                foreach (var i in sub.ToList())
                {
                    subscribersList.Add(i);
                }
            }
            return(subscribersList);
        }
Example #3
0
 /// <summary>
 /// Gets list information to be edited
 /// </summary>
 /// <param name="listID"></param>
 /// <returns>List obejct</returns>
 public M_List EditList(int?listID)
 {
     newList = new M_List();
     using (dbcontext = new ApplicationDbContext())
     {
         try
         {
             newList = dbcontext.M_Lists.Find(listID);
         }
         catch (SqlException ex)
         {
             obj = new M_CustomException((int)ErorrTypes.others, ex.Message, ex.StackTrace, ErorrTypes.others.ToString(), Utlities.GetURL(), ex.LineNumber);
             obj.LogException();
             throw obj;
         }
         catch (Exception ex)
         {
             obj = new M_CustomException((int)ErorrTypes.others, ex.Message, ex.StackTrace, ErorrTypes.others.ToString(), Utlities.GetURL());
             obj.LogException();
             throw obj;
         }
     }
     return(newList);
 }