public async void tester() { try { //this.Frame.Navigate(typeof(PhotoUpdatePage)); //This helps get user detail while data is filled out. RemoteService service = new RemoteService(); VisitorDataPayLoad payload = new VisitorDataPayLoad(); var response = await service.VisitorListControllerService(payload); foreach (var item in response.VisitorList) { visitorId = item.VisitorId.ToString(); visitorFullname = item.VisitorFullName; companyName = item.CompanyName; emailAddress = item.emailAddress; phoneNumber = item.phoneNumber; } } catch (Exception ex) { MessageDialog msg = new MessageDialog(ex.Message); await msg.ShowAsync(); } }
private async void newGuest() { //Send to DB var phoneNumber = txtPhoneNumber.Text; var hostName = txtHostName.Text; VisitorDataPayLoad visitor = new VisitorDataPayLoad(); visitor.CompanyName = userCompany; visitor.EmailAddress = userEmail; visitor.FullName = userName; //I think the guest name is the same as username. I suggest we add another field in Register to get visitor.GuestName = userName; //a particular name to link to change name since name can be changed. visitor.HostName = hostName; visitor.InvitationCode = "No Invitation Code"; //This helps confirm the guest has no invitation. visitor.PhoneNumber = Convert.ToInt64(phoneNumber); visitor.Photo = userPhotoString; //Reason - what if user change name or picture later? This to identify what he/she looked like during that visit. visitor.Signature = base64String; visitor.ThumbPrint = "@"; RemoteService service = new RemoteService(); ResponseMessage msg = await service.CheckInRegisteredUser(visitor); if (msg.ResponseCode != 0) { MessageDialog md = new MessageDialog("Could not complete Check In: " + msg.Message); await md.ShowAsync(); return; } this.Frame.Navigate(typeof(HubPage)); MessageDialog tag = new MessageDialog("Please pick your tag : Your Check In Code is " + msg.Message + ". Please click OK button after copy"); await tag.ShowAsync(); }
public viewModelTV() { try { VisitorList = new List <VisitorGlobal>(); guestList = new List <GuestGlobal>(); RemoteService service = new RemoteService(); VisitorDataPayLoad payload = new VisitorDataPayLoad(); var response = service.VisitorListControllerService(payload); VisitorList = response.VisitorList; var response2 = service.GuestListControllerService(payload); guestList = response2.GuestList; GetVisitors(); GetGuest(); } catch (Exception ex) { MessageDialog msg = new MessageDialog(ex.Message); msg.ShowAsync(); } }
private async void newVisitor() { //Register new Visitor try { VisitorDataPayLoad visitor = new VisitorDataPayLoad(); visitor.CompanyName = Company; visitor.EmailAddress = Email; visitor.FullName = FullName; visitor.PhoneNumber = Convert.ToInt64(PhoneNumber); visitor.Photo = ""; visitor.Signature = "@"; visitor.ThumbPrint = "@"; if (LstPopulate.Items.Count > 0) { UserDetail.RemoveAt(0); } refreshData(); LstPopulate.ItemsSource = null; LstPopulate.ItemsSource = UserDetail; } catch (Exception ex) { MessageDialog msg = new MessageDialog(ex.Message + " newVisitor"); //await msg.ShowAsync(); } }
private void Page_Loaded(object sender, RoutedEventArgs e) { try { VisitorDataPayLoad payloadGuest = new VisitorDataPayLoad { CompanyId = _activePage.CompanyId }; var responseGuest = service.GuestStillCheckInListControllerService(payloadGuest); GuestList = responseGuest.GuestList; if (_activePage.LogOutGuestphoneNumber != null) { txtPhoneNumber.Text = _activePage.LogOutGuestphoneNumber; getUserDetail(); } mainGuestStatus = GuestStatus.CheckedOut.ToString(); } catch (Exception ex) { checkInternet(); MessageDialog msgErr = new MessageDialog(ex.Message, "Err!"); } }
//These Class below interacts with DB private async void newVisitor() { try { //Register new Visitor VisitorDataPayLoad visitor = new VisitorDataPayLoad(); visitor.CompanyName = companyName; visitor.EmailAddress = emailAddress; visitor.FullName = fullname; visitor.GuestName = ""; visitor.HostName = ""; visitor.InvitationCode = ""; visitor.PhoneNumber = Convert.ToInt64(txtPhoneNumber.Text); visitor.Photo = photoString; visitor.Signature = "@"; visitor.ThumbPrint = "@"; RemoteService service = new RemoteService(); ResponseMessage msg = await service.RegisterNewVisitor(visitor); if (msg.ResponseCode != 0) { MessageDialog md = new MessageDialog("Could not complete registration: " + msg.Message); await md.ShowAsync(); return; } MessageDialog regMsg = new MessageDialog("Registration Successful"); await regMsg.ShowAsync(); MessageDialog afterRegistration = new MessageDialog("Choose Next Step"); afterRegistration.Commands.Add(new UICommand("Check-In This User") { Id = 0 }); afterRegistration.Commands.Add(new UICommand("Register Another User") { Id = 1 }); afterRegistration.Commands.Add(new UICommand("Cancel") { Id = 2 }); var result = await afterRegistration.ShowAsync(); if (Convert.ToInt32(result.Id) == 0) { //Call Check In Button this.Frame.Navigate(typeof(CheckInWithInvitationPage)); } } catch (Exception ex) { MessageDialog msg = new MessageDialog(ex.Message + " Void - newVisitor"); //msg.ShowAsync(); } }
private async void CheckOutButton_Click(object sender, RoutedEventArgs e) { try { var checkInCode = txtCheckInCode.Text; if (string.IsNullOrEmpty(checkInCode)) { MessageDialog md = new MessageDialog("Please enter your check in code"); await md.ShowAsync(); return; } VisitorDataPayLoad visitor = new VisitorDataPayLoad(); visitor.CheckInCode = checkInCode; visitor.CompanyId = _activePage.CompanyId; visitor.Description = "Checked out by " + _activePage.UserStaffId + "; " + description; if (LstGuestCollegue.Items.Count > 0) { updateExtraGuestColleague(); ConvertGuestColleagueToJSon(); visitor.AllGuestOut = AllGuestOut; visitor.ExtraGuest = JSONGuestColleague; } RemoteService service = new RemoteService(); ResponseMessage msg = await service.CheckOutVisitor(visitor); if (msg.ResponseStatusCode != System.Net.HttpStatusCode.Found) { MessageDialog md = new MessageDialog("Could not complete Check Out: " + msg.Message, "Alert!"); await md.ShowAsync(); return; } this.Frame.Navigate(typeof(FrontDeskHome), _activePage); if (msg.ResponseCode == 0) { MessageDialog tag = new MessageDialog("You have been checked out! Goodbye"); await tag.ShowAsync(); } else if (msg.ResponseCode == 1) { MessageDialog tag = new MessageDialog("Some Guest Colleagues are yet to be checked out, You can still check them out when it's time"); await tag.ShowAsync(); } this.Frame.Navigate(typeof(FrontDeskHome), _activePage); } catch (Exception ex) { checkInternet(); MessageDialog msg = new MessageDialog(ex.Message + " Void - CheckOutButton_Click"); //msg.ShowAsync(); } }
public async Task <ResponseMessage> GetDataThisVisitorDetail(long visitorPhoNo) { VisitorDataPayLoad visitor = new VisitorDataPayLoad { PhoneNumber = visitorPhoNo }; var response = service.VisitorDetailControllerService(visitor); return(response); }
private async void getUserDetail() { //This helps get user detail while data is filled out. try { RemoteService service = new RemoteService(); VisitorDataPayLoad payload = new VisitorDataPayLoad { PhoneNumber = Convert.ToInt64(txtPhoneNumber.Text) }; var response = await service.GetDetailOnUserService(payload); if (response.ResponseStatusCode == System.Net.HttpStatusCode.Found) { //When we find user userRegistrationStatus = "Registered"; userName = response.GuestName; userCompany = response.CompanyName; userEmail = response.GuestEmail; userPhoneNumber = response.GuestPhoneNumber; userPhotoString = response.GuestPhotstring; txtVisitorName.Text = response.GuestName; string photoString = userPhotoString; //Repetition based on flow/arrangement byte[] Bytes = Convert.FromBase64String(photoString); var stream = new InMemoryRandomAccessStream(); //var bytes = Convert.FromBase64String(source); var dataWriter = new DataWriter(stream); dataWriter.WriteBytes(Bytes); await dataWriter.StoreAsync(); stream.Seek(0); var img = new BitmapImage(); img.SetSource(stream); PhotoCopy.Source = img; } else { userRegistrationStatus = "Not Registered"; PhotoCopy.Source = null; txtVisitorName.Text = ""; } } catch (Exception ex) { MessageDialog msg = new MessageDialog(ex.Message + " Void - getUserDetail"); //msg.ShowAsync(); } }
private async void newVisitor() { try { var GuestName = txtGuestName.Text; var GuestCompany = txtGuestCompanyName.Text; var GuestPhoneNumber = txtGuestPhoneNumber.Text; var GuestEmail = txtGuestEmail.Text; //Register new Visitor VisitorDataPayLoad visitor = new VisitorDataPayLoad(); visitor.CompanyName = GuestCompany; visitor.FullName = GuestName; visitor.PhoneNumber = Convert.ToInt64(GuestPhoneNumber); if (!string.IsNullOrEmpty(GuestEmail)) { visitor.EmailAddress = GuestEmail; } visitor.Signature = "@"; visitor.ThumbPrint = "@"; visitor.CompanyId = _activePage.CompanyId; visitor.Description = "Added via Appointmemt by " + _activePage.UserStaffId; //RemoteService service = new RemoteService(); ResponseMessage msg = await service.RegisterNewVisitor(visitor); if (msg.ResponseStatusCode == System.Net.HttpStatusCode.NotFound) { MessageDialog md = new MessageDialog("Registered: " + msg.Message); //await md.ShowAsync(); //return; } else if (msg.ResponseStatusCode == System.Net.HttpStatusCode.Found) { MessageDialog md = new MessageDialog("Already Registered: " + msg.Message); //await md.ShowAsync(); return; } else { MessageDialog md = new MessageDialog("Could not complete registration: " + msg.Message); //await md.ShowAsync(); return; } } catch (Exception ex) { checkInternet(); MessageDialog msg = new MessageDialog(ex.Message + " Void - newVisitor"); //msg.ShowAsync(); } }
public List <VisitorGlobal> VisitorHelper() { try { RemoteService service = new RemoteService(); VisitorDataPayLoad payload = new VisitorDataPayLoad(); var response = service.VisitorListControllerService(payload); var visitorList = response.VisitorList; return(visitorList); //var result = Newtonsoft.Json.JsonConvert.DeserializeObject<> #region Impo was couldn't run //VisitorList = new List<Visitors>(); //foreach (var item in response.VisitorList) //{ // VisitorList.Add(new Visitors // { // VisitorID = item.VisitorId.ToString(), // VisitorFullname = item.VisitorFullName.ToString(), // VisitorCompany = item.CompanyName.ToString(), // VisitorEmail = item.emailAddress.ToString(), // VisitorPhoneNumber = item.phoneNumber.ToString() // }); //} //VisitorList = new List<Visitors>(); //for (int i = 0; i < 10; i++) //{ // VisitorList.Add(new Visitors // { // VisitorID = "Visitor ID " + i.ToString(), // VisitorFullname = "Visitor Name " + i.ToString(), // VisitorCompany = "Visitor Company " + i.ToString(), // VisitorEmail = "Visitor Email " + i.ToString(), // VisitorPhoneNumber = "Visitor PhoneNumber " + i.ToString() // }); //} #endregion } catch (Exception ex) { MessageDialog msg = new MessageDialog(ex.Message); msg.ShowAsync(); return(null); } }
public List <GuestGlobal> GuestHelper() { try { RemoteService service = new RemoteService(); VisitorDataPayLoad payload = new VisitorDataPayLoad(); var response = service.GuestListControllerService(payload); var guestList = response.GuestList; return(guestList); } catch (Exception ex) { MessageDialog msg = new MessageDialog(ex.Message); msg.ShowAsync(); return(null); } }
private async void btnCheckOut_Click(object sender, RoutedEventArgs e) { try { string txt = txtClickedItemGuestPhoneNumber.Text; var checkInCode = txtClickedItemGuestIvCode.Text; if (string.IsNullOrEmpty(checkInCode)) { MessageDialog md = new MessageDialog("Please enter your check in code"); await md.ShowAsync(); return; } VisitorDataPayLoad visitor = new VisitorDataPayLoad(); visitor.CheckInCode = checkInCode; RemoteService service = new RemoteService(); ResponseMessage msg = await service.CheckOutVisitor(visitor); if (msg.ResponseCode != 0) { MessageDialog md = new MessageDialog("Could not complete Check Out: " + msg.Message); await md.ShowAsync(); return; } MessageDialog tag = new MessageDialog("You have been checked out! Goodbye"); await tag.ShowAsync(); this.Frame.Navigate(typeof(TV)); } catch (Exception ex) { MessageDialog msg = new MessageDialog(ex.Message + " Void - btnCheckOut_Click"); //msg.ShowAsync(); } }
private async void RegisterButton_Click(object sender, RoutedEventArgs e) { try { if (txtFullName.Text.Trim() == "") { MessageDialog md = new MessageDialog("Please enter full name"); await md.ShowAsync(); return; } else if (txtPhoneNumber.Text.Trim() == "") { MessageDialog md = new MessageDialog("Please enter phone Number"); await md.ShowAsync(); return; } else if (txtCompanyName.Text.Trim() == "") { MessageDialog md = new MessageDialog("Please enter company Name"); await md.ShowAsync(); return; } else if (photoString == "") { MessageDialog md = new MessageDialog("Please Select Photo"); await md.ShowAsync(); return; } else if (txtEmail.Text.Trim() == "") { MessageDialog md = new MessageDialog("Please enter Email"); await md.ShowAsync(); return; } else if (!txtEmail.Text.Contains('@') || !txtEmail.Text.Contains('.')) { MessageDialog md = new MessageDialog("Please Enter a Valid Email"); await md.ShowAsync(); return; } else { fullname = txtFullName.Text; emailAddress = txtEmail.Text; companyName = txtCompanyName.Text; phoneNumber = Convert.ToInt64(txtPhoneNumber.Text); RemoteService service = new RemoteService(); VisitorDataPayLoad payload = new VisitorDataPayLoad { PhoneNumber = phoneNumber }; var response = await service.CheckIfVisitorExistService(payload); if (response.ResponseStatusCode == System.Net.HttpStatusCode.Found) { MessageDialog checkInMsg = new MessageDialog("User already exist"); await checkInMsg.ShowAsync(); return; } else if (response.ResponseStatusCode == System.Net.HttpStatusCode.NotFound) { //Send to Registration DB newVisitor(); } else { MessageDialog checkInMsg = new MessageDialog("Server error"); await checkInMsg.ShowAsync(); } } //After Registration clearContents(); } catch (Exception ex) { MessageDialog msg = new MessageDialog(ex.Message + " Void - RegisterButton_Click"); //msg.ShowAsync(); } }
private async void fileCsvToDb() { try { var ity = LstPopulate.Items.Count(); continueValidation = true; for (int i = 0; i < ity; i++) { if (continueValidation == true) { var user = UserDetail[0]; FullName = user.Fullname; Company = user.Company; Email = user.Email; PhoneNumber = user.PhoneNumber; sn = i + 1; checkSyntax(); RemoteService service = new RemoteService(); VisitorDataPayLoad payload = new VisitorDataPayLoad { PhoneNumber = Convert.ToInt64(PhoneNumber) }; var response = await service.CheckIfVisitorExistService(payload); if (response.ResponseStatusCode == System.Net.HttpStatusCode.Found) { MessageDialog checkInMsg = new MessageDialog("User already exist"); LstPopulate.SelectedIndex = 0; LstPopulate.ScrollIntoView(LstPopulate.SelectedItem); await checkInMsg.ShowAsync(); return; } else if (response.ResponseStatusCode == System.Net.HttpStatusCode.NotFound) { //Send to Registration DB newVisitor(); } else if (response.ResponseStatusCode == System.Net.HttpStatusCode.InternalServerError) { continueValidation = false; MessageDialog md = new MessageDialog("Could not complete registration: " + "Err: "); await md.ShowAsync(); return; } else { MessageDialog checkInMsg = new MessageDialog("Server error"); await checkInMsg.ShowAsync(); return; } } else { return; } } MessageDialog msg = new MessageDialog("Uploaded Successfully"); await msg.ShowAsync(); } catch (Exception ex) { MessageDialog msg = new MessageDialog(ex.Message + " fileCsvToDb"); //msg.ShowAsync(); } }
private void getData() { try { VisitorList = new List <VisitorGlobal>(); guestList = new List <GuestGlobal>(); RemoteService service = new RemoteService(); VisitorDataPayLoad payload = new VisitorDataPayLoad(); var response = service.VisitorListControllerService(payload); VisitorList = response.VisitorList; var response2 = service.GuestListControllerService(payload); guestList = response2.GuestList; DisplayGuestList = new List <DisplayDetails>(); var serialNo = 0; foreach (var item in guestList) { BitmapImage PhotoCopy = null; string guestPhotoString = null; string guestPhoneNumber = null; string guestCompany = null; string guestEmail = null; string guestSignature = null; string guestThumbnail = null; foreach (var visitor in VisitorList) { if (item.VisitorId == visitor.VisitorId) { guestPhotoString = visitor.photoString; guestCompany = visitor.CompanyName; guestPhoneNumber = visitor.phoneNumber; guestEmail = visitor.emailAddress; guestSignature = visitor.Signature; guestThumbnail = visitor.ThumbPrint; } } if (guestPhotoString == null || guestPhotoString.Trim() == "") { PhotoCopy.UriSource = new Uri(@"/Assets/no image found.jpeg"); } else { byte[] Bytes = Convert.FromBase64String(guestPhotoString); var stream = new InMemoryRandomAccessStream(); //var bytes = Convert.FromBase64String(source); var dataWriter = new DataWriter(stream); dataWriter.WriteBytes(Bytes); dataWriter.StoreAsync(); stream.Seek(0); var img = new BitmapImage(); img.SetSource(stream); PhotoCopy = img; } serialNo += 1; DisplayGuestList.Add(new DisplayDetails { sn = serialNo.ToString(), GuestFullName = item.GuestName, GuestHostName = item.HostName, GuestStatus = item.Status, GuestCompany = guestCompany, GuestEmail = guestEmail, GuestPhoneNumber = guestPhoneNumber, GuestCheckInTime = item.CheckInTime, GuestCheckOutTime = item.CheckOutTime, GuestCheckInCode = item.CheckInCode, GuestSignature = guestSignature, GuestThumbPrint = guestThumbnail, Picture = PhotoCopy }); } //populateGrid(); } catch (Exception ex) { MessageDialog msg = new MessageDialog(ex.Message + " Void - getData()"); //msg.ShowAsync(); } }
private void getData() { try { VisitorList = new List <VisitorGlobal>(); guestList = new List <GuestGlobal>(); VisitorDataPayLoad payload = new VisitorDataPayLoad { CompanyId = _activePage.CompanyId }; //var response = service.GuestStillCheckInListControllerService(payload); //VisitorList = response.VisitorList; var response = service.GuestListControllerService(payload); guestList = response.GuestList; DisplayGuestList = new List <DisplayDetails>(); var serialNo = 0; int GuestCheckedInToday = 0; int GuestStillCheckedInToday = 0; int GuestThisWeek = 0; int GuestThisMonth = 0; int GuestThisYear = 0; foreach (var item in guestList) { if (item.CheckInTime == item.CheckOutTime) { GuestStillCheckedInToday += 1; } if (item.CheckInTime.Date == DateTime.Today) { GuestCheckedInToday += 1; } DayOfWeek fdow = CultureInfo.CurrentCulture.DateTimeFormat.FirstDayOfWeek; //First Day of the Week int offset = fdow - DateTime.Now.DayOfWeek; DateTime fdowDate = DateTime.Now.AddDays(offset); //Date of First Day of the Week DateTime LdowDate = fdowDate.AddDays(6); //Date of Last Day of the Week DayOfWeek Ldow = LdowDate.DayOfWeek; //Last Day of the Week var thisMonth = DateTime.Today.Month; var thisYear = DateTime.Today.Year; if ((item.CheckInTime.Date >= fdowDate.Date) && (item.CheckInTime.Date <= LdowDate.Date)) { GuestThisWeek += 1; } if ((item.CheckInTime.Month == thisMonth) && (item.CheckInTime.Year == thisYear)) { GuestThisMonth += 1; } if (item.CheckInTime.Year == thisYear) { GuestThisYear += 1; } } txbGuestToday.Text = GuestCheckedInToday.ToString(); txbStillCheckinGuestToday.Text = GuestStillCheckedInToday.ToString(); txbGuestthisWeek.Text = GuestThisWeek.ToString(); txbGuestthisMonth.Text = GuestThisMonth.ToString(); txbGuestthisYear.Text = GuestThisYear.ToString(); var dateFormatter = new Windows.Globalization.DateTimeFormatting.DateTimeFormatter("day month year"); txbToday.Text = dateFormatter.Format(DateTime.Today).ToString(); } catch (Exception ex) { checkInternet(); MessageDialog msg = new MessageDialog(ex.Message + " Void - getData()"); //msg.ShowAsync(); } }