Ejemplo n.º 1
0
 internal async Task <int> AddMailByApp(MassMailAddInfo objMassMail, string username, string appName)
 {
     try
     {
         List <SQLParam> Param = new List <SQLParam>
         {
             new SQLParam("@MessageTitle", objMassMail.MessageTitle),
             new SQLParam("@Gender", objMassMail.Gender),
             new SQLParam("@ToAllGender", objMassMail.ToAllGender),
             new SQLParam("@Interests", objMassMail.Interests),
             new SQLParam("@Subject", objMassMail.Subject),
             new SQLParam("@MessageBody", objMassMail.MessageBody),
             new SQLParam("@IsInstant", objMassMail.IsInstant),
             new SQLParam("@ScheduledOn", objMassMail.UTCScheduled),
             new SQLParam("@TimeZoneOffset", objMassMail.TimeZoneOffset),
             new SQLParam("@Username", username),
             new SQLParam("@AppName", appName)
         };
         SQLExecuteNonQueryAsync objHandler = new SQLExecuteNonQueryAsync();
         return(await objHandler.ExecuteNonQueryAsync("[dbo].[usp_Wb_MassMail_AddMail_ByApp]", Param, "@output"));
     }
     catch
     {
         throw;
     }
 }
Ejemplo n.º 2
0
        internal async Task <OperationStatus> AddUpdateMassMail(MassMailAddInfo objMassMail, string username)
        {
            try
            {
                List <SQLParam> param = new List <SQLParam>
                {
                    new SQLParam("@MassMailID", objMassMail.MassMailID),
                    new SQLParam("@MessageMailTitle", objMassMail.MessageTitle),
                    new SQLParam("@IsRole", objMassMail.IsRolesUsers),
                    new SQLParam("@IsCustom", objMassMail.IsCustomMailList),
                    new SQLParam("@CustomRecipientGroup", objMassMail.CustomRecipientGroup),
                    new SQLParam("@IsSubscribe", objMassMail.IsSubscribeUser),
                    new SQLParam("@HasTarget", objMassMail.HasTargetUserInterest),
                    new SQLParam("@Gender", objMassMail.Gender),
                    new SQLParam("@ToAllGender", objMassMail.ToAllGender),
                    new SQLParam("@Roles", objMassMail.Roles),
                    new SQLParam("@Interests", objMassMail.Interests),
                    new SQLParam("@AdvanceFilters", objMassMail.AdvanceFilters),
                    new SQLParam("@AdditionalUser", objMassMail.AdditionalUser),
                    new SQLParam("@Subject", objMassMail.Subject),
                    new SQLParam("@MessageBody", objMassMail.MessageBody),
                    new SQLParam("@MessageEditDOM", objMassMail.MessageEditDOM),
                    new SQLParam("@IsInstant", objMassMail.IsInstant),
                    new SQLParam("@ScheduledOn", objMassMail.UTCScheduled),
                    new SQLParam("@TimeZoneOffset", objMassMail.TimeZoneOffset),
                    new SQLParam("@Username", username)
                };
                SQLExecuteNonQueryAsync handler = new SQLExecuteNonQueryAsync();
                int result = await handler.ExecuteNonQueryAsync("[dbo].[usp_Wb_massMail_AddUpdateMassMail]", param, "@output");

                if (result == (int)StatusCode.Created)
                {
                    return(new OperationStatus {
                        IsSuccess = true, Message = "Mass mail created successfully.", StatusCode = StatusCode.Created, Result = result
                    });
                }
                else if (result == (int)StatusCode.Updated || result == 2)
                {
                    return(new OperationStatus {
                        IsSuccess = true, Message = "Mass mail updated successfully.", StatusCode = StatusCode.Updated, Result = result
                    });
                }
                return(new OperationStatus {
                    IsSuccess = false, Message = "Something went wrong.", StatusCode = StatusCode.ServerError, Result = result
                });
            }
            catch
            {
                throw;
            }
        }
Ejemplo n.º 3
0
        public async Task <OperationStatus> AddUpdateMassMail(MassMailAddInfo objMassMail, string username, string HostURL)
        {
            MassMailProvider objProvider = new MassMailProvider();

            if (objMassMail.IsInstant)
            {
                DateTime CurrentDate = DateTime.UtcNow.ToLocalTime();
                objMassMail.ScheduledOn    = CurrentDate.ToString();
                objMassMail.TimeZoneOffset = TimeZone.CurrentTimeZone.GetUtcOffset(CurrentDate).ToString();
            }
            OperationStatus status = await objProvider.AddUpdateMassMail(objMassMail, username);

            if ((int)status.Result > 0)
            {
                this.CallMailGateway(objMassMail.UTCScheduled, objMassMail.IsInstant, HostURL);
            }
            return(status);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Send email to subscribe users with interest and gender filter. All system token will be replaced by real value. Replace your app token before call it.This Mail is saved in massmail table.
        /// </summary>
        /// <param name="Subject">Email Subject</param>
        /// <param name="Body">Email Body Get From Mail Template with replaced tokens</param>
        /// <param name="UserName">Current System User</param>
        /// <param name="AudienceInterests">Email target audience interest(Category). eg sports,technology etc</param>
        /// <param name="TargetGender">(eg 0,1,2) 0-Male 1-Female 2-Others</param>
        /// <param name="ToAllGender">Send to all user whose gender is either specified or not.</param>
        /// <param name="AppName">Caller App name (eg Blog,e-Commerce).</param>
        /// <returns></returns>
        public async Task <int> SendMailToSubscribeUser(string Subject, string Body, string UserName, string AudienceInterests, string TargetGender, bool ToAllGender, string AppName, string HostURL)
        {
            MassMailAddInfo  objMassMail = new MassMailAddInfo();
            MassMailProvider objProvider = new MassMailProvider();

            objMassMail.MessageTitle = Subject;
            objMassMail.Gender       = TargetGender;
            objMassMail.Interests    = AudienceInterests;
            objMassMail.Subject      = Subject;
            objMassMail.MessageBody  = Body;
            objMassMail.IsInstant    = true;
            objMassMail.ToAllGender  = ToAllGender;
            DateTime CurrentDate = DateTime.UtcNow.ToLocalTime();

            objMassMail.TimeZoneOffset = TimeZone.CurrentTimeZone.GetUtcOffset(CurrentDate).ToString();
            objMassMail.ScheduledOn    = CurrentDate.ToString();
            int status = await objProvider.AddMailByApp(objMassMail, UserName, AppName);

            if (status > 0)
            {
                this.CallMailGateway(objMassMail.UTCScheduled, objMassMail.IsInstant, HostURL);
            }
            return(status);
        }