Esempio n. 1
0
        public ServicesManager(
            INutConfiguration configurationManager,
            Infrastructure.ConfigurationManagement.DbConfigurationSettings.Factory dbConfigurationSettingsFactory,
            IEventBus eventBus,
            IEnumerable<IReportPeriodically> pushServices,
            IEnumerable<IRemoteInvocationService> remoteInvokedServices,
            Services.IGlobalSettingsService globalSettings,
            Func<RegisteredPackagesPollingClient> packagesPollerFactory,
            Func<PollingClientCollection> pollingCollectionFactory,
            Repositories.IPackageRepository packageRepository,
            IHoardeManager hoardeManager)
        {
            _log = LogProvider.For<ServicesManager>();

            _configurationManager = configurationManager;
            _dbConfigurationSettingsFactory = dbConfigurationSettingsFactory;
            _eventBus = eventBus;
            _pushServices = pushServices;
            _remoteInvokedServices = remoteInvokedServices;
            _globalSettings = globalSettings;

            _packagesPollerFactory = packagesPollerFactory;
            _pollingCollectionFactory = pollingCollectionFactory;

            _packageRepository = packageRepository;

            _hoardeManager = hoardeManager;
        }
Esempio n. 2
0
        public IEnumerable<Order> FindBy(Infrastructure.Query query)
        {
            IList<Order> orders = new List<Order>();

            using (SqlConnection conn = new SqlConnection(_connectionString)) 
            {
                SqlCommand cmd = conn.CreateCommand();
                query.TranslateInfo(cmd);
                conn.Open();

                using (SqlDataReader reader = cmd.ExecuteReader())
                {
                    while (reader.Read()) 
                    {
                        orders.Add(new Order() 
                        {
                            CustomerId = new Guid(reader["CustomerId"].ToString()),
                            OrderDate = DateTime.Parse(reader["OrderDate"].ToString()),
                            Id = new Guid(reader["Id"].ToString()),
                        });
                    }
                }
            }

            return orders;
        }
 protected override int PickOutputChannel(Infrastructure.ChannelMessageEventArgs e)
 {
     if (e.Message.Headers.ContainsKey("ProductType"))
         return (string)e.Message.Headers["ProductType"] == "Cars" ? 0 : 1;
     else
         return base.PickOutputChannel(e);
 }
Esempio n. 4
0
 /// <summary>
 /// 根据配置更新界面
 /// </summary>
 /// <param name="info"></param>
 public void UpdateInterface(Infrastructure.Crosscutting.Updater.UpdateInfo info)
 {
     this.deletePreviousFileMode.SelectedIndex = (int)info.DeleteMethod;
     this.deleteRules.Text = info.DeleteFileLimits.IsEmpty() ? "" : string.Join(Environment.NewLine, info.DeleteFileLimits);
     this.requiredMinVersion.Text = info.RequiredMinVersion;
     this.txtPackagePassword.Text = info.PackagePassword ?? "";
 }
        public Infrastructure.IMessageQueue GetOrAdd(object service, Infrastructure.ProcessingMode mode)
        {
            var key = new Tuple<object, ProcessingMode>(service, mode);

            var queue = _queues.GetOrAdd(key, CreateQueue(key));
            return queue;
        }
Esempio n. 6
0
        public MovieBookingService(Infrastructure.IBus bus)
        {
            this.bus = bus;

            this.cinemaList = new List<string>() { "Streatham", "Brixton", "West Norwood" };
            this.movieList = new List<string>() { "Captain America", "Thor", "The Hunger Games", "The Hunt for Red October" };
        }
Esempio n. 7
0
 /// <summary>
 /// 保存设置到配置中
 /// </summary>
 /// <param name="info"></param>
 public void SaveSetting(Infrastructure.Crosscutting.Updater.UpdateInfo info)
 {
     info.DeleteFileLimits = this.deleteRules.Lines;
     info.DeleteMethod = (Infrastructure.Crosscutting.Updater.DeletePreviousProgramMethod)this.deletePreviousFileMode.SelectedIndex;
     info.RequiredMinVersion = this.requiredMinVersion.Text;
     info.PackagePassword = this.txtPackagePassword.Text;
 }
Esempio n. 8
0
        public RESTScreenViewModel(Infrastructure infrastructure, CodeEditorViewModel requestBodyViewModel,
            CodeEditorViewModel resultViewModel)
        {
            Ensure.ArgumentNotNull(infrastructure, "infrastructure");

            ResultEditor = resultViewModel;
            RequestBodyEditor = requestBodyViewModel;

            _infrastructure = infrastructure;
            base.DisplayName = "REST";
            _eventAggregator = infrastructure.EventAggregator;

            Methods = new List<ComboBoxItemViewModel>
            {
                ComboBoxItemViewModel.FromString("GET"),
                ComboBoxItemViewModel.FromString("POST"),
                ComboBoxItemViewModel.FromString("PUT"),
                ComboBoxItemViewModel.FromString("DELETE"),
                ComboBoxItemViewModel.FromString("HEAD"),
                ComboBoxItemViewModel.FromString("OPTIONS"),
                ComboBoxItemViewModel.FromString("TRACE"),
                ComboBoxItemViewModel.FromString("PATCH"),
            };
            Method = "GET";
        }
