示例#1
0
        /// <summary>
        /// Adds a subscription to the 
        /// </summary>
        /// <param name="bus"></param>
        /// <param name="details"></param>
        /// <returns></returns>
        private IBus AddSubscription(IBus bus, SubscriberDetails details)
        {
            var typeDetails = details.GetType();

            return details.FlatMap(
                async => RegisterAsyncAction(bus, async, typeDetails),
                sync => RegisterSynchronousAction(bus, sync, typeDetails));
        }
示例#2
0
        public IActionResult SubscriberDetails(SubscriberDetails subscriberDetails)
        {
            //if (!ModelState.IsValid)
            //    return View();
            //var userName = HttpContext.Session.GetString("userName");



            var sb = subscriberDetails;

            return(View());
        }
示例#3
0
 protected override ValidationResult IsValid(object value, ValidationContext validationContext)
 {
     Claims[] claimsValue = (Claims[])value;
     if (claimsValue == null)
     {
         SubscriberDetails subscriberDetails = (SubscriberDetails)validationContext.ObjectType.GetProperty("SubscriberDetails").GetValue(validationContext.ObjectInstance);
         string            ErrorString       = string.Empty;
         if (subscriberDetails.N3 == null)
         {
             ErrorString = "N301 is Required in subscriber";
         }
         if (ErrorString == string.Empty)
         {
             return(null);
         }
         return(new ValidationResult(ErrorString));
     }
     return(null);
 }
示例#4
0
        /// <summary>
        /// Calls the generic subscribe function of EasyNetQ using the details and type given.
        /// </summary>
        /// <param name="bus"> The easyNetQ bus</param>
        /// <param name="details"> The details of the subscriber function</param>
        /// <param name="typeDetails"> The type to register against the bus</param>
        /// <returns> THe modified EastNetQ Bus</returns>
        private static IBus RegisterAsyncAction(IBus bus, SubscriberDetails details, Type typeDetails)
        {
            if (!details.IsSubscriberAsyncDetails())
            {
                throw new ArgumentException(
                    "The details parameter must be of generic type SubscriberAsyncDetails", "details");
            }

            var messageType = typeDetails.GetProperty("Type").GetValue(details, null) as Type;
            var messageAction = typeDetails.GetProperty("GetMessageHandler").GetValue(details, null);

            var method = typeof(NonGenericExtensions).GetMethod("Subscribe", new[] {typeof (IBus), 
                                                                                     typeof (Type), 
                                                                                     typeof (string), 
                                                                                     typeof (Action<object>)});
            method.Invoke(null, new[] {bus, messageType, "test", messageAction});

            return bus;
        }
