Example #1
0
 public Dictionary <string, int> SearchIndexHash(Context context, SiteSettings ss)
 {
     if (AccessStatus != Databases.AccessStatuses.Selected)
     {
         return(null);
     }
     else
     {
         var searchIndexHash = new Dictionary <string, int>();
         SiteInfo.TenantCaches.Get(context.TenantId)?
         .SiteMenu
         .Breadcrumb(context: context, siteId: SiteId)
         .SearchIndexes(context, searchIndexHash, 100);
         SiteId.SearchIndexes(context, searchIndexHash, 200);
         UpdatedTime.SearchIndexes(context, searchIndexHash, 200);
         WikiId.SearchIndexes(context, searchIndexHash, 1);
         Title.SearchIndexes(context, searchIndexHash, 4);
         Body.SearchIndexes(context, searchIndexHash, 200);
         Comments.SearchIndexes(context, searchIndexHash, 200);
         Creator.SearchIndexes(context, searchIndexHash, 100);
         Updator.SearchIndexes(context, searchIndexHash, 100);
         CreatedTime.SearchIndexes(context, searchIndexHash, 200);
         SearchIndexExtensions.OutgoingMailsSearchIndexes(
             context: context,
             searchIndexHash: searchIndexHash,
             referenceType: "Wikis",
             referenceId: WikiId);
         return(searchIndexHash);
     }
 }
 public Dictionary <string, int> SearchIndexHash(SiteSettings ss)
 {
     if (AccessStatus != Databases.AccessStatuses.Selected)
     {
         return(null);
     }
     else
     {
         var searchIndexHash = new Dictionary <string, int>();
         SiteInfo.TenantCaches[Sessions.TenantId()]
         .SiteMenu.Breadcrumb(SiteId).SearchIndexes(searchIndexHash, 100);
         SiteId.SearchIndexes(searchIndexHash, 200);
         UpdatedTime.SearchIndexes(searchIndexHash, 200);
         WikiId.SearchIndexes(searchIndexHash, 1);
         Title.SearchIndexes(searchIndexHash, 4);
         Body.SearchIndexes(searchIndexHash, 200);
         Comments.SearchIndexes(searchIndexHash, 200);
         Creator.SearchIndexes(searchIndexHash, 100);
         Updator.SearchIndexes(searchIndexHash, 100);
         CreatedTime.SearchIndexes(searchIndexHash, 200);
         SearchIndexExtensions.OutgoingMailsSearchIndexes(
             searchIndexHash, "Wikis", WikiId);
         return(searchIndexHash);
     }
 }
Example #3
0
 public UpdateObject(string collection, Updator updator,
                     ITreePredicate filterPredicate)
 {
     _collection      = collection;
     _updator         = updator;
     _filterPredicate = filterPredicate;
 }
Example #4
0
        public NativeInterface(Jvm jvm)
        {
            this.jvm      = jvm;
            updateVisitor = new Updator();
            sensorObjects = new Dictionary <IntPtr, ISensor>();

            computer = new Computer();
            computer.FanControllerEnabled = true;
            computer.CPUEnabled           = true;
            computer.GPUEnabled           = true;
            computer.HDDEnabled           = true;
            computer.MainboardEnabled     = true;
            computer.RAMEnabled           = true;
            computer.Open();

            // Update/fetch and add sensors
            UpdateSensors();

            addSensorsDelegate   = (NativeCallbackDelegates.NativeAddSensors)NativeAddSensors;
            updateNativeDelegate = (NativeCallbackDelegates.UpdateNative)UpdateNative;

            GC.KeepAlive(addSensorsDelegate);
            GC.KeepAlive(updateNativeDelegate);

            methods = new NativeJavaMethod[]
            {
                NativeJavaMethod.DescribeNativeVoidMethod(NATIVE_ADD_SENSORS_FUNCTION, addSensorsDelegate),
                NativeJavaMethod.DescribeNativeVoidMethod(NATIVE_UPDATE_SENSORS_FUNCTION, updateNativeDelegate)
            };

            jvm.RegisterNatives(NATIVE_CLASS_PATH, methods);
        }
