public CalenderViewModel(List <string> Vendorsdatetime, UserIndex Vendor, UserQueryDTO userQuery) { UQuery = userQuery; VendorsDateTime = Vendorsdatetime; VendorModel = Vendor; GetData(); }
public bool BookAppointment(UserQueryDTO model) { try { var json = JsonConvert.SerializeObject(model); HttpContent content = new StringContent(json); content.Headers.ContentType = new MediaTypeHeaderValue("application/json"); HttpClient client = new HttpClient(); //client.DefaultRequestHeaders.Add("Authorization", "Bearer " + Setters.AuthenticationModel.Token); var response = client.PostAsync((booking), content).Result; if (response.StatusCode == HttpStatusCode.OK) { var result = response.Content.ReadAsStringAsync().Result; bool user = JsonConvert.DeserializeObject <bool>(result); return(user); } else if (response.StatusCode == HttpStatusCode.BadRequest) { var result = response.Content.ReadAsStringAsync().Result; throw new ApplicationException("Error.."); } return(false); } catch (Exception ex) { throw ex.InnerException; } }
async void BookAppointment_clicked() { try { if (string.IsNullOrEmpty(Firstname) || string.IsNullOrEmpty(Lastname) || string.IsNullOrEmpty(Email) || string.IsNullOrEmpty(Phone)) { await Application.Current.MainPage.DisplayAlert("Error", "Fields can't be empty", "Ok"); } else { UserQueryDTO userQuery = new UserQueryDTO() { FirstName = Firstname, LastName = Lastname, EMailID = Email.Trim(), PhoneNo = Phone, selelecteddate = SDate, time = Convert.ToDateTime(SelectedTime), referalphonenumber = ReferralPhone, Query = Reason, TeacherID = TeacherId }; bool result = false; IsBusy = true; await Task.Run(() => { result = accountService.BookAppointment(userQuery); }); if (result) { await Application.Current.MainPage.DisplayAlert("Message", "Your Appointment is booked", "Ok"); Clear_clicked(); SelectedDate = ""; IsSubmitFormVisible = false; } else { await Application.Current.MainPage.DisplayAlert("Message", "Error in booking Appointment", "Ok"); Clear_clicked(); SelectedDate = ""; IsSubmitFormVisible = false; } } } catch (Exception) { throw; } finally { IsBusy = false; } }
/// <summary> /// 查询列表. /// </summary> /// <param name="modal">The modal<see cref="UserQueryDTO"/>.</param> /// <returns>.</returns> public async Task <BaseResult <UserEntity> > GetList(UserQueryDTO modal) { string tableName = "tbUser"; string where = " IsDelete=0"; string orderby = "userId "; if (modal.sortRule == 1) { orderby += " desc"; } else { orderby += " asc"; } if (modal.userName != null) { where = where + "AND userName LIKE '%" + modal.userName + "%'"; } int skip = (modal.pageIndex - 1) * modal.pageSize + 1; StringBuilder sb = new StringBuilder(); sb.AppendFormat(@"SELECT COUNT(1) FROM {0} WHERE 1=1;", tableName, where); sb.AppendFormat(@"SELECT * FROM(SELECT ROW_NUMBER() OVER(ORDER BY {1}) AS RowNum,* FROM {0} WHERE 1=1 AND {4} ) AS result WHERE RowNum >= {2} AND RowNum <= {3} ORDER BY {1}", tableName, orderby, skip, modal.pageIndex * modal.pageSize, where); var result = new BaseResult <UserEntity>(); try { var pageData = await GetPageList(sb.ToString()); if (pageData.total > -1) { result.code = ResultKey.RETURN_SUCCESS_CODE; result.data = pageData; result.desc = ResultKey.RETURN_SUCCESS_DESC; } else { result.code = ResultKey.RETURN_FAIL_CODE; result.desc = ResultKey.RETURN_FAIL_DESC; } } catch (Exception ex) { NlogHelper.InfoLog(ex.Message); throw new Exception(ex.Message); } return(result); }
public HttpResponseMessage isValidUser([FromBody] UserQueryDTO vm) { CookBookEntities entities = new CookBookEntities(); UserResponseDTO response = new UserResponseDTO(); response.isValid = (entities.ApplicationUsers.SingleOrDefault(obj => obj.Email == vm.Email && obj.Password == vm.Password) != null) ? true : false; if (response.isValid == true) { return(Request.CreateResponse(HttpStatusCode.OK, response)); } else { return(Request.CreateResponse(HttpStatusCode.InternalServerError, response)); } }
public CalenderView(List <string> Vendorsdatetime, UserIndex Vendor, UserQueryDTO userQuery) { InitializeComponent(); BindingContext = new CalenderViewModel(Vendorsdatetime, Vendor, userQuery); }
public async Task <BaseResult <UserEntity> > GetList(UserQueryDTO modal) { return(await userRepository.GetList(modal)); }