示例#5
0
        //void AddNewList(string ListName, string ListDescription)
        //{
        //    string EmailDirectAPIKey = System.Configuration.ConfigurationSettings.AppSettings["ed-apikey"];
        //    ListDetails LD = ListManager.AddNewList(ListName, ListDescription, EmailDirectAPIKey);
        //    Console.WriteLine(LD.ListID.ToString() + " " + LD.Name);
        //}

        void LoadSubscribeEmailToDirectEmail()
        {
            // string ID = "";
            string emailAddress      = "";
            string FirstName         = "";
            string LastName          = "";
            string Country           = "";
            string SignUpDate        = "";
            string EmailDirectAPIKey = System.Configuration.ConfigurationSettings.AppSettings["ed-apikey"];
            bool   emailSubscribed   = false;

            string XMLRequest  = "";
            string XMLResponse = "";

            DataTable dt2 = getDataTable("GetSubscribeEmailForEmailDirect");

            if (dt2.Rows.Count > 0)
            {
                Console.WriteLine("Total Rows Found " + dt2.Rows.Count.ToString());
                foreach (DataRow _drdt2 in dt2.Rows)
                {
                    if (_drdt2["Created"].ToString() != null && _drdt2["Email"].ToString() != null)
                    {
                        emailAddress = _drdt2["Email"].ToString();
                        FirstName    = _drdt2["FirstName"].ToString();
                        LastName     = _drdt2["LastName"].ToString();
                        Country      = _drdt2["Country"].ToString();
                        SignUpDate   = _drdt2["Created"].ToString();
                    }

                    Subscriber checkSubscriber = null;
                    try
                    {
                        checkSubscriber = EDWrapper.SubscriberManager.GetSubscriber(emailAddress, EmailDirectAPIKey);
                        if (checkSubscriber == null)
                        {
                            // functions just return null if an element is not found - Brain Email Direct
                            emailSubscribed = false;
                        }
                        else if (checkSubscriber.Status == "Active")
                        {
                            emailSubscribed = true;
                        }
                        else
                        {
                            emailSubscribed = false;
                        }
                    }
                    catch (EDWrapperException ex)
                    {
                        emailSubscribed = false;
                        InsertEmailDirectLog("EmailSubscribedError", XMLRequest, XMLResponse, emailAddress);
                        Console.WriteLine("Error Code " + ex.EDError.ErrorCode + " Message " + ex.EDError.Message);
                    }


                    EDWrapper.Models.SubscriberDetails emailSubscriber = new SubscriberDetails();
                    emailSubscriber.EmailAddress = emailAddress;
                    emailSubscriber.Lists        = new List <int>()
                    {
                        20
                    };                                                // "CS Signup List" 20 LIST ID
                    emailSubscriber.Publications = new List <int>()
                    {
                        2
                    };                                                    // Publication “Linpharma, Inc. – Newsletter” (API ID: 2)
                    emailSubscriber.SourceID = Convert.ToInt32(System.Configuration.ConfigurationSettings.AppSettings["SOURCEID"]);

                    List <EDWrapper.Models.CustomField> CustomFieldLists = new List <EDWrapper.Models.CustomField>();
                    EDWrapper.Models.CustomField        cs1 = new CustomField();
                    cs1.FieldName = "FirstName";
                    cs1.Value     = FirstName;
                    CustomFieldLists.Add(cs1);
                    EDWrapper.Models.CustomField cs2 = new CustomField();
                    cs2.FieldName = "LastName";
                    cs2.Value     = LastName;
                    CustomFieldLists.Add(cs2);
                    EDWrapper.Models.CustomField cs3 = new CustomField();
                    cs3.FieldName = "Country";
                    cs3.Value     = Country;
                    CustomFieldLists.Add(cs3);

                    EDWrapper.Models.CustomField cs4 = new CustomField();
                    cs4.FieldName = "DateOfSignUp";
                    cs4.Value     = SignUpDate;
                    CustomFieldLists.Add(cs4);

                    EDWrapper.Models.CustomField cs5 = new CustomField();
                    cs5.FieldName = "CLNOClientType";
                    cs5.Value     = System.Configuration.ConfigurationSettings.AppSettings["CLNOClientType"];
                    CustomFieldLists.Add(cs5);

                    emailSubscriber.CustomFields = CustomFieldLists;

                    XMLRequest = SerializeObj <SubscriberDetails>(emailSubscriber);
                    // Console.WriteLine(XMLRequest);
                    try
                    {
                        //if (emailSubscribed == false)
                        //{
                        try
                        {
                            Subscriber newSubscriber = EDWrapper.SubscriberManager.AddSubscriber(emailSubscriber, EmailDirectAPIKey);
                            XMLResponse = SerializeObj <Subscriber>(newSubscriber);
                            Console.WriteLine(XMLResponse);
                            InsertEmailDirectLog("EmailSubscribed", XMLRequest, XMLResponse, emailAddress);
                            UpdateEmailDirectStatus_SubscribeEmailList(SignUpDate, emailAddress);
                        }
                        catch (EDWrapperException ex)
                        {
                            ErrorResult errResponse = new ErrorResult();
                            errResponse = ex.EDError;
                            XMLResponse = SerializeObj <ErrorResult>(errResponse);
                            InsertEmailDirectLog("EmailSubscribedError", XMLRequest, XMLResponse, emailAddress);
                            Console.WriteLine("Error Subscribe Adding email to EmailDirect" + emailAddress);
                        }
                        // }
                        //else
                        //{
                        //    try
                        //    {
                        //        Subscriber newSubscriber = EDWrapper.SubscriberManager.UpdateSubscriber(emailSubscriber, EmailDirectAPIKey);
                        //        XMLResponse = SerializeObj<Subscriber>(newSubscriber);
                        //        Console.WriteLine(XMLResponse);
                        //        InsertEmailDirectLog("EmailSubscribed", XMLRequest, XMLResponse, emailAddress);
                        //        UpdateEmailDirectStatus_SubscribeEmailList(SignUpDate, emailAddress);
                        //    }
                        //    catch (EDWrapperException ex)
                        //    {
                        //        ErrorResult errResponse = new ErrorResult();
                        //        errResponse = ex.EDError;
                        //        XMLResponse = SerializeObj<ErrorResult>(errResponse);
                        //        InsertEmailDirectLog("EmailSubscribedError", XMLRequest, XMLResponse, emailAddress);
                        //        Console.WriteLine("Error Subscribe Adding email to EmailDirect" + emailAddress);
                        //    }
                        //}
                        SubscriberProperties scProperty = EDWrapper.SubscriberManager.GetProperties(emailAddress);
                        Console.Write(scProperty.EmailAddress + " " + scProperty.CustomFields[1].ToString() + " " + scProperty.CustomFields[2].ToString());
                    }
                    catch (EDWrapperException ex2)
                    {
                        ErrorResult errResponse = new ErrorResult();
                        errResponse = ex2.EDError;
                        XMLResponse = SerializeObj <ErrorResult>(errResponse);
                        InsertEmailDirectLog("EmailSubscribedError", XMLRequest, XMLResponse, emailAddress);
                        Console.WriteLine("Error Subscribe Adding email to EmailDirect" + emailAddress);
                    }
                }
            }
        }
