private async void AutoSugBoxEmps_QuerySubmitted(AutoSuggestBox sender, AutoSuggestBoxQuerySubmittedEventArgs args) { ProgressRingAutosuggestionLoad.IsActive = true; ProgressRingAutosuggestionLoad.Visibility = Visibility.Visible; string QueryItem = args.QueryText.ToString(); if (String.IsNullOrEmpty(QueryItem)) { await EmployeeSync.GetAllEmployeesAsnc(EmployeeCharacters, "All"); await LeaveTransactionGetPostPut.GetLeaveTransactionAsnc(LeaveTransactions, "All", "1"); Passwordresetframe.Visibility = Visibility.Collapsed; } else { await EmployeeSync.GetAutosuggestEmployeesAsnc(EmployeeCharacters, QueryItem); await LeaveTransactionGetPostPut.GetLeaveTransactionAsnc(LeaveTransactions, EmployeeCharacters[0].EmpId, "1"); Passwordresetframe.Visibility = Visibility.Visible; Passwordresetframe.Navigate(typeof(PasswordResetAdmin), EmployeeCharacters[0].EmpId); } ProgressRingAutosuggestionLoad.IsActive = false; ProgressRingAutosuggestionLoad.Visibility = Visibility.Collapsed; }
private async void passwordResetButton_Click(object sender, RoutedEventArgs e) { if(string.IsNullOrEmpty(passwordResetBox.Password)||string.IsNullOrWhiteSpace(passwordResetBox.Password)) { var messageDialog = new MessageDialog("Type password before you click on change"); await messageDialog.ShowAsync(); } else { try { passwordResetButton.IsEnabled = false; ProgressRingPasswordReset.IsActive = true; ProgressRingPasswordReset.Visibility = Visibility.Visible; string empId = ""; string newPassword = ""; var localObjectStorageHelper = new LocalObjectStorageHelper(); // Read and Save with simple objects string keySimpleObject = "47"; if (localObjectStorageHelper.KeyExists(keySimpleObject)) { empId = localObjectStorageHelper.Read<string>(keySimpleObject); } newPassword = passwordResetBox.Password; await EmployeeSync.GetAllEmployeesAsnc(EmployeeCharacters, empId); string condition = EmployeeCharacters[0]._id.Oid.ToString(); string setValue = String.Format("{{\"$set\":{{\"Password\":\"{0}\"}}}}", newPassword); await EmployeeSync.EmpPasswordPutAsync(condition, setValue); var messageDialog = new MessageDialog("Password changed"); await messageDialog.ShowAsync(); passwordResetButton.IsEnabled = true; ProgressRingPasswordReset.Visibility = Visibility.Collapsed; ProgressRingPasswordReset.IsActive = false; passwordResetBox.Password = ""; } catch { var messageDialog = new MessageDialog("Password not changed !Error "); await messageDialog.ShowAsync(); ProgressRingPasswordReset.Visibility = Visibility.Collapsed; ProgressRingPasswordReset.IsActive = false; passwordResetButton.IsEnabled = true; } } }
private async void Page_Loaded(object sender, RoutedEventArgs e) { ProgressRingFormLoad.IsActive = true; ProgressRingFormLoad.Visibility = Visibility.Visible; await EmployeeSync.GetAllEmployeesAsnc(EmployeeCharacters, "All"); await LeaveTransactionGetPostPut.GetLeaveTransactionAsnc(LeaveTransactions, "All", "1"); ProgressRingFormLoad.IsActive = false; ProgressRingFormLoad.Visibility = Visibility.Collapsed; }
protected async override void OnNavigatedTo(NavigationEventArgs e) { var empId = (string)e.Parameter; await EmployeeSync.GetAllEmployeesAsnc(EmployeeCharacters, empId); if (EmployeeCharacters.Count > 0) { EmpIdTextBlock.Text = EmployeeCharacters[0].EmpId; EmpNameTextBlock.Text = EmployeeCharacters[0].EmpFirstName; string icon = String.Format("ms-appx:///Assets/EmpPhotos/{0}.png", EmployeeCharacters[0].EmpId); ImageBrush.ImageSource = new BitmapImage(new Uri(icon, UriKind.Absolute)); } }
private async void AutoSugBoxEmps_Unloaded(object sender, RoutedEventArgs e) { ProgressRingAutosuggestionLoad.IsActive = true; ProgressRingAutosuggestionLoad.Visibility = Visibility.Visible; await EmployeeSync.GetAllEmployeesAsnc(EmployeeCharacters, "All"); await LeaveTransactionGetPostPut.GetLeaveTransactionAsnc(LeaveTransactions, "All", "1"); Passwordresetframe.Visibility = Visibility.Collapsed; ProgressRingAutosuggestionLoad.IsActive = false; ProgressRingAutosuggestionLoad.Visibility = Visibility.Collapsed; }
private async void AutoSugBoxEmps_TextChanged(AutoSuggestBox sender, AutoSuggestBoxTextChangedEventArgs args) { if (String.IsNullOrEmpty(sender.Text)) { await EmployeeSync.GetAllEmployeesAsnc(EmployeeCharacters, "All"); await LeaveTransactionGetPostPut.GetLeaveTransactionAsnc(LeaveTransactions, "All", "1"); Passwordresetframe.Visibility = Visibility.Collapsed; } else { String after = sender.Text.Substring(0, 1).ToUpper() + sender.Text.Substring(1); var autoSuggestbox = (AutoSuggestBox)sender; var Suggestions = EmployeeCharacters.Where(p => p.EmpFirstName.StartsWith(after)).Select(p => p.EmpFirstName).ToList(); autoSuggestbox.ItemsSource = Suggestions; } }
private async void EmpIdNextButton_Click(object sender, RoutedEventArgs e) { EmpIdNextButton.IsEnabled = false; ProgressRingUserName.IsActive = true; ProgressRingUserName.Visibility = Visibility.Visible; await EmployeeSync.GetAllEmployeesAsnc(EmployeeCharacters, EmpIdTextBox.Text); if (EmployeeCharacters.Count > 0) { Frame.Navigate(typeof(SignInPassword), EmpIdTextBox.Text); } else if (EmployeeCharacters.Count == 0) { NotFindErrorTextBlock.Visibility = Visibility.Visible; } ProgressRingUserName.IsActive = false; ProgressRingUserName.Visibility = Visibility.Collapsed; EmpIdNextButton.IsEnabled = true; }
private async void ApplyButton_Click(object sender, RoutedEventArgs e) { ApplyButton.IsEnabled = false; ProgressRingApply.IsActive = true; ProgressRingApply.Visibility = Visibility.Visible; string Empid = ""; var localObjectStorageHelper = new LocalObjectStorageHelper(); // Read and Save with simple objects string keySimpleObject = "47"; if (localObjectStorageHelper.KeyExists(keySimpleObject)) { Empid = localObjectStorageHelper.Read <string>(keySimpleObject); } await EmployeeSync.GetAllEmployeesAsnc(EmployeeCharacters, Empid); // not used //string condition = String.Format("{{\"_id\":\"{0}\"}}", "58fdd151c2ef16688202ffa8"); //Update the data working code //string condition = "58fde913bd966f74dc8f846d"; //string setValue = String.Format("{{\"$set\":{{\"LeaveStatus\":\"{0}\"}}}}", "4"); //await LeaveTransactionPost.LeaveTransactionPutAsync(condition, setValue); string EmpFirstName = ""; string EmpLastName = ""; string EmpDesignation = ""; string EmpReportingTo = ""; string EmpTeam = ""; string intitDeparturedate = ""; string intitDepartureHour = ""; string intitArrivaldate = ""; string intitArrivalHour = ""; string AppliedDate = ""; string AppliedTime = ""; string LeavePeriodF = ""; string LeaveType = ""; string Description = ""; string ApprovedBy = ""; string ApprovedDate = ""; string ApprovedTime = ""; string LeaveStatus = ""; string TransPkey = ""; string EmpPath = ""; EmpFirstName = EmployeeCharacters[0].EmpFirstName; EmpLastName = EmployeeCharacters[0].EmpLastName; EmpDesignation = EmployeeCharacters[0].EmpDesignation; EmpReportingTo = EmployeeCharacters[0].EmpReportingTo; EmpTeam = EmployeeCharacters[0].EmpTeam; EmpPath = EmployeeCharacters[0].EmpPath; intitDeparturedate = DateTimeToDateIndian.GetDateFromDateTime(DepartureDateCalendar.Date.Value.ToString("G")); intitDepartureHour = DeparturetimeComboBox.SelectionBoxItem.ToString(); intitArrivaldate = DateTimeToDateIndian.GetDateFromDateTime(ArrivalDateCalendar.Date.Value.ToString("G")); intitArrivalHour = ArrivaltimeComboBox.SelectionBoxItem.ToString(); AppliedDate = DateTimeToDateIndian.GetDateFromDateTime(DateTime.Now.ToString("G")); AppliedTime = DateTime.Now.ToString("hh:mm tt"); LeavePeriodF = GetNumberOfLeaveDays(intitDepartureHour, intitArrivalHour).ToString(); LeaveType = LeaveTypeComboBox.SelectionBoxItem.ToString(); Description = DescriptionTextBox.Text.ToString(); LeaveStatus = "1"; TransPkey = RandomNumGen.GenerateRandomNumber().ToString() + Empid; if (Convert.ToDouble(LeavePeriodF) > 0.5) { if (await LeaveTransactionGetPostPut.LeaveDataPostAsync ( TransPkey, Empid, EmpFirstName, EmpLastName, EmpDesignation, EmpReportingTo, EmpTeam, EmpPath, intitDeparturedate, intitDepartureHour, intitArrivaldate, intitArrivalHour, AppliedDate, AppliedTime, LeavePeriodF, LeaveType, Description, ApprovedBy, ApprovedDate, ApprovedTime, LeaveStatus ) == "OK") { var messageDialog = new MessageDialog("Applied sucessfully"); await messageDialog.ShowAsync(); DepartureDateCalendar.Date = DateTime.Now; ArrivalDateCalendar.Date = DateTime.Now.AddHours(24); DescriptionTextBox.Text = ""; LeaveTypeComboBox.SelectedIndex = 0; } else { var messageDialog = new MessageDialog("Not applied"); await messageDialog.ShowAsync(); } } else { Result.Text = "Your leave period less than half day,Please take oral approve"; } ProgressRingApply.IsActive = false; ProgressRingApply.Visibility = Visibility.Collapsed; ApplyButton.IsEnabled = true; }