Esempio n. 9
0
        /// <summary>
        /// Creates a tab that will load the given tab data when opened.
        /// </summary>
        /// <param name="tabData">The tab data to be loaded.</param>
        public Tab(Infrastructure.Tab tabData)
            : this()
        {
            NavigateFirst = true;

            this.TabData = tabData;
            this.Title = tabData.Title;
        }
Esempio n. 10
0
        /// <summary>
        /// Initializes a new instance of an object.
        /// </summary>
        /// <param name="id">Grou Id.</param>
        /// <param name="name">Group name.</param>
        /// <param name="query">Current search query.</param>
        public SearchResultGroup(string id, string name, Infrastructure.Search.SearchQuery query)
        {
            this.Name = name;
            this.Excerpt = string.Empty;
            this.Url = url => { return url.Action("Index", "Home", new { q = query.WithoutCriterion("skip").WithoutCriterion("take").WithCriterion("in", id).ToString() }); };

            this.Results = new List<SearchResultBase>();
        }
Esempio n. 11
0
        void Instance_DownloadProgressChanged(object sender, Infrastructure.Crosscutting.Updater.Wrapper.RunworkEventArgs e)
        {
            pbProgress.Style = ProgressBarStyle.Blocks;
            pbProgress.Value = e.Progress.TaskPercentage;

            if (!string.IsNullOrEmpty(e.Progress.StateMessage)) lblProgressDesc.Text = e.Progress.StateMessage;
            else lblProgressDesc.Text = string.Format("{0}/{1}", ExtensionMethod.ToSizeDescription(e.Progress.TaskProgress), ExtensionMethod.ToSizeDescription(e.Progress.TaskCount));
        }
 public override FrameworkElement LoadXaml(IDeviceAgent devices, KioskState state, Infrastructure.ObjectModel.TransactionContextBase transactionContext)
 {
     FrameworkElement viewGrid = base.LoadXaml(devices, state, transactionContext);
     DProcessPayment doPayment = new DProcessPayment(this.DoPayment);
     Devices.GetCashAcceptor().NoteStackedEvent += OnNoteStackedEvent;
     doPayment.BeginInvoke(null, null);
     return viewGrid;
 }
 //IPeopleService _peopleService;
 public AddressBookViewModel(IPeopleRepository repository, Infrastructure.IView view)
 {
     //_peopleService = peopleService;
     //this.People = _peopleService.GetAll().ToList();
     var people = repository.GetAll().ToList();
     _people = people;
     View = view;
     View.ViewModel = this;
 }
Esempio n. 14
0
 public Locale Build(Infrastructure.Data.Locale dataLocale, bool hasPhoto)
 {
     return new Locale(dataLocale.LocaleID)
     {
         Latitude = dataLocale.Lat,
         Longitude = dataLocale.Long,
         Name = dataLocale.LocaleName.Trim(),
         HasPhotos = hasPhoto
     };
 }
Esempio n. 15
0
 public DataViewerViewModel(Infrastructure infrastructure, TypesListViewModel typesListViewModel,
     PaggerViewModel paggerModel)
     : base(infrastructure)
 {
     _infrastructure = infrastructure;
     TypesList = typesListViewModel;
     base.DisplayName = "Data Viewer";
     PaggerModel = paggerModel;
     paggerModel.OnPageChanged = View;
 }
Esempio n. 16
0
 public SinaController(Infrastructure.Crosscutting.Authorize.IUserService user,
     Infrastructure.Crosscutting.Authorize.IUserExtensionService userExtension)
 {
     if (user == null)
     {
         throw new ArgumentNullException("userService is null");
     }
     userService = user;
     userExtensionService = userExtension;
 }
 private Association HandleAssociationResponse(Infrastructure.Http.Response response)
 {
     if (response.StatusCode == HttpStatusCode.OK
         || response.StatusCode == HttpStatusCode.Created
         || response.StatusCode == HttpStatusCode.Accepted)
     {
         return Client.JsonMapper.From<Association>(response.Body);
     }
     Client.HandleErrors(response);
     return null;
 }
 void ControlChannels_MessageReceivedOnChannel(object sender, Infrastructure.ChannelMessageEventArgs e)
 {
     if (e.Message != null && e.Message.Headers.ContainsKey(HeaderName.PressureValue)
                           && e.Message.Headers.ContainsKey(HeaderName.PressureChannel))
     {
         string name = (string)e.Message.Headers[HeaderName.PressureChannel];
         if (!mChannelPressure.ContainsKey(name))
             mChannelPressure.Add(name, 0);
         mChannelPressure[name] += (double)e.Message.Headers[HeaderName.PressureValue];
     }
 }
Esempio n. 19
0
        private ImportSummary HandleResponse(Infrastructure.Http.Response response)
        {
            if (response.StatusCode == HttpStatusCode.OK)
            {
                return _client.JsonMapper.From<SetupResponse>(response.Body).ImportSummary;
            }

            _client.HandleErrors(response);

            return null;
        }
