Beispiel #1
0
        public static bool CreateContract(string username, int id, int volume, decimal price, CorporationWebContractTypes contractType, bool materialIncluded, bool blueprintIncluded, string description, bool enablePartition)
        {
            var tmpCorpWebContract = new CorporationWebContract();

            tmpCorpWebContract.BlueprintId  = id;
            tmpCorpWebContract.ContractType = contractType;
            tmpCorpWebContract.Volume       = volume;
            tmpCorpWebContract.Price        = price;

            if (contractType == CorporationWebContractTypes.Buy)
            {
                tmpCorpWebContract.Client = username;
            }
            else if (contractType == CorporationWebContractTypes.Sell)
            {
                tmpCorpWebContract.Contractor = username;
            }

            tmpCorpWebContract.State             = CorporationWebContractStates.Pending;
            tmpCorpWebContract.MaterialIncluded  = materialIncluded;
            tmpCorpWebContract.BlueprintIncluded = blueprintIncluded;
            tmpCorpWebContract.Destination       = -1;
            tmpCorpWebContract.Description       = description;
            tmpCorpWebContract.EnablePartition   = enablePartition;

            var createContractRequest = new WebContracts(WebRequestType.Set, username, tmpCorpWebContract);
            var result = createContractRequest.Request();

            if (result.Status == WebRequestStatus.Failed)
            {
            }

            return(result.Status == WebRequestStatus.Ok);
        }
Beispiel #2
0
        public static bool DeleteContract(string username, long id)
        {
            var tmpCorpWebContract = new CorporationWebContract();

            tmpCorpWebContract.Id = id;

            var createContractRequest = new WebContracts(WebRequestType.Set, username, tmpCorpWebContract, true);
            var result = createContractRequest.Request();

            if (result.Status == WebRequestStatus.Failed)
            {
            }

            return(result.Status == WebRequestStatus.Ok);
        }
Beispiel #3
0
        public static bool AcceptContract(string username, long id, int selectedVolume)
        {
            var tmpCorpWebContract = new CorporationWebContract();

            tmpCorpWebContract.Id     = id;
            tmpCorpWebContract.Volume = selectedVolume;

            var createContractRequest = new WebContracts(WebRequestType.Set, username, tmpCorpWebContract, false, true);
            var result = createContractRequest.Request();

            if (result.Status == WebRequestStatus.Failed)
            {
            }

            return(result.Status == WebRequestStatus.Ok);
        }
Beispiel #4
0
        public static List <CorporationWebContract> GetContracts(string username)
        {
            var contracts             = new List <CorporationWebContract>();
            var createContractRequest = new WebContracts(WebRequestType.Get, username, null);
            var result = createContractRequest.Request();

            if (result.Status == WebRequestStatus.Ok)
            {
                foreach (var contract in result.Contracts)
                {
                    contracts.Add(new CorporationWebContract(contract));
                }
            }
            else
            {
            }

            return(contracts);
        }