示例#6
0
        /// <summary>
        /// Calls the EasyNetQ Respond function with the type details contained in the SubscriberDetails.
        /// </summary>
        /// <param name="bus"> The EasyNetQ bus</param>
        /// <param name="details"> The subscriber details</param>
        /// <param name="typeDetails"> The </param>
        /// <returns></returns>
        private static IBus RegisterSynchronousAction(IBus bus, SubscriberDetails details, Type typeDetails)
        {
            if (details.IsSubscriberAsyncDetails())
            {
                throw new ArgumentException(
                    "The details parameter must be of generic type SubscriberSyncronousDetails", "details");
            }

            var requestType = typeDetails.GetProperty("GetRequestType").GetValue(details, null) as Type;
            var responseType = typeDetails.GetProperty("GetResponseType").GetValue(details, null) as Type;
            var messageAction = typeDetails.GetProperty("GetMessageHandler").GetValue(details, null);

            var method = new Func<Func<object, object>, IDisposable>(bus.Respond);
            var methodInfo = method.Method.GetGenericMethodDefinition().MakeGenericMethod(requestType, responseType);

            methodInfo.Invoke(bus, new[] {messageAction});

            return bus;
        }
示例#7
0
        private void buttonValidate_Click(object sender, EventArgs e)
        {
            GroupClient             generalService = new GroupClient("ReportWSServiceHttpEndpoint2");
            WSCarrierLookupResponse wSCarrierLookupResponse;
            string securityToken;
            string orgCode = "wt63419";



            // Moses Newman 06/01/2020 replace with SBTNonValid
            //CUSTOMERTableAdapter.FillByActiveDayDue(IACData.CUSTOMER, 0, false, true);
            CUSTOMERTableAdapter.FillBySBTNonValidDefi(IACData.CUSTOMER);

            progressBar1.Minimum = 0;
            progressBar1.Maximum = IACData.CUSTOMER.Rows.Count;

            for (Int32 i = 0; i < IACData.CUSTOMER.Rows.Count; i++)
            {
                labelStatus.Text = "Working on customer " + IACData.CUSTOMER.Rows[i].Field <String>("CUSTOMER_NO") + " " + i.ToString().TrimStart() + " of " + (IACData.CUSTOMER.Rows.Count - 1).ToString().TrimStart();
                labelStatus.Refresh();
                // Moses Newman 07/21/2020 Only Force Validate people who have not opted out
                string[] phone = IACData.CUSTOMER.Rows[i].Field <String>("CUSTOMER_CELL_PHONE").Split(',');
                if (GetSubscriberStatus(phone[0]) != "Inactive" && phone[0] != "")
                {
                    securityToken = sbtLogin();

                    wSCarrierLookupResponse = generalService.GetCarrierLookup(securityToken, phone, orgCode);

                    if (!wSCarrierLookupResponse.Result)
                    {
                        MakeComment("*** Failed to VALIDATE cell phone number! ***", wSCarrierLookupResponse.Message, i);
                        IACData.CUSTOMER.Rows[i].SetField <Boolean>("CellValid", false);
                    }
                    else
                    {
                        if (wSCarrierLookupResponse.Result && !wSCarrierLookupResponse.Response[0].Landline)
                        {
                            string        VBTError = "", gsVBTPin = "";
                            MessageClient messageResult = new MessageClient("MessageWSServiceHttpEndpoint");
                            securityToken = sbtLogin();
                            string phoneNo = phone[0];

                            WSVerificationResponse wSVerificationResponse = messageResult.RequestVBT(securityToken, orgCode, phoneNo);
                            if (!wSVerificationResponse.Result)
                            {
                                gsVBTPin = "";

                                VBTError = wSVerificationResponse.Message;
                                if (VBTError.TrimEnd() != "Subscriber information already exists")
                                {
                                    IACData.CUSTOMER.Rows[i].SetField <Boolean>("TAcct", false);
                                    MakeComment("*** VBT PIN NOT CREATED! ***", VBTError, i);
                                    MessageBox.Show(VBTError);
                                }
                            }
                            else
                            {
                                gsVBTPin = "AUTO";
                                IACData.CUSTOMER.Rows[i].SetField <Boolean>("DNTAcct", false);
                                IACData.CUSTOMER.Rows[i].SetField <Boolean>("TAcct", true);
                                MakeComment("VBT AUTO CREATED.", wSVerificationResponse.Message, i);
                            }

                            if (gsVBTPin == "AUTO")
                            {
                                SubscriberClient subscriberService = new SubscriberClient("SubscriberWSServiceHttpEndpoint");



                                SubscriberInfo    subscriber = new SubscriberInfo();
                                SubscriberDetails subdetails = new SubscriberDetails();

                                subscriber.MobilePhone = IACData.CUSTOMER.Rows[i].Field <String>("CUSTOMER_CELL_PHONE");

                                subscriber.FName = IACData.CUSTOMER.Rows[i].Field <String>("CUSTOMER_FIRST_NAME");
                                subscriber.LName = IACData.CUSTOMER.Rows[i].Field <String>("CUSTOMER_LAST_NAME");
                                EmailTableAdapter.Fill(IACData.Email, IACData.CUSTOMER.Rows[i].Field <String>("CUSTOMER_NO"));
                                subscriber.Email        = IACData.Email.Rows[0].Field <String>("EmailAddress");
                                subscriber.City         = IACData.CUSTOMER.Rows[i].Field <String>("CUSTOMER_CITY");
                                subscriber.Street       = IACData.CUSTOMER.Rows[i].Field <String>("CUSTOMER_STREET_1");
                                subscriber.Street2      = IACData.CUSTOMER.Rows[i].Field <String>("CUSTOMER_STREET_2");
                                subscriber.ZipCode      = IACData.CUSTOMER.Rows[i].Field <String>("CUSTOMER_ZIP_1") + IACData.CUSTOMER.Rows[i].Field <String>("CUSTOMER_ZIP_2");
                                subscriber.CustomField1 = "";
                                subscriber.CustomField2 = "";
                                subscriber.CustomField3 = "";
                                subscriber.PrivateCode  = IACData.CUSTOMER.Rows[i].Field <String>("CUSTOMER_PURCHASE_ORDER");
                                subscriber.UniqueID     = IACData.CUSTOMER.Rows[i].Field <String>("CUSTOMER_NO");


                                securityToken = sbtLogin();
                                WSSubscriberResponse wSSubscriberResponse = subscriberService.UpdateSubscriber(securityToken, subscriber);

                                if (!wSSubscriberResponse.Result)
                                {
                                    MakeComment("*** SBT SUBSCRIBER FIELDS UPDATE FAILED! ***", wSSubscriberResponse.Message, i);
                                    MessageBox.Show(wSSubscriberResponse.Message);
                                }
                                else
                                {
                                    MakeComment("SBT SUBSCRIBER FIELDS UPDATED.", wSSubscriberResponse.Message, i);
                                }

                                MakeComment("Cell Phone Number VALIDATED. AUTO VBT", wSCarrierLookupResponse.Message, i);
                                IACData.CUSTOMER.Rows[i].SetField <Boolean>("CellValid", true);
                                IACData.CUSTOMER.Rows[i].SetField <Boolean>("DNTAcct", false);
                                IACData.CUSTOMER.Rows[i].SetField <Boolean>("TAcct", true);
                                IACData.CUSTOMER.Rows[i].SetField <Boolean>("TConfirmed", true);
                                IACData.CUSTOMER.Rows[i].SetField <String>("TPin", "AUTO");
                            }
                        }
                        else
                        {
                            MakeComment("*** Cell Phone Number will not VALIDATE because it is a LANDLINE! ***", wSCarrierLookupResponse.Message, i);
                            IACData.CUSTOMER.Rows[i].SetField <Boolean>("CellValid", false);
                        }
                    }
                    CUSTOMERTableAdapter.Update(IACData.CUSTOMER.Rows[i]);
                }
                progressBar1.Value = i;
            }
            MessageBox.Show("*** Completed cell phone validation! ***", "Validate Cell Phones", MessageBoxButtons.OK);
        }
 private bool IsFromFollowedArtistOrLabel(Record record, SubscriberDetails subscriber)
 {
     return(subscriber.FollowedArtists.Contains(record.ArtistId) || subscriber.FollowedLabels.Contains(record.LabelId));
 }
 public IEnumerable <RecordDetails> LatestByFavorites(SubscriberDetails subscriber)
 {
     return(_set
            .Where(r => IsFromLastSevenDays(r) && IsFromFollowedArtistOrLabel(r, subscriber))
            .Select(_mapper.Map <RecordDetails>));
 }