public static bool PassesFilter(PackageViewModel item, string filterText) { return item.Name.ContainsNoCase(filterText) || item.Description.ContainsNoCase(filterText) || item.Source.ContainsNoCase(filterText); }
public void LicenseNamesAreParsedByCommas() { var package = new Package { LicenseNames = "l1,l2, l3 ,l4 , l5 ", }; var packageViewModel = new PackageViewModel(package); Assert.Equal(new string[] { "l1", "l2", "l3", "l4", "l5" }, packageViewModel.LicenseNames); }
public void UsesNormalizedPackageVersionIfNormalizedVersionMissing() { var package = new Package() { Version = "01.02.00.00" }; var packageViewModel = new PackageViewModel(package); Assert.Equal("1.2.0", packageViewModel.Version); }
public void LicenseReportUrlKeptWhenLicenseReportEnabled() { var package = new Package { HideLicenseReport = false, LicenseReportUrl = "url" }; var packageViewModel = new PackageViewModel(package); Assert.NotNull(packageViewModel.LicenseReportUrl); }
public void LicenseNamesKeptWhenLicenseReportEnabled() { var package = new Package { HideLicenseReport = false, LicenseNames = "l1" }; var packageViewModel = new PackageViewModel(package); Assert.NotNull(packageViewModel.LicenseNames); }
public void UsesNormalizedVersionForDisplay() { var package = new Package() { Version = "01.02.00.00", NormalizedVersion = "1.3.0" // Different just to prove the View Model is using the DB column. }; var packageViewModel = new PackageViewModel(package); Assert.Equal("1.3.0", packageViewModel.Version); }
public void LicenseReportFieldsKeptWhenLicenseReportDisabled() { var package = new Package { HideLicenseReport = true, LicenseNames = "l1", LicenseReportUrl = "url" }; var packageViewModel = new PackageViewModel(package); Assert.NotNull(packageViewModel.LicenseNames); Assert.NotNull(packageViewModel.LicenseReportUrl); }
public void PackageViewModels_ChildViewModelParent_IsInstalledPackagesViewModel() { CreateViewModel(); FakePackage package = AddPackageToProjectLocalRepository(); viewModel.ReadPackages(); CompleteReadPackagesTask(); PackageViewModel childViewModel = viewModel.PackageViewModels.First(); IPackageViewModelParent parent = childViewModel.GetParent(); Assert.AreEqual(viewModel, parent); }
public ActionResult Packages() { StripeConfiguration.SetApiKey(WebConfigurationManager.AppSettings["StripeSecretKey"]); ViewBag.PublicKey = WebConfigurationManager.AppSettings["StripePublicKeyTest"]; var getValidationPakages = _context.CouponValidationPackages.ToList(); var viewModel = new PackageViewModel { Packages = getValidationPakages }; return(View(viewModel)); }
private bool HandleDataObject(PackageFolder?folder, IDataObject data, bool copy) { if (!CanHandleDataObject(folder, data)) { return(false); } if (data.GetDataPresent(PackageFileDataFormat)) { if (data.GetData(PackageFileDataFormat) is string packagePartPath) { var packagePart = RootFolder.GetPackageParts().FirstOrDefault(part => part.Path == packagePartPath); if (packagePart != null) { folder ??= RootFolder; if (packagePart is PackageFile file) { folder.AddFile(file, copy); } else { if (packagePart is PackageFolder childFolder && !folder.IsDescendantOf(childFolder)) { folder.AddFolder(childFolder, copy); } } return(true); } } } if (data.GetDataPresent(NativeDragDrop.FileGroupDescriptorW)) { folder ??= RootFolder; PackageViewModel.AddDraggedAndDroppedFileDescriptors(folder, NativeDragDrop.GetFileGroupDescriptorW(data)); return(true); } if (data.GetDataPresent(DataFormats.FileDrop)) { var value = data.GetData(DataFormats.FileDrop); if (value is string[] filenames && filenames.Length > 0) { var viewModel = (PackageViewModel)DataContext; viewModel.AddDraggedAndDroppedFiles(folder, filenames); return(true); } } return(false); }
private void DisplayData() { lstData.ItemsSource = null; if (_track == null) { return; } if (_data == null) { return; } if (_car == null) { return; } if (_track.Count() < 1) { return; } List <PackageViewModel> pvm = new List <PackageViewModel>(); foreach (var item in _data.Rows) { CarStateModel csm = new CarStateModel(); List <CarStateModel> temp = _track.Where(p => p.hh == item.DT.hh).ToList(); if (temp.Count() == 1) { csm = temp[0]; } else if (temp.Count() > 1) { temp = _track.Where(p => p.hh == item.DT.hh && p.mm == item.DT.mm).ToList(); if (temp.Count() == 1) { csm = temp[0]; } else if (temp.Count() > 1) { temp = _track.Where(p => p.hh == item.DT.hh && p.mm == item.DT.mm && p.ss == item.DT.ss).ToList(); if (temp.Count() > 0) { csm = temp[0]; } } } PackageViewModel pm = new PackageViewModel(csm, item, _car.Device.Sensors); pvm.Add(pm); } lstData.ItemsSource = pvm; }
public IHttpResponse Create(PackageViewModel model) { var recipient = this.ApplicationDbContext .Users .FirstOrDefault(x => x.Username == model.ChosenRecipient); //create package and set recipient to it var package = new Package { Description = model.Description, Weight = model.Weight, ShippingAddress = model.ShippingAddress, Recipient = recipient, RecipientId = recipient.Id, Status = Status.Pending //EstimatedDeliveryDate = null }; if (string.IsNullOrEmpty(package.Description) || string.IsNullOrWhiteSpace(package.Description) || package.Description == null) { return(BadRequestError("Description can't be empty or null")); } if (string.IsNullOrEmpty(package.ShippingAddress) || string.IsNullOrWhiteSpace(package.ShippingAddress) || package.ShippingAddress == null) { return(BadRequestError("Shipping Address can't be empty or null")); } this.ApplicationDbContext.Packages.Add(package); this.ApplicationDbContext.SaveChanges(); //add package to recipient's packages and to DB recipient.Packages.Add(package); //create receipt and add package and recipient to it var receipt = new Receipt { Fee = (decimal)(package.Weight * 2.67d), IssuedOn = DateTime.Now, Package = package, PackageId = package.Id, Recipient = recipient, RecipientId = recipient.Id }; this.ApplicationDbContext.Receipts.Add(receipt); this.ApplicationDbContext.SaveChanges(); //take info from model and take all recipients from dbContext return(this.Redirect("/home/index")); }
public async Task <ActionResult> Update(PackageViewModel model) { Package _ObjPackage = model._MainObj; int rs = await cms_db.UpdatePackage(_ObjPackage); int rs2 = await cms_db.CreateUserHistory(long.Parse(User.Identity.GetUserId()), Request.ServerVariables["REMOTE_ADDR"], (int)EnumCore.ActionType.Update, "Update", model.PackageId, model.PackageName, "PackageManager", (int)EnumCore.ObjTypeId.package); if (rs == (int)EnumCore.Result.action_true && rs2 == (int)EnumCore.Result.action_true) { return(RedirectToAction("Index")); } return(RedirectToAction("Index")); }
private async Task AddSpecificPriceList(PackageViewModel model, Guid packageid) { var specificPriceList = this.Mapper.Map <List <SpecificPriceModel> >(model.SpecificPriceList); if (specificPriceList != null && specificPriceList.Count > 0) { foreach (var item in specificPriceList) { item.PackageId = packageid; } await this.packageService.InsertSpecificPriceAsync(specificPriceList); } }
public void PackageViewModels_ChildPackageViewModelParent_IsUpdatedPackagesViewModel() { CreateViewModel(); AddPackageToLocalRepository("Test", "1.0.0.0"); FakePackage newerPackage = AddPackageToActiveRepository("Test", "1.1.0.0"); viewModel.ReadPackages(); CompleteReadPackagesTask(); PackageViewModel childViewModel = viewModel.PackageViewModels.First(); IPackageViewModelParent parent = childViewModel.GetParent(); Assert.AreEqual(viewModel, parent); }
/// <summary> /// If the chosen item is a Package or Folder then the Select Button is enabled, and the correct /// path is set. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.Windows.RoutedPropertyChangedEventArgs<System.Object>"/> instance containing the event data.</param> private void PkgFolderChooser_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs <object> e) { bool enableButton = false; PackageFolderContentItem folder = PackageFileChooser.SelectedItem as PackageFolderContentItem; if (folder != null && !(folder is PackageViewModel)) { Stack <string> subDirs = new Stack <string>(); subDirs.Push(folder.Label); PackageContentItem parent = folder.Parent; while (parent.Parent != null) { subDirs.Push(parent.Label); parent = parent.Parent; } PackageViewModel package = parent as PackageViewModel; if (package != null) { string subDirectory = ""; while (subDirs.Count > 0) { subDirectory = System.IO.Path.Combine(subDirectory, subDirs.Pop()); } if (Directory.Exists(System.IO.Path.Combine(package.Package.Location, subDirectory))) { TraceLabSDK.PackageSystem.IPackageReference reference = new TraceLab.Core.PackageSystem.PackageReference(package.Package); TraceLabDirectoryPath path = new TraceLabDirectoryPath(); path.Init(reference, subDirectory); Path = path; enableButton = true; } } } else if (folder != null && folder is PackageViewModel) { PackageViewModel package = folder as PackageViewModel; if (Directory.Exists(package.Package.Location)) { TraceLabSDK.PackageSystem.IPackageReference reference = new TraceLab.Core.PackageSystem.PackageReference(package.Package); TraceLabDirectoryPath path = new TraceLabDirectoryPath(); path.Init(reference, "."); Path = path; enableButton = true; } } SelectButton.IsEnabled = enableButton; }
public void HasSemVer2VersionIsTrueWhenSemVer2Version(string version) { // Arrange var package = new Package { Version = version }; // Act var viewModel = new PackageViewModel(package); // Assert Assert.True(viewModel.HasSemVer2Version); }
public ActionResult Create(PackageViewModel viewModel) { /*try * { * var package = new Package * { * TourId = viewModel.TourId, * ServiceId = viewModel.ServiceId, * VehicleId = viewModel.VehicleId * }; * _dbContext.Packages.Add(package); * _dbContext.SaveChanges(); * return RedirectToAction("Index","Home"); * } * catch * { * return View("Create", viewModel); * }*/ if (!ModelState.IsValid) { var tmptour = _dbContext.Tours.Single(t => t.Id == viewModel.TourId); viewModel.TourId = tmptour.Id; viewModel.Services = _dbContext.Services.ToList(); viewModel.Vehicles = _dbContext.Vehicles.ToList(); return(View("Create", viewModel)); } // Create tmp variables var tour = _dbContext.Tours.Single(t => t.Id == viewModel.TourId); var service = _dbContext.Services.Single(s => s.Id == viewModel.ServiceId); var vehicle = _dbContext.Vehicles.Single(v => v.Id == viewModel.VehicleId); int quantity = int.Parse(viewModel.Quantity); decimal total = quantity * tour.Price + service.Price + vehicle.Price; var package = new Package { TourId = tour.Id, ServiceId = viewModel.ServiceId, VehicleId = viewModel.VehicleId, QuantityVehi = quantity, Total = total, CustomerName = viewModel.CustomerName, CustomerEmail = viewModel.CustomerEmail, CustomerPhoneNumber = viewModel.CustomerPhoneNumber, CustomerAddress = viewModel.CustomerAddress }; _dbContext.Packages.Add(package); _dbContext.SaveChanges(); return(RedirectToAction("Index", "Home")); }
/// <summary> /// Imports the effect log as an asset. /// </summary> private void ImportEffectLog(PackageViewModel package) { using (var transaction = session.UndoRedoService.CreateTransaction()) { CheckEffectLogAsset(package); // Create asset (on first time) if (effectLogViewModel == null) { var effectLogAsset = new EffectLogAsset(); var assetItem = new AssetItem(EffectLogAsset.DefaultFile, effectLogAsset); // Add created asset to project effectLogViewModel = (EffectLogViewModel)package.CreateAsset(package.AssetMountPoint, assetItem, true, null); CheckEffectLogAsset(package); } // Import shaders foreach (var effectCompilerResult in pendingEffects) { if (!effectLogStore.Contains(effectCompilerResult)) { effectLogStore[effectCompilerResult] = true; } } // Reset current list of shaders to import var oldPendingEffects = pendingEffects; session.UndoRedoService.PushOperation(new AnonymousDirtyingOperation(Enumerable.Empty <IDirtiable>(), () => { pendingEffects = oldPendingEffects; session.ImportEffectLogPendingCount = oldPendingEffects.Count; }, () => { pendingEffects = new HashSet <EffectCompileRequest>(); session.ImportEffectLogPendingCount = 0; })); pendingEffects = new HashSet <EffectCompileRequest>(); session.ImportEffectLogPendingCount = 0; // Extract current asset data var effectLogData = effectLogStream.ToArray(); // Update asset effectLogViewModel.Text = Encoding.UTF8.GetString(effectLogData, 0, effectLogData.Length); effectLogText = effectLogViewModel.Text; // Select current asset session.ActiveAssetView.SelectAssets(new[] { effectLogViewModel }); session.UndoRedoService.SetName(transaction, "Import effect log"); } }
public ActionResult Index(PackageViewModel model, string button) { //get the list of packages from session List <Package> packages = PackageDataAccess.GetPackageList(); switch (model.shippingType) { case "Standard": Package package = new Package(); LoadPackageFromForm(package, model); model.package = package; if (button == "Save") { UpsertPackage(package); } break; case "Two Day": TwoDayPackage twoDayPackage = new TwoDayPackage(5); LoadPackageFromForm(twoDayPackage, model); model.package = twoDayPackage; if (button == "Save") { UpsertPackage(twoDayPackage); } break; case "Overnight": OvernightPackage overnightPackage = new OvernightPackage(10); LoadPackageFromForm(overnightPackage, model); model.package = overnightPackage; if (button == "Save") { UpsertPackage(overnightPackage); } break; } //if they used save button, redirect to list page if (button == "Save") { //Go back to the PersonList page return(RedirectToAction("ShippingList", "Shipping")); } else { return(View(model)); } }
public void PackageStatusSummaryThrowsForUnexpectedPackageStatus() { // Arrange var package = new Package { Version = "1.0.0", PackageStatusKey = (PackageStatus)4, }; // Act var packageViewModel = new PackageViewModel(package); // Assert Assert.Throws <ArgumentOutOfRangeException>(() => packageViewModel.PackageStatusSummary); }
// // GET: /Package/Edit/5 public ActionResult Edit(int id) { ViewBag.Title = "Edit"; Package package = db.Packages.Find(id); PackageViewModel viewModel = new PackageViewModel(); viewModel.package = package; viewModel._clients = db.Clients.ToList(); viewModel._contents = db.Contents.ToList(); viewModel._displays = db.Displays.ToList(); //Call Create View return(View(viewModel)); }
public IActionResult Index() { if (User.Identity.IsAuthenticated) { var username = User.Identity.Name; var packages = new PackageViewModel(_packageService.GetUserPackagesByStatus(username, Status.Pending), _packageService.GetUserPackagesByStatus(username, Status.Shipped), _packageService.GetUserPackagesByStatus(username, Status.Delivered)); return(this.View(packages)); } return(View()); }
public ActionResult DiscardConfirm(PackageViewModel pvm) { var package = packagesContracts.UpdateStatus(pvm.BarcodeId, 4); if (package.PackageId > 0) { TempData["Success"] = "Discarded the package"; return(RedirectToAction("Index")); } else { TempData["Fail"] = "Failed to Discard the package"; return(View("Index")); } }
private void RunSelfUpdate(MainWindow wnd) { UpdatesViewModel updates = wnd.ViewModel.Updates; updates.IsPrereleaseIncluded = true; updates.Refresh.Completed += async() => { bool canUpdate = false; PackageUpdateViewModel package = updates.Packages.FirstOrDefault(p => p.Current.Id == Args.SelfPackageId); if (package != null) { if (package.Target.Version == Args.SelfUpdateVersion) { canUpdate = true; } else { if (package.Current.LoadVersions.CanExecute()) { package.Current.LoadVersions.Execute(); } PackageViewModel version = package.Current.Versions.FirstOrDefault(p => p.Version == Args.SelfUpdateVersion); if (version != null) { package.Target = version.Model; canUpdate = true; } else { Navigator.Notify("Self Update Error", $"Unnable to find update package (version {Args.SelfUpdateVersion}) for PackageManager.", Navigator.MessageType.Error); } } } else { Navigator.Notify("Self Update Error", $"Unnable to find update package for PackageManager.", Navigator.MessageType.Error); } if (canUpdate) { await updates.Update.ExecuteAsync(package); } Shutdown(); }; wnd.SelectUpdatesTab(); }
public void PackageStatusSummaryIsCorrect(PackageStatus packageStatus, bool isListed, PackageStatusSummary expected) { // Arrange var package = new Package { Version = "1.0.0", PackageStatusKey = packageStatus, Listed = isListed }; // Act var packageViewModel = new PackageViewModel(package); // Assert Assert.Equal(expected, packageViewModel.PackageStatusSummary); }
public IActionResult ConfirmDetails(string id) { PackageViewModel package = null; if (id != null) { package = _packagesService.GetPackageViewModel(id); } if (package == null || id == null) { return(View("Invalid")); } return(View("Details", package)); }
public async Task <IActionResult> ViewPackage(string packageId) { await GetLoggedInUser(); var package = await _tourPackageService.GetPackageWithRelatedSpotsAsync(new Guid(packageId)); var model = new PackageViewModel() { Package = package, Company = _companyService.Get(package.CompanyId), Loves = package.Loves.Count, IsLoved = user == null ? true : package.Loves.Where(l => l.AuthorId == user.Id).Any(), }; return(View(model)); }
public async Task <ActionResult> Create(PackageViewModel model) { Package MainModel = model._MainObj; MainModel.CrtdDT = DateTime.Now; MainModel.CrtdUserId = long.Parse(User.Identity.GetUserId()); MainModel.CrtdUserName = User.Identity.Name; MainModel.StateId = (int)EnumCore.StateType.enable; MainModel.StateName = "Enable"; int rs = await cms_db.CreatePackageAsync(MainModel); int rs2 = await cms_db.CreateUserHistory(long.Parse(User.Identity.GetUserId()), Request.ServerVariables["REMOTE_ADDR"], (int)EnumCore.ActionType.Create, "Create", MainModel.PackageId, MainModel.PackageName, "PackageManager", (int)EnumCore.ObjTypeId.package); return(RedirectToAction("Index")); }
public static void ShowWindow(FormType formType, PackageViewModel source) { ContainerWindow.ShowWindow(new ContainerWindowViewModel { Title = "内核包", FormType = formType, IconName = "Icon_Package", IsMaskTheParent = true, Width = 860, Height = 300, CloseVisible = System.Windows.Visibility.Visible }, ucFactory: (window) => { PackageViewModel vm = new PackageViewModel(source); window.AddCloseWindowOnecePath(vm.Id); return(new PackageEdit(vm)); }, fixedSize: false); }
public async Task InstallPackageAsync( PackageViewModel packageViewModel, CancellationToken cancellationToken = default(CancellationToken)) { var package = new InteractivePackage(packageViewModel.Package); var installedPackages = await Workbook.Packages.InstallPackageAsync( package, packageViewModel.SourceRepository, cancellationToken); // TODO: Should probably alert user that the package is already installed. // Should we add a fresh #r for the package in case that's what they're trying to get? // A feel good thing? if (installedPackages.Count == 0) { return; } foreach (var installedPackage in installedPackages) { ReferencePackageInWorkspace(installedPackage); await LoadPackageIntegrationsAsync(installedPackage, cancellationToken); } // TODO: Figure out metapackages. Install Microsoft.AspNet.SignalR, for example, // and no #r submission gets generated, so all the workspace reference stuff // above fails to bring in references to dependnet assemblies automatically. // User must type them out themselves. // // This was busted in our NuGet 2.x code as well. package = installedPackages.FirstOrDefault( p => PackageIdComparer.Equals(p, package)); // TODO: Same issue as installedPackages.Count == 0. What do we want to tell user? // probably they tried to install a package they already had installed, and // maybe it bumped a shared dep (which is why installedPackages is non-empty). if (package == null) { return; } await ReferenceTopLevelPackageAsync( package, cancellationToken); }
public ActionResult Create(PackageViewModel model) { _commonHelper = new CommonHelper(); if (_commonHelper.CreatePackage(model, User.Identity.Name)) { Success("The package has been created successfully.", true); return(RedirectToAction("Index")); } else { Danger("The package has been created successfully.", false); } model.PackageTypes = _commonHelper.GetPackageTypes(); _commonHelper = null; return(View(model)); }
public async Task <OkObjectResult> GetPackage(string name) { var entity = await _services.GetPackageByName(name); var result = PackageViewModel.FromEntity(entity); if (result.ProjectBlockId != null) { var layoutBlock = _projecst.GetParentOfProjectBlock(result.ProjectBlockId ?? 0); result.Layout = ProjectBlockViewModelExtension.FromEnitity(layoutBlock); var perspective = _projecst.GetProjectBlock(result.ProjectBlockId ?? 0); result.Perspective = ProjectBlockViewModelExtension.FromEnitity(perspective); } return(Ok(result)); }
public ActionResult Index(PackageViewModel model) { var db = Globals.GetDatabase(); var newPackage = new Package(); newPackage.PackageName = model.PackageName; newPackage.StartDate = model.StartDate; newPackage.EndDate = model.EndDate; newPackage.Description = model.Description; newPackage.Cap = model.Cap; newPackage.Amount = model.Amount; newPackage.PicturePath = model.PicturePath; db.Packages.Add(newPackage); db.SaveChanges(); ViewBag.Message = "Your package has been created"; return(View()); }
public IHttpResponse Create(PackageViewModel model) { if (User.Role != Role.Admin.ToString()) { return(View("/")); } if (!_packagesService.CreatePackage(model, Db)) { var errorMessage = $"Package : {model.Description} not created"; return(View("/error", new ErrorViewModel(errorMessage))); } var userViewModel = _usersService.Profile(User.Username, Db); return(View("/home/loggedInUser", userViewModel)); }
public long Save(PackageViewModel tbl) { PackageMaster vendortype = new PackageMaster() { AccessUsers = tbl.AccessUsers, Gender = tbl.Gender, IsDelete = false, PackageName = tbl.PackageName, Price = tbl.Price, Validity = tbl.Validity }; //tbl.IsDelete = false; objData.PackageMasters.Add(vendortype); objData.SaveChanges(); return(vendortype.PackageId.Value); }
public PackageManagerViewModel(IExperiment experiment) { m_experiment = experiment; var references = new HashSet<string>(experiment.References.Select((a) => { return a.ID; })); var manager = TraceLab.Core.PackageSystem.PackageManager.Instance; foreach (TraceLabSDK.PackageSystem.IPackage package in manager) { var packageVM = new PackageViewModel(package); packageVM.IsCheckedChanged += packageVM_IsCheckedChanged; if (references.Contains(package.ID)) { packageVM.IsChecked = true; } m_packages.Add(packageVM); } }
void ShowPackageInformation(PackageViewModel packageViewModel) { this.packageVersionTextBox.Text = packageViewModel.Version.ToString (); this.packageCreatedByTextBox.Text = packageViewModel.GetAuthors (); this.packageLastUpdatedTextBox.Text = packageViewModel.GetLastPublishedDisplayText (); this.packageDownloadsTextBox.Text = packageViewModel.GetDownloadCountDisplayText (); this.packageDescriptionTextView.Buffer.Text = packageViewModel.Description; this.packageIdTextBox.Text = packageViewModel.Id; this.packageIdTextBox.Visible = packageViewModel.HasNoGalleryUrl; ShowUri (this.packageIdButton, packageViewModel.GalleryUrl, packageViewModel.Id); ShowUri (this.moreInformationButton, packageViewModel.ProjectUrl); ShowUri (this.viewLicenseTermsButton, packageViewModel.LicenseUrl); this.packageDependenciesListHBox.Visible = packageViewModel.HasDependencies; this.packageDependenciesNoneLabel.Visible = !packageViewModel.HasDependencies; this.packageDependenciesListLabel.Text = packageViewModel.GetPackageDependenciesDisplayText (); EnablePackageActionButtons (packageViewModel); this.packageInfoFrameVBox.Visible = true; this.managePackageButtonBox.Visible = true; }
void EnablePackageActionButtons(PackageViewModel packageViewModel) { this.addPackageButton.Visible = !packageViewModel.IsManaged; this.removePackageButton.Visible = !packageViewModel.IsManaged; this.managePackageButton.Visible = packageViewModel.IsManaged; this.addPackageButton.Sensitive = !packageViewModel.IsAdded; this.removePackageButton.Sensitive = packageViewModel.IsAdded; }
void AppendPackageToTreeView(PackageViewModel packageViewModel) { packageStore.AppendValues ( ImageService.GetPixbuf ("md-nuget-package", IconSize.Dnd), packageViewModel.GetDisplayTextMarkup (), packageViewModel); }
public PackageView(PackageViewModel viewModel) : base(viewModel) { InitializeComponent(); }
void ShowPackageInformation (PackageViewModel packageViewModel) { this.packageNameLabel.Markup = packageViewModel.GetNameMarkup (); this.packageVersionLabel.Text = packageViewModel.Version.ToString (); this.packageAuthor.Text = packageViewModel.GetAuthors (); this.packagePublishedDate.Text = packageViewModel.GetLastPublishedDisplayText (); this.packageDownloads.Text = packageViewModel.GetDownloadCountDisplayText (); this.packageDescription.Text = packageViewModel.Description; this.packageId.Text = packageViewModel.Id; this.packageId.Visible = packageViewModel.HasNoGalleryUrl; ShowUri (this.packageIdLink, packageViewModel.GalleryUrl, packageViewModel.Id); ShowUri (this.packageProjectPageLink, packageViewModel.ProjectUrl); ShowUri (this.packageLicenseLink, packageViewModel.LicenseUrl); this.packageDependenciesListHBox.Visible = packageViewModel.HasDependencies; this.packageDependenciesNoneLabel.Visible = !packageViewModel.HasDependencies; this.packageDependenciesList.Text = packageViewModel.GetPackageDependenciesDisplayText (); this.packageInfoVBox.Visible = true; }
void DrawCheckBox (Context ctx, PackageViewModel packageViewModel, Rectangle cellArea) { CreateCheckboxImages (); Image image = GetCheckBoxImage (packageViewModel.IsChecked); double alpha = GetCheckBoxImageAlpha (); ctx.DrawImage ( image, cellArea.Left + checkBoxPadding.Left, cellArea.Top + ((cellArea.Height - checkBoxImageSize.Height - 2) / 2), alpha); }
public NuGetPackageToAdd(PackageViewModel viewModel) { var package = viewModel.GetPackage (); Id = package.Id; Version = package.Version.ToString (); }
void InstallPackage (PackageViewModel packageViewModel) { try { if (packageViewModel != null) { List<IPackageAction> packageActions = CreateInstallPackageActions (new PackageViewModel [] { packageViewModel }); InstallPackages (packageActions); } } catch (Exception ex) { LoggingService.LogError ("Installing package failed.", ex); ShowErrorMessage (ex.Message); } }
void LoadPackageImage (int row, PackageViewModel packageViewModel) { if (packageViewModel.HasIconUrl) { // Workaround: Image loading is incorrectly being done on GUI thread // since the wrong synchronization context seems to be used. So // here we switch to a background thread and then back to the GUI thread. Task.Run (() => LoadImage (packageViewModel.IconUrl, row)); } }
void AppendPackageToListView (PackageViewModel packageViewModel) { int row = packageStore.AddRow (); packageStore.SetValue (row, packageHasBackgroundColorField, IsOddRow (row)); packageStore.SetValue (row, packageCheckBoxAlphaField, GetPackageCheckBoxAlpha ()); packageStore.SetValue (row, packageViewModelField, packageViewModel); }
public PackageCellViewEventArgs (PackageViewModel packageViewModel) { PackageViewModel = packageViewModel; }
private void LoadData() { _reader = new PackageReader(); _reader.Read(PathToFile); PackageViewModel = new PackageViewModel(_reader); MetadataViewModel = new MetadataViewModel(_reader); ManifestViewModel = new ManifestViewModel(_reader); RequiresViewModel = new RequiresViewModel(_reader); DefineViewModel = new DefineViewModel(_reader); SigningViewModel = new SigningViewModel(_reader); LicenseViewModel = new LicenseViewModel(_reader); CompatibilityPolicy = new CompatibilityPolicyViewModel(_reader); ApplicationRoleViewModel = new ApplicationRoleViewModel(_reader); AssemblyRoleViewModel = new AssemblyRoleViewModel(_reader); FilesViewModel = new FilesViewModel(_reader); //PackageCompositionViewModel = new PackageCompositionViewModel(_reader); //_allViewModels.Add(PackageViewModel); }
void OnPackageChecked (PackageViewModel packageViewModel) { if (PackageChecked != null) { PackageChecked (this, new PackageCellViewEventArgs (packageViewModel)); } }
private void CreateModels(PackageReader reader) { string package = "package"; _packageViewModel = new PackageViewModel() { Name = reader.GetRulesPropertyValueByName(package, "name"), DisplayName = reader.GetRulesPropertyValueByName(package, "display-name"), Architecture = reader.GetRulesPropertyValueByName(package, "arch"), Feed = reader.GetRulesPropertyValueByName(package, "feed"), Location = reader.GetRulesPropertyValueByName(package, "location"), Publisher = reader.GetRulesPropertyValueByName(package, "publisher"), Version = reader.GetRulesPropertyValueByName(package, "version") }; string metadata = "metadata"; _metadataViewModel = new MetadataViewModel() { Summary = reader.GetRulesPropertyValueByName(metadata, "summary"), Description = reader.GetRulesPropertyValueByName(metadata, "description"), AuthorVersion = reader.GetRulesPropertyValueByName(metadata, "author-version"), BugTracker = reader.GetRulesPropertyValueByName(metadata, "bug-tracker"), Stability = reader.GetRulesPropertyValueByName(metadata, "stability"), Licenses = reader.GetRulesPropertyValueByName(metadata, "licenses"), }; //_requiresViewModel = new RequiresViewModel() //{ // RequiredPackages = new ObservableCollection<Package>() //}; _packageCompositionViewModel = new PackageCompositionViewModel() { Symlinks = reader.GetRulesPropertyValueByName("package-composition", "symlinks") }; _packageCompositionViewModel = new PackageCompositionViewModel() { Symlinks = reader.GetRulesPropertyValueByName("package-composition", "symlinks") }; _filesCollection = new ObservableCollection<FilesViewModel>(); foreach (string parameter in reader.ReadFilesParameters()) { ObservableCollection<string> collection = new ObservableCollection<string>(reader.GetFilesIncludeList(parameter)); FilesViewModel model = new FilesViewModel(parameter) { Root = reader.GetFilesRulesPropertyValueByParameterAndName(parameter,"root"), TrimPath = reader.GetFilesRulesPropertyValueByParameterAndName(parameter, "trim-path"), Include = collection }; _filesCollection.Add(model); } }
protected CommandBase(PackageViewModel viewModel) { this.ViewModel = viewModel; }
public ActionResult BillingOptions(int id) { TempData["SelectedMenu"] = "Account"; TempData["SelectedSubMenu"] = "Billing"; User userObj = (User)Session["user"]; Account accountObj = (Account)Session["account"]; if (userObj.PrimaryUser == false) return RedirectToAction("Index", "Admin"); decimal additionalPrice = 0; //TempData["SelectedMenu"] = "Subscription"; List<List<string>> typeListObj = new List<List<string>>(); PackageViewModel packageViewModel = new PackageViewModel(); //trial Data if (Session["trialData"] != null) { TrialDataModel trialObj = (TrialDataModel)Session["trialData"]; packageViewModel.trialObj = trialObj; } //get all plans var plans = planRepository.Plans.ToList(); // plans.RemoveAll(pname => pname.Name == "Free"); packageViewModel.Plans = plans; // get all types //var types = featureRepository.Features.Where(p => p.Price == 0).Select(f => f.Type).Distinct().ToList(); List<string> types = new List<string>(); types.Add("Sync Contacts"); types.Add("Sync Calendar"); types.Add("Sync Period"); //types.Add("Contacts Sync"); //types.Add("Calendar Sync"); //types.Add("Connections"); types.Add("Max Items per Folder"); types.Add("Fields Available"); types.Add("History Tracking"); types.Add("Third Party Connections"); packageViewModel.Types = types; // get selected plan var planID = accountRepo.Accounts.FirstOrDefault(aguid => aguid.AccountGUID == accountObj.AccountGUID).PlanID; packageViewModel.PlanID = planID; // get selected plan details var selectedPlanDetails = plans.FirstOrDefault(pid => pid.ID == planID); selectedPlanDetails.Price = selectedPlanDetails.Price; packageViewModel.SelectedPlanDetails = selectedPlanDetails; // run all plans foreach (var pln in plans) { var allFeatures = featureRepository.Features.Where(pl => pl.PlanLevel == pln.PlanLevel).ToList(); List<string> typesList = new List<string>(); foreach (var typ in types) { var res = allFeatures.FirstOrDefault(t => t.Type == typ); if (res != null) { typesList.Add(res.Name); } else { typesList.Add("-"); } } typeListObj.Add(typesList); } packageViewModel.Names = typeListObj; // get card details from stripe var stripeCustomerID = accountRepo.Accounts.FirstOrDefault(aguid => aguid.AccountGUID == accountObj.AccountGUID).StripeCustomerID; if (stripeCustomerID != null) { // default card details var customer = new StripeCustomerService(); customer.ApiKey = "sk_test_4Xusc3Meo8gniONh6dDRZvlp"; var cusRes = customer.Get(stripeCustomerID); var defaultCardID = cusRes.StripeDefaultCardId; packageViewModel.DefaultCardID = defaultCardID; // get saved quantity var featureQuality = featureRepository.Features.FirstOrDefault(pid => pid.PlanLevel == selectedPlanDetails.PlanLevel & pid.Type == "Max Items per Folder"); var savedQuality = purchRepository.Purchases.FirstOrDefault(fid => fid.FeatureID == featureQuality.ID && fid.AccountGUID == accountObj.AccountGUID); if (savedQuality != null) { var quantitySaved = (savedQuality.Quantity) / (featureQuality.Quantity); packageViewModel.QuantitySaved = quantitySaved; } else { packageViewModel.QuantitySaved = 1; } var cards = new StripeCardService(); cards.ApiKey = "sk_test_4Xusc3Meo8gniONh6dDRZvlp"; var objCard = cards.List(stripeCustomerID, null); List<CardViewModel> allCardDetails = new List<CardViewModel>(); foreach (var card in objCard) { CardViewModel objcard = new CardViewModel(); objcard.CardID = card.Id; objcard.Name = card.Name; objcard.Number = "**** " + card.Last4; objcard.Type = card.Brand; objcard.ExpireDate = card.ExpirationYear + "/" + card.ExpirationMonth; allCardDetails.Add(objcard); } packageViewModel.CardDetails = allCardDetails; } else { packageViewModel.CardDetails = null; } // End get card details if (id == 2) { ViewBag.MessagePass = "******"; } else { ViewBag.MessagePass = ""; } return View(packageViewModel); }