public FormCreateBooking(IConsumer serviceC, ICommodity serviceP, IMain serviceM) { InitializeComponent(); this.serviceC = serviceC; this.serviceP = serviceP; this.serviceM = serviceM; }
public AddCommodityPresenter(AddCommodityModel model, ICommodity view) { this.model = model; this.view = view; view.InsertCommodity += PresenterAddCommodity; view.SelectCustomers += PresenterSelectCustomers; }
public StoreInPlan(SessionInfo _session = null, StoreInPlanHead model = null) { InitializeComponent(); this._repo = new StoreInPlanRepo(); this._repoIn = new StoreInRepo(); this._repoCurr = new CurrenciesRepo(); this._repoSupplier = new SupplierRepo(); this._repoBT = new BussinessTypeRepo(); this._repoMaker = new MakerRepo(); this._repoMill = new MillRepo(); this._repoCmdt = new Commodity(); this._repoSpec = new SpecRepo(); this._repoCoating = new CoatingRepo(); this._repoWhse = new WharehouseRepo(); this._repoPort = new ImportPortRepo(); this._repoCust = new CustomerRepo(); this._repoLookup = new LookupRepo(); this.SourceStr = ""; epiSession = _session; if (model == null || epiSession == null) { this.HeadContent = new StoreInPlanHead(); this.IMEXReviewFlag = false; } else { this.HeadContent = model; this.IMEXReviewFlag = true; } this.ModelClone = new StoreInPlanHead(); this.POTrans = new POLineModel(); }
public CommodityDialog() { InitializeComponent(); this._repo = new Commodity(); this.Code = ""; this.Description = ""; this.RequireCoating = false; }
public Transaction(ICommodity commodity, ITrade trade) { TxCommodity = commodity; TxTrade = trade; TxProfitValidator = new ProfitValidator(TxCommodity, TxTrade); TxTradeValidator = new TradeValidator(TxTrade); }
static void Main(string[] args) { CommodityFactory fac = new CommodityFactory(); ICommodity com = fac.GetCommodityService(2); com.SendCommodity(); Console.WriteLine("Hello World!"); }
public void RegisterTransaction(ICommodity commodity) { TransactionCount++; if (TransactionCount > 5) { RandomizeCommodities(); } }
public void TestMethodPassing() { StoreFactory storeFactory = new StoreFactory(); //优惠券 ICommodity commodity1 = storeFactory.GetCommodityService(1); commodity1.sendCommodity("10001", "EGM123112", "2132131", null); Assert.IsNotNull(commodity1); }
public ProductionSource(ICommodity commodityProduced, double extractionRateHour, double totalMineableMaterials) { CommodityProduced = commodityProduced; MaterialCommodityCode = commodityProduced.Name; // HACK: to fix... ProductionRatePerHour = extractionRateHour; InitialTotalMaterials = totalMineableMaterials; LastProductionRun = DateTime.Now; MinEfficiency = 0.1; CurrentEfficiency = 1; MaxEfficiency = 1.2; // eventually efficiencies could be determined by researched technologies and tech upgrades }
/// <summary> /// Sell commodoty method /// Checks: /// if trade is profatble /// credits the profit back in wallet /// </summary> /// <param name="sellingCommodity"></param> public void Sell(ICommodity sellingCommodity) { if (!TxProfitValidator.IsValid()) { throw new Exception("The trade is not profitable"); } using (var myWallet = new GoldWallet(WalletService.FetchBalance(), new GoldTaxLoad())) { using (var ts = new TransactionScope()) { TxCommodity.Quantity -= TxTrade.TradeQuantity; myWallet.Credit(TxTrade.GetTradeCost() - (GoldTaxLoad.GoldBuyTransactionCharges * sellingCommodity.Quantity)); } } }
public McssMaster(MCSS model = null, SessionInfo _session = null) { InitializeComponent(); this._repo = new McssRepo(); this._repoCustomer = new CustomerRepo(); this._repoCoating = new CoatingRepo(); this._repoSpec = new SpecRepo(); this._repoCommodity = new Commodity(); this._repoSupplier = new SupplierRepo(); this._repoBT = new BussinessTypeRepo(); this._repoMaker = new MakerRepo(); this._repoMill = new MillRepo(); this._repoCatg = new CategoryGroupRepo(); specialRef = new Dictionary<int, string>(); #region Dashboard if (model == null) { this.McssContent = new MCSS(); this.ModelClone = new MCSS(); this.Initail = new InitialModel(); } else { this.McssContent = model; ModelClone = (MCSS)model.Clone(); } epiSession = _session; #endregion #region Direct form //epiSession = new SessionInfo(); //if (epiSession.SessionID == null) //{ // Login frm = new Login(); // frm.ShowDialog(); //} //else if (epiSession.SessionID == "x") //{ // Application.Exit(); //} //else //{ // this.Text = epiSession.CompanyName; //} #endregion }
public override void AddNameProperty(ObjectPropertyList list) { if (Commodity == null) { list.Add(1047016); } else { ICommodity Comm = Commodity as ICommodity; if (Core.EJ) { list.Add(1115599, string.Format("{0}\t#{1}", Commodity.Amount, Comm.Description.Number)); } else { list.Add(1047017); if (Comm != null) { list.Add(1060658, "#{0}\t{1}", Comm.Description.Number, Commodity.Amount); // ~1_val~: ~2_val~ } } } }
private static bool CheckKeyword(string searchstring, Item item) { if (item is CommodityDeed && ((CommodityDeed)item).Commodity != null) { item = ((CommodityDeed)item).Commodity; } if (item is IResource) { string resName = CraftResources.GetName(((IResource)item).Resource); if (resName.ToLower().IndexOf(searchstring.ToLower()) >= 0) { return(true); } } if (item is ICommodity) { ICommodity commodity = (ICommodity)item; string name = commodity.Description.String; if (string.IsNullOrEmpty(name) && commodity.Description.Number > 0) { name = StringList.GetString(commodity.Description.Number); } if (!string.IsNullOrEmpty(name) && name.ToLower().IndexOf(searchstring.ToLower()) >= 0) { return(true); } } return(Keywords.ContainsKey(searchstring.ToLower()) && Keywords[searchstring.ToLower()] == item.GetType()); }
public SaleListSearchTermManager(FormSaleList form, ICommodity icommodity) { this.form = form; this.icommodity = icommodity; InitControls(); SetSearchContentToInit(); }
public ProfitValidator(ICommodity comodity, ITrade trade) { Comodity = comodity; Trade = trade; TradeValidator = new TradeValidator(trade); }
public static bool CheckMatch(Item item, int price, SearchCriteria searchCriteria) { if (item is CommodityDeed && ((CommodityDeed)item).Commodity != null) { item = ((CommodityDeed)item).Commodity; } if (searchCriteria.MinPrice > -1 && price < searchCriteria.MinPrice) { return(false); } if (searchCriteria.MaxPrice > -1 && price > searchCriteria.MaxPrice) { return(false); } if (!string.IsNullOrEmpty(searchCriteria.SearchName)) { string name; if (item is CommodityDeed && ((CommodityDeed)item).Commodity is ICommodity) { ICommodity commodity = (ICommodity)((CommodityDeed)item).Commodity; if (!string.IsNullOrEmpty(commodity.Description.String)) { name = commodity.Description.String; } else { name = StringList.GetString(commodity.Description.Number); } } else { name = GetItemName(item); } if (name == null) { return(false); // TODO? REturn null names? } if (!CheckKeyword(searchCriteria.SearchName, item) && name.ToLower().IndexOf(searchCriteria.SearchName.ToLower()) < 0) { return(false); } } if (searchCriteria.SearchType != Layer.Invalid && searchCriteria.SearchType != item.Layer) { return(false); } if (searchCriteria.Details.Count == 0) { return(true); } foreach (SearchDetail detail in searchCriteria.Details) { object o = detail.Attribute; int value = detail.Value; if (value == 0) { value = 1; } if (o is AosAttribute) { AosAttributes attrs = RunicReforging.GetAosAttributes(item); if (attrs == null || attrs[(AosAttribute)o] < value) { return(false); } } else if (o is AosWeaponAttribute) { AosWeaponAttributes attrs = RunicReforging.GetAosWeaponAttributes(item); if ((AosWeaponAttribute)o == AosWeaponAttribute.MageWeapon) { if (attrs == null || attrs[(AosWeaponAttribute)o] == 0 || attrs[(AosWeaponAttribute)o] > Math.Max(0, 30 - value)) { return(false); } } else if (attrs == null || attrs[(AosWeaponAttribute)o] < value) { return(false); } } else if (o is SAAbsorptionAttribute) { SAAbsorptionAttributes attrs = RunicReforging.GetSAAbsorptionAttributes(item); if (attrs == null || attrs[(SAAbsorptionAttribute)o] < value) { return(false); } } else if (o is AosArmorAttribute) { AosArmorAttributes attrs = RunicReforging.GetAosArmorAttributes(item); if (attrs == null || attrs[(AosArmorAttribute)o] < value) { return(false); } } else if (o is SkillName) { if (detail.Category != Category.RequiredSkill) { AosSkillBonuses skillbonuses = RunicReforging.GetAosSkillBonuses(item); if (skillbonuses != null) { bool hasSkill = false; for (int i = 0; i < 5; i++) { SkillName check; double bonus; if (skillbonuses.GetValues(i, out check, out bonus) && check == (SkillName)o && bonus >= value) { hasSkill = true; break; } } if (!hasSkill) { return(false); } } else if (item is SpecialScroll && value >= 105) { if (((SpecialScroll)item).Skill != (SkillName)o || ((SpecialScroll)item).Value < value) { return(false); } } else { return(false); } } else if (!(item is BaseWeapon) || ((BaseWeapon)item).DefSkill != (SkillName)o) { return(false); } } else if (!CheckSlayer(item, o)) { return(false); } else if (o is AosElementAttribute) { if (item is BaseWeapon) { BaseWeapon wep = item as BaseWeapon; if (detail.Category == Category.DamageType) { int phys, fire, cold, pois, nrgy, chaos, direct; wep.GetDamageTypes(null, out phys, out fire, out cold, out pois, out nrgy, out chaos, out direct); switch ((AosElementAttribute)o) { case AosElementAttribute.Physical: if (phys < value) { return(false); } break; case AosElementAttribute.Fire: if (fire < value) { return(false); } break; case AosElementAttribute.Cold: if (cold < value) { return(false); } break; case AosElementAttribute.Poison: if (pois < value) { return(false); } break; case AosElementAttribute.Energy: if (nrgy < value) { return(false); } break; case AosElementAttribute.Chaos: if (chaos < value) { return(false); } break; case AosElementAttribute.Direct: if (direct < value) { return(false); } break; } } else { switch ((AosElementAttribute)o) { case AosElementAttribute.Physical: if (wep.WeaponAttributes.ResistPhysicalBonus < value) { return(false); } break; case AosElementAttribute.Fire: if (wep.WeaponAttributes.ResistFireBonus < value) { return(false); } break; case AosElementAttribute.Cold: if (wep.WeaponAttributes.ResistColdBonus < value) { return(false); } break; case AosElementAttribute.Poison: if (wep.WeaponAttributes.ResistPoisonBonus < value) { return(false); } break; case AosElementAttribute.Energy: if (wep.WeaponAttributes.ResistEnergyBonus < value) { return(false); } break; } } } else if (item is BaseArmor && detail.Category == Category.Resists) { BaseArmor armor = item as BaseArmor; switch ((AosElementAttribute)o) { case AosElementAttribute.Physical: if (armor.PhysicalResistance < value) { return(false); } break; case AosElementAttribute.Fire: if (armor.FireResistance < value) { return(false); } break; case AosElementAttribute.Cold: if (armor.ColdResistance < value) { return(false); } break; case AosElementAttribute.Poison: if (armor.PoisonResistance < value) { return(false); } break; case AosElementAttribute.Energy: if (armor.EnergyResistance < value) { return(false); } break; } } else if (detail.Category != Category.DamageType) { AosElementAttributes attrs = RunicReforging.GetElementalAttributes(item); if (attrs == null || attrs[(AosElementAttribute)o] < value) { return(false); } } else { return(false); } } else if (o is Misc) { switch ((Misc)o) { case Misc.ExcludeFel: break; case Misc.GargoyleOnly: if (!IsGargoyle(item)) { return(false); } break; case Misc.NotGargoyleOnly: if (IsGargoyle(item)) { return(false); } break; case Misc.ElvesOnly: if (!IsElf(item)) { return(false); } break; case Misc.NotElvesOnly: if (IsElf(item)) { return(false); } break; case Misc.FactionItem: return(false); case Misc.PromotionalToken: if (!(item is PromotionalToken)) { return(false); } break; case Misc.Cursed: if (item.LootType != LootType.Cursed) { return(false); } break; case Misc.NotCursed: if (item.LootType == LootType.Cursed) { return(false); } break; case Misc.CannotRepair: if (CheckCanRepair(item)) { return(false); } break; case Misc.NotCannotBeRepaired: if (!CheckCanRepair(item)) { return(false); } break; case Misc.Brittle: NegativeAttributes neg2 = RunicReforging.GetNegativeAttributes(item); if (neg2 == null || neg2.Brittle == 0) { return(false); } break; case Misc.NotBrittle: NegativeAttributes neg3 = RunicReforging.GetNegativeAttributes(item); if (neg3 != null && neg3.Brittle > 0) { return(false); } break; case Misc.Antique: NegativeAttributes neg4 = RunicReforging.GetNegativeAttributes(item); if (neg4 == null || neg4.Antique == 0) { return(false); } break; case Misc.NotAntique: NegativeAttributes neg5 = RunicReforging.GetNegativeAttributes(item); if (neg5 != null && neg5.Antique > 0) { return(false); } break; } } else if (o is string) { string str = o as string; if (str == "WeaponVelocity" && (!(item is BaseRanged) || ((BaseRanged)item).Velocity < value)) { return(false); } if (str == "SearingWeapon" && (!(item is BaseWeapon) || !((BaseWeapon)item).SearingWeapon)) { return(false); } if (str == "ArtifactRarity" && (!(item is IArtifact) || ((IArtifact)item).ArtifactRarity < value)) { return(false); } } } return(true); }
private static Predicate <ICommodity> Matching(ICommodity commodity) => c => c.Name == commodity.Name;
static void AddTransaction(ICommodity tx) { MasterLedger.HistoryTransactions.Add(tx); }
private ICommodity Find(ICommodity commodity) => Stockpiles.Find(Matching(commodity));
private int FindValueOf(ICommodity commodity) => Find(commodity)?.Value ?? 0;
public int GetImportOfferFor(ICommodity commodity) => FindValueOf(commodity);
public void Load(ICommodity commodity) { Commodity = commodity; }
private static int Random(ICommodity commodity) => UnityEngine.Random.Range(-1, 1);
public CommodityViewModel(CommandBindingCollection commandBindings, ICommodity commidity) { this.CommandBindings = commandBindings; this.Commodity = commidity; this.Price = new PriceViewModel(this.Commodity.Price, this.Commodity.CurrencyType); }
public FormCommodity(ICommodity service) { InitializeComponent(); this.service = service; }
public Commodities(ICommodity service) { InitializeComponent(); this.service = service; }
private void LoadCargo(ICommodity offerCommodity) { Cargo.Load(offerCommodity); }