public BaseEmployee(int id, string name, decimal salary, ContractTypeEnum contractType, Role role) { Id = id;; Name = name; Salary = salary; ContractType = contractType; Role = role; }
public static Employee GetEmployeeInstance(ContractTypeEnum contractType) { switch (contractType) { case ContractTypeEnum.HourlySalary: return(new HourlyEmployee()); case ContractTypeEnum.MonthlySalary: return(new MonthlyEmployee()); default: return(null); } }
public IContractCalculator CreateContract(ContractTypeEnum contractType) { switch (contractType) { case ContractTypeEnum.Hourly: return(new HourlyContract(HoursOfMonth, MonthOfYear)); case ContractTypeEnum.Monthly: return(new MonthlyContract(MonthOfYear)); default: throw new ContratTypeNotSupportException(); } }
public static bool TryGetAddress(int blockchainID, string address, out ContractTypeEnum type) { if (_dictionary.TryGetValue(blockchainID, out var blockchainDictionary)) { if (blockchainDictionary.TryGetValue(address, out type)) { return(true); } } type = ContractTypeEnum.Token; return(false); }
public void GetContractAbi(ContractTypeEnum type) { string abi = AbiHelper.GetContractAbi(type, BlockchainType.Ethereum, BlockchainNetwork.Mainnet); Assert.NotNull(abi); Assert.NotEmpty(abi); abi = AbiHelper.GetContractAbi(type, BlockchainType.Ethereum, BlockchainNetwork.Rinkeby); Assert.NotNull(abi); Assert.NotEmpty(abi); abi = AbiHelper.GetContractAbi(type, BlockchainType.xDai, BlockchainNetwork.Mainnet); Assert.NotNull(abi); Assert.NotEmpty(abi); }
public MonthlyEmployee(int id, string name, decimal salary, ContractTypeEnum contractType, Role role) : base(id, name, salary, contractType, role) { }
private static async Task ProcessSmartContractEvent(int blockchainID, BlockchainType blockchainType, BlockchainNetwork blockchainNetwork, ContractTypeEnum type, EthApiService eth, FilterLog filterLog, FilterLog transaction, Web3 cl) { Logger.WriteLine(Source.BlockchainSync, "WebSockets: Processing " + type + " event on " + blockchainType + " " + transaction.TransactionHash); if (type == ContractTypeEnum.Holding) { await ProcessHoldingSmartContractEvent(blockchainID, blockchainType, blockchainNetwork, eth, filterLog, transaction, cl); } else if (type == ContractTypeEnum.Profile) { await ProcessProfileSmartContractEvent(blockchainID, blockchainType, blockchainNetwork, eth, filterLog, transaction, cl); } else if (type == ContractTypeEnum.Litigation) { await ProcessLitigationSmartContractEvent(blockchainID, blockchainType, blockchainNetwork, eth, filterLog, transaction, cl); } }
public static string GetContractAbi(ContractTypeEnum ContractTypeEnum, BlockchainType type, BlockchainNetwork network) { string path = $"OTHub.Settings.Abis.{type}.{network}."; switch (ContractTypeEnum) { case ContractTypeEnum.Approval: path += "approval.json"; break; case ContractTypeEnum.Holding: path += "holding.json"; break; case ContractTypeEnum.HoldingStorage: path += "holding-storage.json"; break; case ContractTypeEnum.Profile: path += "profile.json"; break; case ContractTypeEnum.ProfileStorage: path += "profile-storage.json"; break; case ContractTypeEnum.Replacement: path += "replacement.json"; break; case ContractTypeEnum.Litigation: path += "litigation.json"; break; case ContractTypeEnum.LitigationStorage: path += "litigation-storage.json"; break; case ContractTypeEnum.Token: path += "token.json"; break; case ContractTypeEnum.ERC725: path += "erc725.json"; break; case ContractTypeEnum.Reading: path += "reading.json"; break; case ContractTypeEnum.Hub: path += "hub.json"; break; case ContractTypeEnum.StarfleetStake: path += "starfleetstake.json"; break; case ContractTypeEnum.StarfleetBounty: path += "bounty.json"; break; default: throw new Exception("Not supported: " + ContractTypeEnum); } using (Stream resource = Assembly.GetExecutingAssembly().GetManifestResourceStream(path)) using (StreamReader reader = new StreamReader(resource)) { return(reader.ReadToEnd()); } }