Example #5
0
        static void Main()
        {
            Updator u = new Updator();

            u.Do();
            Console.WriteLine("Finished...\n\nStarting application...");
            u.StartApp();
        }
Example #6
0
        private string NoticeBody(
            Context context, SiteSettings ss, Notification notification, bool update = false)
        {
            var body = new System.Text.StringBuilder();

            notification.ColumnCollection(context, ss, update)?.ForEach(column =>
            {
                switch (column.Name)
                {
                case "Title":
                    body.Append(Title.ToNotice(
                                    context: context,
                                    saved: SavedTitle,
                                    column: column,
                                    updated: Title_Updated(context: context),
                                    update: update));
                    break;

                case "Body":
                    body.Append(Body.ToNotice(
                                    context: context,
                                    saved: SavedBody,
                                    column: column,
                                    updated: Body_Updated(context: context),
                                    update: update));
                    break;

                case "Comments":
                    body.Append(Comments.ToNotice(
                                    context: context,
                                    saved: SavedComments,
                                    column: column,
                                    updated: Comments_Updated(context: context),
                                    update: update));
                    break;

                case "Creator":
                    body.Append(Creator.ToNotice(
                                    context: context,
                                    saved: SavedCreator,
                                    column: column,
                                    updated: Creator_Updated(context: context),
                                    update: update));
                    break;

                case "Updator":
                    body.Append(Updator.ToNotice(
                                    context: context,
                                    saved: SavedUpdator,
                                    column: column,
                                    updated: Updator_Updated(context: context),
                                    update: update));
                    break;
                }
            });
            return(body.ToString());
        }
        /// <summary>
        /// Updates the specified macros.
        /// </summary>
        /// <param name="macros">The macros.</param>
        public void Update(IEnumerable <MacroDto> macros)
        {
            var updator = new Updator(this.Session);

            foreach (var macro in macros)
            {
                updator.Update(macro);
            }
        }
Example #8
0
        public string FullText(
            SiteSettings ss, bool backgroundTask = false, bool onCreating = false)
        {
            if (Parameters.Search.Provider != "FullText")
            {
                return(null);
            }
            if (!Parameters.Search.CreateIndexes && !backgroundTask)
            {
                return(null);
            }
            if (AccessStatus == Databases.AccessStatuses.NotFound)
            {
                return(null);
            }
            var fullText = new List <string>();

            SiteInfo.TenantCaches[Sessions.TenantId()]
            .SiteMenu.Breadcrumb(SiteId).FullText(fullText);
            SiteId.FullText(fullText);
            ss.EditorColumns.ForEach(columnName =>
            {
                switch (columnName)
                {
                case "WikiId":
                    WikiId.FullText(fullText);
                    break;

                case "Title":
                    Title.FullText(fullText);
                    break;

                case "Body":
                    Body.FullText(fullText);
                    break;

                case "Comments":
                    Comments.FullText(fullText);
                    break;
                }
            });
            Creator.FullText(fullText);
            Updator.FullText(fullText);
            CreatedTime.FullText(fullText);
            UpdatedTime.FullText(fullText);
            if (!onCreating)
            {
                FullTextExtensions.OutgoingMailsFullText(fullText, "Wikis", WikiId);
            }
            return(fullText
                   .Where(o => !o.IsNullOrEmpty())
                   .Select(o => o.Trim())
                   .Distinct()
                   .Join(" "));
        }
