예제 #1
0
        public object Map(COMPTEMP row)
        {
            var site = new Site
            {
                Key = row.KEY,
                Unit = row.UNIT,
                Number = row.NUMBER,
                Street = row.STREET,
                Suburb = row.SUBURB,
                State = row.STATE,
                Postcode = row.P_CODE,
                Name = row.COMPANY,
                BuildingName = row.BUILD_ID,
                //PropertyManagerName = row.AGENT_COMP,
                PropertyManaged = row.MANBYAGENT,
                PMSite = row.PM_SITE,
                Phone = row.PHONE,
                InHouse = row.IN_HOUSE,
                Size = Configuration.MigrationSizeConverter.Convert(row.SALES_REP),
                TsToCall = row.TSTOCALL,
                Qualification = row.QUALI_NO,
                CleaningContract = MapCleaningContract(row),
                SecurityContract = MapSecurityContract(row),
                Contacts = new Collection<Contact>(),
                ContactPersons = new Collection<ContactPerson>(),
                Groups = new Collection<SiteGroup>()
            };

            return site;
        }
예제 #2
0
        public override ScriptActionResult Update(Site site, Contact contact, LeadPersonal person, Telesale telesale)
        {
            if (contact == null || contact.ContactPerson == null)
                return ScriptActionResult.InCompeleted;

            contact.ContactPerson.Email = Email;
            return ScriptActionResult.Completed;
        }
예제 #3
0
 public override ScriptActionResult Update(Site site, Contact contact, LeadPersonal person, Telesale telesale)
 {
     LeadAssembler.Contact = contact;
     LeadAssembler.LeadPersonal = person;
     LeadAssembler.Telesale = telesale;
     contact.Leads.Add(LeadAssembler.Assemble(BusinessTypes.Cleaning));
     return ScriptActionResult.Completed | ScriptActionResult.EmailRequired;
 }
예제 #4
0
        public override ScriptActionResult Update(Site site, Contact contact, LeadPersonal person, Telesale telesale)
        {
            if (contact == null || contact.Site == null)
                return ScriptActionResult.InCompeleted;

            contact.Site.Qualification = Number;
            return ScriptActionResult.Completed;
        }
예제 #5
0
        public override ScriptActionResult Update(Site site, Contact contact, LeadPersonal person, Telesale telesale)
        {
            if (contact.CallLines == null)
                return ScriptActionResult.InCompeleted;

            var callLine = contact.CallLines.Last();
            callLine.EmailInfo = true;
            return ScriptActionResult.Completed;
        }
예제 #6
0
        public override ScriptActionResult Update(Site site, Contact contact, LeadPersonal person, Telesale telesale)
        {
            if (contact == null || !contact.CallFrequency.HasValue)
                return ScriptActionResult.InCompeleted;

            if (UpdateInMonth)
                contact.NextCall = DateTime.Today.AddMonths(contact.CallFrequency.Value);
            else
                contact.NextCall = DateTime.Today.AddDays(3*7);

            return ScriptActionResult.Completed;
        }
예제 #7
0
        public override ScriptActionResult Update(Site site, Contact contact, LeadPersonal person, Telesale telesale)
        {
            if (string.IsNullOrEmpty(Firstname) && string.IsNullOrEmpty(Lastname))
                return ScriptActionResult.InCompeleted;

            if (contact == null || contact.ContactPerson == null)
                return ScriptActionResult.InCompeleted;

            contact.ContactPerson.Firstname = Firstname;
            contact.ContactPerson.Lastname = Lastname;
            return ScriptActionResult.Completed;
        }
예제 #8
0
        private void MatchTenantInfo(Site tenant, string tenantInfo, string state)
        {
            string phone = "", name = "";
            var success = MatchTenantInfo(tenantInfo, PhoneCodeRegex(state.ToUpper()), ref phone, ref name);

            if (!success)
                success = MatchTenantInfo(tenantInfo, MobileCodeRegiex(), ref phone, ref name);

            if (success)
            {
                tenant.Phone = phone;
                tenant.Name = name;
            }
        }
예제 #9
0
        public override ScriptActionResult Update(Site site, Contact contact, LeadPersonal person, Telesale telesale)
        {
            var group = contact.Site.Groups.SingleOrDefault(x => x.Type == "Building");
            if (group == null)
                throw new Exception("No property manager building found for this site");

            throw new NotImplementedException();
            //todo need to re-do on this
            /*if (!string.IsNullOrEmpty(Firstname) || !string.IsNullOrEmpty(Lastname))
            {
                group.Firstname = Firstname;
                group.Lastname = Lastname;
            }

            if (!string.IsNullOrEmpty(Phone))
                group.Phone = Phone;

            if (!string.IsNullOrEmpty(Company))
                group.AgentComp = Company;*/
        }
