Beispiel #1
0
        public static void Bootstrap(TemplatesSource source, GenShell shell, Version wizardVersion)
        {
            try
            {
                AppHealth.Current.AddWriter(new ShellHealthWriter(shell));
                AppHealth.Current.Info.TrackAsync($"{StringRes.ConfigurationFileLoadedString}: {Configuration.LoadedConfigFile}").FireAndForget();

                string hostVersion = $"{wizardVersion.Major}.{wizardVersion.Minor}";

                var repository = new TemplatesRepository(source, wizardVersion);

                ToolBox = new GenToolBox(repository, shell);

                PurgeTempGenerations(Path.Combine(Path.GetTempPath(), Configuration.Current.TempGenerationFolderPath), Configuration.Current.DaysToKeepTempGenerations);

                CodeGen.Initialize(source.Id, hostVersion);

                IsInitialized = true;
            }
            catch (Exception ex)
            {
                IsInitialized = false;
                AppHealth.Current.Exception.TrackAsync(ex, StringRes.GenContextBootstrapError).FireAndForget();
                Trace.TraceError($"{StringRes.GenContextBootstrapError} Exception:\n\r{ex}");
                throw;
            }
        }
        public static void Bootstrap(TemplatesSource source, GenShell shell, Version wizardVersion, string platform, string language)
        {
            try
            {
                AppHealth.Current.AddWriter(new ShellHealthWriter(shell));
                AppHealth.Current.Info.TrackAsync($"{StringRes.ConfigurationFileLoadedString}: {Configuration.LoadedConfigFile}").FireAndForget();

                string hostVersion = $"{shell.GetVsVersionAndInstance()}-{wizardVersion.Major}.{wizardVersion.Minor}";

                if (source is RemoteTemplatesSource)
                {
                    CodeGen.Initialize($"{source.Id}.{source.Platform}.{source.Language}", hostVersion);
                }
                else
                {
                    CodeGen.Initialize($"{source.Id}", hostVersion);
                }

                var repository = new TemplatesRepository(source, wizardVersion, platform, language);

                ToolBox = new GenToolBox(repository, shell);

                PurgeTempGenerations(Configuration.Current.DaysToKeepTempGenerations);

                CurrentLanguage = language;
                CurrentPlatform = platform;
            }
            catch (Exception ex)
            {
                AppHealth.Current.Exception.TrackAsync(ex, StringRes.GenContextBootstrapError).FireAndForget();
                Trace.TraceError($"{StringRes.GenContextBootstrapError} Exception:\n\r{ex}");
                throw;
            }
        }
 public JobListingsController(DBApplicationContext context)
 {
     _dbContext             = context;
     _jobListingsRepository = new JobListingsRepository(context);
     _companiesRepository   = new CompaniesRepository(context);
     _categoriesRepository  = new CategoriesRepository(context);
     _templatesRepository   = new TemplatesRepository(context);
 }
        protected void Button1_Click(object sender, EventArgs e)
        {
            int tid = Convert.ToInt32(DeleteTemplate.Text.ToString());
            TemplatesRepository tr = new TemplatesRepository();

            tr.Delete(tid);
            Response.Redirect("Templates.aspx");
        }
        public void SetUp()
        {
            _collection = _database.GetCollection <Template>("Templates");
            _collection.InsertMany(DeepClone(_templates));

            _tenantIdProvider = new Mock <ITenantIdProvider>();

            _repository = new TemplatesRepository(_database, _tenantIdProvider.Object);
        }
Beispiel #6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Context.User.IsInRole("OperationManager"))
            {
                Response.Redirect("NotAuthorized.aspx");
            }
            TemplatesRepository Tr = new TemplatesRepository();

            Tr.UpdateStatus();
        }
Beispiel #7
0
 public ApplicationsController(DBApplicationContext context)
 {
     _dbContext                       = context;
     _templatesRepository             = new TemplatesRepository(context);
     _applicationsRepository          = new ApplicationsRepository(context);
     _companyUsersRepository          = new CompanyUsersRepository(context);
     _applicationEducationsRepository = new ApplicationEducationsRepository(context);
     _applicationSkillsRepository     = new ApplicationSkillsRepository(context);
     _applicationWorkExperience       = new ApplicationWorkExperiencesRepository(context);
 }
Beispiel #8
0
 public HomeController()
 {
     authContext = new ApplicationDbContext();
     manualRepository = new ManualRepository(new ApplicationDbContext());
     categoryRepository = new CategoryRepository(new ApplicationDbContext());
     tagRepository = new TagRepository(new ApplicationDbContext());
     ratingRepository = new RatingRepository(new ApplicationDbContext());
     templatesRepository = new TemplatesRepository(new ApplicationDbContext());
     userRepository = new UserRepository(new ApplicationDbContext());
 }
        public void InitializeFixture(string language)
        {
            var source = new UnitTestsTemplatesSource();

            GenContext.Bootstrap(source, new FakeGenShell(language), language);

            GenContext.ToolBox.Repo.SynchronizeAsync().Wait();

            Repository = GenContext.ToolBox.Repo;
        }
        public TemplatesFixture()
        {
            var source = new UnitTestsTemplatesSource();

            CodeGen.Initialize(source.Id, "0.0");

            Repository = new TemplatesRepository(source, Version.Parse("0.0.0.0"));

            Repository.SynchronizeAsync(true).Wait();
        }
        public TemplatesFixture()
        {
            var source = new UnitTestsTemplatesSource();

            GenContext.Bootstrap(source, new FakeGenShell());

            GenContext.ToolBox.Repo.SynchronizeAsync().Wait();

            Repository = GenContext.ToolBox.Repo;
        }
Beispiel #12
0
 public HomeController()
 {
     authContext         = new ApplicationDbContext();
     manualRepository    = new ManualRepository(new ApplicationDbContext());
     categoryRepository  = new CategoryRepository(new ApplicationDbContext());
     tagRepository       = new TagRepository(new ApplicationDbContext());
     ratingRepository    = new RatingRepository(new ApplicationDbContext());
     templatesRepository = new TemplatesRepository(new ApplicationDbContext());
     userRepository      = new UserRepository(new ApplicationDbContext());
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            TemplatesRepository Tr           = new TemplatesRepository();
            int idvalue                      = Convert.ToInt32(Request.QueryString["id"].ToString());
            List <NHubDAL.Model.Templates> T = Tr.GetTemplate(idvalue);

            foreach (NHubDAL.Model.Templates Templatedetails in T)
            {
                DeleteTemplate.Text = Templatedetails.TemplateId.ToString();
            }
        }
        private static TemplatesRepository CreateNewRepos()
        {
            var source = new LocalTemplatesSource();

            CodeGen.Initialize(source.Id, "0.0");

            var repos = new TemplatesRepository(source, Version.Parse("0.0.0.0"));

            repos.SynchronizeAsync(true).Wait();

            return(repos);
        }
Beispiel #15
0
 public AiService(AppSettings appSettings)
 {
     _appSettings              = appSettings;
     _witTokenService          = new WitTokenService(appSettings);
     _witService               = new WitService(appSettings);
     _proceduceAiService       = new ProceduceAiService(appSettings);
     _templatesRepository      = new TemplatesRepository(appSettings);
     _productsRepository       = new ProductsRepository(appSettings);
     _extentionService         = new ExtentionService(appSettings);
     _productCaresService      = new ProductCaresService(appSettings);
     _productGeneralRepository = new ProductGeneralRepository(appSettings);
 }
Beispiel #16
0
        public void InitializeFixture(string platform, string language)
        {
            var source = new UnitTestsTemplatesSource(null);

            GenContext.Bootstrap(source, new TestShell(platform, language), platform, language);
            if (!_syncExecuted)
            {
                GenContext.ToolBox.Repo.SynchronizeAsync(true).Wait();
                _syncExecuted = true;
            }

            Repository = GenContext.ToolBox.Repo;
        }
Beispiel #17
0
        public void InitializeFixture(string platform, string language)
        {
            var source = new LocalTemplatesSource();

            GenContext.Bootstrap(source, new FakeGenShell(platform, language), Platforms.Uwp, language);
            GenContext.Current = this;
            if (!syncExecuted)
            {
                GenContext.ToolBox.Repo.SynchronizeAsync(true).Wait();
                syncExecuted = true;
            }

            Repository = GenContext.ToolBox.Repo;
        }
