示例#1
0
        /// <summary>
        /// The SaleRegistry Console Client Demonstrating the overall
        /// Workflow or Process of obtaining the ownership of the property.
        /// </summary>
        /// <param name="args"></param>
        static void Main(string[] args)
        {
            try
            {
                string assetId = UniqueIdHelper.GenerateId();

                Payee          payee          = new Payee();
                Supervisor     supervisor     = new Supervisor(assetId);
                PropertyBuyer  propertyBuyer  = new PropertyBuyer();
                PropertySeller propertySeller = new PropertySeller();

                System.Console.WriteLine("Initiating the " +
                                         "Sale Deed Application Process");

                supervisor.InitApplication().Wait();
                supervisor.StartTheReviewProcess().Wait();
                supervisor.CompleteTheReviewProcess().Wait();

                propertyBuyer.PayTransferFee(payee.GetPayee(), assetId).Wait();
                supervisor.TransferOwnership(propertySeller.GetOwnerAddress(),
                                             propertyBuyer.GetBuyerAddress()).Wait();

                System.Console.WriteLine("Completed executing the " +
                                         "Sale Deed Application Process");
            }
            catch (Exception ex)
            {
                System.Console.WriteLine(ex.ToString());
            }

            System.Console.ReadLine();
        }
        public GameObject BulletGenerator(WeaponEnum enu)
        {
            var definition = LoadedWeapons.First(d => d.WeaponEnum == enu);
            var bullet     = UnityEngine.Object.Instantiate(definition.BulletPrefab, Vector3.zero, Quaternion.identity,
                                                            GameObjectsProviderService.BulletsParentObject.transform);
            int viewId = UniqueIdHelper.GetNextForWeapon(enu);

            bullet.GetComponent <PhotonView>().ViewID = viewId;
            return(bullet.gameObject);
        }
 public async Task Enqueue(string queueName, string message)
 {
     var sendMessageRequest = new SendMessageRequest
     {
         QueueUrl               = QueueUrlFactory(queueName),
         MessageGroupId         = UniqueIdHelper.GenerateUniqueId(),
         MessageDeduplicationId = UniqueIdHelper.GenerateUniqueId(),
         MessageBody            = message
     };
     await _sqsClient.SendMessageAsync(sendMessageRequest);
 }
 /// <summary>
 /// Additional checking to ensure duplicate unique ids are not present
 /// </summary>
 /// <param name="uniqueId"></param>
 /// <returns></returns>
 private string GetUniqueId(string uniqueId)
 {
     if (UrlShortenerCache.Instance.GetOriginalUrl(uniqueId) == null)
     {
         return(uniqueId);
     }
     else
     {
         GetUniqueId(UniqueIdHelper.GetUniqueId());
     }
     return(uniqueId);
 }
 public void CreateUnit(Vector3 position, Player player)
 {
     if (PhotonHelper.PlayerIsMultiplayerHost())
     {
         int id = UniqueIdHelper.GetNext();
         GameObjectsProviderService.MainPhotonView.RPC("RPC_CreateUnit", RpcTarget.All, position, player.Name, id);
     }
     else if (PhotonNetwork.OfflineMode)
     {
         UnitCreatorService.CreateSinglePlayerUnit(position, player);
     }
 }
        public SaleDeedContractTest()
        {
            transferResult       = new Mock <ITransferResult>();
            mockContractLogger   = new Mock <IContractLogger>();
            mockPersistentState  = new Mock <IPersistentState>();
            mockContractState    = new Mock <ISmartContractState>();
            mockInternalExecutor = new Mock <IInternalTransactionExecutor>();

            this.mockContractState.Setup(s => s.PersistentState).Returns(this.mockPersistentState.Object);
            this.mockContractState.Setup(s => s.ContractLogger).Returns(this.mockContractLogger.Object);
            this.mockContractState.Setup(x => x.InternalTransactionExecutor).Returns(mockInternalExecutor.Object);

            assetId            = UniqueIdHelper.GenerateId();
            this.sender        = "0x0000000000000000000000000000000000000001".HexToAddress();
            this.buyer         = "0x0000000000000000000000000000000000000002".HexToAddress();
            this.propertyOwner = "0x0000000000000000000000000000000000000003".HexToAddress();
            this.payee         = "0x0000000000000000000000000000000000000004".HexToAddress();
        }
        /// <summary>
        /// CreateShortUrl
        /// </summary>
        /// <param name="originalUrl"></param>
        /// <returns></returns>
        public ShortUrlVM CreateShortUrl(string originalUrl)
        {
            var existingShortUrl = repository.GetOne <ShortUrl>(x => x.OriginalUrl == originalUrl);

            if (existingShortUrl == null)
            {
                existingShortUrl = new ShortUrl()
                {
                    OriginalUrl = originalUrl,
                    UniqueId    = this.GetUniqueId(UniqueIdHelper.GetUniqueId()),
                    CreatedDate = DateTime.UtcNow
                };
                repository.Create <ShortUrl>(existingShortUrl);
                repository.Save();

                //Update Cache
                UrlShortenerCache.Instance.FullCacheReload();
            }
            return(new ShortUrlVM(existingShortUrl));
        }
