public void Setup() { _carsRepo = new Mock <IRepository <string, Car> >(); _diaryRepo = new Mock <IRepository <string, DiaryItem> >(); _unitUnderTest = new DiaryService(_diaryRepo.Object, _carsRepo.Object); }
private async Task <string> GetMJML(List <EntryModel> memories, string userId, string babyName) { var importResultModel = new ImportResultModel { Entries = memories }; var model = DiaryService.GetDays(importResultModel); model.BabyName = babyName; model.MemoriesBadgeCount = memories.Count; model.ShowMemoriesLink = true; model.BaseUrl = _configuration["BASE_URL"]; model.Profile = new Profile { UserId = userId }; model.Entries = model.Entries .OrderByDescending(entry => entry.TimeUTC.Year) .OrderBy(entry => entry.TimeUTC.TimeOfDay); var mjml = await RazorTemplateEngine.RenderAsync("/Views/Emails/MemoriesEmail.cshtml", model); return(mjml); }
async Task WriteDiaryAsync() { if (!IsAuthenticated) { return; } if (DiaryInfo == null) { return; } DiaryContent content; if (DiaryInfo.IsSecret) { content = await DiaryService.WriteDiaryAsync(User, DiaryInfo, Date, Content, UserData.Password); } else { content = await DiaryService.WriteDiaryAsync(User, DiaryInfo, Date, Content); } if (content != null) { Navi.NavigateTo(DiaryUrl.DiaryContent(DiaryInfo.DiaryName, Date)); } }
private async Task EditDiary() { if (!IsAuthenticated) { return; } if (DiaryInfo == null) { return; } List <DiaryContent> content; if (DiaryInfo.IsSecret) { content = await DiaryService.UpdateDiaryAsync(User, DiaryInfo, View.DiaryContents, UserData.Password); } else { content = await DiaryService.UpdateDiaryAsync(User, DiaryInfo, View.DiaryContents); } if (content?.Any() ?? false) { Navi.NavigateTo(DiaryUrl.DiaryContent(DiaryInfo.DiaryName, content.First().Date)); } else { Navi.NavigateTo(DiaryUrl.Home(DiaryInfo.DiaryName)); } }
public async Task <IActionResult> Diary(string babyName, string inputDate) { var date = DateTime.Now; if (!string.IsNullOrEmpty(inputDate)) { date = DateTime.Parse(inputDate); } var entries = await _sqLiteService.GetEntriesFromDb(date, User, babyName); var importResultModel = new ImportResultModel { Entries = entries }; var model = DiaryService.GetDays(importResultModel); model.Date = date.ToString("yyyy-MM-dd"); model.DateNext = date.AddDays(1).ToString("yyyy-MM-dd"); model.DatePrevious = date.AddDays(-1).ToString("yyyy-MM-dd"); model.BabyName = babyName; model.Profile = await _accountService.GetProfile(User); var memories = await _sqLiteService.GetMemoriesFromDb(DateTime.Now, User, babyName); model.MemoriesBadgeCount = memories.Count; model.ShowMemoriesLink = true; ViewData["LastEntry"] = await _sqLiteService.GetLastEntryDateTime(User, babyName); return(View("Diary", model)); }
protected override async Task OnPageInitializedAsync() { if (!IsAuthenticated) { Navi.NavigateTo("/login"); return; } var list = await DiaryService.GetWritableDiaryInfoAsync(User); DiaryInfo = list.FirstOrDefault(x => x.DiaryName == DiaryName); if (DiaryInfo == null) { Navi.NavigateTo(DiaryUrl.Home(DiaryName)); } if (DiaryInfo.IsSecret && string.IsNullOrWhiteSpace(UserData.Password)) { Navi.NavigateTo(DiaryUrl.SetPassword()); return; } LastDiary = await DiaryService.GetLastDiaryViewAsync(User, DiaryInfo); Date = DateTime.Today; }
private async Task <DiaryInfo> GetDiaryInfo(string diaryName) { if (string.IsNullOrWhiteSpace(diaryName)) { return(null); } return(await DiaryService.GetDiaryInfoAsync(User, diaryName)); }
public VulcanAccount(LoginConfig login) { RestClient.CookieContainer = new CookieContainer(); this.Login = login; UrlGenerator = new UrlGenerator(Login.Host, Login.BaseSymbol); LoginService = new LoginService(this); DiaryService = new DiaryService(this); }
private async Task Search(DiarySearchData searchData) { var files = await DiarySearchService.SearchAsync(DiaryInfo.DiaryName, searchData) ?? new List <DiaryFileName>(); var contents = await files .Select(async filename => await DiaryService.GetDiaryContentAsync(User, DiaryInfo, filename)) .WhenAll(); DiaryContentList = contents.Where(x => x != null).ToList(); }
public void Setup() { MapperConfiguration mappingConfig = new MapperConfiguration(mc => { mc.AddProfile(new MappingDiary <DiaryData>()); }); IMapper mapper = mappingConfig.CreateMapper(); diaryService = new DiaryService <DiaryData>(workingWithDiaryForTest, mapper); }
private async Task <DiaryInfo> GetMyDiaryInfo() { var userDiaryInfo = await DiaryService.GetUserDiaryInfoAsync(User); if (userDiaryInfo?.MyDiaryList?.Empty() ?? true) { return(null); } var diaryName = userDiaryInfo.MyDiaryList.First(); return(await GetDiaryInfo(diaryName)); }
public void TestMethod1() { DiaryService diaryService = new DiaryService(new HandleJSON()); Assert.AreEqual(DiaryValidation.isFreeTimeLegal(new FreeTime("Eliad", "08:00", "12:00"), diaryService), true); Assert.AreEqual(DiaryValidation.isFreeTimeLegal(new FreeTime("", "12:00", "10:00"), diaryService), false); Assert.AreEqual(DiaryValidation.isFreeTimeLegal(new FreeTime("Eliad", "12:30", "16:00"), diaryService), false); Assert.AreEqual(diaryService.isAppearInEnd("12:00"), true); Assert.AreEqual(diaryService.isAppearInEnd("18:00"), false); Assert.AreEqual(diaryService.isAppearInStart("12:00"), true); Assert.AreEqual(diaryService.isAppearInStart("17:50"), false); }
public TaskReturnValue GetMatterTaskDetails(HostSecurityToken oHostSecurityToken, Guid projectId, Int32 taskId) { TaskReturnValue returnValue = null; if (Functions.ValidateIWSToken(oHostSecurityToken)) { oDiaryService = new DiaryService(); returnValue = oDiaryService.GetMatterTaskDetails(Functions.GetLogonIdFromToken(oHostSecurityToken), projectId, taskId); } else { returnValue = new TaskReturnValue(); returnValue.Success = false; returnValue.Message = "Invalid Token"; } return(returnValue); }
public ReturnValue DeleteBooking(HostSecurityToken oHostSecurityToken, DeleteData deleteData) { ReturnValue returnValue = null; if (Functions.ValidateIWSToken(oHostSecurityToken)) { oDiaryService = new DiaryService(); returnValue = oDiaryService.DeleteBooking(Functions.GetLogonIdFromToken(oHostSecurityToken), deleteData); } else { returnValue = new ReturnValue(); returnValue.Success = false; returnValue.Message = "Invalid Token"; } return(returnValue); }
public AppointmentReturnValue GetAppointmentDetails(HostSecurityToken oHostSecurityToken, Int32 appointmentId) { AppointmentReturnValue returnValue = null; if (Functions.ValidateIWSToken(oHostSecurityToken)) { oDiaryService = new DiaryService(); returnValue = oDiaryService.GetAppointmentDetails(Functions.GetLogonIdFromToken(oHostSecurityToken), appointmentId); } else { returnValue = new AppointmentReturnValue(); returnValue.Success = false; returnValue.Message = "Invalid Token"; } return(returnValue); }
public DiaryMemberSearchReturnValue GetDiaryMembers(HostSecurityToken oHostSecurityToken, CollectionRequest collectionRequest) { DiaryMemberSearchReturnValue returnValue = null; if (Functions.ValidateIWSToken(oHostSecurityToken)) { oDiaryService = new DiaryService(); returnValue = oDiaryService.GetDiaryMembers(Functions.GetLogonIdFromToken(oHostSecurityToken), collectionRequest); } else { returnValue = new DiaryMemberSearchReturnValue(); returnValue.Success = false; returnValue.Message = "Invalid Token"; } return(returnValue); }
public TaskReturnValue SaveTask(HostSecurityToken oHostSecurityToken, Task taskDetails) { TaskReturnValue returnValue = new TaskReturnValue(); if (Functions.ValidateIWSToken(oHostSecurityToken)) { oDiaryService = new DiaryService(); returnValue = oDiaryService.SaveTask(Functions.GetLogonIdFromToken(oHostSecurityToken), taskDetails); } else { returnValue = new TaskReturnValue(); returnValue.Success = false; returnValue.Message = "Invalid Token"; } return(returnValue); }
public CancellationCodeSearchReturnValue GetBookingCancelledCategories(HostSecurityToken oHostSecurityToken, CollectionRequest collectionRequest) { CancellationCodeSearchReturnValue returnValue = null; if (Functions.ValidateIWSToken(oHostSecurityToken)) { oDiaryService = new DiaryService(); returnValue = oDiaryService.GetBookingCancelledReasons(Functions.GetLogonIdFromToken(oHostSecurityToken), collectionRequest); } else { returnValue = new CancellationCodeSearchReturnValue(); returnValue.Success = false; returnValue.Message = "Invalid Token"; } return(returnValue); }
public AppointmentSearchReturnValue AppointmentSearch(HostSecurityToken oHostSecurityToken, CollectionRequest collectionRequest, AppointmentSearchCriteria criteria) { AppointmentSearchReturnValue returnValue = null; if (Functions.ValidateIWSToken(oHostSecurityToken)) { oDiaryService = new DiaryService(); returnValue = oDiaryService.AppointmentSearch(Functions.GetLogonIdFromToken(oHostSecurityToken), collectionRequest, criteria); } else { returnValue = new AppointmentSearchReturnValue(); returnValue.Success = false; returnValue.Message = "Invalid Token"; } return(returnValue); }
public async Task <IActionResult> Memories(string babyName) { var memories = await _sqLiteService.GetMemoriesFromDb(DateTime.Now, User, babyName); var importResultModel = new ImportResultModel { Entries = memories }; var model = DiaryService.GetDays(importResultModel); model.BabyName = babyName; model.MemoriesBadgeCount = memories.Count; model.ShowMemoriesLink = true; model.Profile = await _accountService.GetProfile(User); return(View("Memories", model)); }
public void InitializeStudents() { LoginService.Login(Login.Email, Login.Password, out var certificate, out var sendCertificate); var lastSymbol = Login.BaseSymbol; foreach (var schoolSymbol in certificate.Wresult.Symbols.Select(x => x.Trim()).Where(x => new Regex("[a-zA-Z]*").IsMatch(x))) { UrlGenerator.Symbol = schoolSymbol; certificate.Action = certificate.Action.Replace(lastSymbol, schoolSymbol); lastSymbol = schoolSymbol; try { sendCertificate = LoginService.SendCertificate(certificate); } catch (Exception) { continue; } if (!sendCertificate.IsValid()) { continue; } UrlGenerator.SchoolId = sendCertificate.StudentSchools[0].Split('/')[4]; var diares = DiaryService.GetDiares(); if (diares.Success) { foreach (var diary in diares.Data) { if (!Students.Any(x => x.StudentId == diary.StudentId)) { Students.Add(new Student.Student(diary.StudentId, UrlGenerator.SchoolId, UrlGenerator.Symbol, diary.StudentName, diary.StudentLastName, diary)); } } } } }
protected override async Task OnPageInitializedAsync() { if (!IsAuthenticated) { Navi.NavigateTo("/login"); return; } DiaryInfo = await DiaryService.GetDiaryInfoAsync(User, DiaryName); var list = await DiaryService.GetDiaryFileAllAsync(User, DiaryInfo); if (list?.Empty() ?? true) { searchData = null; return; } searchData = new DiarySearchData(); searchData.BeginDate = list.First().Date; searchData.EndDate = list.Last().Date; }
public UserResponse(User user) { Id = user.Id; Name = user.Name; Surname = user.Surname; City = user.City; if (user.UserDetails != null) { //UserDetails = new UserDetailsResponse(user.UserDetails); UserService userService = new UserService(); UserDetails = userService.ReadUserDetailsById(user.UserDetails.Id); } if (user.Diaries != null) { Diaries = new List <DiaryResponse>(); DiaryService diaryService = new DiaryService(); foreach (var diary in user.Diaries) { Diaries.Add(diaryService.GetDiary(diary.Id)); } } }
private async Task InitDiary() { DiaryInfo = null; View = null; if (!string.IsNullOrWhiteSpace(DiaryName)) { DiaryInfo = await DiaryService.GetDiaryInfoAsync(User, DiaryName); } else { var userDiaryInfo = await DiaryService.GetUserDiaryInfoAsync(User); if (userDiaryInfo.MyDiaryList.Empty()) { return; } var diaryName = userDiaryInfo.MyDiaryList.First(); DiaryInfo = await DiaryService.GetDiaryInfoAsync(User, diaryName); } if (DiaryInfo == null) { return; } if (DiaryInfo.IsSecret && string.IsNullOrWhiteSpace(UserData.Password)) { Navi.NavigateTo(DiaryUrl.SetPassword()); return; } //WritableDiary = await DiaryService.GetWritableDiaryInfoAsync(User); //ViewableDiary = await DiaryService.GetViewableDiaryInfoAsync(User); if (HasDiaryInfo) { if (string.IsNullOrWhiteSpace(Date)) { View = await DiaryService.GetLastDiaryViewAsync(User, DiaryInfo); } else if (Date.TryToDate(out var parsedDate)) { View = await DiaryService.GetDiaryViewAsync(User, DiaryInfo, parsedDate); } if (DiaryInfo.IsSecret && HasDiaryContent) { foreach (var content in View?.DiaryContents) { try { content.Text = content.Text.Decrypt(UserData.Password); } catch { content.Text = "임호화된 일기를 해석하지 못했습니다. 비밀번호를 다시 확인해주세요."; } } } } }
public PublishModel() { _diaryService = new DiaryService(); }
public DiaryController() { this._diaryService = new DiaryService(); }
public DiaryServiceTests() { _target = new DiaryService(_diaryDataManagerMock.Object); }
public async Task OnGetAsync() { DiaryNotes = await DiaryService.GetAllNotes(null, null); }
public DiaryController(IMapper mapper, IDiary <Diary> service) { _service = new DiaryService <DiaryData>(service, mapper); }
public DiaryController(DiaryService diarygService) { this._DiaryService = diarygService; }