public async Task <int> AddSubscribeUser(string Email, string FName, string Lname, string Location, int Gender, bool InterestInAll, string Interest)
        {
            try
            {
                NL_Controller objCon  = new NL_Controller();
                NL_UserInfo   objUser = new NL_UserInfo
                {
                    ClientIP        = _context.HttpContext?.Connection?.RemoteIpAddress?.ToString(),
                    AddedBy         = "SubcribeComponent",
                    SubscriberEmail = Email,
                    FirstName       = FName,
                    LastName        = Lname,
                    Location        = Location,
                    InterestInAll   = InterestInAll,
                    Interest        = Interest,
                    Gender          = (UserGender)Gender,
                    IsImported      = false
                };
                int status = await objCon.SaveEmailSubscriber(objUser);

                await objCon.SendMailToUser(Email);

                return(status);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public async Task <IActionResult> GetUserInterest(int SiteID)
        {
            NL_Controller objCon   = new NL_Controller();
            var           interest = await objCon.GetInterest(SiteID);

            return(new ObjectResult(interest));
        }
Example #3
0
        private void ManageNewsLetterSubscription(string email, ref int?newID)
        {
            string        clientIP      = Request.UserHostAddress.ToString();
            NL_Controller objController = new NL_Controller();

            objController.SaveEmailSubscriber(email, Int32.Parse(SageUserModuleID), GetPortalID, GetUsername, clientIP);
        }
    private void ManageNewsLetterSubscription(string email, ref int?newID)
    {
        string clientIP     = Request.UserHostAddress.ToString();
        int    userModuleID = 0;

        userModuleID = Int32.Parse(SageUserModuleID);
        //NewLetterSubscriberController.AddNewLetterSubscribers(email, clientIP, true, GetUsername, DateTime.Now, GetPortalID);
        NL_Controller nlc = new NL_Controller();

        nlc.SaveEmailSubscriber(email, userModuleID, GetPortalID, GetUsername, clientIP);
    }
 public async Task <int> UnsubscribeUser(string token, string reason)
 {
     try
     {
         NL_Controller objCon = new NL_Controller();
         return(await objCon.UnSubscribeByEmailLink(token, reason));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Example #6
0
 public async Task <IList <InterestInfo> > GetUserInterest()
 {
     try
     {
         NL_Controller objCon = new NL_Controller();
         return(await objCon.GetInterestForCampaign(GetSiteID));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Example #7
0
 public async Task <IList <AdvanceFilterInfo> > GetAdvanceFilters()
 {
     try
     {
         NL_Controller objCon = new NL_Controller();
         return(await objCon.GetAdvanceFilters(GetSiteID));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
        public async Task <IActionResult> GetAllSubscriber(string Keyword = "", int Offset = 0, int Limit = 10, int IsImported = 0, int IsSubscribed = 0)
        {
            try
            {
                NL_Controller objCon = new NL_Controller();
                var           users  = await objCon.GetAllImportUser(Keyword, Offset, Limit, IsImported, IsSubscribed);

                return(new ObjectResult(users));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public async Task <IActionResult> GetImportedUserByID(int subscriberID)
        {
            try
            {
                NL_Controller objCon = new NL_Controller();
                var           result = await objCon.GetImportedUserByID(subscriberID);

                return(new ObjectResult(result));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public async Task <IActionResult> GetAllImportUser(string searchKey, int offset, int limit, int isImported, int isSubscribed)
        {
            try
            {
                NL_Controller objCon = new NL_Controller();
                var           users  = await objCon.GetAllImportUser(searchKey, offset, limit, isImported, isSubscribed);

                return(new ObjectResult(users));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
 public async Task <int> AddUpdateSubscribeUser(NL_UserInfo objUser)
 {
     try
     {
         NL_Controller objCon = new NL_Controller();
         objUser.IsImported = true;
         objUser.AddedBy    = GetUsername;
         return(await objCon.SaveEmailSubscriber(objUser));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
        public async Task <IActionResult> GetUserInterest(int SiteID)
        {
            try
            {
                NL_Controller objCon   = new NL_Controller();
                var           interest = await objCon.GetInterest(SiteID);

                return(new ObjectResult(interest));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public async Task <int> DeleteMultImportedUser(string subscriberIDs)
        {
            try
            {
                NL_Controller objController = new NL_Controller();
                await objController.DeleteMultImportedUser(subscriberIDs);

                return(1);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public async Task <int> DeleteImportUserByID(int subscriberID)
        {
            try
            {
                NL_Controller objCon = new NL_Controller();
                await objCon.DeleteImportUserByID(subscriberID);

                return(1);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
 public void GetNLSetting(int UserModuleID, int PortalID)
 {
     try
     {
         NL_Controller         cont           = new NL_Controller();
         List <NL_SettingInfo> objSettingList = cont.GetNLSetting(UserModuleID, PortalID);
         string href   = string.Empty;
         string header = string.Empty;
         foreach (NL_SettingInfo objInfo in objSettingList)
         {
             header = "<h4>" + objInfo.ModuleDescription + "</h4>";
             href   = objInfo.UnSubscribePageName + PageExt;
         }
     }
     catch (Exception ex)
     {
         ProcessException(ex);
     }
 }
 public void GetNLSetting(int UserModuleID, int PortalID)
 {
     try
     {
         NL_Controller         cont           = new NL_Controller();
         List <NL_SettingInfo> objSettingList = cont.GetNLSetting(UserModuleID, PortalID);
         string href   = string.Empty;
         string header = string.Empty;
         foreach (NL_SettingInfo objInfo in objSettingList)
         {
             header = "<h4>" + objInfo.ModuleDescription + "</h4>";
             href   = objInfo.UnSubscribePageName + PageExt;
         }
         //moduleHeader.Text = header;
         UnSubscribe.Text = "<a id='btnUnsubscibe' href='" + href + "' class='sfUnSubscribeButton sfLocalee'>Click here to UnSubscribe</a>";
     }
     catch (Exception ex)
     {
         ProcessException(ex);
     }
 }
Example #17
0
 public void GetNLSetting(int UserModuleID, int PortalID)
 {
     try
     {
         string modulePath = this.AppRelativeTemplateSourceDirectory;
         hst = AppLocalized.getLocale(modulePath);
         NL_Controller         cont           = new NL_Controller();
         List <NL_SettingInfo> objSettingList = cont.GetNLSetting(UserModuleID, PortalID);
         string href   = string.Empty;
         string header = string.Empty;
         foreach (NL_SettingInfo objInfo in objSettingList)
         {
             header = "<h2>" + getLocale("Subscribe") + "</h2><h4>" + getLocale("Our Newsletter") + "</h4>";
             href   = objInfo.UnSubscribePageName + PageExt;
         }
         moduleHeader.Text = header;
         UnSubscribe.Text  = "<a id='btnUnsubscibe' href='" + href + "' class='sfUnSubscribeButton'>" + getLocale("Click here to UnSubscribe") + "</a>";
     }
     catch (Exception ex)
     {
         ProcessException(ex);
     }
 }
        // Import code

        private async Task <bool> SaveImportedData(DataTable data)
        {
            NL_Controller objCon  = new NL_Controller();
            NL_UserInfo   objInfo = new NL_UserInfo();

            customEmaillstInfo = new List <string>();
            string chkdgrpLst = GetSelectedGroup();
            Regex  regEmail   = new Regex(@"^\w.+@[a-zA-Z_]+?\.[a-zA-Z]{2,3}$");

            if (data != null && data.Rows.Count > 0)
            {
                int RowCount = 2;
                foreach (DataRow row in data.Rows)
                {
                    if (data.Rows.IndexOf(row) != 0)
                    {
                        Match match = regEmail.Match(row[1].ToString());
                        try
                        {
                            if (string.IsNullOrEmpty(row[1].ToString()))
                            {
                                customEmaillstInfo.Add("Empty record found in row " + RowCount);
                            }
                            //else if (match.Success)
                            //    customEmaillstInfo.Add("Invalid Email Added in row" + RowCount);
                            else if (string.IsNullOrEmpty(row[2].ToString()))
                            {
                                customEmaillstInfo.Add("Empty record found in row " + RowCount);
                            }
                            else if (string.IsNullOrEmpty(row[3].ToString()))
                            {
                                customEmaillstInfo.Add("Empty record found in row " + RowCount);
                            }
                            else if (string.IsNullOrEmpty(row[4].ToString()))
                            {
                                customEmaillstInfo.Add("Empty record found in row " + RowCount);
                            }
                            else if (string.IsNullOrEmpty(row[5].ToString()))
                            {
                                customEmaillstInfo.Add("Empty record found in row " + RowCount);
                            }
                            else if (string.IsNullOrEmpty(row[6].ToString()))
                            {
                                customEmaillstInfo.Add("Empty record found in row " + RowCount);
                            }
                            else
                            {
                                objInfo.SubscriberEmail = row[1].ToString();
                                objInfo.FirstName       = row[2].ToString();
                                objInfo.LastName        = row[3].ToString();
                                objInfo.Location        = row[5].ToString();
                                objInfo.Gender          = getGender(row[6].ToString().ToLower());
                                objInfo.IsImported      = true;
                                objInfo.ClientIP        = null;
                                if (row[4].ToString().ToLower() == "all")
                                {
                                    objInfo.InterestInAll = true;
                                    objInfo.Interest      = "";
                                }
                                else
                                {
                                    objInfo.InterestInAll = false;
                                    objInfo.Interest      = row[4].ToString().Trim();
                                }
                                objInfo.AddedBy        = GetUsername;
                                objInfo.RecipientGroup = chkdgrpLst;
                                int status = await objCon.SaveEmailSubscriber(objInfo);

                                if (status == 2)
                                {
                                    customEmaillstInfo.Add(string.Format("Email of row {0} already exists in the database.", RowCount));
                                }

                                //foreach (ListItem item in SrvrChkGrp.Items)
                                //{
                                //    if (item.Selected)
                                //        item.Selected = false;
                                //}
                                //EmailListLedger.PostedFile.InputStream.Dispose();
                            }
                        }
                        catch (Exception ex)
                        {
                            customEmaillstInfo.Add(string.Format("Error in row {0}. Error Message: {1}", RowCount, ex.Message));
                            return(false);
                        }
                        RowCount++;
                    }
                }
            }
            return(true);
        }