Esempio n. 20
0
        public MappingsInfoViewModel(TypesListViewModel typesListViewModel, Infrastructure infrastructure)
            : base(infrastructure)
        {
            _infrastructure = infrastructure;
            TypesList = typesListViewModel;
            TypesList.PropertyChanged += (sender, args) =>
            {
                if (args.PropertyName != "SelectedType") return;

                LoadMapping();
            };
        }
        public ClusterConnectionViewModel(Infrastructure infrastructure)
        {
            _infrastructure = infrastructure;
            _eventAggregator = infrastructure.EventAggregator;

            var observable = Observable.Interval(_infrastructure.Config.RefreshInterval.Seconds()).TimeInterval();
            observable.Subscribe(o =>
            {
                if (infrastructure.Connection.IsConnected)
                    _eventAggregator.PublishOnUIThread(new RefreshEvent());
            });
            ClusterUri = infrastructure.Config.DefaultClusterUrl.ToString();
        }
Esempio n. 22
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ReleasesPollingClient" /> class.
 /// </summary>
 /// <param name="packageId">The package identifier.</param>
 /// <param name="dbConfigurationSettingsFactory">The database configuration settings factory.</param>
 /// <param name="configurationManager">The configuration manager.</param>
 /// <param name="globalSettingsService">The global settings service.</param>
 /// <param name="packageService">The package service.</param>
 /// <param name="eventBus">The event bus.</param>
 public ReleasesPollingClient(string packageId,
     Infrastructure.ConfigurationManagement.DbConfigurationSettings.Factory dbConfigurationSettingsFactory,
     INutConfiguration configurationManager,
     Services.IGlobalSettingsService globalSettingsService,
     Services.IPackageService packageService,
     IEventBus eventBus)
 {
     _packageId = packageId;
     _dbConfigurationSettingsFactory = dbConfigurationSettingsFactory;
     _configurationManager = configurationManager;
     _globalSettingsService = globalSettingsService;
     _packageService = packageService;
     _eventBus = eventBus;
 }
Esempio n. 23
0
        public static Infrastructure AddMongo(this Infrastructure infrastructure, string url)
        {
            var database = GetMongoDatabase(url);
            var store    = GetMongoFhirStore(database);
            var index    = GetMongoFhirIndex(database, infrastructure.SearchParameters);

            // MongoFhirStore implements three interfaces:
            infrastructure.Store         = store;
            infrastructure.Generator     = store;
            infrastructure.SnapshotStore = store;
            infrastructure.Index         = index;

            return(infrastructure);
        }
Esempio n. 24
0
        public ActionResult Send(SendViewModel sendReq)
        {
            var          target       = dbManager.Users.First(u => u.UserName == sendReq.UserName);
            CheckManager checkManager = new CheckManager(target.UserName);

            string targPath = Infrastructure.GetUsersDirectory(target.UserName);
            string srcPath  = Infrastructure.GetUsersDirectory(User.Identity.Name);

            System.IO.File.Copy(srcPath, targPath);

            Infrastructure.Logger.Info("{0} copied succ to {1}", srcPath, targPath);

            return(View("SendSuccess"));
        }
        public IHttpActionResult DeleteInfrastructure(int id)
        {
            Infrastructure infrastructure = db.Infrastructures.Find(id);

            if (infrastructure == null)
            {
                return(NotFound());
            }

            db.Infrastructures.Remove(infrastructure);
            db.SaveChanges();

            return(Ok(infrastructure));
        }
Esempio n. 26
0
        ///////////////////
        ///////////////////
        ///////////////////
        ///////////////////
        ///////////////////
        /// someother tab

        // int charChanged = 0;
        //int currentCharLength = 0;


        //private async void ComboBox1_TextUpdate(Object sender, EventArgs e)
        //{

        /*
         * Console.WriteLine(comboBox1.Text);
         * //comboBox1.AutoCompleteMode = AutoCompleteMode.None;
         * //comboBox1.AutoCompleteSource = AutoCompleteSource.ListItems;
         * if (comboBox1.Text.Length >= 3)
         * {
         *  var token = "";
         *  var allWinelistUrl = Links.baseLink + Links.allwineList;
         *  if (comboBox1.Text != string.Empty)
         *      allWinelistUrl = allWinelistUrl.Replace("startswith=", "startswith=" + comboBox1.Text);
         *  var responseBody = await RestVerbs.Get(allWinelistUrl, token);
         *  var responseBodyJson = JsonConvert.DeserializeObject<ICollection<WineListResponse>>(responseBody);
         *  var dt = new DataTable();
         *
         *
         *  // comboBox1.DisplayMember = "WineName";
         *  // comboBox1.DataSource = responseBodyJson;
         *  foreach (var wine in responseBodyJson)
         *  {
         *      comboBox1.Items.Add(wine.WineName);
         *  }
         *
         * }
         * currentCharLength = comboBox1.Text.Length;
         */
        //}



        ///////////////////
        ///////////////////
        ///////////////////
        ///////////////////
        ///////////////////
        /// mypages tab

        private void btnLogOut_Click(object sender, EventArgs e)
        {
            var isSuccess = Infrastructure.Logout();

            if (!string.IsNullOrEmpty(isSuccess.Message))
            {
                MessageBox.Show(isSuccess.Message, "fel");
            }

            LogIn login = new LogIn();

            login.Show();
            Hide();
        }