Beispiel #18
0
        public static void Bootstrap(TemplatesSource source, GenShell shell, Version wizardVersion)
        {
            AppHealth.Current.AddWriter(new ShellHealthWriter());
            AppHealth.Current.Info.TrackAsync($"Configuration file loaded: {Configuration.LoadedConfigFile}").FireAndForget();

            string hostVersion = $"{wizardVersion.Major}.{wizardVersion.Minor}";

            CodeGen.Initialize(source.Id, hostVersion);
            TemplatesRepository repository = new TemplatesRepository(source, wizardVersion);

            ToolBox = new GenToolBox(repository, shell);

            IsInitialized = true;
        }
        protected void CreateBtn_Click(object sender, EventArgs e)
        {
            TemplatesRepository tr = new TemplatesRepository();
            int    ServiceLineID   = Convert.ToInt32(ServiceLineDDL.SelectedValue);
            int    NotificationId  = Convert.ToInt32(NotificationDDL.SelectedValue);
            string Templatename    = TemplateName.Text;
            String name            = Context.User.Identity.Name;
            string id             = tr.Getid(name);
            int    ApprovalStatus = 1;

            tr.Insert(Templatename, id, ServiceLineID, NotificationId, ApprovalStatus);
            createlbltxt.Text = "Template Created,Now insert the url";
            uploadlbltxt.Text = "";
        }
        public void InitializeFixture(string language)
        {
            var source = new UnitTestsTemplatesSource();

            GenContext.Bootstrap(source, new FakeGenShell(language), language);
            if (!_syncExecuted)
            {
                GenContext.ToolBox.Repo.SynchronizeAsync().Wait();
                _syncExecuted = true;
            }
            else
            {
                GenContext.ToolBox.Repo.CheckForUpdatesAsync().Wait();
            }

            Repository = GenContext.ToolBox.Repo;
        }
        protected void Upload_Click(object sender, EventArgs e)
        {
            try
            {
                TemplatesRepository tr = new TemplatesRepository();
                string Tmpltname       = TemplateName.Text;
                int    id             = tr.GetTemplateId(Tmpltname);
                int    ChannelId      = Convert.ToInt32(ChannelDDL.SelectedValue);
                string url            = URL.Text;
                int    ApprovalStatus = 1;
                tr.InsertUrl(id, ChannelId, url, ApprovalStatus);
                Uploadsucces.Text = "Template Inserted";
            }

            catch (Exception ex)
            {
                uploadlbltxt.Text = "First Create the template,then upload your template url!!";
            }
        }
Beispiel #22
0
        public void InitializeFixture(string platform, string language)
        {
            var path = $"{Path.GetPathRoot(Environment.CurrentDirectory)}\\UIT\\UI\\";

            var source = new LocalTemplatesSource(null, $"UITest{platform}");

            GenContext.Bootstrap(source, new FakeGenShell(platform, language), platform, language);

            GenContext.ToolBox.Repo.SynchronizeAsync(true).Wait();

            Repository = GenContext.ToolBox.Repo;

            GenContext.Current = new FakeContextProvider
            {
                ProjectName          = "Test",
                DestinationPath      = path,
                GenerationOutputPath = path,
            };
        }