Example #9
0
        private void Replace(IEnumerable <LightDoctorDto> doubloons, LightDoctorDto withDoctor, IEnumerable <Patient> preloadedPatients)
        {
            var updator = new Updator(this.Session);

            //Select the Id of doubloons and be sure the replacement is not in the list of items to remove
            var ids = (from d in doubloons
                       where d.Id != withDoctor.Id
                       select d.Id).ToList();

            // Find the replacement doctor
            var newDoctor = this.Session.Get <Doctor>(withDoctor.Id);

            //Find the patients that has on of the doubloons
            if (preloadedPatients == null)
            {
                preloadedPatients = this.Session.Query <Patient>().ToList();
            }
            var patients = (from pat in preloadedPatients
                            where pat.Doctors.Where(e => ids.Contains(e.Id)).Count() > 0
                            select pat);

            // Replace the doubloons with the replacement patient
            foreach (var patient in patients)
            {
                //foreach (var doctor in patient.Doctors)
                for (int i = 0; i < patient.Doctors.Count; i++)
                {
                    var doctor = patient.Doctors[i];
                    if (ids.Contains(doctor.Id))
                    {
                        var toRemove = this.Session.Get <Doctor>(doctor.Id);
                        patient.Doctors.Remove(toRemove);
                        updator.AddDoctorTo(patient, newDoctor);
                        this.Session.Update(patient);
                    }
                }
            }
            // Remove old not used doctors
            foreach (var id in ids)
            {
                var doctor = this.Session.Get <Doctor>(id);
                if (doctor != null)
                {
                    this.Session.Delete(doctor);
                }
            }
        }
Example #10
0
        private string NoticeBody(SiteSettings ss, Notification notification, bool update = false)
        {
            var body = new System.Text.StringBuilder();

            notification.MonitorChangesColumnCollection(ss).ForEach(column =>
            {
                switch (column.ColumnName)
                {
                case "Title": body.Append(Title.ToNotice(SavedTitle, column, Title_Updated, update)); break;

                case "Body": body.Append(Body.ToNotice(SavedBody, column, Body_Updated, update)); break;

                case "Comments": body.Append(Comments.ToNotice(SavedComments, column, Comments_Updated, update)); break;

                case "Creator": body.Append(Creator.ToNotice(SavedCreator, column, Creator_Updated, update)); break;

                case "Updator": body.Append(Updator.ToNotice(SavedUpdator, column, Updator_Updated, update)); break;

                case "CreatedTime": body.Append(CreatedTime.ToNotice(SavedCreatedTime, column, CreatedTime_Updated, update)); break;
                }
            });
            return(body.ToString());
        }
        /// <summary>
        /// Updates the specified macros.
        /// </summary>
        /// <param name="macros">The macros.</param>
        public void Update(IEnumerable<MacroDto> macros)
        {
            var updator = new Updator(this.Session);

            foreach (var macro in macros)
            {
                updator.Update(macro);
            }
        }
        private void Replace(IEnumerable<LightDoctorDto> doubloons, LightDoctorDto withDoctor, IEnumerable<Patient> preloadedPatients)
        {
            var updator = new Updator(this.Session);

            //Select the Id of doubloons and be sure the replacement is not in the list of items to remove
            var ids = (from d in doubloons
                       where d.Id != withDoctor.Id
                       select d.Id).ToList();

            // Find the replacement doctor
            var newDoctor = this.Session.Get<Doctor>(withDoctor.Id);

            //Find the patients that has on of the doubloons
            if (preloadedPatients == null) { preloadedPatients = this.Session.Query<Patient>().ToList(); }
            var patients = (from pat in preloadedPatients
                            where pat.Doctors.Where(e => ids.Contains(e.Id)).Count() > 0
                            select pat);
            // Replace the doubloons with the replacement patient
            foreach (var patient in patients)
            {
                //foreach (var doctor in patient.Doctors)
                for (int i = 0; i < patient.Doctors.Count; i++)
                {
                    var doctor = patient.Doctors[i];
                    if (ids.Contains(doctor.Id))
                    {
                        var toRemove = this.Session.Get<Doctor>(doctor.Id);
                        patient.Doctors.Remove(toRemove);
                        updator.AddDoctorTo(patient, newDoctor);
                        this.Session.Update(patient);
                    }
                }
            }
            // Remove old not used doctors
            foreach (var id in ids)
            {
                var doctor = this.Session.Get<Doctor>(id);
                if (doctor != null) { this.Session.Delete(doctor); }
            }
        }