public ActionResult AddCondition(SearchListViewModel _model) { if (HttpContext.Session.GetString("auth") != "completed") { return(RedirectToAction("Logout", "Account")); } ViewBag.Title = "Add Condition"; if (ModelState.IsValid) { this._conditionRepository.SaveCondition(_model.conditionsListViewModel.condition); TempData["returnMessage"] = "View Category Details"; TempData["successMessage"] = $"Successfully added new condition: {_model.conditionsListViewModel.condition.Description}"; } else { TempData["returnMessage"] = null; TempData["successMessage"] = null; } _model.bookInfoListViewModel = new BookInfoListViewModel(); _model.bookInfoListViewModel.Categories = this._categoryRepository.Categories; _model.conditionsListViewModel.Conditions = this._conditionRepository.Conditions; return(View("ViewCondition", _model)); }
public async Task <IActionResult> EditUser(SearchListViewModel _model) { AppUser _editUser = await this._userManager.FindByNameAsync(_model.appUser.UserName); if (_editUser != null) { _editUser.Address = _model.appUser.Address; _editUser.ContactNumber = _model.appUser.ContactNumber; _editUser.Email = _model.appUser.EmailAddress; _editUser.EmailAddress = _model.appUser.EmailAddress; _editUser.HideMap = _model.appUser.HideMap; } IdentityResult _result = await this._userManager.UpdateAsync(_editUser); if (_result.Succeeded) { string _url = Url.Action("Success"); string _urlQueryString = $"?userName={_model.appUser.UserName}"; return(new RedirectResult(_url + _urlQueryString)); } else { foreach (IdentityError error in _result.Errors) { ModelState.AddModelError("", error.Description); } } return(View(_model)); }
public SearchListViewModel SearchList(SearchInfoViewModel searchInfo) { #region 參數宣告 SearchListViewModel searchList = new SearchListViewModel(); IActorSettingService actorSettingService = new ActorSettingService(); #endregion #region 流程 //檢查是否驗證通過 if (!_authState.IsAuth) { throw new Exception(_authState.AuthDescription); } // 參數驗證 VerifyParams(searchInfo); try { //取得查詢結果 searchList = actorSettingService.QuerySearchList(searchInfo); } catch (Exception ex) { throw ex; } #endregion return(searchList); }
public ActionResult EditCategory(SearchListViewModel _model) { if (HttpContext.Session.GetString("auth") != "completed") { return(RedirectToAction("Logout", "Account")); } ViewBag.Title = "Edit Category"; _model.bookInfoListViewModel = new BookInfoListViewModel(); _model.bookInfoListViewModel.Categories = this.repository.Categories; if (ModelState.IsValid) { if (_model.categoriesListViewModel.category.Id > 0) { repository.SaveCategory(_model.categoriesListViewModel.category); TempData["returnMessage"] = "View Category Details"; TempData["successMessage"] = $"Successfully edited category: {_model.categoriesListViewModel.category.Name}"; } else { TempData["returnMessage"] = null; TempData["successMessage"] = null; } } else { TempData["returnMessage"] = null; TempData["successMessage"] = null; } return(View("ViewCategory", _model)); }
public ActionResult ListAdvertisements() { string authStatus = _contextAccessor.HttpContext.Session.GetString("auth"); if (authStatus != "completed") { return(RedirectToAction("Logout", "Account")); } ViewBag.Title = "List of Request Advertisements"; TempData["loadMessage"] = "Request Advertisements List has been loaded."; SearchListViewModel _model = new SearchListViewModel(); _model.bookInfoListViewModel = new BookInfoListViewModel(); _model.bookInfoListViewModel.Categories = this._categoryRepository.Categories; _model.advertisementsListViewModel = new AdvertisementsListViewModel(); _model.advertisementsListViewModel.Advertisements = this._advertisementRepository.Advertisements .OrderBy(ads => ads.RequestId); int _adsCount = _model.advertisementsListViewModel.Advertisements.Count(); if (_adsCount == 0) { TempData["errorMessage"] = "No record(s) found"; } return(View(_model)); }
public SearchListViewModel QuerySearchList(SearchInfoViewModel searchInfo) { //組立SQL字串並連接資料庫 #region 參數告宣 SearchListViewModel result = new SearchListViewModel(); #endregion #region 流程 StringBuilder _sqlStr = new StringBuilder(); StringBuilder _sqlCountStr = new StringBuilder(); _sqlCountStr.Append("select count(*) from appraisal"); _sqlStr.Append("select * from appraisal ORDER BY " + (searchInfo.iSortCol_0 + 1).ToString() + " " + searchInfo.sSortDir_0 + " OFFSET @iDisplayStart ROWS FETCH NEXT @iDisplayLength ROWS ONLY"); _sqlParams = new Dapper.DynamicParameters(); _sqlParams.Add("iDisplayStart", searchInfo.iDisplayStart); _sqlParams.Add("iDisplayLength", searchInfo.iDisplayLength); result.data = new List <SearchItemViewModel>(); result.draw = (searchInfo.sEcho + 1); using (var cn = new SqlConnection(_dbConnPPP)) //連接資料庫 { cn.Open(); result.data = cn.Query <SearchItemViewModel>(_sqlStr.ToString(), _sqlParams).ToList(); result.recordsTotal = cn.Query <int>(_sqlCountStr.ToString()).First(); result.recordsFiltered = result.recordsTotal; } return(result); #endregion }
public SearchListViewModel QuerySearchList(SearchInfoViewModel searchInfo) { //組立SQL字串並連接資料庫 #region 參數告宣 SearchListViewModel result = new SearchListViewModel(); #endregion #region 流程 StringBuilder _sqlStr = new StringBuilder(); _sqlStr.Append("SELECT * FROM Product p Where p.Status = 1"); _sqlParams = new Dapper.DynamicParameters(); if (!string.IsNullOrEmpty(searchInfo.Name)) { _sqlStr.Append(" AND p.Name LIKE @Name "); _sqlParams.Add("Name", "%" + searchInfo.Name + "%"); } result.SearchItemList = new List <SearchItemViewModel>(); using (var cn = new SqlConnection(_dbConnPPP)) //連接資料庫 { cn.Open(); result.SearchItemList = cn.Query <SearchItemViewModel>(_sqlStr.ToString(), _sqlParams).ToList(); } return(result); #endregion }
public ViewResult Index() { ViewBag.Title = "Home"; //BookInfoListViewModel model = new BookInfoListViewModel(); //model.Categories = categoryRepository.Categories; //model.MyBookImages = this._fileRepository.MyBookImages // .OrderBy(f => f.BookImageId); SearchListViewModel _model = new SearchListViewModel(); _model.bookInfoListViewModel = new BookInfoListViewModel(); _model.bookInfoListViewModel.Categories = categoryRepository.Categories; _model.bookInfoListViewModel.MyBookImages = this._fileRepository.MyBookImages .OrderBy(f => f.BookImageId); _model.conditionsListViewModel = new ConditionsListViewModel(); _model.conditionsListViewModel.Conditions = this._conditionRepository.Conditions; _model.booksListViewModel = new BooksListViewModel(); _model.booksListViewModel.Books = this.repository.Books; _model.advertisementsListViewModel = new AdvertisementsListViewModel(); _model.advertisementsListViewModel.Advertisements = this._advertisementRepository.Advertisements .OrderBy(ads => ads.RequestId); return(View(_model)); }
public IActionResult AddBook(SearchListViewModel _model, BookImage bookImage, IFormFile thumbnail, List <IFormFile> relatedImages) { ViewBag.Title = "Add Book"; if (ModelState.IsValid) { repository.SaveBook(_model.bookInfoListViewModel.book); this._fileRepository.SaveBookImages(bookImage, thumbnail, _model.bookInfoListViewModel.book.Id); this._fileRepository.ThumbnailBook(thumbnail); this._fileRepository.RelatedImagesBook(relatedImages, bookImage.BookImageCode); TempData["returnMessage"] = "View Book Details"; TempData["successMessage"] = $"Successfully added new book: {_model.bookInfoListViewModel.book.Title}"; } else { TempData["returnMessage"] = null; return(View()); } _model.bookInfoListViewModel.Categories = categoryRepository.Categories; _model.conditionsListViewModel = new ConditionsListViewModel(); _model.conditionsListViewModel.Conditions = this._conditionRepository.Conditions; _model.bookInfoListViewModel.MyBookImages = this._fileRepository.MyBookImages .Where(i => i.Id == _model.bookInfoListViewModel.book.Id); return(View("ViewBook", _model)); }
public ViewResult EditBook(int?id) { ViewBag.Title = "Edit Book"; Book book = repository.Books.Where(r => r.Id == id).FirstOrDefault(); SearchListViewModel _model = new SearchListViewModel(); _model.bookInfoListViewModel = new BookInfoListViewModel(); _model.bookInfoListViewModel.Categories = this.categoryRepository.Categories; _model.bookInfoListViewModel.book = book; _model.bookInfoListViewModel.MyBookImages = this._fileRepository.MyBookImages .Where(i => i.Id == id); _model.conditionsListViewModel = new ConditionsListViewModel(); _model.conditionsListViewModel.Conditions = this._conditionRepository.Conditions; //BookInfoListViewModel model = new BookInfoListViewModel(); //model.Categories = categoryRepository.Categories; //model.book = book; //model.MyBookImages = this._fileRepository.MyBookImages // .Where(i => i.Id == id); TempData["processId"] = id; return(View(_model)); }
public void ListViewItemDoubleClick(object sender, RoutedEventArgs e) { var item = sender as ListViewItem; var animal = (Animal)item.DataContext; SearchListViewModel viewModel = (SearchListViewModel)DataContext; viewModel.AnimalDoubleCkick(animal); }
public SplashPage() { InitializeComponent(); BindingContext = new SplashViewModel(); viewModel = new SearchListViewModel(""); this.txtProcessMessage.Text = "Wait..."; this.txtProcessMessage.IsVisible = true; }
public async Task <IActionResult> Login(SearchListViewModel _model) { string _errorMessage = string.Empty; _model.bookInfoListViewModel = new BookInfoListViewModel(); _model.bookInfoListViewModel.Categories = this._categoryRepository.Categories; if (ModelState.IsValid) { // ** Changed from IdentityUser to AppUser AppUser user = await userManager.FindByNameAsync(_model.loginModel.UserName); if (user != null) { HttpContext.Session.SetString("auth", "completed"); if (user.UserName.ToLower() == "admin") { if ((await signInManager.PasswordSignInAsync(user, _model.loginModel.Password, false, false)).Succeeded) { // the user is admin here and must be redirect to 2fa //return Redirect(_model.loginModel?.ReturnUrl ?? "/"); HttpContext.Session.SetString("auth", "partial"); return(RedirectToAction("VerifyBySms", new { username = user.UserName, returnUrl = _model.loginModel?.ReturnUrl ?? " / " })); } else { _errorMessage = "Invalid UserName or Password"; } } else { if (user.IsVerified == false) { _errorMessage = "User is not yet verified. Please open your mailbox for further verification. Thank you."; } else { if ((await signInManager.PasswordSignInAsync(user, _model.loginModel.Password, false, false)).Succeeded) { return(Redirect(_model.loginModel?.ReturnUrl ?? "/")); } else { _errorMessage = "Invalid UserName or Password"; } } } } else { _errorMessage = "Invalid UserName or Password"; } } ModelState.AddModelError("", _errorMessage); return(View(_model)); }
public ViewResult RequestAdvertisement() { ViewBag.Title = "Send Request for Book Advertisement"; SearchListViewModel _model = new SearchListViewModel(); _model.bookInfoListViewModel = new BookInfoListViewModel(); _model.bookInfoListViewModel.Categories = this.categoryRepository.Categories; return(View(_model)); }
public ActionResult Search(string query) { query = query.Trim().ToLower(); var entities = entityRepository.Where(e => e.Name.ToLower().Contains(query)) .OrderBy(e => e.EntityID).Take(20).ToList(); var vm = new SearchListViewModel(entities); return(View(vm)); }
async Task PushSearchListPage() { SearchListViewModel viewModel = new SearchListViewModel(_Searchbar.Text); var page = new SearchResultsPage() { BindingContext = viewModel, Title = "Search Results", }; await Navigation.PushAsync(page); }
public ViewResult Register() { ViewBag.Title = "Registration"; SearchListViewModel _model = new SearchListViewModel(); _model.bookInfoListViewModel = new BookInfoListViewModel(); _model.bookInfoListViewModel.Categories = this._categoryRepository.Categories; _model.appUser = new AppUser(); return(View(_model)); }
public ViewResult Success(string userName) { ViewBag.Title = "Updated User"; SearchListViewModel _model = new SearchListViewModel(); _model.bookInfoListViewModel = new BookInfoListViewModel(); _model.bookInfoListViewModel.Categories = this._categoryRepository.Categories; _model.appUser = this._userManager.Users .Where(u => u.UserName == userName).FirstOrDefault(); return(View(_model)); }
public ViewResult ViewCategory(int?id) { ViewBag.Title = "View Category Details"; SearchListViewModel _model = new SearchListViewModel(); _model.bookInfoListViewModel = new BookInfoListViewModel(); _model.bookInfoListViewModel.Categories = this.repository.Categories; _model.categoriesListViewModel = new CategoriesListViewModel(); _model.categoriesListViewModel.category = this.repository.Categories .Where(r => r.Id == id).First(); _model.categoriesListViewModel.Categories = this.repository.Categories; return(View(_model)); }
public ActionResult AddCategory() { if (HttpContext.Session.GetString("auth") != "completed") { return(RedirectToAction("Logout", "Account")); } ViewBag.Title = "Add Category"; SearchListViewModel _model = new SearchListViewModel(); _model.bookInfoListViewModel = new BookInfoListViewModel(); _model.bookInfoListViewModel.Categories = this.repository.Categories; return(View(_model)); }
public SearchListViewModel QuerySearchList(SearchInfoViewModel searchInfo) { #region 參數宣告 SearchListViewModel searchList = new SearchListViewModel(); MaintainDao maintainDao = new MaintainDao(); #endregion #region 流程 searchList = maintainDao.QuerySearchList(searchInfo); //將參數送入Dao層,組立SQL字串並連接資料庫 return(searchList); #endregion }
public ActionResult ListCondition() { ViewBag.Title = "List of Conditions"; TempData["loadMessage"] = "Conditions list has been loaded."; SearchListViewModel _model = new SearchListViewModel(); _model.bookInfoListViewModel = new BookInfoListViewModel(); _model.bookInfoListViewModel.Categories = this._categoryRepository.Categories; _model.conditionsListViewModel = new ConditionsListViewModel(); _model.conditionsListViewModel.Conditions = this._conditionRepository.Conditions; return(View(_model)); }
public ViewResult ViewCondition(int?id) { ViewBag.Title = "View Condition Detail"; SearchListViewModel _model = new SearchListViewModel(); _model.bookInfoListViewModel = new BookInfoListViewModel(); _model.bookInfoListViewModel.Categories = this._categoryRepository.Categories; _model.conditionsListViewModel = new ConditionsListViewModel(); _model.conditionsListViewModel.condition = this._conditionRepository.Conditions .Where(r => r.Id == id).First(); _model.conditionsListViewModel.Conditions = this._conditionRepository.Conditions; return(View(_model)); }
public ViewResult DeleteBook(int id) { ViewBag.Title = "Delete Book"; SearchListViewModel _model = new SearchListViewModel(); _model.bookInfoListViewModel = new BookInfoListViewModel(); _model.bookInfoListViewModel.Categories = this.categoryRepository.Categories; _model.bookInfoListViewModel.book = repository.DeleteBook(id); _model.conditionsListViewModel = new ConditionsListViewModel(); _model.conditionsListViewModel.Conditions = this._conditionRepository.Conditions; return(View(_model)); }
/// <summary> /// 查詢列表 /// </summary> /// <param name="searchInfo"></param> /// <returns></returns> public SearchListViewModel QuerySearchList(SearchInfoViewModel searchInfo) { #region 參數宣告 SearchListViewModel searchList = new SearchListViewModel(); IBatchImportMaterialRepository batchImportMaterialRp = new BatchImportMaterialRepository(); #endregion #region 流程 searchList = batchImportMaterialRp.QuerySearchList(searchInfo); return(searchList); #endregion }
/// <summary> /// 查詢列表 /// </summary> /// <param name="searchInfo"></param> /// <returns></returns> public SearchListViewModel QuerySearchList(SearchInfoViewModel searchInfo) { #region 參數宣告 SearchListViewModel searchList = new SearchListViewModel(); IMaterialVerifyFormRepository materialVerifyFormRp = new MaterialVerifyFormRepository(); #endregion #region 流程 searchList = materialVerifyFormRp.QuerySearchList(searchInfo); return(searchList); #endregion }
/// <summary> /// 查詢列表 /// </summary> /// <param name="searchInfo"></param> /// <returns></returns> public SearchListViewModel QuerySearchList(SearchInfoViewModel searchInfo) { #region 參數宣告 SearchListViewModel searchList = new SearchListViewModel(); IProjectPriceSellRepository projectPriceSellRp = new ProjectPriceSellRepository(); #endregion #region 流程 searchList = projectPriceSellRp.QuerySearchList(searchInfo); return(searchList); #endregion }
/// <summary> /// 查詢列表 /// </summary> /// <param name="searchInfo"></param> /// <returns></returns> public SearchListViewModel QuerySearchList(SearchInfoViewModel searchInfo) { #region 參數宣告 SearchListViewModel searchList = new SearchListViewModel(); IHandSetRepository handSetRp = new HandSetRepository(); #endregion #region 流程 searchList = handSetRp.QuerySearchList(searchInfo); return(searchList); #endregion }
/// <summary> /// 查詢列表 /// </summary> /// <param name="searchInfo"></param> /// <returns></returns> public SearchListViewModel QuerySearchList(SearchInfoViewModel searchInfo) { #region 參數宣告 SearchListViewModel searchList = new SearchListViewModel(); IActorRepository actorRp = new ActorRepository(); #endregion #region 流程 searchList = actorRp.QuerySearchList(searchInfo); return(searchList); #endregion }
/// <summary> /// 查詢列表 /// </summary> /// <param name="searchInfo"></param> /// <returns></returns> public SearchListViewModel QuerySearchList(SearchInfoViewModel searchInfo) { #region 參數宣告 SearchListViewModel searchList = new SearchListViewModel(); IBrandPMRepository brandPMRp = new BrandPMRepository(); #endregion #region 流程 searchList = brandPMRp.QuerySearchList(searchInfo); return(searchList); #endregion }
private static void OnDetachSelectedChanged(WeakEventListener<SearchListView, SearchListViewModel, SelectedChangedEventArgs> listener, SearchListViewModel source) { source.SelectedChanged -= listener.OnEvent; }