示例#8
0
        public WorkerRecordStoreServiceMockBuilder WithWorkerRecord(string type, DateTime lastPingTime = default(DateTime))
        {
            if (lastPingTime == default(DateTime))
            {
                lastPingTime = DateTime.UtcNow;
            }

            _workerRecords.Add(new WorkerRecord
            {
                Id            = UniqueIdHelper.GenerateUniqueId(),
                Type          = type,
                HasTerminated = false,
                ShouldRun     = true,
                LastPingTime  = lastPingTime
            });

            _workerRecordStoreService.GetAllWorkerRecords().Returns(_workerRecords);

            return(this);
        }
示例#9
0
 public string GenerateUniqueId()
 {
     return(UniqueIdHelper.GenerateUniqueId());
 }
示例#10
0
        private void btnCreate_Click(object sender, EventArgs e)
        {
            try
            {
                if (cmbPropertyOwner.Text == "" ||
                    cmbPropertyOwner.SelectedIndex == -1)
                {
                    MessageBox.Show("Please select the property owner", "Error",
                                    MessageBoxButtons.OK, MessageBoxIcon.Error);
                    cmbPropertyOwner.Focus();
                    return;
                }

                var splittedPersonInfo = cmbPropertyOwner.Text.Split(
                    new char[1] {
                    '-'
                });

                bool isAssetInfoValid = assetInfoUserControl1.Validate();
                if (!isAssetInfoValid)
                {
                    return;
                }

                bool isLocationInfoValid = locationInfoUserControl1.Validate();
                if (!isLocationInfoValid)
                {
                    return;
                }

                int id         = 0;
                int locationId = 0;

                LocationInfo locationInfo = new LocationInfo
                {
                    Address1  = locationInfoUserControl1.AddressLine1,
                    Address2  = locationInfoUserControl1.AddressLine2,
                    City      = locationInfoUserControl1.City,
                    State     = locationInfoUserControl1.State,
                    ZipCode   = locationInfoUserControl1.ZipCode,
                    Country   = locationInfoUserControl1.Country,
                    Latitude  = locationInfoUserControl1.Latitude,
                    Longitude = locationInfoUserControl1.Longitude
                };
                locationId = propertyLocationRespository.Insert(locationInfo);

                if (locationId <= 0)
                {
                    MessageBox.Show("There was a problem in saving the location info. " +
                                    "Please contact Sys Admin or Support.", "Error",
                                    MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                AssetInfo assetInfo = new AssetInfo
                {
                    AssetId        = UniqueIdHelper.GenerateId(),
                    MarketPrice    = long.Parse(assetInfoUserControl1.MarketPrice),
                    PropertyNumber = assetInfoUserControl1.PropertyNumber,
                    MuncipleNumber = assetInfoUserControl1.Munciple,
                    WardNumber     = assetInfoUserControl1.WardNumber,
                    PurchacePrice  = long.Parse(assetInfoUserControl1.PurchasePrice),
                    PropertyTax    = long.Parse(assetInfoUserControl1.PropertyTax),
                    SquareFeet     = long.Parse(assetInfoUserControl1.Measurment),
                    ESignature     = assetInfoUserControl1.Base64EncodedSignature,
                    PersonId       = int.Parse(splittedPersonInfo[0]),
                    LocationId     = locationId
                };

                // Persist the Asset Info
                assetManagementRepository.InsertAsset(assetInfo);

                btnCopyAssetId.Enabled = true;
                lblAssetId.Visible     = true;
                lblAssetId.Text        = string.Format("{0} - {1}",
                                                       "AssetId", assetInfo.AssetId);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }