示例#1
0
        internal Shape GetShapeByPPlaceholderShape(P.PlaceholderShape inpPPlaceholderShape)
        {
            IEnumerable <Shape> placeholderShapes = CollectionItems.Where(sp => sp.Placeholder != null).OfType <Shape>();
            Shape mappedShape = placeholderShapes.FirstOrDefault(IsEqual);

            bool IsEqual(Shape collectionShape)
            {
                Placeholder placeholder = (Placeholder)collectionShape.Placeholder;

                P.PlaceholderShape colPPlaceholderShape = placeholder.PPlaceholderShape;

                if (inpPPlaceholderShape.Index != null && colPPlaceholderShape.Index != null &&
                    inpPPlaceholderShape.Index == colPPlaceholderShape.Index)
                {
                    return(true);
                }

                if (inpPPlaceholderShape.Type != null && colPPlaceholderShape.Type != null)
                {
                    if (inpPPlaceholderShape.Type == P.PlaceholderValues.Body &&
                        inpPPlaceholderShape.Index != null && colPPlaceholderShape.Index != null)
                    {
                        return(inpPPlaceholderShape.Index == colPPlaceholderShape.Index);
                    }

                    return(inpPPlaceholderShape.Type.Equals(colPPlaceholderShape.Type));
                }

                return(false);
            }

            return(mappedShape);
        }
        internal SCSlideLayout GetSlideLayoutBySlide(SCSlide slide)
        {
            SlideLayoutPart inputSlideLayoutPart = slide.SlidePart.SlideLayoutPart;

            return(CollectionItems.SelectMany(sm => sm.SlideLayouts)
                   .First(sl => sl.SlideLayoutPart == inputSlideLayoutPart));
        }
示例#3
0
        /// <summary>
        /// Removes the specified slide.
        /// </summary>
        /// <param name="item"></param>
        public override void Remove(Slide item)
        {
            Check.NotNull(item, nameof(item));

            RemoveFromDom(item.Number);
            _sdkPrePart.Presentation.Save();
            CollectionItems.Remove(item);
            UpdateNumbers();
        }
示例#4
0
        protected override void OnDelete(MedicalPractice entity)
        {
            if (entity == null)
            {
                return;
            }

            var associatedPhysicians = new List <string>();

            using (var session = DataserviceProvider.SessionFactory.OpenSession())
            {
                associatedPhysicians = session.Query <Monahrq.Infrastructure.Domain.Physicians.PhysicianMedicalPractice>()
                                       .Where(x => x.MedicalPractice.Id == entity.Id && !x.Physician.IsDeleted)
                                       .Select(x => string.Format(" - {0} {1} (NPI: {2})", x.Physician.FirstName, x.Physician.LastName, x.Physician.Npi))
                                       .ToList();
            }

            if (associatedPhysicians.Any())
            {
                // string physicianNames = string.Join(",", associatedPhysicians);
                var warningMessage = string.Format("Unable to delete medical practice \"{0}\" because it is associated with the following physicians:", entity.Name) + Environment.NewLine;
                associatedPhysicians.ForEach(x => warningMessage += Environment.NewLine + x);

                MessageBox.Show(warningMessage, "Dataset Deletion Warning", MessageBoxButtons.OK);
                return;
            }
            else if (MessageBox.Show(string.Format(@"Are you sure want to delete {0} ?", entity.Name), @"Delete Confirmation", MessageBoxButtons.OKCancel) != DialogResult.OK)
            {
                return;
            }

            using (var session = DataserviceProvider.SessionFactory.OpenSession())
            {
                using (var trans = session.BeginTransaction())
                {
                    var msg = string.Format("{0} {1} has been deleted.", entity.Name, Inflector.Titleize(entity.GetType().Name));

                    try
                    {
                        session.Evict(entity);
                        session.Delete(entity);
                        trans.Commit();
                        Notify(msg);
                    }
                    catch (Exception exc)
                    {
                        trans.Rollback();

                        var excToUse = exc;
                        LogEntityError(excToUse, entity.GetType(), entity.Name);
                    }
                }
            }

            CollectionItems.Remove(entity);
        }
示例#5
0
        public override void Remove(Slide innerRow)
        {
            //TODO: validate case when last slide is deleted
            Check.NotNull(innerRow, nameof(innerRow));

            RemoveFromDom(innerRow.Number);
            _sdkPre.PresentationPart.Presentation.Save(); // save the modified presentation
            CollectionItems.Remove(innerRow);
            UpdateNumbers();
        }
示例#6
0
        /// <summary>
        /// Removes the specified table row.
        /// </summary>
        /// <param name="item"></param>
        public override void Remove(RowEx item)
        {
            if (!_innerSdkDic.ContainsKey(item))
            {
                throw new ArgumentNullException(nameof(item));
            }

            _innerSdkDic[item].Remove();
            CollectionItems.Remove(item);
        }
        /// <summary>
        /// Reloads the selected states.
        /// </summary>
        /// <param name="session">The session.</param>
        public void ReloadSelectedStates(ISession session)
        {
            // var configService = ServiceLocator.Current.GetInstance<IConfigurationService>();
            var selectedStates = ConfigurationService.HospitalRegion.DefaultStates.OfType <string>().ToList();

            CollectionItems.OfType <HospitalCategory>().ForEach(x =>
            {
                x.HospitalCountForSelectedRegion = GetHospitalCountForCategory(session, x.Id,
                                                                               selectedStates);
            });
        }