예제 #10
0
        public override ScriptActionResult Update(Site site, Contact contact, LeadPersonal person, Telesale telesale)
        {
            Lead lead;

            LeadAssembler.Contact = contact;
            LeadAssembler.LeadPersonal = person;
            LeadAssembler.Telesale = telesale;

            switch (Type)
            {
                case ScriptActionType.CreateMaintenanceLead:
                    lead = LeadAssembler.Assemble(BusinessTypes.Maintenance);
                    break;
                default:
                    lead = LeadAssembler.Assemble(BusinessTypes.Cleaning);
                    break;
            }

            contact.Leads.Add(lead);

            return ScriptActionResult.Completed | ScriptActionResult.EmailRequired;
        }
예제 #11
0
        public override ScriptActionResult Update(Site site, Contact contact, LeadPersonal person, Telesale telesale)
        {
            if (site == null)
                throw new Exception("This site cant not be changed to OPR, please contact DB admin");

            if (site.Contacts.Any(x=>x.Code == "OPR"))
                throw new Exception("Not a valid tenant, the site already has an OPR contact");

            site.PropertyManaged = false;
            site.TsToCall = true;
            site.Size = Size.Size025.ToString();

            contact.DaToCheck = true;
            contact.DaToCheckInfo = "Need new tenant for PMS";

            site.Contacts.Add(new Contact
            {
                SiteId = site.Id,
                BusinessTypeId = (int)BusinessTypes.Cleaning,
                LastCall = DateTime.Today,
                NextCall = DateTime.Today.AddDays(contact.CallFrequency.GetValueOrDefault() * 7),
                Code = "OPR",
                CallFrequency = 3,
                ContactPerson = new ContactPerson
                {
                    SiteId = site.Id,
                    Lastname = Lastname,
                    Firstname = Firstname,
                    DirectLine = Phone,
                    Mobile = Mobile,
                    CreateDate = DateTime.Today
                }
            });

            return ScriptActionResult.Completed;
        }
예제 #12
0
 public override ScriptActionResult Update(Site site, Contact contact, LeadPersonal person, Telesale telesale)
 {
     contact.DaToCheck = true;
     contact.DaToCheckInfo = InfoForDa;
     return ScriptActionResult.Completed;
 }
예제 #13
0
        private static bool MatchTenantWithRegex(Site site, string target, string regex)
        {
            var regexMatch = Regex.Match(target, regex, RegexOptions.IgnoreCase);

            if (regexMatch.Success)
            {
                var matched = regexMatch.Groups[regexMatch.Groups.Count - 1].Value;
                if (matched.Length > 15)
                    site.Phone = matched.Substring(0, 15);
                else
                    site.Phone = matched;

                site.Name = Regex.Replace(target, regex, "");
            }
            else
            {
                site.Name = target;
            }

            return regexMatch.Success;
        }
예제 #14
0
        private static Site CopyTenantInfo(COMPTEMP origin, string tenant)
        {
            var phoneCode = Migration.PhoneCodes[origin.STATE];

            var site = new Site
            {
                Key = Migration.NextTenantKey(),
                Number = origin.NUMBER,
                Street = origin.STREET,
                Suburb = origin.SUBURB,
                State = origin.STATE,
                Postcode = origin.P_CODE,
                BuildingName = origin.BUILD_ID,
                PropertyManaged = true,
            };

            var regex = string.Format(@"\(?{0}\)?\s*\d{{4,8}}?\s*\d{{4,8}}?", phoneCode);
            if (!MatchTenantWithRegex(site, tenant, regex))
            {
                regex = string.Format(@"{0}\d{{2,2}}\s?\d{{3,3}}\s?\d{{3,3}}", Migration.PhoneCodes["Mobile"]);
                MatchTenantWithRegex(site, tenant, regex);
            }

            return site;
        }
예제 #15
0
 public override ScriptActionResult Update(Site site, Contact contact, LeadPersonal person, Telesale telesale)
 {
     contact.CallBackDate = CallbackDate;
     return ScriptActionResult.Completed;
 }
예제 #16
0
 public abstract ScriptActionResult Update(Site site, Contact contact, LeadPersonal person, Telesale telesale);