示例#1
0
 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);
            }
        }
示例#3
0
        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();
            }
        }
示例#4
0
        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);
        }
示例#5
0
        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);
        }
示例#6
0
 public MonthlyEmployee(int id, string name, decimal salary, ContractTypeEnum contractType, Role role) : base(id, name, salary, contractType, role)
 {
 }
示例#7
0
        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);
            }
        }
示例#8
0
        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());
                }
        }