示例#8
0
 private void ClearSourceFilterText()
 {
     if (SelectedPage == SelectedTabPage.CollectionItem)
     {
         CollectionItems.ClearFilterText();
     }
     else if (SelectedPage == SelectedTabPage.Taxon)
     {
         Taxa.ClearFilterText();
     }
 }
示例#9
0
 /// <summary>
 /// Resets this instance.
 /// </summary>
 public override void Reset()
 {
     IsLoaded           = false;
     SelectedDataSet    = DataSetsCollectionView.FirstOrDefault();
     SelectedProperty   = PropertyFilters.FirstOrDefault();
     PropertyFilterText = string.Empty;
     IsLoaded           = true;
     GetPage();
     if (CollectionItems.Count > 0)
     {
         CollectionItems.MoveCurrentToFirst();
     }
 }
        public async Task UpdateViewModel()
        {
            IsLoading   = true;
            ResultItems = await exampleService.GetItems();

            Debug.WriteLine(ResultItems[0].channel);
            foreach (var item in ResultItems)
            {
                CollectionItems.Add(item);
            }
            Debug.WriteLine(CollectionItems[0].channel);
            IsLoading = false;
        }
        private void DeleteCurrentCollectionItem()
        {
            if (!Dialog.AskForDelete())
            {
                return;
            }
            var itemToDelete = SelectedCollectionItem;

            SelectedCollectionItem = CollectionItems.Last();
            OnPropertyChanged(nameof(SelectedCollectionItem));
            _viewProvider.DeleteCollectionItem(itemToDelete.InnerObject.Id);
            CollectionItems.Remove(itemToDelete);
        }
        /// <summary>
        /// Executes the load.
        /// </summary>
        /// <param name="session">The session.</param>
        protected override void ExecLoad(ISession session)
        {
            TotalCount  = 0;
            CurrentPage = 0;
            PageSize    = INITIAL_LOAD_COUNT;

            var statesList = ConfigurationService.HospitalRegion.DefaultStates.OfType <string>().ToList();

            ListExtensions.ForEach(statesList, x => TotalCount += session.Query <db.Physician>().Count(GetWhereClause(x)));

            Fetch(session, statesList);
            CollectionItems.MoveCurrentToFirst();
            IsLastItemFetched = PageSize * CurrentPage >= TotalCount - INITIAL_LOAD_COUNT;
            PageSize          = 5;
        }
        private async Task LoadData(string sortBy)
        {
            LoaderState.ToBusy();
            SortOnCode  = sortBy == "Code";
            SortOnGenus = sortBy == "Genus";
            OnPropertyChanged(nameof(SortOnCode));
            OnPropertyChanged(nameof(SortOnGenus));
            var items = await _viewProvider.GetCollectionItemsAsync(sortBy);

            CollectionItems.Clear();
            foreach (var item in items)
            {
                CollectionItems.Add(new CollectionItemViewModel(item));
            }
            LoaderState.ToIdle();
        }
示例#14
0
        private void OnSaveCustomRegion()
        {
            Validate();
            if (HasErrors)
            {
                return;
            }

            //if (string.IsNullOrWhiteSpace(RegionTitle) || RegionID == null || SelectedState == null)
            //{
            //    MessageBox.Show("Please enter a region  ID , name and select a state before adding a custom geographic region.",
            //        "Unable to add Custom Region", MessageBoxButton.OK, MessageBoxImage.Exclamation);
            //    return;
            //}

            var customRegion = new CustomRegion
            {
                Code = string.Format("CUS{0}{1}", RegionID, SelectedState),
                Name = RegionTitle,
                IsSourcedFromBaseData = false,
                State          = SelectedState,
                Version        = 1,
                Created        = DateTime.Now,
                ImportRegionId = RegionID
            };

            using (var session = DataserviceProvider.SessionFactory.OpenSession())
            {
                try
                {
                    OnAddNewItem(customRegion);
                    CollectionItems.AddNewItem(customRegion);
                    CollectionItems.CommitNew();
                    Reset();
                    var msg = String.Format("Custom region {0} with state {1} has been added", customRegion.Name, customRegion.State);
                    MappedCustomRegionToPopulationCount = Service.GetCustomRegionToPopulationMappingCount(ConfigurationService.HospitalRegion.DefaultStates.OfType <string>().ToList());
                    EventAggregator.GetEvent <GenericNotificationEvent>().Publish(msg);
                    IsAddNewRegionPopupVisible = false;
                }
                catch (GenericADOException)
                {
                    MessageBox.Show("region  ID already exist.", "Unable to add Custom Region", MessageBoxButton.OK, MessageBoxImage.Exclamation);
                }
            }
        }
