예제 #1
0
 public Partition(Frame navigationService, ConnectionService connectionService)
 {
     InitializeComponent();
     _navigationService = navigationService;
     _dataContext       = new PartitionViewModel(connectionService);
     DataContext        = _dataContext;
 }
예제 #2
0
        public async Task <IActionResult> Create(PartitionViewModel model)
        {
            if (ModelState.IsValid)
            {
                var nameAlreadyExists = CommonContext.Partitions.Any(x => x.Name.ToLower() == model.Name.ToLower());
                if (nameAlreadyExists)
                {
                    // duplicate partition name
                    ModelState.AddModelError(string.Empty, "Name already exsits.");
                    return(View(model));
                }

                var partition = new Partition();
                partition.Name             = model.Name;
                partition.ConnectionString = Cryptography.Encrypt(model.ConnectionString);
                partition.CreateUserId     = User.GetLoggedInUserId().Value;
                partition.UpdateUserId     = partition.CreateUserId = User.GetLoggedInUserId().Value;


                //put dude in the database
                using (var tx = CommonContext.Database.BeginTransaction())
                {
                    CommonContext.Partitions.Add(partition);
                    await CommonContext.SaveChangesAsync();

                    tx.Commit();
                }
                return(RedirectToAction("Index"));
            }
            return(View(model));
        }
예제 #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SaveStoreWindow"/> class.
 /// </summary>
 /// <param name="owner">The window owner.</param>
 /// <param name="partitionViewModel">The partition that has unsaved changes.</param>
 public SaveStoreWindow(Window owner, PartitionViewModel partitionViewModel)
 {
     this.InitializeComponent();
     this.DataContext = this;
     this.Owner       = owner;
     this.Text        = $"The partition {partitionViewModel.Name} has unsaved changes.{Environment.NewLine}{Environment.NewLine}Do you wish to save these changes to disk before continuing?";
 }
예제 #4
0
        public async Task <IActionResult> Edit(Guid Id)
        {
            var model     = new PartitionViewModel();
            var partition = await CommonContext.Partitions.Select(x => x).Where(x => x.Id == Id).SingleOrDefaultAsync();

            model.Id               = Id;
            model.Name             = partition.Name;
            model.ConnectionString = Cryptography.Decrypt(partition.ConnectionString);
            model.Disabled         = partition.Disabled;
            return(View(model));
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            // Create your application here
            _vm = new PartitionViewModel();
            SetContentView(Resource.Layout.partition_display);

            _partition = FindViewById <RecyclerView>(Resource.Id.partition);
            var adapter = new PartitionAdapter(_vm.Partition);

            _partition.SetAdapter(adapter);
            _partition.SetLayoutManager(new LinearLayoutManager(this));
        }
예제 #6
0
        /// <summary>
        /// Initializes a new instance of the <see cref="StreamSource"/> class.
        /// </summary>
        /// <param name="partitionViewModel">The partition that is the stream's data source.</param>
        /// <param name="streamReaderType">The type of stream reader that should be used to read data from the store.</param>
        /// <param name="streamName">The name of the stream.</param>
        /// <param name="streamMetadata">The metadata for the stream.</param>
        /// <param name="streamAdapter">The stream adapter to use when reading stream data.</param>
        /// <param name="summarizer">The summarizer to use when reading the stream.</param>
        public StreamSource(
            PartitionViewModel partitionViewModel,
            Type streamReaderType,
            string streamName,
            IStreamMetadata streamMetadata,
            IStreamAdapter streamAdapter,
            ISummarizer summarizer)
        {
            this.StoreName        = partitionViewModel.StoreName;
            this.StorePath        = partitionViewModel.StorePath;
            this.StreamReaderType = streamReaderType;
            this.StreamName       = streamName;
            this.StreamMetadata   = streamMetadata;
            this.StreamAdapter    = streamAdapter;
            this.Summarizer       = summarizer;
            this.IsLive           = partitionViewModel.IsLivePartition;

            partitionViewModel.PropertyChanged += this.PartitionPropertyChanged;
        }
예제 #7
0
        /// <summary>
        /// Initializes a new instance of the <see cref="StreamSource"/> class.
        /// </summary>
        /// <param name="partitionViewModel">The partition that is the stream's data source.</param>
        /// <param name="streamReaderType">The type of stream reader that should be used to read data from the store.</param>
        /// <param name="streamName">The name of the stream.</param>
        /// <param name="streamMetadata">The metadata for the stream.</param>
        /// <param name="streamAdapter">The stream adapter to use when reading stream data.</param>
        /// <param name="summarizer">The summarizer to use when reading the stream.</param>
        /// <param name="allocator">The allocator to use when reading data.</param>
        /// <param name="deallocator">The deallocator to use when reading data.</param>
        public StreamSource(
            PartitionViewModel partitionViewModel,
            Type streamReaderType,
            string streamName,
            IStreamMetadata streamMetadata,
            IStreamAdapter streamAdapter,
            ISummarizer summarizer,
            Func <dynamic> allocator,
            Action <dynamic> deallocator)
        {
            this.StoreName        = partitionViewModel.StoreName;
            this.StorePath        = partitionViewModel.StorePath;
            this.StreamReaderType = streamReaderType;
            this.StreamName       = streamName;
            this.StreamMetadata   = streamMetadata;
            this.StreamAdapter    = streamAdapter;
            this.Summarizer       = summarizer;
            this.IsLive           = partitionViewModel.IsLivePartition;
            this.Allocator        = allocator;
            this.Deallocator      = deallocator;

            partitionViewModel.PropertyChanged += this.OnPartitionViewModelPropertyChanged;
        }
예제 #8
0
        public IActionResult Create()
        {
            var model = new PartitionViewModel();

            return(View(model));
        }