public void AFailedSimplePreAuthAndValidateCollection() { var paymentWithCard = GetCardPaymentModel("432438862"); var response = JudoPayApi.PreAuths.Create(paymentWithCard).Result; Assert.IsNotNull(response); Assert.IsFalse(response.HasError); var receipt = response.Response as PaymentReceiptModel; Assert.IsNotNull(receipt); Assert.AreEqual("Success", receipt.Result); Assert.AreEqual("PreAuth", receipt.Type); var collection = new CollectionModel { Amount = 20, ReceiptId = response.Response.ReceiptId, }; var collectionResponse = JudoPayApi.Collections.Create(collection).Result; // The collection will go through since it is less than the preauth amount Assert.That(collectionResponse.HasError, Is.False); Assert.That(collectionResponse.Response.ReceiptId, Is.GreaterThan(0)); var validateResponse = JudoPayApi.Collections.Create(collection).Result; Assert.That(validateResponse, Is.Not.Null); Assert.That(validateResponse.HasError, Is.True); Assert.That(validateResponse.Error.Message, Is.EqualTo("Sorry, but the amount you're trying to collect is greater than the pre-auth")); Assert.That(validateResponse.Error.Code, Is.EqualTo(46)); }
BloomWebSocketServer webSocketServer); //autofac uses this public BulkBloomPubCreator(BookServer bookServer, CollectionModel collectionModel, BloomWebSocketServer webSocketServer) { _bookServer = bookServer; _collectionModel = collectionModel; _webSocketServer = webSocketServer; }
public void ASimplePreAuthAndCollection() { var paymentWithCard = GetCardPaymentModel(); var response = JudoPayApi.PreAuths.Create(paymentWithCard).Result; Assert.IsNotNull(response); Assert.IsFalse(response.HasError); var receipt = response.Response as PaymentReceiptModel; Assert.IsNotNull(receipt); Assert.AreEqual("Success", receipt.Result); Assert.AreEqual("PreAuth", receipt.Type); var collection = new CollectionModel { Amount = 25, ReceiptId = response.Response.ReceiptId, }; response = JudoPayApi.Collections.Create(collection).Result; Assert.IsNotNull(response); Assert.IsFalse(response.HasError); receipt = response.Response as PaymentReceiptModel; Assert.IsNotNull(receipt); Assert.AreEqual("Success", receipt.Result); Assert.AreEqual("Collection", receipt.Type); }
/// <summary> /// Update Collection /// </summary> /// <returns></returns> public async Task UpdateCollection(string authToken, string plexServerHost, string libraryKey, CollectionModel collectionModel) { var apiRequest = new ApiRequestBuilder(plexServerHost, "library/sections/" + libraryKey + "/all", HttpMethod.Put) .AddPlexToken(authToken) .AddRequestHeaders(GetClientIdentifierHeader()) .AcceptJson() .AddQueryParams(new Dictionary <string, string>() { { "type", "18" }, { "id", collectionModel.RatingKey }, { "includeExternalMedia", "1" }, { "title.value", collectionModel.Title }, { "titleSort.value", collectionModel.TitleSort }, { "summary.value", collectionModel.Summary }, { "contentRating.value", collectionModel.ContentRating }, { "title.locked", "1" }, { "titleSort.locked", "1" }, { "contentRating.locked", "1" } }) .Build(); await _apiService.InvokeApiAsync(apiRequest); }
public CollectionModel gethistories(int khId) { var collec = new CollectionModel(); collec.item1 = BLLKhachHang.Instance.GetAllDVs(connectString, khId); collec.item2 = BLLKhachHang.Instance.GetAllbikes(connectString, khId); return(collec); }
public InitializeMotecsCommand(LocationModel location, MotecParser parser, CollectionModel <MotecModel> collection, R3eDatabase r3eDatabase, GraphicalAssetFactory assetFactory) { this.location = location; this.parser = parser; this.collection = collection; r3EDatabase = r3eDatabase; this.assetFactory = assetFactory; }
public CollectionModel Update(CollectionModel collectionChanges) { var collection = _context.Collections.Attach(collectionChanges); collection.State = Microsoft.EntityFrameworkCore.EntityState.Modified; _context.SaveChanges(); return(collectionChanges); }
/// <summary> /// 构造 /// </summary> /// <param name="scheduleID"></param> public WorkerController(int scheduleID) { //采集model collModel = CollectionInfo.CollctionModelList.Find(n => n.CollectionId == scheduleID); //采集插件 plugin = new PluginGeneral(Type.GetType("NovelCollProject.plugin." + collModel.Plugin + ".Page")); plugin._CollectionModel = collModel; }
public async Task <IActionResult> Delete(int id) { CollectionModel col = await _collectionRepository.GetCollectionById(id); await _collectionRepository.Delete(id); return(RedirectToAction(nameof(AddNewCollection), new { isSuccess = true, projectId = col.ProjectsID })); }
public dynamic Get() { var root_model = new CollectionModel(); root_model.self = new Link{href = "/"}; root_model.AddCollectionLink(new Link { href = "/contacts", name = "Contacts", prompt = "Contacts", rel = "Contacts" }); return new {collection = root_model}; }
private string _previousTargetSaveAs; // enhance: should this be shared with CollectionApi or other save as locations? public BookCommandsApi(CollectionModel collectionModel, BloomWebSocketServer webSocketServer, BookSelection bookSelection, SpreadsheetApi spreadsheetApi) { _collectionModel = collectionModel; _webSocketServer = webSocketServer; _bookSelection = bookSelection; this._spreadsheetApi = spreadsheetApi; _collectionModel.BookCommands = this; }
public async Task <IActionResult> EditCollection(CollectionModel collectionModel) { Collection oldCollection = await db.Collections.FirstOrDefaultAsync(x => x.Id == collectionModel.IdCollection); oldCollection.Name = collectionModel.NameCollection; oldCollection.Description = collectionModel.Description; if (collectionModel.NameField != null) { if (oldCollection.FormattedFields.Count != collectionModel.NameField.Count) { int countNewFields = collectionModel.TypeField.Count; int index = oldCollection.FormattedFields.Count; List <Field> fields = oldCollection.FormattedFields; for (int i = 0; i < countNewFields; i++) { fields.Add(new Field(collectionModel.NameField[index], collectionModel.TypeField[i])); index++; } oldCollection.FormattedFields = fields; List <Item> items = db.Items.Where(x => x.CollectionId == oldCollection.Id).ToList(); for (int j = 0; j < items.Count; j++) { for (int i = 0; i < countNewFields; i++) { items[j].Values += ","; } db.Items.Update(items[j]); } } else { List <Field> fields = new List <Field>(); for (int i = 0; i < oldCollection.FormattedFields.Count; i++) { fields.Add(new Field(collectionModel.NameField[i], oldCollection.FormattedFields[i].Type)); } oldCollection.FormattedFields = fields; } } User ownerUser = await db.Users.FirstOrDefaultAsync(u => u.Id == oldCollection.UserId); string ownerId = ownerUser.Id; db.Collections.Update(oldCollection); await db.SaveChangesAsync(); return(RedirectToAction("UserPage", "Home", new { idUser = ownerId })); }
/// <summary> /// Creates an opened database collection tree item control. /// </summary> public CollectionTreeItem(DatabaseModel db, CollectionModel collection) { Collection = collection; Database = db; Image = Icon.FromResource("LiteDB.Explorer.Core.Assets.Icons.Open.ico", typeof(CollectionTreeItem).Assembly); Text = collection.Name; collection.PropertyChanged += collectionOnPropertyChanged; }
public CollectionApi(CollectionSettings settings, CollectionModel collectionModel, BookSelection bookSelection, EditBookCommand editBookCommand, BookThumbNailer thumbNailer, BloomWebSocketServer webSocketServer) { _settings = settings; _collectionModel = collectionModel; _bookSelection = bookSelection; _editBookCommand = editBookCommand; _thumbNailer = thumbNailer; _webSocketServer = webSocketServer; }
public CollectionModel GetCollection() { var uId = HttpContext.User.Id(); var result = _collectionSource.GetCollection(uId); if (result == null || result.OwnedCards == null || result.BorrowedCards == null) { return(null); } var uniqueCardNames = GetUniqueCardNames(result.OwnedCards.Keys, result.BorrowedCards.Keys); var cardInfo = GetCardInfo(uniqueCardNames); var newBorrowedCards = new Dictionary <string, IDictionary <string, IBorrowedCard> >(); //var userids = result.BorrowedCards.SelectMany(card => card.Value.Select(user => user.Key)).ToArray(); var userids = result.OwnedCards.Where(card => card.Value.LentTo.Count > 0) .SelectMany(card => card.Value.LentTo.Keys) .Concat( result.BorrowedCards.SelectMany(card => card.Value.Select(user => user.Key)) ).ToArray(); var userNames = _userSource.GetUserNamesByUserIds(userids); foreach (var borrowedCards in result.BorrowedCards) { var cardName = borrowedCards.Key; var borrowed = borrowedCards.Value; foreach (var user in borrowed) { var bCard = new BorrowedCardModel { AmountBorrowed = user.Value.AmountBorrowed, CardId = user.Value.CardId, Lender = user.Value.Lender, LenderUserName = userNames[user.Value.Lender] }; if (!newBorrowedCards.ContainsKey(cardName)) { newBorrowedCards[cardName] = new Dictionary <string, IBorrowedCard>(); } newBorrowedCards[cardName].Add(user.Value.Lender, bCard); } } var model = new CollectionModel { CardInfo = cardInfo, UserCollection = new Collection { BorrowedCards = newBorrowedCards, CollectionId = result.CollectionId, OwnedCards = result.OwnedCards, UserId = result.UserId }, UserIdToUserName = userNames }; return(model); }
public void GetCollectionsTransactions() { var judo = JudoPaymentsFactory.Create(Configuration.Token, Configuration.Secret, Configuration.Baseaddress); var paymentWithCard = new CardPaymentModel { JudoId = Configuration.Judoid, YourPaymentReference = "578543", YourConsumerReference = "432438862", Amount = 25, CardNumber = "4976000000003436", CV2 = "452", ExpiryDate = "12/15", CardAddress = new CardAddressModel { Line1 = "Test Street", PostCode = "W40 9AU", Town = "Town" } }; var response = judo.PreAuths.Create(paymentWithCard).Result; Assert.IsNotNull(response); Assert.IsFalse(response.HasError); Assert.AreEqual("Success", response.Response.Result); var collection = new CollectionModel { Amount = 25, ReceiptId = int.Parse(response.Response.ReceiptId), YourPaymentReference = "578543" }; response = judo.Collections.Create(collection).Result; Assert.IsNotNull(response); Assert.IsFalse(response.HasError); Assert.AreEqual("Success", response.Response.Result); var paymentReceipt = response.Response as PaymentReceiptModel; Assert.IsNotNull(paymentReceipt); var transactions = judo.Consumers.GetCollections(paymentReceipt.Consumer.ConsumerToken).Result; Assert.IsNotNull(transactions); Assert.IsFalse(transactions.HasError); Assert.IsNotEmpty(transactions.Response.Results); // ReSharper disable once PossibleNullReferenceException Assert.AreEqual(Configuration.Judoid, transactions.Response.Results.FirstOrDefault().JudoId.ToString(CultureInfo.InvariantCulture)); // ReSharper disable once PossibleNullReferenceException Assert.AreEqual(response.Response.ReceiptId, transactions.Response.Results.FirstOrDefault().ReceiptId); }
public SelectBackgroundCommand(MenuButtonEventArgs args, ScreenModel screenModel, CollectionModel <BackgroundModel> backgroundCollection, PlaceHolderCollectionModel placeholderCollection, UserPreferencesModel preferences, Database database) { this.args = args; this.screenModel = screenModel; this.backgroundCollection = backgroundCollection; this.placeholderCollection = placeholderCollection; this.preferences = preferences; this.database = database; }
public ActionResult Index() { CollectionModel model = new CollectionModel() { collection = collectionrepository.Collections.Where(col => col.CollectionStatus == true).OrderByDescending(col => col.CollectionID).FirstOrDefault(), collectionlist = collectionrepository.Collections.Where(list => list.CollectionStatus == true).OrderByDescending(list => list.CollectionID).ToList() }; return(View(model)); }
public DeleteBackgroundCommand(IntEventArgs args, CollectionModel <BackgroundModel> backgroundCollection, ScreenModel screenModel, Database database, LocationModel locationModel, CollectionModel <ProfileModel> profileCollection) { this.args = args; this.backgroundCollection = backgroundCollection; this.screenModel = screenModel; this.database = database; this.locationModel = locationModel; this.profileCollection = profileCollection; }
public async Task <IActionResult> Edit(CollectionModel collection, int?page) { _db.Update(collection); var pageNumber = page ?? 1; var collections = _db.GetAllCollections(); var collectionList = await collections.OrderBy(m => m.Id).ToPagedListAsync(pageNumber, 4); return(View("Index", collectionList)); }
// GET: Create public IActionResult Create() { var collections = _db.GetAllCollections(); var collectionId = collections.Max(m => m.Collection_Id); var model = new CollectionModel(); model.Collection_Id = collectionId + 1; return(View(model)); }
public static ServiceCollection ToServiceCollection(this CollectionModel cl) { return(new ServiceCollection { ID = cl.ID, Name = cl.Name, Description = cl.Description, UserID = cl.UserID }); }
public ActionResult Detail(int collectionid) { CollectionModel model = new CollectionModel() { collection = db.Collections.Find(collectionid), picture = picturerepository.CollectionPictures.Where(p => p.CollectionID == collectionid && p.CollectionPictureStatus == true).ToList() }; return(View(model)); }
public DeleteProfileCommand(IntEventArgs args, CollectionModel <ProfileModel> profileCollection, SelectedProfileModel profileSelection, Database database, LocationModel location, LayoutIOModel layoutIO) { this.args = args; this.profileCollection = profileCollection; this.profileSelection = profileSelection; this.database = database; this.location = location; this.layoutIO = layoutIO; }
public ImportBackgroundCommand(ImportBackgroundEventArgs args, ScreenModel screenModel, LocationModel locationModel, Database database, CollectionModel <BackgroundModel> collection, PlaceHolderCollectionModel placeholderCollection) { this.args = args; this.screenModel = screenModel; this.locationModel = locationModel; this.database = database; this.collection = collection; this.placeholderCollection = placeholderCollection; }
public CollectionModel Delete(int id) { CollectionModel collection = _context.Collections.Where(m => m.Collection_Id == id).FirstOrDefault(); if (collection != null) { _context.Collections.Remove(collection); _context.SaveChanges(); } return(collection); }
private async Task SearchAsync() { Notes = await NoteService.SearchAsync( query : AppState.Query, offset : _offset, limit : AppState.Limit, sortProperty : AppState.Property, sortDirection : AppState.Direction); await InvokeAsync(StateHasChanged); }
public IHttpActionResult GetCollectionModel(int id) { CollectionModel collectionModel = db.Collections.Find(id); if (collectionModel == null) { return(NotFound()); } return(Ok(collectionModel)); }
public IHttpActionResult GetCollectionModel(int id, [FromUri] string fields) { CollectionModel collectionModel = db.Collections.Find(id); if (collectionModel == null) { return(NotFound()); } return(Ok(collectionModel.GetFieldsFromModel(fields))); }
private void CollectionDetails(int CollectionID) { collectionLogic = collectionLogic.GetCollectionById(CollectionID); List <CollectionModel> collectionDetails = new List <CollectionModel>(); collectionDetails.Add(collectionLogic); dvCollection.DataSource = collectionDetails; dvCollection.DataBind(); }
public void ASimplePreAuthAndCollection() { var judo = JudoPaymentsFactory.Create(Configuration.Token, Configuration.Secret, Configuration.Baseaddress); var paymentWithCard = new CardPaymentModel { JudoId = Configuration.Judoid, YourPaymentReference = "578543", YourConsumerReference = "432438862", Amount = 25, CardNumber = "4976000000003436", CV2 = "452", ExpiryDate = "12/15", CardAddress = new CardAddressModel { Line1 = "Test Street", PostCode = "W40 9AU", Town = "Town" } }; var response = judo.PreAuths.Create(paymentWithCard).Result; Assert.IsNotNull(response); Assert.IsFalse(response.HasError); var receipt = response.Response as PaymentReceiptModel; Assert.IsNotNull(receipt); Assert.AreEqual("Success", receipt.Result); Assert.AreEqual("PreAuth", receipt.Type); var collection = new CollectionModel { Amount = 25, ReceiptId = int.Parse(response.Response.ReceiptId), YourPaymentReference = "578543" }; response = judo.Collections.Create(collection).Result; Assert.IsNotNull(response); Assert.IsFalse(response.HasError); receipt = response.Response as PaymentReceiptModel; Assert.IsNotNull(receipt); Assert.AreEqual("Success", receipt.Result); Assert.AreEqual("Collection", receipt.Type); }
public override async Task UpdateInfoFromOnline(CollectionModel collection, CollectionVersionModel collectionVersion, Account author, IContentManager contentList) { await base.UpdateInfoFromOnline(collection, collectionVersion, author, contentList).ConfigureAwait(false); Subscribers = collection.Subscribers; AuthorAvatarUrl = author.Avatar; Author = author.DisplayName; collectionVersion.Repositories.SyncCollectionLocked(Repositories); UpdateServersInfo(collectionVersion); await SynchronizeMods(contentList, collectionVersion).ConfigureAwait(false); }
public async Task RefreshCollections() { this.Collections = new List<CollectionModel>(); FeedResponse<DocumentCollection> collections; using (PerformanceWatcher.Start("ReadCollectionFeed")) { collections = await this._client.ReadDocumentCollectionFeedAsync(_db.SelfLink); } foreach (DocumentCollection collection in collections) { CollectionModel model = new CollectionModel(_client, this, collection); this.Collections.Add(model); } }
public CollectionExpItemVM(DatabaseExpItemVM parentDatabaseExp, CollectionModel model, MainVM main, CollectionViewModel sourceView = null, CollectionExpItemVM viewSourceCollection = null) : base(main) { _parentDbExpItem = parentDatabaseExp; _model = model; if (sourceView != null) { this.View = sourceView; IsView = true; ViewSourceCollection = viewSourceCollection; } else { this.View = new CollectionViewModel(); IsView = false; } this.ContextMenuItems.Add(new MenuItemVM() { Caption = "Refresh", Command = new LambdaCommand((o) => _wrkspc?.Refresh()) }); if (sourceView == null) { var savedCollection = Config.Instance.GetCollection(model.AccountEndpoint, model.DatabaseName, model.Name); if (savedCollection != null) { this.IsExpanded = savedCollection.IsExpanded; if (savedCollection.Views != null) { foreach (var view in savedCollection.Views) { this.Children.Add(new CollectionExpItemVM(parentDatabaseExp, model, main, view, this)); } } } this.ContextMenuItems.Add(new MenuItemVM() { Caption = "Delete collection", Command = new LambdaCommand(async (o) => { MessageBoxResult messageBoxResult = System.Windows.MessageBox.Show("Are you sure?", "Delete Confirmation", System.Windows.MessageBoxButton.YesNo); if (messageBoxResult == MessageBoxResult.Yes) { await this._model.DeleteCollectionFromDatabase(); parentDatabaseExp.Children.Remove(this); } }) }); } else { this.ContextMenuItems.Add(new MenuItemVM() { Caption = "Delete view", Command = new LambdaCommand((o) => { MessageBoxResult messageBoxResult = System.Windows.MessageBox.Show("Are you sure?", "Delete Confirmation", System.Windows.MessageBoxButton.YesNo); if (messageBoxResult == MessageBoxResult.Yes) { this.ViewSourceCollection.Children.Remove(this); this.ViewSourceCollection.IsSelected = true; Config.Instance.RemoveCollectionView(_model.AccountEndpoint, _model.DatabaseName, this.View); } }) }); } }
/// <summary> /// Creates a new instance with the specified collection language model. </summary> public LMSimilarity(CollectionModel collectionModel) { this.collectionModel = collectionModel; }
public DocumentModel(DocumentClient client, CollectionModel sourceCollection, Document document) : base(client) { _document = document; _sourceCollection = sourceCollection; }
/// <summary> /// Instantiates with the specified collectionModel and λ parameter. </summary> public LMJelinekMercerSimilarity(CollectionModel collectionModel, float lambda) : base(collectionModel) { this.Lambda_Renamed = lambda; }
public ActionResult Hidden(CollectionModel model) { return this.View(model); }
/// <summary> /// Instantiates the similarity with the default μ value of 2000. </summary> public LMDirichletSimilarity(CollectionModel collectionModel) : this(collectionModel, 2000) { }
public CollectionWrkspcVM(CollectionModel model, CollectionExpItemVM expItem): base() { _model = model; ExpItem = expItem; this.Collection = new CollectionVM(model, this); }
public CollectionVM(CollectionModel model, CollectionWrkspcVM wrkspc) { _model = model; Workspace = wrkspc; Filter = new CollectionFilterData(); Columns = new ObservableCollection<PropertyDefinitionModel> { new PropertyDefinitionModel { Name = "id", Path="id", Type = Enums.PropertyType.String } }; this.AvailableProperties = new ObservableCollection<PropertyDefinitionModel>(); this.MaxItems = 20; }
public ActionResult Index(CollectionModel model) { return this.View(model); }
/// <summary> /// Instantiates the similarity with the provided μ parameter. </summary> public LMDirichletSimilarity(CollectionModel collectionModel, float mu) : base(collectionModel) { this.Mu_Renamed = mu; }