示例#15
0
        protected override void OnDelete(MonahrqRegion entity)
        {
            if (entity == null)
            {
                return;
            }

            if (MessageBox.Show(string.Format("Delete Region: {0}", entity.Name), "Delete Region?",
                                MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.No) == MessageBoxResult.No)
            {
                return;
            }

            if (entity.HospitalCount > 0)
            {
                MessageBox.Show(
                    string.Format("Please delete associations with hospitals before deleting region \"{0}\". There are currently {1} hospital(s) associated with this region.", entity.Name, entity.HospitalCount),
                    "Delete Region?", MessageBoxButton.OK, MessageBoxImage.Exclamation, MessageBoxResult.No); return;
            }

            using (var session = DataserviceProvider.SessionFactory.OpenSession())
            {
                using (var trans = session.BeginTransaction())
                {
                    var updateQuery = string.Format(@"UPDATE {0} SET {1}_Id = NULL WHERE {1}_Id = {2} AND IsDeleted = 1", typeof(Hospital).EntityTableName(), entity.GetType().Name, entity.Id);
                    session.CreateSQLQuery(updateQuery).ExecuteUpdate();
                    session.Flush();
                    trans.Commit();
                }
            }

            CollectionItems.Remove(entity);
            base.OnDelete(entity);

            CollectionItems.Refresh();
            MappedCustomRegionToPopulationCount = Service.GetCustomRegionToPopulationMappingCount(ConfigurationService.HospitalRegion.DefaultStates.OfType <string>().ToList());
        }
 private CollectionItemViewModel GetCollectionItem(Guid id)
 {
     return(CollectionItems.Single(x => x.InnerObject.Id == id));
 }
 internal SCSlideMaster GetSlideMasterByLayout(SCSlideLayout slideLayout)
 {
     return(CollectionItems.First(sldMaster =>
                                  sldMaster.SlideLayouts.Any(sl => sl.SlideLayoutPart == slideLayout.SlideLayoutPart)));
 }
示例#18
0
 protected override void ExecLoad(ISession session)
 {
     Fetch(session);
     CollectionItems.MoveCurrentToFirst();
 }
示例#19
0
 void Start()
 {
     talkToNpcText.enabled       = false;
     talkToNpcTextShadow.enabled = false;
     collectionItems             = GetComponent <CollectionItems>();
 }
        /// <summary>
        /// Called when [delete].
        /// </summary>
        /// <param name="entity">The entity.</param>
        protected override async void OnDelete(db.Physician entity)
        {
            if (entity == null)
            {
                return;
            }

            var result =
                MessageBox.Show(@"Are you sure want to delete the data for this physician, """ + entity.Name + @"""?", @"Delete Confirmation", MessageBoxButtons.OKCancel);

            if (result != DialogResult.OK)
            {
                return;
            }

            var       errorOccurred   = false;
            Exception errorException  = null;
            var       progressService = new ProgressService();

            progressService.SetProgress("Deleting physican", 0, false, true);

            //await Task.Delay(500);

            string entityName          = entity.Name;
            var    executedSuccessully = await progressService.Execute(() =>
            {
                using (var session = DataserviceProvider.SessionFactory.OpenSession())
                {
                    using (var trans = session.BeginTransaction())
                    {
                        try
                        {
                            var updateQuery = string.Format(@"UPDATE {0} SET IsDeleted = 1 WHERE Id = {1} AND IsDeleted = 0",
                                                            typeof(db.Physician).EntityTableName(),
                                                            entity.Id);
                            session.CreateSQLQuery(updateQuery).ExecuteUpdate();
                            session.Flush();
                            trans.Commit();
                        }
                        catch
                        {
                            trans.Rollback();
                            throw;
                        }
                    }
                }
            },
                                                                       opResult =>
            {
                if (!opResult.Status && opResult.Exception != null)
                {
                    errorOccurred  = true;
                    errorException = opResult.Exception;
                }
                else
                {
                    errorOccurred = true;
                }
            }, new CancellationToken());

            progressService.SetProgress("Completed", 100, true, false);

            if (errorOccurred && errorException != null)
            {
                Logger.Write(errorException, "Error deleting physician \"{0}\"", entity.Name);
                LogEntityError(errorException, typeof(db.Physician), entityName);
                return;
            }

            CollectionItems.Remove(entity);
            CollectionItems.Refresh();

            Notify(string.Format("{0} {1} has been deleted.", entityName,
                                 Inflector.Titleize(typeof(db.Physician).Name)));
        }
示例#21
0
 public bool GameMatch() => CollectionItems.Any() || Items.Any();
示例#22
0
 IEnumerator <KeyValuePair <K, ICollection <V> > > IEnumerable <KeyValuePair <K, ICollection <V> > > .GetEnumerator()
 {
     return(CollectionItems.GetEnumerator());
 }