internal object getSessionById(int id) { var session = _context.Sessions.Include("Rooms") .Include("Assignees") .Include("Speakers") .Include("ProctorCheckIns") .FirstOrDefault(s => s.Id == id); SessionDto sessionDto = MapToDto.MapSessionToDto(session); return(sessionDto); }
public Control Wrap(SessionDto obj) { var dto = obj as MasterDto; var control = new ModbusControl { Text = dto.Name, Dock = DockStyle.Fill, }; control.ToUI(dto); return(control); }
/// <summary> /// 为保存session使用的工厂创建 /// </summary> /// <typeparam name="T"></typeparam> /// <param name="httpRequest"></param> /// <param name="businessRequest"></param> /// <param name="dto"></param> /// <returns></returns> public static RequestSessionManager <T> Create <T>( IHttpRequest httpRequest, T businessRequest, SessionDto dto) { if (defaultCode == 0) { return(new ServiceStackRequestSessionManager <T>(httpRequest, businessRequest, dto)); } else { return(new CustomizeRequestSessionManager <T>(httpRequest, businessRequest, dto)); } }
public void LogOut(SessionDto session) { try { //ToDo } catch (Exception ex) { var errorMessage = $"Error in: {GetType().FullName}, method: LogOut, exception: AuthenticationException, message: {ex.Message}."; throw new AuthenticationException(errorMessage); } }
public BuildSessionModel GetBuildSession(SessionDto session) { SessionService.CheckSession(session); if (!UserBuildTokens.ContainsKey(session.UserId.Value)) { throw new NotFoundException("build session"); } string token = UserBuildTokens[session.UserId.Value]; return(BuildSessions[token].BuildSession); }
public void It_should_add_the_new_sessions_as_sessionCircles_to_the_canvas() { var newSession = new SessionDto { SPID = 2 }; var newCircle = CreateSessionCircle(newSession); sessions.Add(newSession); sessionDrawer.Draw(sessions); canvasWrapper.Verify(x => x.Add(newCircle.Object.UiElement, It.IsAny <int>())); }
protected Mock <ISessionCircle> CreateSessionCircle(SessionDto session) { var sessionCircle = new Mock <ISessionCircle>(); sessionCircle.Setup(x => x.Session).Returns(session); sessionCircle.Setup(x => x.UiElement).Returns(new Object()); sessionCircleFactory .Setup(x => x.Create(session, It.IsAny <ISessionCircleList>())) .Returns(() => sessionCircle.Object); return(sessionCircle); }
public async Task <bool> DeleteSessionAsync(SessionDto sessionDto) { OnDelete(sessionDto); var entity = _context.Sessions .Where(x => x.Id == sessionDto.Id) .FirstOrDefault(); if (entity != null) { _context.Sessions.Remove(entity); OnBeforeDelete(entity); try { await _context.SaveChangesAsync(); } catch (DbUpdateException ex) { // _context.Entry(entity).State = EntityState.Detached; var sqlException = ex.GetBaseException() as SqlException; if (sqlException != null) { var errorMessage = "deleting error"; var number = sqlException.Number; if (number == 547) { string table = GetErrorTable(sqlException) ?? "descendant"; errorMessage = $"Must delete {table} records before deleting Session"; } throw new Exception(errorMessage, ex); } } finally { // _context.Entry(entity).State = EntityState.Detached; } OnAfterDelete(entity); } else { return(false); } return(true); }
public JsonResult LoginCheck(string email, string password) { try { var customer = _customerRepo.FindEntities(x => x.EmailAddress.Equals(email) && x.Password.Equals(password)).FirstOrDefault(); if (customer == null) { string msgTitle = _localizer["Uyarı"]; string rspText = _localizer["Kullanıcı bulunamadı. Lütfen eposta ve şifrenizi kontrol ediniz..."]; return(Json(new { success = false, title = msgTitle, responseText = rspText })); } else { //if (rememberMe) //{ // SetMyCookie("userEmail", customer.EmailAddress); //} //else //{ // RemoveMyCookie("userEmail"); // string userCok = Request.Cookies["userEmail"]; //} SessionDto sessionDto = new SessionDto(); sessionDto.Id = customer.Id; sessionDto.NameSurname = customer.NameSurname; HttpContext.Session.SetObject("customerInfo", sessionDto); string msgTitle = _localizer["Başarılı"]; string rspText = _localizer["Giriş işlemi başarılı... yönlendiriliyorsunuz..."]; return(Json(new { success = true, title = msgTitle, responseText = rspText })); } } catch (System.Exception e) { _errorRepo.CreateEntity(new ErrorLog { ErrorDetail = e.Message, ErrorLocation = "LoginCheck", ErrorUrl = HttpContext.Request.Path }); string msgTitle = _localizer["Hata"]; string rspText = _localizer["Hata oluştu ve kayıt altına alındı."]; return(Json(new { success = false, title = msgTitle, responseText = rspText })); } }
public SessionDto GetSessionDetails(int id) { var sessionDto = new SessionDto(); //var cardActions = _db.CreatureAction.Where(ca => ca.CreatureCard.AccountCreatureCard.Any(acc => acc.AccountId == id)).; var creatureCards = _db.AccountCreatureCards .Where(cc => cc.AccountId == id) .Include(x => x.CreatureCard.Actions) .Select(cc => new CreatureCardDto() { Name = cc.CreatureCard.Name, AC = cc.CreatureCard.AC, Initiative = cc.CreatureCard.Initiative, isHostile = cc.CreatureCard.isHostile, CurrentHP = cc.CreatureCard.CurrentHP, MaxHP = cc.CreatureCard.MaxHP, PPerception = cc.CreatureCard.PPerception, PInsight = cc.CreatureCard.PInsight, PInvestigation = cc.CreatureCard.PInvestigation, Strength = cc.CreatureCard.Strength, Dexterity = cc.CreatureCard.Dexterity, Wisdom = cc.CreatureCard.Wisdom, Intelligence = cc.CreatureCard.Intelligence, Constitution = cc.CreatureCard.Constitution, Notes = cc.CreatureCard.Notes, RedIndicatorOn = cc.CreatureCard.RedIndicatorOn, GreenIndicatorOn = cc.CreatureCard.GreenIndicatorOn, BlueIndicatorOn = cc.CreatureCard.BlueIndicatorOn, Actions = _mapper.Map <List <CreatureActionDto> >(cc.CreatureCard.Actions) }).ToList(); //add the actions sessionDto.CreatureCards.AddRange(creatureCards); var resources = _db.AccountResources .Where(ar => ar.AccountId == id) .Include(i => i.Resources) .ToList(); if (resources.Count != 0) { resources.ForEach(r => { var resource = _db.Resources.FirstOrDefault(x => x.ResourceId == r.ResourceId); var dto = _mapper.Map <ResourceDto>(resource); sessionDto.Resources.Add(dto); }); } return(sessionDto); }
private SessionDto GetSessionLogged(LoginUseCase login) { var sesion = new SessionDto(); var employee = login.EmployeeLogged; sesion.ClientId = employee.EmployeeId; sesion.UserId = employee.Credentials.UserId; sesion.Username = employee.Credentials.Username; sesion.FullName = employee.ToString(); sesion.Email = employee.Credentials.Email; sesion.ProfileId = employee.Profile.ProfileId; sesion.ProfileName = employee.Profile.ProfileName; return(sesion); }
public async Task <IActionResult> Update(int id, [FromBody] SessionDto sessionDto) { var session = mapper.Map <Sessions>(sessionDto); try{ sessionService.Update(session); await unitOfWork.CompleteAsync(); return(Ok()); } catch (ApplicationException ex) { return(BadRequest(ex.Message)); } }
public static SessionView ToViewModel(this SessionDto sessionDto) { if (sessionDto == null) { return(null); } return(new SessionView { Id = sessionDto.Id, Title = sessionDto.Title, TimeFrom = sessionDto.TimeFrom, TimeTo = sessionDto.TimeTo }); }
public async Task OnGetAsync(int id) { var session = await _apiClient.GetSessionAsync(id); Session = new SessionDto { ID = session.ID, ConferenceID = session.ConferenceID, TrackId = session.TrackId, Title = session.Title, Abstract = session.Abstract, StartTime = session.StartTime, EndTime = session.EndTime }; }
public void ShowSummary(SessionDto session) { if (sessionOverview != null && sessionOverview.Session != session) { canvasWrapper.Remove(sessionOverview); } sessionOverview = new SessionOverview(session) { Background = new SolidColorBrush(Colors.White), IsHitTestVisible = false }; canvasWrapper.Add(sessionOverview, 10); canvasWrapper.TrackMouse(sessionOverview); }
public IQueryable <SessionDto> Get() { var s1 = new SessionDto { created_at = DateTime.UtcNow.ToString(CultureInfo.InvariantCulture), day = "Thursday", description = "", id = 18, level = "Beginner", speaker = "Paul Irish", time = "2012-02-16T17:15:00Z", title = "Progressive Advancement on the High Seas of Web", updated_at = DateTime.UtcNow.ToString(CultureInfo.InvariantCulture), formatted_time = "05:15 PM" }; var s2 = new SessionDto { created_at = DateTime.UtcNow.ToString(CultureInfo.InvariantCulture), day = "Friday", description = "", id = 19, level = "Intermediate", speaker = "Menno Van Slooten", time = "2012-02-17T10:00:00Z", title = "Automated UI Testing With jQuery", updated_at = DateTime.UtcNow.ToString(CultureInfo.InvariantCulture), formatted_time = "10:00 AM" }; var s3 = new SessionDto { created_at = DateTime.UtcNow.ToString(CultureInfo.InvariantCulture), day = "Friday", description = "", id = 21, level = "Advanced", speaker = "Steve Smith", time = "2012-02-17T11:45:00Z", title = "Design Interactions With jQuery", updated_at = DateTime.UtcNow.ToString(CultureInfo.InvariantCulture), formatted_time = "11:45 AM" }; var sessions = new List <SessionDto> { s1, s2, s3 }.AsQueryable(); return(sessions); }
public static Session ToSqlModel(this SessionDto sessionDto) { if (sessionDto == null) { return(null); } return(new Session { Id = sessionDto.Id, TimeFrom = sessionDto.TimeFrom, TimeTo = sessionDto.TimeTo, Title = sessionDto.Title, IsDeleted = false }); }
private SessionDto CreateSession(Client client) { var session = new SessionDto { SessionId = "", UserId = client.Credentials.UserId, ClientId = client.Id, Username = client.Credentials.Username, Password = client.Credentials.EncriptedPassword, FullName = client.ToString(), Email = client.Credentials.Email, ProfileId = client.Profile.ProfileId, ProfileName = client.Profile.ProfileName }; return(session); }
public async Task <SessionDto> CreateSessionAsync(Guid roomId, SessionDto session) { var room = await _roomRepository.GetAsync(roomId); var schedule = session.Schedule == null ? null : DateRange.Create(session.Schedule.Start, session.Schedule.End); var model = room.CreateSession(schedule, _sessionScheduleValidator); var entity = await _roomRepository.CreateSessionAsync(room.Id, model); var result = _mapper.Map <SessionDto>(entity); return(result); }
public async void CreateSession() { var session = new SessionDto { SessionType = "1", Scheduled = DateTime.Now, Location = new LocationDto() { Id = 1 } }; var result = await _service.CreateSession(session); Assert.NotEqual(0, result); }
/// <summary> /// 后台系统Session登陆判断 /// </summary> /// <param name="filterContext">ActionExecutingContext</param> protected override void OnActionExecuting(ActionExecutingContext filterContext) { base.OnActionExecuting(filterContext); if (filterContext.HttpContext.Session["WebReportUser"] == null) { filterContext.HttpContext.Response.Redirect("~/Login/Index"); } else { SysSession = Session["WebReportUser"] as SessionDto; if (SysSession.password == XMLHelper.GetNodeString("User", "SQL/MustChangePassword")) { filterContext.HttpContext.Response.Redirect("~/Profile/Password"); } } }
public void ShowWelcomeScreen(SimulatorDataSet dataSet, ChampionshipDto championship) { var eventStartingViewModel = _viewModelFactory.Create <EventStartingViewModel>(); EventDto currentEvent = championship.GetCurrentOrLastEvent(); SessionDto currentSession = currentEvent.Sessions[championship.CurrentSessionIndex]; eventStartingViewModel.EventTitleViewModel.FromModel((championship, currentEvent, currentSession)); eventStartingViewModel.Screens.Add(CreateTrackOverviewViewModel(dataSet, championship)); eventStartingViewModel.Screens.Add(CreateStandingOverviewViewModel(championship)); Window window = _windowService.OpenWindow(eventStartingViewModel, "Event Starting", WindowState.Maximized, SizeToContent.Manual, WindowStartupLocation.CenterOwner); eventStartingViewModel.CloseCommand = new RelayCommand(() => CloseWindow(window)); }
public IEnumerable <FurnitureItemModel> GetBuildList(SessionDto session) { return(ProtectedExecute <SessionDto, FurnitureItemModel>(sessionDto => { SessionService.CheckSession(session); Dictionary <FurnitureItemModel, InvariantPartStore> partStores = GetAll().ToDictionary( furniture => furniture, furniture => GetPartStore(furniture.Id) ); InvariantPartStore userPartStore = PartService.GetOwnedInvariant(sessionDto); return partStores.Where(store => userPartStore.Contains(store.Value)) .Select(store => store.Key).ToList(); }, session)); }
public async Task <ActionResult <SessionDto> > GetSession(int id) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var session = await sessionService.GetSessionDtoAsync(id, SessionDto.IncludeNavigations()); if (session == null) { return(NotFound()); } return(session); }
public SessionDto MySession(int sessionId) { var session = _context.Session.Where(x => x.SessionId == sessionId).FirstOrDefault(); var table = _context.Table.Where(x => x.TableId == session.TableId).FirstOrDefault(); SessionDto sessionDto = new SessionDto { SessionId = session.SessionId, StartDate = session.StartDate, FinishDate = session.FinishDate, TableName = table.TableName, TableId = table.TableId, TotalFee = session.TotalFee, Order = session.Order }; return(sessionDto); }
public IHttpActionResult Post([FromBody] SessionDto dto) { Session entity = ModelMapper.Map <Session>(dto); string secret = Thread.CurrentPrincipal.Identity.Name; Account organiser = this.accounts.Get(a => a.Secret == secret, collections: true).First(); entity.Organisers.Add(organiser); organiser.OrganisedSessions.Add(entity); this.sessions.Add(entity); this.accounts.Change(organiser); dto = ModelMapper.Map <SessionDto>(entity); return(Ok(dto)); }
private async void OnStartSession(object obj) { if (IsBusy) { return; } IsBusy = true; // Thuc hien cong viec tai day try { var ok = await PageDialogService.DisplayAlertAsync("", "Xác nhận bắt đầu thu tiền", "Đồng ý", "Không"); if (ok) { var json = JsonConvert.SerializeObject(InitMoneyBindProp); var content = new StringContent(json, Encoding.UTF8, "application/json"); using (var client = new HttpClient()) { var response = await client.PostAsync(Properties.Resources.BaseUrl + "sessions", content); if (response.IsSuccessStatusCode) { var session = JsonConvert.DeserializeObject <SessionDto>(await response.Content.ReadAsStringAsync()); SessionBindProp = new SessionDto(session); Application.Current.Properties["session"] = SessionBindProp; await Application.Current.SavePropertiesAsync(); SessionDetailVisibleBindProp = true; SessionVisibleBindProp = false; } } } } catch (Exception ex) { await ShowErrorAsync(ex); } finally { IsBusy = false; } }
public LockResourceBySpid( int lockingSpid, List <LockedResourceDto> lockedResourceDtos, SessionDto session, IGetRowOfLockedResourceQuery getRowOfLockedResourceQuery, INotifyUser notifyUser) { this.getRowOfLockedResourceQuery = getRowOfLockedResourceQuery; this.notifyUser = notifyUser; LockingSPID = lockingSpid; TooManyResult = lockedResourceDtos.Count > MaxResults; LockedResourceDtos = lockedResourceDtos.Take(MaxResults).ToList(); Session = session; DataContext = this; AllowQuery = true; InitializeComponent(); }
public void TestSessionMapObjToDto() { var session = new Session("session"); var sessionDocument = new SessionDocument("path", DocumentType.Designer); session.AddDocument(sessionDocument); var sessionDto = new SessionDto(); DtoMapper.MapObjToDto(session, sessionDto); Assert.AreEqual(session.Name, sessionDto.Name); Assert.AreEqual(session.GetDocuments().Count(), sessionDto.DocumentsCount); Assert.AreEqual(sessionDocument.Path, sessionDto.Documents[0].Path); Assert.AreEqual(sessionDocument.Type, sessionDto.Documents[0].Type); }
public SessionDto GetSessionDetail(int id) { var sessions = _context.Session.Where(x => x.TableId == id).OrderByDescending(x => x.SessionId).FirstOrDefault(); SessionDto sessionDto = new SessionDto { FinishDate = sessions.FinishDate, Order = sessions.Order, SessionId = sessions.SessionId, StartDate = sessions.StartDate, TotalFee = sessions.TotalFee, TableId = sessions.TableId, TableName = sessions.Table.TableName }; sessionDto.Order = sessionDto.Order.OrderByDescending(x => x.OrderId).ToList(); return(sessionDto); }