Example #1
0
        public void Add <T>(T data) where T : Wrapper, new()
        {
            var typeParameterType = typeof(T);

            try
            {
                if (data == null)
                {
                    throw new ArgumentNullException("data");
                }

                if (!IsIndexAvailable())
                {
                    return;
                }

                FactoryIndexer <T> .Index(data);

                Log.InfoFormat("IndexEngine->Add<{0}>(mail Id = {1}) success", typeParameterType, data == null ? -1 : data.Id);
            }
            catch (Exception ex)
            {
                Log.ErrorFormat("IndexEngine->Add<{0}>(mail Id = {1}) error: {2}", typeParameterType, data == null ? -1 : data.Id, ex.ToString());
            }
        }
Example #2
0
        private Task CreateTask(string title, string description)
        {
            var newTask = GenerateTask();

            newTask.Title       = title;
            newTask.Description = description;

            SaveOrUpdate(newTask);

            FactoryIndexer <TasksWrapper> .Index(newTask);

            return(newTask);
        }
Example #3
0
        private Project CreateProject(string title, string description)
        {
            var newProject = GenerateProject(SecurityContext.CurrentAccount.ID);

            newProject.Title       = title;
            newProject.Description = description;

            SaveOrUpdate(newProject);

            FactoryIndexer <ProjectsWrapper> .Index(newProject);

            return(newProject);
        }
        public int Save(ContactInfo contactInfo)
        {
            var id = SaveInDb(contactInfo);

            contactInfo.ID = id;

            FactoryIndexer <InfoWrapper> .IndexAsync(contactInfo);

            if (contactInfo.InfoType == ContactInfoType.Email)
            {
                FactoryIndexer <EmailWrapper> .Index(new EmailWrapper
                {
                    Id               = contactInfo.ContactID,
                    TenantId         = TenantID,
                    EmailInfoWrapper = new List <EmailInfoWrapper>
                    {
                        contactInfo
                    }
                });
            }

            return(id);
        }