private void ButtonDeleteDocuments_Click(object sender, RoutedEventArgs e)
 {
     if (this.ListViewTransferCollection.SelectedItems != null)
     {
         YellowstonePathology.Business.Mongo.Transfer transfer = (YellowstonePathology.Business.Mongo.Transfer) this.ListViewTransferCollection.SelectedItem;
         transfer.DropMongoCollection();
         transfer.UpdateMongoDocumentCount();
     }
 }
 private void ButtonView_Click(object sender, RoutedEventArgs e)
 {
     if (this.ListViewTransferCollection.SelectedItem != null)
     {
         YellowstonePathology.Business.Mongo.Transfer transfer = (YellowstonePathology.Business.Mongo.Transfer) this.ListViewTransferCollection.SelectedItem;
         TransferWindow transferWindow = new TransferWindow(transfer);
         transferWindow.ShowDialog();
         this.NotifyPropertyChanged("TransferCollection");
     }
 }
 private void MenuItemDeleteTransfers_Click(object sender, RoutedEventArgs e)
 {
     if (this.ListViewTransferCollection.SelectedItem != null)
     {
         while (this.ListViewTransferCollection.SelectedItems.Count != 0)
         {
             YellowstonePathology.Business.Mongo.Transfer transfer = (YellowstonePathology.Business.Mongo.Transfer) this.ListViewTransferCollection.SelectedItems[0];
             this.m_TransferCollection.Remove(transfer);
         }
         this.m_DocumentCollectionTracker.SubmitChanges();
         MessageBox.Show("Transfers have been removed.");
     }
 }
        private void AddTransferDocuments(string assemblyName)
        {
            Assembly assembly = Assembly.LoadFile(assemblyName);

            Type[] types = assembly.GetTypes();

            foreach (Type type in types)
            {
                object[] customAttributes = type.GetCustomAttributes(typeof(YellowstonePathology.Business.Persistence.PersistentClass), false);
                if (customAttributes.Length > 0)
                {
                    foreach (object o in customAttributes)
                    {
                        if (o is YellowstonePathology.Business.Persistence.PersistentClass)
                        {
                            YellowstonePathology.Business.Persistence.PersistentClass persistentClass = (YellowstonePathology.Business.Persistence.PersistentClass)o;
                            if (string.IsNullOrEmpty(persistentClass.StorageName) == false)
                            {
                                string collectionName = persistentClass.StorageName.Substring(3);
                                string tableName      = persistentClass.StorageName;

                                YellowstonePathology.Business.Mongo.Transfer transfer = YellowstonePathology.Business.Mongo.Transfer.New(tableName, collectionName);
                                transfer.AssemblyQualifiedName = type.AssemblyQualifiedName;
                                transfer.HasBaseClass          = persistentClass.HasPersistentBaseClass;

                                if (persistentClass.HasPersistentBaseClass == true)
                                {
                                    transfer.BaseTableName = persistentClass.BaseStorageName;
                                }

                                List <PropertyInfo> propertyList = type.GetProperties().Where(prop => Attribute.IsDefined(prop, typeof(YellowstonePathology.Business.Persistence.PersistentPrimaryKeyProperty))).ToList();
                                transfer.PrimaryKeyName = propertyList[0].Name;

                                if (persistentClass.HasPersistentBaseClass == true)
                                {
                                    transfer.HasBaseClass = true;
                                }
                                this.m_TransferCollection.Add(transfer);
                            }
                        }
                    }
                }
            }

            this.m_DocumentCollectionTracker.SubmitChanges();
            this.NotifyPropertyChanged("TransferCollection");
        }
Ejemplo n.º 5
0
 public TransferWindow(YellowstonePathology.Business.Mongo.Transfer transfer)
 {
     this.m_Transfer = transfer;
     InitializeComponent();
     this.DataContext = this;
 }
Ejemplo n.º 6
0
 public TransferWindow(YellowstonePathology.Business.Mongo.Transfer transfer)
 {
     this.m_Transfer = transfer;
     InitializeComponent();
     this.DataContext = this;
 }