Beispiel #23
0
        public void CanCreateTreeNode()
        {
            const string sitecoreRootPath = @"sitecore/templates/system/branches";
            const int    rootItemsCount   = 1;
            const int    childrenItemsCountForFirstNode = 4;
            const string firstChildName = @"Branch";

            var webApiRepository = new Mock <ISitecoreWebApiRepository>();

            webApiRepository
            .Setup(r => r.RequestItemsAsync(It.IsAny <SitecoreActionType>(), It.IsAny <string>()))
            .ReturnsAsync(_validRequestResult);

            var repository = new TemplatesRepository(webApiRepository.Object, sitecoreRootPath);

            var tree = repository.CreateTree().ToList();

            Assert.NotNull(tree);
            Assert.AreEqual(rootItemsCount, tree.Count);
            Assert.AreEqual(childrenItemsCountForFirstNode, tree.First().Children.Count);
            Assert.AreEqual(firstChildName, tree.First().Children.First().Value.Name);
        }
 public TemplatesController(DBApplicationContext context)
 {
     _dbContext             = context;
     _templatesRepository   = new TemplatesRepository(context);
     _jobListingsRepository = new JobListingsRepository(context);
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            //if (!Context.User.IsInRole("Operation Manager"))
            //{
            //    Response.Redirect("NotAuthorized.aspx");
            //}
            if (!IsPostBack)
            {
                TemplatesRepository Tr = new TemplatesRepository();
                Tr.UpdateStatus();
            }
            SourceRepository        Sr = new SourceRepository();
            List <Source>           L  = Sr.GetSource();
            EventRepository         ER = new EventRepository();
            TemplateEventRepository TE = new TemplateEventRepository();

            foreach (Source s in L)
            {
                Label SourceName = new Label();
                SourceName.Text = s.SourceName.ToString();
                PlaceHolder PR1 = new PlaceHolder();

                List <Events> Event = ER.GetEventsid(s.SourceId);
                foreach (Events OneEvent in Event)
                {
                    Table     T         = new Table();
                    TableRow  tablerow  = new TableRow();
                    TableCell tableCell = new TableCell();
                    Label     LE        = new Label();
                    LE.Text = OneEvent.EventName;
                    PlaceHolder Pr2 = new PlaceHolder();

                    List <TemplateEvent> TemplateEvent = TE.GetTemplatesid(OneEvent.EventId);

                    foreach (TemplateEvent OneTemplate in TemplateEvent)
                    {
                        Label LT = new Label();
                        LT.Text = OneTemplate.TemplateName;
                        HyperLink DeleteTemplate    = new HyperLink();
                        HyperLink ConfigureTemplate = new HyperLink();
                        DeleteTemplate.Text        = "Delete";
                        ConfigureTemplate.Text     = "Configure";
                        DeleteTemplate.NavigateUrl = "TemplateDelete.aspx?id=" + OneTemplate.TemplateId;
                        Pr2.Controls.Add(LT);

                        Pr2.Controls.Add(new LiteralControl("&nbsp;&nbsp;&nbsp;"));
                        Pr2.Controls.Add(DeleteTemplate);
                        Pr2.Controls.Add(ConfigureTemplate);
                        Pr2.Controls.Add(new LiteralControl("<br/>"));
                        tableCell.Controls.Add(Pr2);
                    }

                    tablerow.Cells.Add(tableCell);
                    T.Rows.Add(tablerow);
                    PR1.Controls.Add(LE);
                    PR1.Controls.Add(new LiteralControl("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"));
                    PR1.Controls.Add(T);
                    PR1.Controls.Add(new LiteralControl("<br/>"));
                }
                PlaceHolder1.Controls.Add(SourceName);
                PlaceHolder1.Controls.Add(new LiteralControl("&nbsp;&nbsp;&nbsp;"));
                PlaceHolder1.Controls.Add(new LiteralControl("<br/>"));
                PlaceHolder1.Controls.Add(PR1);
                PlaceHolder1.Controls.Add(new LiteralControl("<br/>"));
            }
        }
 private void SetUpFixtureForTesting(string language)
 {
     _fixture.InitializeFixture(TestPlatform, language);
     _repo    = GenContext.ToolBox.Repo;
     _context = new UserSelectionContext(language, TestPlatform);
 }
Beispiel #27
0
 private void SetUpFixtureForTesting(string language)
 {
     _fixture.InitializeFixture(TestPlatform, language);
     _repo = GenContext.ToolBox.Repo;
 }
 public GenToolBox(TemplatesRepository repo, IGenShell shell)
 {
     Repo  = repo;
     Shell = shell;
 }
Beispiel #29
0
 public ExtentionService(AppSettings appSettings)
 {
     _appSettings         = appSettings;
     _proceduceAiService  = new ProceduceAiService(appSettings);
     _templatesRepository = new TemplatesRepository(appSettings);
 }
Beispiel #30
0
 public TemplatesService(AppSettings appSettings)
 {
     _appSettings         = appSettings;
     _templatesRepository = new TemplatesRepository(appSettings);
 }