Esempio n. 27
0
        //
        // GET: /Infrastructure/Edit/5

        public ActionResult Edit(int id = 0)
        {
            Infrastructure infrastructure = db.Infrastructures.Find(id);

            if (infrastructure == null)
            {
                return(HttpNotFound());
            }
            ViewBag.RoomID       = new SelectList(db.Rooms, "RoomID", "RoomName", infrastructure.RoomID);
            ViewBag.EquipmentID  = new SelectList(db.Equipments, "EquipmentID", "EquipmentCategory", infrastructure.EquipmentID);
            ViewBag.DepartmentID = new SelectList(db.Departments, "DepartmentID", "DepartmentName", infrastructure.DepartmentID);
            ViewBag.MakeID       = new SelectList(db.Makes, "MakeID", "MakeName", infrastructure.MakeID);
            return(View(infrastructure));
        }
Esempio n. 28
0
 public ActionResult Edit(Infrastructure infrastructure)
 {
     if (ModelState.IsValid)
     {
         db.Entry(infrastructure).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.RoomID       = new SelectList(db.Rooms, "RoomID", "RoomName", infrastructure.RoomID);
     ViewBag.EquipmentID  = new SelectList(db.Equipments, "EquipmentID", "EquipmentCategory", infrastructure.EquipmentID);
     ViewBag.DepartmentID = new SelectList(db.Departments, "DepartmentID", "DepartmentName", infrastructure.DepartmentID);
     ViewBag.MakeID       = new SelectList(db.Makes, "MakeID", "MakeName", infrastructure.MakeID);
     return(View(infrastructure));
 }
Esempio n. 29
0
        private async void AddOneBottleButton_Click(object sender, EventArgs e)
        {
            var sendSuccessfully = await Infrastructure.AddBottles(this._inventoryId, this._currentAmount, int.Parse(this.tbamount.Text), this._shelfId);

            if (sendSuccessfully.ErrorCode)
            {
                var responseObject = (InventoryResponse)sendSuccessfully.Object;
                this.CurrentAmount = responseObject.Amount.ToString();
            }
            else if (!string.IsNullOrEmpty(sendSuccessfully.Message))
            {
                MessageBox.Show(sendSuccessfully.Message, "Fel");
            }
        }
Esempio n. 30
0
        public IHttpActionResult GetInfrastructureWithID([FromUri] int InfrastructureID, [FromUri] string lang = "en", [FromUri] string extra = "")
        {
            using (CSSPDBContext db = new CSSPDBContext(DatabaseType))
            {
                InfrastructureService infrastructureService = new InfrastructureService(new Query()
                {
                    Language = (lang == "fr" ? LanguageEnum.fr : LanguageEnum.en)
                }, db, ContactID);

                infrastructureService.Query = infrastructureService.FillQuery(typeof(Infrastructure), lang, 0, 1, "", "", extra);

                if (infrastructureService.Query.Extra == "A")
                {
                    InfrastructureExtraA infrastructureExtraA = new InfrastructureExtraA();
                    infrastructureExtraA = infrastructureService.GetInfrastructureExtraAWithInfrastructureID(InfrastructureID);

                    if (infrastructureExtraA == null)
                    {
                        return(NotFound());
                    }

                    return(Ok(infrastructureExtraA));
                }
                else if (infrastructureService.Query.Extra == "B")
                {
                    InfrastructureExtraB infrastructureExtraB = new InfrastructureExtraB();
                    infrastructureExtraB = infrastructureService.GetInfrastructureExtraBWithInfrastructureID(InfrastructureID);

                    if (infrastructureExtraB == null)
                    {
                        return(NotFound());
                    }

                    return(Ok(infrastructureExtraB));
                }
                else
                {
                    Infrastructure infrastructure = new Infrastructure();
                    infrastructure = infrastructureService.GetInfrastructureWithInfrastructureID(InfrastructureID);

                    if (infrastructure == null)
                    {
                        return(NotFound());
                    }

                    return(Ok(infrastructure));
                }
            }
        }
Esempio n. 31
0
        static void Main(string[] args)
        {
            Console.WriteLine($"The Main thread. ThreadId = {Thread.CurrentThread.ManagedThreadId}");

            var generateRandomIntegersTask = new Task <int[]>(() =>
            {
                var randomIntegers = MathHelper.GenerateRandomIntegers(MinRandomValue, MaxRandomValue, CountOfRandomIntegers);

                Console.WriteLine("Generated random integers:");
                Infrastructure.PrintElementsOfCollection <int>(randomIntegers);

                return(randomIntegers);
            });

            generateRandomIntegersTask
            .ContinueWith(data =>
            {
                var multiplikator = MathHelper.GenerateRandomInteger(MultiplikatorMinValue, MultiplikatorMaxValue);

                Console.WriteLine($"Multiple each element of the array by {multiplikator}.");

                MultipleEachElementOfIntegerArrayBy(data.Result, multiplikator);

                Console.WriteLine("The result of multiplication:");
                Infrastructure.PrintElementsOfCollection <int>(data.Result);

                return(data.Result);
            })
            .ContinueWith(data =>
            {
                Array.Sort(data.Result);

                Console.WriteLine("Sorted array:");
                Infrastructure.PrintElementsOfCollection <int>(data.Result);

                return(data.Result);
            })
            .ContinueWith(data =>
            {
                var averageValue = data.Result.Average();

                Console.WriteLine($"The average value: {averageValue}.");
            });

            generateRandomIntegersTask.Start();

            Console.WriteLine("\n\nTap to continue...");
            Console.ReadKey();
        }
Esempio n. 32
0
        public Species Build(Infrastructure.Data.Species dataSpecies, Genus genus, bool hasPhotos)
        {
            var hasFish = dataSpecies.Fish.Count > 0;

            var species = new Species(dataSpecies.SpeciesID)
                              {
                                  Genus = genus,
                                  Described = Convert.ToBoolean(dataSpecies.Described),
                                  Name = dataSpecies.SpeciesName.Trim(),
                                  HaveFish = hasFish,
                                  HasPhotos = hasPhotos
                              };

            return species;
        }
        private async void btnAddVintage_Click(object sender, EventArgs e)
        {
            var addVintageResponse = await Infrastructure.AddVintage(this.WineId, tbYear.Text);

            if (addVintageResponse.ErrorCode)
            {
                Vintages.Add((VintageResponse)addVintageResponse.Object);
                ShowVintages();
                cbYears.SelectedIndex = cbYears.Items.Count - 1;
            }
            else if (!string.IsNullOrEmpty(addVintageResponse.Message))
            {
                MessageBox.Show(addVintageResponse.Message, "Fel");
            }
        }
Esempio n. 34
0
 private void RemoveItem(Infrastructure item)
 {
     if (MessageBox.Show("Naozaj si želáte odstrániť infraštruktúru " + item.Name, "?",
                         MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
     {
         if (!ezkoController.RemoveInfrastructure(item))
         {
             BasicMessagesHandler.ShowErrorMessage("Infraštruktúru sa nepodarilo odstrániť");
         }
         else
         {
             FillDataGridView();
         }
     }
 }
Esempio n. 35
0
        public static DistributedServices.Entities.Dto.Client Map(Infrastructure.Data.MainModule.Models.Client item)
        {
            if (item == null)
                return new Entities.Dto.Client();

            var dto = new Entities.Dto.Client()
            {
                Name = item.Name,
                Description = "TEST DESCRIPTION",
                Token = item.Token,
                Id = item.Id
            };

            return dto;
        }
        public Field Create(Infrastructure.Data.Field dataField, Form form)
        {
            if (dataField == null)
            return null;

              return new Field
              {
            Id = dataField.Id,
            FieldId = dataField.FieldId,
            Form = form,
            Value = dataField.Value,
            Data = dataField.Data,
            FieldName = dataField.FieldName
              };
        }
Esempio n. 37
0
    static Task <int> Main()
    {
        var Config = new ConfigurationBuilder()
                     .SetBasePath(Directory.GetCurrentDirectory())
                     .AddJsonFile("appsettings.json")
                     .Build();
        var dendEnvironmentConfiguration = new DendConfigurationDTO();

        dendEnvironmentConfiguration.VpcId    = Config["vpcId"];
        dendEnvironmentConfiguration.PublicIp = Config["publicIp"];
        dendEnvironmentConfiguration.Region   = Config["region"];
        var infrastructure = new Infrastructure(dendEnvironmentConfiguration);

        return(infrastructure.runDeployment());
    }
        private async void btnAddShelf_Click(object sender, EventArgs e)
        {
            var addShelfResponse = await Infrastructure.AddShelf(tbShelfName.Text);

            if (addShelfResponse.ErrorCode)
            {
                Shelves.Add((ShelfResponse)addShelfResponse.Object);
                ShowShelves();
                cbShelves.SelectedIndex = cbShelves.Items.Count - 1;
            }
            else if (!string.IsNullOrEmpty(addShelfResponse.Message))
            {
                MessageBox.Show(addShelfResponse.Message, "Fel");
            }
        }
 private void btnAddInventory_Click(object sender, EventArgs e)
 {
     try
     {
         var selectedSelf          = (ShelfResponse)cbShelves.SelectedItem;
         var selectedvintage       = (VintageResponse)cbYears.SelectedItem;
         var amount                = int.Parse(tbAmount.Text);
         var addinventoryResponnse = Infrastructure.AddInventory(selectedvintage.VintageId, selectedSelf.ShelfId, amount);
     }
     catch (Exception error)
     {
         MessageBox.Show(error.Message, "Fel");
         return;
     }
     this.Close();
 }
Esempio n. 40
0
    private void OnEnable()
    {
        if (PanelAudioSourceComponent == null)
        {
            PanelAudioSourceComponent = GetComponent <AudioSource>();
        }

        CommandLineText           = "";
        CommandLineCharacterIndex = 0;
        SelectedDistrict          = null;
        SelectedStructure         = null;
        GoToSelectMenu();

        //Start routine
        StartCoroutine(Routine_UpdateText());
    }
		public UserReturnModel Create(Infrastructure.ApplicationUser appUser)
		{
			return new UserReturnModel
			{
				Url = _UrlHelper.Link("GetUserById", new { id = appUser.Id }),
				Id = appUser.Id,
				UserName = appUser.UserName,
				FullName = string.Format("{0} {1}", appUser.FirstName, appUser.LastName),
				Email = appUser.Email,
				EmailConfirmed = appUser.EmailConfirmed,
				Level = appUser.Level,
				JoinDate = appUser.JoinDate,
				Roles = _AppUserManager.GetRolesAsync(appUser.Id).Result,
				Claims = _AppUserManager.GetClaimsAsync(appUser.Id).Result
			};
		}
Esempio n. 42
0
 public DeploymentNode(
     NodeSettings nodeSettings,
     ClusterSettings clusterSettings,
     Infrastructure infrastructure,
     string[] servicesToBeDeployed,
     string[] servicesToBeEnabled,
     ClusterManifestType clusterManifest)
 {
     this.nodeSettings         = nodeSettings;
     this.clusterSettings      = clusterSettings;
     this.infrastructure       = infrastructure;
     this.servicesToBeDeployed = servicesToBeDeployed;
     this.servicesToBeEnabled  = servicesToBeEnabled;
     this.clusterManifest      = clusterManifest;
     this.fabricHostSections   = new List <SettingsTypeSection>();
 }
Esempio n. 43
0
        private void dataGridView_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            DataGridView senderGrid = (DataGridView)sender;

            if (senderGrid.Columns[e.ColumnIndex] is DataGridViewButtonColumn && e.RowIndex >= 0)
            {
                Infrastructure item = senderGrid.Rows[e.RowIndex].Tag as Infrastructure;
                if (senderGrid.Columns[e.ColumnIndex].Name == "Edit")
                {
                    EditItem(item);
                }
                else if (senderGrid.Columns[e.ColumnIndex].Name == "Remove")
                {
                    RemoveItem(item);
                }
            }
        }
        public bool Update(Infrastructure infrastructure)
        {
            infrastructure.ValidationResults = Validate(new ValidationContext(infrastructure), ActionDBTypeEnum.Update);
            if (infrastructure.ValidationResults.Count() > 0)
            {
                return(false);
            }

            db.Infrastructures.Update(infrastructure);

            if (!TryToSave(infrastructure))
            {
                return(false);
            }

            return(true);
        }
        public ActionResult Delete(int id)
        {
            var reservation = new Infrastructure {
                I_ID = id
            };

            try
            {
                SqlParameter param = new SqlParameter("@id", id);
                db.Database.ExecuteSqlCommand("stp_DeleteInfra @id", param);
                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
Esempio n. 46
0
        /// <summary>
        /// Loads infrastructure configuration from the given YAML.
        /// </summary>
        /// <param name="node">The YAML to load configuration from.</param>
        /// <returns>The infrastructure configuration loaded from the given YAML.</returns>
        public virtual Infrastructure Load(YamlMappingNode node)
        {
            var infrastructure = new Infrastructure();

            foreach (var(tag, value) in node.Children)
            {
                if (!KnownParserNodes.TryGetValue(tag.GetTag(), out var action))
                {
                    throw new ArgumentException(
                              $"Unknown tag {tag.GetTag()} (line {tag.Start.Line})");
                }

                action(infrastructure, value);
            }

            return(infrastructure);
        }
Esempio n. 47
0
 protected void AddMessage(string text, Infrastructure.Messages.MessageTypes type)
 {
     if (!string.IsNullOrWhiteSpace(text))
     {
         List<Infrastructure.Messages.Message> messages;
         if (TempData[MessageKey] == null)
         {
             messages = new List<Infrastructure.Messages.Message>();
         }
         else
         {
             messages = (List<Infrastructure.Messages.Message>)TempData[MessageKey];
         }
         messages.Add(new Infrastructure.Messages.Message(text, type));
         TempData[MessageKey] = messages;
     }
 }
        public override bool FinishedLaunching(UIApplication uiApplication, NSDictionary launchOptions)
        {
            Forms.Init();
            CachedImageRenderer.Init();
            CarouselViewRenderer.Init();
            Infrastructure.Init();

            Iconize.With(new Plugin.Iconize.Fonts.MaterialModule());
            IconControls.Init();

            InitPlugins();

            ConfigureUI();
            LoadApplication(new App());

            return(base.FinishedLaunching(uiApplication, launchOptions));
        }
        private bool TryToSave(Infrastructure infrastructure)
        {
            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateException ex)
            {
                infrastructure.ValidationResults = new List <ValidationResult>()
                {
                    new ValidationResult(ex.Message + (ex.InnerException != null ? " Inner: " + ex.InnerException.Message : ""))
                }.AsEnumerable();
                return(false);
            }

            return(true);
        }
Esempio n. 50
0
        public static void Initialization()
        {
            Settings = new Settings();

            WorkEnvironment = new WorkEnvironment();

            Metrics = new MetricsWriter();

            Pilots = new PilotsEntity();

            Infrastructure = new Infrastructure();

            Space = new SpaceEntity();

            InternalBrowser = new InternalBrowser();

            LostAndFoundOffice = new LostSolarSystems();
        }
Esempio n. 51
0
        public ActionResult LoadFile(HttpPostedFileBase file)
        {
            if (!(file != null && file.ContentLength > 0))
            {
                return(View("LoadFile"));
            }
            try
            {
                var fileName = Path.GetFileName(file.FileName);

                //check ext
                Infrastructure.Logger.Info("Name red: " + file.ToString() + "|||" + file.FileName);
                var exts = Infrastructure.GetAllowedExts();
                var ext  = Path.GetExtension(file.FileName);

                Infrastructure.Logger.Info("Comparing: {0} and {1}", String.Join(",", exts), ext);

                if (!exts.Contains(ext))
                {
                    Infrastructure.Logger.Error("Wrong!");
                    return(View("LoadFile"));
                }

                dbManager.Files.Add(new Files()
                {
                    UserId   = User.Identity.Name,
                    FileName = fileName
                });

                dbManager.SaveChanges();

                string dir  = Infrastructure.GetUsersDirectory(User.Identity.Name);
                var    path = Path.Combine(dir, fileName);
                file.SaveAs(path);
            }
            catch (Exception e)
            {
                Infrastructure.Logger.Error(e.ToString());
                throw e;
            }

            Infrastructure.Logger.Info("Load succeeded!");
            return(RedirectToAction("Index"));
        }
        public void Infrastructure_Controller_GetInfrastructureWithID_Test()
        {
            foreach (LanguageEnum LanguageRequest in AllowableLanguages)
            {
                foreach (int ContactID in new List <int>()
                {
                    AdminContactID
                })                                                             //, TestEmailValidatedContactID, TestEmailNotValidatedContactID })
                {
                    InfrastructureController infrastructureController = new InfrastructureController(DatabaseTypeEnum.SqlServerTestDB);
                    Assert.IsNotNull(infrastructureController);
                    Assert.AreEqual(DatabaseTypeEnum.SqlServerTestDB, infrastructureController.DatabaseType);

                    Infrastructure infrastructureFirst = new Infrastructure();
                    using (CSSPDBContext db = new CSSPDBContext(DatabaseType))
                    {
                        InfrastructureService infrastructureService = new InfrastructureService(new Query(), db, ContactID);
                        infrastructureFirst = (from c in db.Infrastructures select c).FirstOrDefault();
                    }

                    // ok with Infrastructure info
                    IHttpActionResult jsonRet = infrastructureController.GetInfrastructureWithID(infrastructureFirst.InfrastructureID);
                    Assert.IsNotNull(jsonRet);

                    OkNegotiatedContentResult <Infrastructure> Ret = jsonRet as OkNegotiatedContentResult <Infrastructure>;
                    Infrastructure infrastructureRet = Ret.Content;
                    Assert.AreEqual(infrastructureFirst.InfrastructureID, infrastructureRet.InfrastructureID);

                    BadRequestErrorMessageResult badRequest = jsonRet as BadRequestErrorMessageResult;
                    Assert.IsNull(badRequest);

                    // Not Found
                    IHttpActionResult jsonRet2 = infrastructureController.GetInfrastructureWithID(0);
                    Assert.IsNotNull(jsonRet2);

                    OkNegotiatedContentResult <Infrastructure> infrastructureRet2 = jsonRet2 as OkNegotiatedContentResult <Infrastructure>;
                    Assert.IsNull(infrastructureRet2);

                    NotFoundResult notFoundRequest = jsonRet2 as NotFoundResult;
                    Assert.IsNotNull(notFoundRequest);
                }
            }
        }
Esempio n. 53
0
        private async void btnSignup_Click(object sender, EventArgs e)
        {
            var isSignedUp = await Infrastructure.SignUp(tbEmailSignup.Text, tbDisplayName.Text, tbPasswordSignUp.Text, tbRepeatPasswordSignUp.Text);

            if (isSignedUp.ErrorCode)
            {
                var metadetaErrorModel = await Infrastructure.GetMetadata();

                MetaDataResponse metadata = (MetaDataResponse)metadetaErrorModel.Object;

                Wine_Application wineApp = new Wine_Application(metadata);
                wineApp.Show();
                this.Hide();
            }
            else if (!string.IsNullOrEmpty(isSignedUp.Message))
            {
                MessageBox.Show(isSignedUp.Message, "Fel");
            }
        }
        private void CreateClientHost()
        {
            IServiceDescriptor clientDescriptor = new ClientConfiguration(_clientConfiguration.ClientPort);
            string             uriClient        = Infrastructure.GetEndpointUrl(clientDescriptor);

            _contractInstance = new ClientContract(_infrastructureCallback, CheckClient);

            _clientHost = new ServiceHost(_contractInstance, new Uri(uriClient));

            Infrastructure.AddServiceBehaviors(_clientHost.Description);

            _clientHost.AddServiceEndpoint(
                typeof(IClientInfrastructure),
                Infrastructure.CreateApplicationBinding(false),
                Constants.ClientAccessContract
                );

            _clientHost.Open();
        }
Esempio n. 55
0
        private async void btnAddCountry_Click(object sender, EventArgs e)
        {
            var addCountryResponse = await Infrastructure.AddCountry(tbNewCountry.Text);

            if (addCountryResponse.ErrorCode)
            {
                var metadetaErrorModel = await Infrastructure.GetMetadata();

                MetaDataResponse metadata = (MetaDataResponse)metadetaErrorModel.Object;
                Metadata = metadata;

                ShowCountriesAddNewWine();
                cbOriginCountry.SelectedIndex = cbOriginCountry.FindStringExact(tbNewCountry.Text);
            }
            else if (!string.IsNullOrEmpty(addCountryResponse.Message))
            {
                MessageBox.Show(addCountryResponse.Message, "Fel");
            }
        }
        internal Form Create(Infrastructure.Data.Form dataForm)
        {
            Form form = new Form(dataForm.Timestamp)
              {
            Id = dataForm.Id,
            FormItemId = dataForm.FormItemId,
            InteractionId = dataForm.SessionId,
            Data = dataForm.Data
              };

              List<Field> fields = new List<Field>();
              foreach (Infrastructure.Data.Field dataField in dataForm.Fields)
              {
            Field field = _fieldFactory.Create(dataField, form);
            if (field != null)
              fields.Add(field);
              }
              form.Field = fields;
              return form;
        }
Esempio n. 57
0
        public IndexInfoViewModel(IndexInfo indexInfo, Infrastructure infrastructure, Action refreshIndexList)
        {
            Ensure.ArgumentNotNull(infrastructure, "infrastructure");
            Ensure.ArgumentNotNull(indexInfo, "indexInfo");

            _infrastructure = infrastructure;
            _refreshIndexList = refreshIndexList;
            Name = indexInfo.Name;
            IsOpen = indexInfo.IsOpen;
            Settings = indexInfo.Settings.Select(setting => new ElasticPropertyViewModel
            {
                Label = setting.Key.Humanize(LetterCasing.Sentence),
                Value = setting.Value
            });
            Types = indexInfo.Types.Select(type => new ElasticPropertyViewModel
            {
                Label = type.Key.Humanize(LetterCasing.Sentence),
                Value = type.Value
            });
        }
Esempio n. 58
0
        public Genus Build(Infrastructure.Data.Genus dataGenus, RiftDataDataEntities dataEntities)
        {
            var speciesList = new List<Species>();

            var genus = new Genus(dataGenus.GenusID) { Name = dataGenus.GenusName.Trim(), GenusType = this.genusTypeFactory.Build(dataGenus.Type)};

            dataGenus.Species.ToList().Where(s => s.Genus == dataGenus.GenusID).ToList()
                                                    .ForEach(s => speciesList.Add(this.speciesFactory.Build(s, genus, _hasPhotoService.SpeciesHasPhoto(s.SpeciesID))));

            if (speciesList.Count < 1)
            {
                throw new EmptySpeciesListException();
            }

            genus.HasFish = dataGenus.Fish.Count > 0;

            genus.Species = speciesList.OrderBy(s => s.Name).ToList();

            return genus;
        }
Esempio n. 59
0
        public IHttpActionResult Delete([FromBody] Infrastructure infrastructure, [FromUri] string lang = "en")
        {
            using (CSSPDBContext db = new CSSPDBContext(DatabaseType))
            {
                InfrastructureService infrastructureService = new InfrastructureService(new Query()
                {
                    Language = (lang == "fr" ? LanguageEnum.fr : LanguageEnum.en)
                }, db, ContactID);

                if (!infrastructureService.Delete(infrastructure))
                {
                    return(BadRequest(String.Join("|||", infrastructure.ValidationResults)));
                }
                else
                {
                    infrastructure.ValidationResults = null;
                    return(Ok(infrastructure));
                }
            }
        }
Esempio n. 60
0
        private async void btnAddWine_Click(object sender, EventArgs e)
        {
            var winName          = tbWineName.Text;
            var producer         = tbProducer.Text;
            var selectedDistrict = (DistrictResponse)cbOriginDistrict.SelectedItem;
            var alcohol          = tbAlcohol.Text;

            if (string.IsNullOrEmpty(winName) || selectedDistrict == null || selectedDistrict.DistrictId <= 0)
            {
                MessageBox.Show("vinnamnet och distrikt är oligatoriska!", "Fel");
                return;
            }

            var addWineResponse = await Infrastructure.AddWine(winName, producer, selectedDistrict.DistrictId, alcohol, AddedGrapes, pbWineImage.Image);

            if (!addWineResponse.ErrorCode && !string.IsNullOrEmpty(addWineResponse.Message))
            {
                MessageBox.Show(addWineResponse.Message, "Fel");
            }
        }