コード例 #1
0
        public ActionResult Index()
        {
            var viewmodel = new TemplateListViewModel(baseviewmodel);

            viewmodel.templates = repository.GetExamTemplates(sessionid.Value).ToModel();
            return(View(viewmodel));
        }
コード例 #2
0
        public void ExecuteSelectTableTemplateTest()
        {
            string dbfile = "taskaludb29.sqlite";
            string path   = Path.GetTempPath() + "\\" + dbfile;

            TouchTestDB(dbfile);

            var lt = new ListTemplate();

            lt.Order    = 1;
            lt.Name     = "name";
            lt.Template = "template";
            SQLiteClass.ExecuteInsertTableTemplate(path, lt);
            var lt2 = new ListTemplate();

            lt2.Order    = 2;
            lt2.Name     = "name2";
            lt2.Template = "template2";
            SQLiteClass.ExecuteInsertTableTemplate(path, lt2);

            var tlv    = new TemplateListViewModel();
            var result = SQLiteClass.ExecuteSelectTableTemplate(path, tlv);

            Debug.Assert(result);
            Debug.Assert(tlv.Entries.Count == 2);
        }
コード例 #3
0
        public async Task <TemplateListViewModel> GetAllAsync(string requestId = "")
        {
            _logger.LogInformation($"RequestId: {requestId} - GetAllAsync called.");

            try
            {
                var listItems = (await _templateRepository.GetAllAsync(requestId)).ToList();
                Guard.Against.Null(listItems, nameof(listItems), requestId);

                var templateistViewModel = new TemplateListViewModel
                {
                    ItemsList = await Task.WhenAll(listItems.Select(item => _templateHelpers.MapToViewModel(item)).ToList())
                };

                if (templateistViewModel.ItemsList.Count == 0)
                {
                    _logger.LogWarning($"RequestId: {requestId} - GetAllAsync no items found");
                    throw new NoItemsFound($"RequestId: {requestId} - Method name: GetAllAsync - No Items Found");
                }

                return(templateistViewModel);
            }
            catch (Exception ex)
            {
                _logger.LogError($"RequestId: {requestId} - GetAllAsync Service Exception: {ex}");
                throw new ResponseException($"RequestId: {requestId} - GetAllAsync Service Exception: {ex}");
            }
        }
コード例 #4
0
        public void GlobalTemplate()
        {
            TemplateListViewModel model = IoC.Get <TemplateListViewModel>();

            model.IsShow = true;
            model.Init();
        }
コード例 #5
0
        public ViewResult Index()
        {
            TemplateListViewModel model = new TemplateListViewModel();

            model.FolderTree = GetCurrentFolderTree();
            model.Instances  = Service.GetTemplates();
            return(View(model));
        }
コード例 #6
0
        // Templates List
        public ActionResult TemplateList(string id)
        {
            string UserGuid  = User.Identity.GetUserId();
            var    viewModel = new TemplateListViewModel
            {
                MyTemplates = _context.Templates.Include("Category").Where(t => t.UserId == UserGuid).OrderBy(t => t.Day).ToList(),
                DefCurrency = _context.Users.Single(u => u.Id == UserGuid).DefCurrency
            };

            return(View(viewModel));
        }
コード例 #7
0
        public IActionResult TemplateList()
        {
            var userID = _httpContextAccessor.HttpContext.User.FindFirst(ClaimTypes.NameIdentifier).Value;

            var viewModel = new TemplateListViewModel
            {
                Templates = _templateService.GetTemplates(userID),
            };

            return(View(viewModel));
        }
コード例 #8
0
        public IActionResult Template()
        {
            var orgId = getOrg();

            List <TemplateListViewModel> tlVM = new List <TemplateListViewModel>();

            TemplateListViewModel temp;

            var temps = _context.AppraisalTemplates.Where(x => x.OrganisationId == orgId).ToList();

            foreach (var item in temps)
            {
                temp = new TemplateListViewModel();
                var appTemp = _context.AppraisalTemplateCategories.Where(x => x.AppraisalTemplateId == item.Id).ToList();

                temp.AppraisalTemplate = item;
                temp.NoOfCategory      = appTemp.Count();
                temp.TotalWeight       = appTemp.Sum(x => x.Weight);

                tlVM.Add(temp);
            }

            return(View(tlVM));
        }
コード例 #9
0
		/// <summary>
		/// Initializes a new instance of the MainViewModel class.
		/// </summary>
		public MainViewModel()
		{
			////if (IsInDesignMode)
			////{
			////    // Code runs in Blend --> create design time data.
			////}
			////else
			////{
			////    // Code runs "for real"
			////}

			/* 쇼 동작 원리: 시작
			 * 1. 로딩.
			 * 2. MainViewModel.Play는 ActiveBoard.Start를 호출하고 이를 통해 첫 페이지 로딩 후 EVT_STARTING 전송. Starting으로 ShowPage Navigate.
			 * 3. ShowPage에서 이 메시지로 ActiveBoard의 CurrentPage를 로딩하고 그에 맞는 XAML 로딩.
			 * 4. 내부에 XAML이 EVT_LOADED 로딩.
			 * 5. 그에 대한 메시지로 현재 페이지에 대한 RemainedSecond를 셋팅.
			 * 6. tick마다 --RemainedSecond.
			 * 7. RemainedSecond < 0  이 되면 MoveNext..
			 * 
			 * 총 메시지는 3번: ready, loaded, start.
			*/
			/* 쇼 동작원리: 종료
			 * 1. MainViewModel에서 타이머 종료, 첫페이지 돌리기, Finishing 명령 전송.
			 * 2. ShowPage 에서 이를 통해 Finished 및 Page Close.
			 * */

			_timer = new DispatcherTimer();
			_timer.Tick += PlayTimerEventHandler;
			_timer.Interval = new TimeSpan(0, 0, 1);

			Messenger.Default.Register<GenericMessage<LbMessage>>(this, message =>
			{
				Debug.WriteLine("* MainViewModel Received Message: " + message.Content.MessageType.ToString());
				switch (message.Content.MessageType)
				{
					case LbMessageType.EVT_SHOW_FINISHING:
						Stop(ActiveBoard);
						break;
					case LbMessageType.EVT_PAGE_STARTED:
						// 페이지 장착 완료.
						CurrentRemainedSecond = (int)CurrentPage.Duration.TotalSeconds;
						CurrentPageStarted = true;

						_timer.Start();
						break;
					case LbMessageType.EVT_SHOW_STARTED:
						// 첫페이지 로딩.
						ActiveBoard.Start();
						CurrentPage = ActiveBoard.Board.Pages[ActiveBoard.CurrentIndex];
						break;
					case LbMessageType.EVT_PAGE_CREATING:
						// 페이지 추가 명령을 받았을 때.
						var page = generatePageFromTemaplate(message.Content.Data as LbTemplate);
						ActiveBoard.Board.Pages.Add(page);
						break;
					case LbMessageType.EVT_PAGE_FINISHED:
						CurrentRemainedSecond = 0;
						CurrentPageElapsedRatio = 0;
						break;
				}
			});

			// 초기화하면서 TemplateList.xml 파일을 로딩한다.
			Templates = new TemplateListViewModel();
		}
コード例 #10
0
 public async Task <IViewComponentResult> InvokeAsync(TemplateListViewModel model)
 {
     return(View(model));
 }