private bool ValidateJob() { if (Ultilities.StringIsEmptyOrNull(Job.Name)) { SendDisplayAlert("Error", "Name is not allowed empty!"); return(false); } if (Ultilities.StringIsEmptyOrNull(Job.Description)) { SendDisplayAlert("Error", "Description is not allowed empty!"); return(false); } if (Ultilities.StringIsEmptyOrNull(Job.Address)) { SendDisplayAlert("Error", "Address is not allowed empty!"); return(false); } if (Job.DateEnd < Job.DateStart) { SendDisplayAlert("Error", "Date Start have to less than Date End"); return(false); } if (Job.DateEnd == Job.DateStart) { if (Job.TimeDeadLine < DateTime.Now.TimeOfDay) { SendDisplayAlert("Error", "Please choose another deadline!"); return(false); } } return(true); }
private async Task <IEnumerable <PublicJobViewModel> > SearchJob() { var user = await UnitOfWork.Users.FindAsync(p => p.Email == _currentEmail); var query = UnitOfWork.Jobs.AsQueryable(); query = query.Where(p => p.IsFinished == false && p.DateStart >= DateTime.Today); if (MinRange > 0 && MaxRange > 0 && MinRange < MaxRange) { query = query.Where(p => p.Reward >= MinRange && p.Reward <= MaxRange); } else if (MinRange > 0) { query = query.Where(p => p.Reward >= MinRange); } else if (MaxRange > 0) { query = query.Where(p => p.Reward <= MaxRange); } if (!Ultilities.StringIsEmptyOrNull(Keyword)) { query = query.Where(p => p.Name.ToLower().Contains(Keyword.ToLower())); } if (_myTask) { query = query.Where(p => p.UserId == user.Id); } if (_orderBy) { query = query.OrderBy(p => p.Reward); } else { query = query.OrderByDescending(p => p.Reward); } var list = await query.ToListAsync(); if (list.Count > 0) { var jobsList = list.Select(j => new PublicJobViewModel() { Id = j.Id, Name = j.Name, Reward = j.Reward, UserId = j.UserId }).ToArray(); return(jobsList); } return(null); }
private bool ValidateToken() { if (Ultilities.StringIsEmptyOrNull(Token)) { SendDisplayAlert("Error", "Please enter the token number!"); return(false); } if (Token != _currentToken) { SendDisplayAlert("Error", "This is invalid token, resend token to try again!"); return(false); } return(true); }
private bool ValidateLogin() { if (Ultilities.StringIsEmptyOrNull(User.Email) || Ultilities.StringIsEmptyOrNull(User.Password)) { SendDisplayAlert("Error", "Email and Password are not allowed empty!"); return(false); } else if (!Ultilities.StringIsEmail(User.Email)) { SendDisplayAlert("Error", "This is not an email!"); return(false); } return(true); }
private bool ValidateUser() { if (Ultilities.StringIsEmptyOrNull(User.Name)) { SendDisplayAlert("Error", "Name is not allowed empty!"); return(false); } if (Ultilities.StringIsEmptyOrNull(User.Email)) { SendDisplayAlert("Error", "Email is not allowed empty!"); return(false); } else if (!Ultilities.StringIsEmail(User.Email)) { SendDisplayAlert("Error", "That is not email address!"); return(false); } if (Ultilities.StringIsEmptyOrNull(User.Password)) { SendDisplayAlert("Error", "Password is not allowed empty!"); return(false); } if (Ultilities.StringIsEmptyOrNull(User.Address)) { SendDisplayAlert("Error", "Address is not allowed empty!"); return(false); } if (Ultilities.StringIsEmptyOrNull(User.ContactNumber)) { SendDisplayAlert("Error", "Contact Number is not allowed empty!"); return(false); } if (!Ultilities.StringIsPhoneNumber(User.ContactNumber)) { SendDisplayAlert("Error", "That is not a contact number"); return(false); } return(true); }