/// <summary> /// 結束遊戲 /// </summary> internal void win_game(Brand brand) { //清除桌面上的牌 table.cleanImage(); //停止迴圈 roundTimer.Stop(); //把最後那張牌加入玩家手牌 all.NowPlayer.add(brand); //設定牌為可視並更新 table.ShowAll = true; table.addImage(); //呼叫台數計算 Tally t = new Tally(); t.setLocation(all.getLocation, all.Win_Times); t.setPlayer(all); t.ShowDialog(); //清除桌面上的牌 table.cleanImage(); //換到下一個莊 all.nextWiner(false); //設定全部的牌為不顯示 table.ShowAll = false; //開新的遊戲 newgame_round(); factory = new BrandFactory(); }
public BrandsTest() { BrandPlayer a = new BrandPlayer(); BrandFactory x = new BrandFactory(); x.createBrands(); x.randomBrands(); //x.PrintRadomTable(); //¦C¥X¶Ã¼Æªí a = x.getBrands(); Iterator ai; ai = a.creatIterator(10); print(ai); ai = a.creatIterator(3); a = removefromplayer(ai, a); ai = a.creatIterator(10); print(ai); //Console.WriteLine(); //Console.Write("{0},{1}\n", sa.getReadyBrand().getClass(),sa.getReadyBrand().getNumber()); //chackBrands(); //chackArrayList(); x.creatImageArray(); }
public AiTest() { BrandPlayer[] player = new BrandPlayer[4]; BrandPlayer table = new BrandPlayer(); BrandFactory x = new BrandFactory(); x.createBrands(); x.randomBrands(); table = x.getBrands(); Deal deal = new Deal(16, table); deal.DealBrands(); player = deal.Player; printplayer(player); //SimpleAI sa = new SimpleAI(); //sa.setPlayer(player[0]); //PlayerSort bs = new PlayerSort(player[0]); //player[0] = bs.getPlayer(); //PlayerSort bs = new PlayerSort(player[0]); PlayerSort bs = new PlayerSort(player[0], new FlowerBrand(0), new TenThousandBrand(0), new RopeBrand(0), new TubeBrand(0), new WordBrand(0)); player[0] = bs.getPlayer; Level_1 l = new Level_1(); l.setPlayer(player[0]); l.getReadyBrand(); //printplayer(player); //Level_1 l = new Level_1(); //BrandPlayer test = new BrandPlayer(); //test.add(new WordBrand(1)); //test.add(new WordBrand(1)); //test.add(new WordBrand(1)); //test.add(new WordBrand(2)); //test.add(new WordBrand(3)); //test.add(new WordBrand(3)); //test.add(new WordBrand(3)); //test.add(new WordBrand(5)); //l.setPlayer(test); l.setPlayer(player[0]); Brand t = l.getReadyBrand(); Console.WriteLine("==>{0}{1}", t.getNumber(), t.getClass()); //printplayer(player); //sa.getReadyBrand(); //Console.WriteLine(); //Console.WriteLine("Ready Brand is {0},{1}", l.getReadyBrand().getClass(), l.getReadyBrand().getNumber()); }
/// <summary> /// 転送オブジェクトをエンティティに変換します。 /// </summary> /// <returns> /// エンティティを返却します。 /// </returns> public IBrandEntityModel ConvertToEntity() { return(BrandFactory.Load( brandId: this.BrandId, brandName: this.BrandName, note: this.Note, updateDateTime: this.UpdateDateTime, updateUserId: this.UpdateUserId )); }
/// <summary> /// ブランドマスタリストを更新します。 /// </summary> /// <param name="input">ブランドマスタリストの更新対象。</param> public Task <HttpStatusCode> Put(IEnumerable <BrandInputModel> input) { return(Task.Run(() => { var addedBrands = input.GetAdded(); var modifiedBrands = input.GetModified(); var deletedBrands = input.GetDeleted(); var updateDateTime = DateTime.Now; var updateUserId = "Stub"; // 追加 foreach (var brand in addedBrands) { var addedBrand = DataBase.Brands.FirstOrDefault(p => p.BrandId.Equals(brand.BrandId)); if (addedBrand == null) { DataBase.Brands.Add(BrandFactory.Create( brandId: brand.BrandId, brandName: brand.BrandName, note: brand.Note, updateDateTime: updateDateTime, updateUserId: updateUserId )); } } // 更新 foreach (var brand in modifiedBrands) { var modifiedBrand = DataBase.Brands.FirstOrDefault(p => p.BrandId.Equals(brand.BrandId)); if (modifiedBrand == null) { continue; } modifiedBrand.BrandName = brand.BrandName; modifiedBrand.Note = brand.Note; modifiedBrand.UpdateDateTime = updateDateTime; modifiedBrand.UpdateUserId = updateUserId; } // 削除 foreach (var brand in deletedBrands) { var deletedBrand = DataBase.Brands.FirstOrDefault(p => p.BrandId.Equals(brand.BrandId)); if (deletedBrand == null) { continue; } DataBase.Brands.Remove(deletedBrand); } return HttpStatusCode.OK; })); }
public static Brand Execute(IRegisterNewBrandRequest request) { try { return(BrandFactory.MakeBrand(request)); } catch (Exception e) { throw e; } }
/// <summary> /// 建立牌,並分配牌 /// </summary> public void creatBrands() { factory = new BrandFactory(); factory.createBrands(); factory.randomBrands(); all.Table = factory.getBrands(); for (int i = 0; i < all.Table.getCount(); i++) { all.Table.getBrand(i).WhoPush = location.Table; } dealbrands(); }
public Brand() { //初始化ASP.NET内置对象 Response = System.Web.HttpContext.Current.Response; Request = System.Web.HttpContext.Current.Request; Server = System.Web.HttpContext.Current.Server; Session = System.Web.HttpContext.Current.Session; Application = System.Web.HttpContext.Current.Application; tools = ToolsFactory.CreateTools(); brand = BrandFactory.CreateBrand(); MyProductType = ProductTypeFactory.CreateProductType(); }
internal override void round() { try { // 如果是吃或碰不摸牌 if (Chow_Pong_Brand) { Chow_Pong_Brand = false; } else { touchBrand(); } // 目前狀態不等於玩家時 if (!NowPlayer_is_Real_Player) { makeBrand(getfromAI()); } else { setInforamtion(); } // 同步玩家資料 if (iAmServer) { chat.SendObject(all); } } catch (FlowOverException) { // 流局 MessageBox.Show(Settings.Default.FlowEnd); table.cleanImage(); factory = new BrandFactory(); all.nextWiner(true); // 建立牌 creatBrands(); // 新局 newgame_round(); } catch (ErrorBrandPlayerCountException) { MessageBox.Show(Settings.Default.ErrorBrandPlayer); } table.cleanImage(); table.addImage(); }
public DealTest() { BrandPlayer[] player = new BrandPlayer[4]; BrandPlayer table = new BrandPlayer(); BrandFactory x = new BrandFactory(); x.createBrands(); x.randomBrands(); table = x.getBrands(); Console.WriteLine("共有: {0}", table.getCount()); // 印出洗好的牌 printplayer(table, "亂數牌"); PlayerSort bbs = new PlayerSort(table); BrandPlayer sort_table = bbs.getPlayer; printplayer(sort_table, "亂數排序回去"); // 分配牌 Deal deal = new Deal(16, table); deal.DealBrands(); player = deal.Player; // 印出全部的玩家 printplayer(player); BrandPlayer check = new BrandPlayer(); foreach (BrandPlayer b in player) { for (int i = 0; i < b.getCount(); i++) { check.add(b.getBrand(i)); } } for (int i = 0; i < table.getCount(); i++) { check.add(table.getBrand(i)); } PlayerSort bs = new PlayerSort(check); check = bs.getPlayer; Console.WriteLine("\n共有: {0}", check.getCount()); printplayer(check, "重新檢查"); }
public ICommandResult Create(AssetCommand command) { try { if (command.IsValid()) { var brandResult = this.brandRepository.GetById(new Guid(command.BrandId)); if (brandResult is null) { AddNotification("BrandID", "Brand not found"); return(new UnsuccessfulCommandResult(StatusCodeResult.NotFound, "Please, check the properties before creating the user", this.Notifications)); } var brand = BrandFactory.Create(brandResult); var asset = AssetFactory.Create(command, brand); this.assetRepository.Save(asset); return(new SuccessfulCommandResult("Asset was saved with successful", new { id = asset.Id, Name = asset.Name, Description = asset.Description, Registry = asset.Registry, Brand = new { id = asset.Brand.Id, Name = asset.Brand.Name, } })); } return(new UnsuccessfulCommandResult(StatusCodeResult.BadRequest, "Please, check the properties before creating the asset", command.Notifications)); } catch (Exception ex) { return(new UnsuccessfulCommandResult(StatusCodeResult.InternalServerError, "There was an error saving the user, please contact your system administrator.", ex.Message)); } }
public SCMPurchasing() { //初始化ASP.NET内置对象 Response = System.Web.HttpContext.Current.Response; Request = System.Web.HttpContext.Current.Request; Server = System.Web.HttpContext.Current.Server; Session = System.Web.HttpContext.Current.Session; Application = System.Web.HttpContext.Current.Application; tools = ToolsFactory.CreateTools(); DBHelper = SQLHelperFactory.CreateSQLHelper(); depot = new SCMDepot(); supplier = new SCMSupplier(); PROBLL = ProductFactory.CreateProduct(); PROTYPEBLL = ProductTypeFactory.CreateProductType(); BRANDBLL = BrandFactory.CreateBrand(); }
/// <summary> /// 切換到下個玩家所要做的事情 /// </summary> /// <param name="sender">時間倒數器</param> /// <param name="e"></param> protected void rotateTimer_Tick(object sender, EventArgs e) { try { round(); } catch (FlowOverException) { // 流局 MessageBox.Show(Settings.Default.FlowEnd); table.cleanImage(); factory = new BrandFactory(); all.nextWiner(true); // 新局 newgame_round(); } catch (ErrorBrandPlayerCountException) { MessageBox.Show(Settings.Default.ErrorBrandPlayer); } }
// public static Type ShouldReturnCorrectType(string brandName) { return(BrandFactory.Create(brandName).GetType()); }
/// <summary> /// <see cref="DataBase"/> クラスの新しいインスタンスを作成します。 /// </summary> static DataBase() { // 商品マスタ DataBase.Products = new List <ProductEntityModel>() { ProductFactory.Load( productId: "000010010001", productName: "ポテトチップス(うすしお)", brandId: "00001", catetoryId: "001", listPrice: 100, productTagType: ProductTagTypeOptions.None, updateDateTime: DateTime.Now, updateUserId: "Stub" ), ProductFactory.Load( productId: "000010010002", productName: "ポテトチップス(のり塩)", brandId: "00001", catetoryId: "001", listPrice: 120, productTagType: ProductTagTypeOptions.None, updateDateTime: DateTime.Now, updateUserId: "Stub" ), ProductFactory.Load( productId: "000010010003", productName: "ポテトチップス(コンソメ)", brandId: "00001", catetoryId: "001", listPrice: 150, productTagType: ProductTagTypeOptions.None, updateDateTime: DateTime.Now, updateUserId: "Stub" ), ProductFactory.Load( productId: "000020020001", productName: "チョコレート(ビター)", brandId: "00002", catetoryId: "002", listPrice: 200, productTagType: ProductTagTypeOptions.None, updateDateTime: DateTime.Now, updateUserId: "Stub" ), ProductFactory.Load( productId: "000020020002", productName: "チョコレート(ミルク)", brandId: "00002", catetoryId: "002", listPrice: 230, productTagType: ProductTagTypeOptions.None, updateDateTime: DateTime.Now, updateUserId: "Stub" ), ProductFactory.Load( productId: "000020020003", productName: "チョコレート(ホワイト)", brandId: "00002", catetoryId: "002", listPrice: 250, productTagType: ProductTagTypeOptions.None, updateDateTime: DateTime.Now, updateUserId: "Stub" ), ProductFactory.Load( productId: "000030010001", productName: "ポテトチップス(ピザ)", brandId: "00003", catetoryId: "001", listPrice: 200, productTagType: ProductTagTypeOptions.MadeToOrder, updateDateTime: DateTime.Now, updateUserId: "Stub" ), ProductFactory.Load( productId: "000030010002", productName: "ポテトチップス(ピリ辛)", brandId: "00003", catetoryId: "001", listPrice: 200, productTagType: ProductTagTypeOptions.LimitedEdition, updateDateTime: DateTime.Now, updateUserId: "Stub" ), ProductFactory.Load( productId: "000030010003", productName: "ポテトチップス(ガーリック)", brandId: "00003", catetoryId: "001", listPrice: 200, productTagType: ProductTagTypeOptions.LimitedEdition | ProductTagTypeOptions.EndOfSale, updateDateTime: DateTime.Now, updateUserId: "Stub" ), ProductFactory.Load( productId: "000030030001", productName: "アイスキャンデー", brandId: "00003", catetoryId: "003", listPrice: 50, productTagType: ProductTagTypeOptions.None, updateDateTime: DateTime.Now, updateUserId: "Stub" ), ProductFactory.Load( productId: "000030030002", productName: "アイスクリーム", brandId: "00003", catetoryId: "003", listPrice: 50, productTagType: ProductTagTypeOptions.None, updateDateTime: DateTime.Now, updateUserId: "Stub" ), ProductFactory.Load( productId: "000030030003", productName: "アイスシャーベット", brandId: "00003", catetoryId: "003", listPrice: 50, productTagType: ProductTagTypeOptions.None, updateDateTime: DateTime.Now, updateUserId: "Stub" ) }; // 商品カテゴリマスタ DataBase.ProductCategories = new List <ProductCategoryEntityModel>() { ProductCategoryFactory.Load( categoryId: "001", categoryName: "ポテトチップス", updateDateTime: DateTime.Now, updateUserId: "Stub" ), ProductCategoryFactory.Load( categoryId: "002", categoryName: "チョコレート", updateDateTime: DateTime.Now, updateUserId: "Stub" ), ProductCategoryFactory.Load( categoryId: "003", categoryName: "アイス", updateDateTime: DateTime.Now, updateUserId: "Stub" ) }; // ブランドマスタ DataBase.Brands = new List <BrandEntityModel>() { BrandFactory.Load( brandId: "00001", brandName: "メーカーA", note: "ポテトチップス専門メーカー。業界最大手とされている。", updateDateTime: DateTime.Now, updateUserId: "Stub" ), BrandFactory.Load( brandId: "00002", brandName: "メーカーB", note: "チョコレート専門メーカー。", updateDateTime: DateTime.Now, updateUserId: "Stub" ), BrandFactory.Load( brandId: "00003", brandName: "メーカーC", note: "総合お菓子メーカー。ポテトチップス・チョコレート・アイスと幅広く商品展開を行っている。", updateDateTime: DateTime.Now, updateUserId: "Stub" ) }; // 得意先マスタ DataBase.Customers = new List <CustomerEntityModel>() { CustomerFactory.Load( customerId: "0000000001", customerName: "アルファ商店", customerKanaName: "アルファショウテン", customerShortName: "α商店", establishmentDate: DateTime.Parse("2020/04/01"), ceo: "アルファ 一郎", postalCode: "0000000", address: "〇〇都〇〇区〇〇丁目〇〇番 〇〇ビル〇〇階", tel: "0000000000", fax: "0000000000", mail: "*****@*****.**", hp: "http://alfa.test.com/", cutoffDateType: CutoffDateTypeOptions.None, cutoffDate: 0, collectionDateType: CollectionDateTypeOptions.None, collectionDate: 0, taxType: TaxTypeOptions.None, taxCalcType: TaxCalcTypeOptions.None, taxRoundType: TaxRoundTypeOptions.None, note: null, updateDateTime: DateTime.Now, updateUserId: "Stub" ), CustomerFactory.Load( customerId: "0000000002", customerName: "ベータ商店", customerKanaName: "ベータショウテン", customerShortName: "β商店", establishmentDate: DateTime.Parse("1920/04/01"), ceo: "ベータ 太郎", postalCode: "0000000", address: "〇〇都〇〇区〇〇丁目〇〇番 〇〇ビル〇〇階", tel: "0000000000", fax: "0000000000", mail: "*****@*****.**", hp: "http://beta.test.com/", cutoffDateType: CutoffDateTypeOptions.None, cutoffDate: 0, collectionDateType: CollectionDateTypeOptions.None, collectionDate: 0, taxType: TaxTypeOptions.None, taxCalcType: TaxCalcTypeOptions.None, taxRoundType: TaxRoundTypeOptions.None, note: null, updateDateTime: DateTime.Now, updateUserId: "Stub" ), CustomerFactory.Load( customerId: "0000000003", customerName: "ガンマ商店", customerKanaName: "ガンマショウテン", customerShortName: "γ商店", establishmentDate: DateTime.Parse("1999/12/31"), ceo: "ガンマ 大治郎", postalCode: "0000000", address: "〇〇都〇〇区〇〇丁目〇〇番 〇〇ビル〇〇階", tel: "0000000000", fax: "0000000000", mail: "*****@*****.**", hp: "http://gamma.test.com/", cutoffDateType: CutoffDateTypeOptions.None, cutoffDate: 0, collectionDateType: CollectionDateTypeOptions.None, collectionDate: 0, taxType: TaxTypeOptions.None, taxCalcType: TaxCalcTypeOptions.None, taxRoundType: TaxRoundTypeOptions.None, note: null, updateDateTime: DateTime.Now, updateUserId: "Stub" ) }; // 回収日区分 DataBase.CollectionDateTypes = CollectionDateTypeFactory.CreateInitialData(); // 締日区分 DataBase.CutoffDateTypes = CutoffDateTypeFactory.CreateInitialData(); // 消費税区分 DataBase.TaxTypes = TaxTypeFactory.CreateInitialData(); // 消費税端数処理区分 DataBase.TaxRoundTypes = TaxRoundTypeFactory.CreateInitialData(); // 消費税計算区分 DataBase.TaxCalcTypes = TaxCalcTypeFactory.CreateInitialData(); // 商品タグ区分 DataBase.ProductTagTypes = ProductTagTypeFactory.CreateInitialData(); // 1000件越えテスト用 for (var i = 0; i < 1000; i++) { DataBase.Products.Add( ProductFactory.Load( productId: $"99999999{i:4}", productName: $"テスト商品 {i}", brandId: "99999", catetoryId: "999", listPrice: 9999, productTagType: ProductTagTypeOptions.None, updateDateTime: DateTime.Now, updateUserId: "Stub" ));; } DataBase.ProductCategories.Add( ProductCategoryFactory.Load( categoryId: "999", categoryName: "テストお菓子", updateDateTime: DateTime.Now, updateUserId: "Stub" )); DataBase.Brands.Add( BrandFactory.Load( brandId: "99999", brandName: "テストメーカー", note: "1000件テスト用", updateDateTime: DateTime.Now, updateUserId: "Stub" )); }
/// <inheritdoc/> public IBrandsPutOutputDto Put(IBrandsPutInputDto input) { using var dataAccessContext = this.GetRepository.CreateDataAccessContext(); this.GetRepository.DataAccessContext = dataAccessContext; this.PutRepository.DataAccessContext = dataAccessContext; // トランザクション開始 dataAccessContext.BeginTransaction(); // 取得 var entites = this.GetRepository.Get(); // 更新 foreach (var changedInput in input.ChangedDtos) { var entity = entites.FirstOrDefault(e => e.BrandId == changedInput.BrandId); if (entity == null) { continue; } entity.BrandName = changedInput.BrandName; entity.Note = changedInput.Note; entity.UpdateDateTime = this.Executor.ExecuteDateTime; entity.UpdateUserId = this.Executor.UserId; entity.EntityState |= EntityStateOptions.Modified; } // 削除 foreach (var deletedInput in input.DeletedDtos) { var entity = entites.FirstOrDefault(e => e.BrandId == deletedInput.BrandId); if (entity == null) { continue; } entity.UpdateDateTime = this.Executor.ExecuteDateTime; entity.UpdateUserId = this.Executor.UserId; entity.EntityState |= Enums.EntityStateOptions.Deleted; } // 作成 foreach (var addedInput in input.AddedDtos) { var entity = BrandFactory.Create( brandId: addedInput.BrandId, brandName: addedInput.BrandName, note: addedInput.Note, updateDateTime: this.Executor.ExecuteDateTime, updateUserId: this.Executor.UserId ); entites.Add(entity); } // マスタ更新 this.PutRepository.Put(entites); // コミット dataAccessContext.CommitTransaction(); return(this.Output); }