示例#1
0
        protected override void SetId(string id, BaseRoot value)
        {
            if (!value.MappingFields.Exists(e => ZohoEvent.Filter(e.Entity) && e.Field.Equals("CONTACTID")))
            {
                value.MappingFields.Add(new MappingFields {
                    Entity = "Event", Field = "CONTACTID", Value = id
                });
            }

            if (!value.MappingFields.Exists(e => ZohoAccount.Filter(e.Entity) && e.Field.Equals("CONTACTID")))
            {
                value.MappingFields.Add(new MappingFields {
                    Entity = "Account", Field = "CONTACTID", Value = id
                });
            }

            if (!value.MappingFields.Exists(e => ZohoPotential.Filter(e.Entity) && e.Field.Equals("CONTACTID")))
            {
                value.MappingFields.Add(new MappingFields {
                    Entity = "Potential", Field = "CONTACTID", Value = id
                });
            }

            if (!value.MappingFields.Exists(e => ZohoEvent.Filter(e.Entity) && e.Field.Equals("Participants")))
            {
                value.MappingFields.Add(new MappingFields {
                    Entity = "Event", Field = "Participants", Value = "<Participant><FL val=\"CONTACTID\">{0}</FL></Participant>"
                });
            }

            SetParticipants(id, value);
        }
示例#2
0
 protected override void SetId(string id, BaseRoot value)
 {
     if (!value.MappingFields.Exists(e => ZohoEvent.Filter(e.Entity) && e.Field.Equals("ACCOUNTID")))
     {
         value.MappingFields.Add(new MappingFields {
             Entity = ZohoEvent.ENTITY, Field = "ACCOUNTID", Value = id
         });
     }
     if (!value.MappingFields.Exists(e => ZohoPotential.Filter(e.Entity) && e.Field.Equals("ACCOUNTID")))
     {
         value.MappingFields.Add(new MappingFields {
             Entity = ZohoPotential.ENTITY, Field = "ACCOUNTID", Value = id
         });
     }
 }
示例#3
0
        public bool Execute(ScheduleRoot schedule, List <MappingFields> mapping)
        {
            Predicate <MappingFields> filterName = m => m.Field.Equals(FIELD_NAME);
            var potentialName = mapping.Where(w => filterName(w)).First().Value;

            LeadRoot lead = new LeadRoot {
                Lead = schedule.Lead, Authentication = schedule.Authentication, MappingFields = mapping
            };

            SendRequestSearch(lead, GetEntityName(), FIELD_SELECT, FIELD_SEARCH, potentialName, GetResponseSearch);

            if (Execute(lead, mapping.Where(w => FilterEntity(w.Entity)).ToList()))
            {
                if (!schedule.MappingFields.Exists(e => ZohoEvent.Filter(e.Entity) && e.Field.Equals("SEMODULE")))
                {
                    lead.MappingFields.Where(w => ZohoEvent.Filter(w.Entity)).ToList().ForEach(f => { schedule.MappingFields.Add(f); });
                }
                return(true);
            }
            return(false);
        }
示例#4
0
        public bool Execute(ScheduleRoot schedule, List <MappingFields> mapping)
        {
            if (base.Execute(schedule))
            {
                AccountRoot account = GetAccount(schedule);
                if (!string.IsNullOrEmpty(schedule.Lead.Id))
                {
                    SendRequestGetRecord(account, ZohoPotential.ENTITY_NAME, schedule.Lead.Id, GetIdByRecord);
                }

                if (Execute(account, account.MappingFields.Where(w => FilterEntity(w.Entity)).ToList()))
                {
                    schedule.Account = new Account {
                        Id = account.Id
                    };
                    account.MappingFields.Where(w => ZohoEvent.Filter(w.Entity)).ToList().ForEach(f => { schedule.MappingFields.Add(f); });
                    account.MappingFields.Where(w => ZohoPotential.Filter(w.Entity)).ToList().ForEach(f => { schedule.MappingFields.Add(f); });
                    return(true);
                }
            }
            return(false);
        }
示例#5
0
        public bool Execute(ScheduleRoot schedule, Contact contact, List <MappingFields> mapping, int index = 0)
        {
            Predicate <MappingFields> filterEmail = m => m.Field.Equals(FIELD_EMAIL) && m.Id == index;
            var email = mapping.Where(w => filterEmail(w)).First().Value;

            if (schedule.MappingFields.Exists(e => ZohoPotential.Filter(e.Entity) && e.Field.Equals(ACCOUNT_ID)))
            {
                string accountId = schedule.MappingFields.Where(w => ZohoPotential.Filter(w.Entity) && w.Field.Equals(ACCOUNT_ID)).First().Value;
                mapping.Add(new MappingFields {
                    Entity = ENTITY, Field = ACCOUNT_ID, Id = index, Value = accountId
                });
            }

            ContactRoot contactRoot = new ContactRoot {
                Authentication = schedule.Authentication, Contact = contact, MappingFields = schedule.MappingFields
            };

            SendRequestSearch(contactRoot, GetEntityName(), FIELD_SELECT, FIELD_SEARCH, email, GetResponseSearch);

            if (Execute(contactRoot, mapping, index))
            {
                Predicate <string> filter = s => ZohoEvent.Filter(s) || ZohoPotential.Filter(s) || ZohoAccount.Filter(s);

                if (!schedule.MappingFields.Exists(e => filter(e.Entity) && e.Field.Equals("CONTACTID")))
                {
                    contactRoot.MappingFields.Where(e => filter(e.Entity) && e.Field.Equals("CONTACTID")).ToList().ForEach(f => schedule.MappingFields.Add(f));
                }

                if (!schedule.MappingFields.Exists(e => ZohoEvent.Filter(e.Entity) && e.Field.Equals("Participants")))
                {
                    contactRoot.MappingFields.Where(e => ZohoEvent.Filter(e.Entity) && e.Field.Equals("Participants")).ToList().ForEach(f => schedule.MappingFields.Add(f));
                }

                return(true);
            }
            return(false);
        }