private void AddReferralInterests(IdTypeList referralInterestIds)
 {
     foreach (IdType id in referralInterestIds)
     {
         AddReferralInterest(id);
     }
 }
示例#2
0
 private void GenerateIdTypeData()
 {
     IdTypeList.Add("");
     IdTypeList.Add("Driving License");
     IdTypeList.Add("Identity Card");
     IdTypeList.Add("Signature");
 }
        public static Referral Create(ReferralData data, IdTypeList referralInterestIds)
        {
            Referral referral = new Referral();

            data.ReferralDate = DateTimeType.Now;
            UpdateGeocode(data);
            referral.Update(data);
            try {
                referral.AddReferralInterests(referralInterestIds);
                if (referral.ReferDemonstrator)
                {
                    IdType id       = IdType.UNSET;
                    bool   recycled = referral.FindReferral(ref id);
                    referral.DirectSalesAgentId = id;
                    if (referral.directSalesAgentId.IsValid)
                    {
                        if (!recycled)
                        {
                            ((Demonstrator)referral.DirectSalesAgent).UpdateReferralCount();
                        }
                        referral.SendReferralEmailToProspect();
                    }
                }

                if (referral.DirectSalesAgentId.IsValid)
                {
                    referral.SendDemonstratorNotification();
                }
            } catch (Exception ex) {
                log.Error(ex);
                throw;
            }


            referral.Store();
            return(referral);
        }