private async void Delete() { if (await this.dialogService.ShowMessageConfirm( "Infomation", "Are you sure delete this record...?", "Yes", "No")) { // Check the connections to internet var response = await this.apiService.CheckConnection(); if (!response.IsSuccess) { await this.dialogService.ShowMessage( "Error", response.Message, "Accept"); return; } // Generate an object var zoomDataItem = new ZoomDataItem { Tracking = this.Tracking, UserId = this.mainViewModel.UserData.UserId, ZoomDataId = this.ZoomDataId, }; // Delete the record response = await this.apiService.Delete <ZoomDataItem>( MethodsHelper.GetUrlAPI(), "/api", "/ZoomDatas", this.mainViewModel.Token.TokenType, this.mainViewModel.Token.AccessToken, zoomDataItem); if (!response.IsSuccess) { await this.dialogService.ShowMessage( "Error", response.Message, "Accept"); return; } // Delete record this.cantvViewModel.LoadUserData(); await dialogService.ShowMessage( "Infromation", string.Format( "Record: {0} remove successfully...!!!", zoomDataItem.Tracking), "Accept"); } }
private async void LoadData() { // Set status of controls this.SetStatusControl(false, true, 1); // Validate the connections of internet var response = await this.apiService.CheckConnection(); if (!response.IsSuccess) { // Set status of controls this.SetStatusControl(true, false, 0); await this.dialogService.ShowMessage( "Error", response.Message, "Accept"); return; } // Find the values of the Nationality response = await this.apiService.GetList <NationalityData>( MethodsHelper.GetUrlAPI(), "/api", "/Nationalities", "", this.mainViewModel.Token.TokenType, this.mainViewModel.Token.AccessToken); if (!response.IsSuccess) { // Set status of controls this.SetStatusControl(true, false, 0); await this.dialogService.ShowMessage( "Error", response.Message, "Accept"); return; } // this.listNationalities = new List <NationalityData>((List <NationalityData>)response.Result); // Load to values the ObservableCollection this.Nationalities = new ObservableCollection <NationalityData>( listNationalities.OrderBy(n => n.NationalityId)); // Load the values in the fields this.NationalityId = this.cneItemViewModel.NationalityId; this.IdentificationCard = this.cneItemViewModel.IdentificationCard; // Set status of controls this.SetStatusControl(true, false, 0); }
private async void LoadValues() { // this.Nationality = ""; this.IdentificationCard = ""; // this.BirthDate = DateTime.Now.Date; // Define the status of the controls this.SetStatusControl(false, true, 1); var response = await this.apiService.CheckConnection(); if (!response.IsSuccess) { // Define the status of the controls this.SetStatusControl(true, false, 0); await this.dialogService.ShowMessage( "Error", response.Message, "Accept"); return; } // Get an List<> of the Nationalities response = await this.apiService.GetList <NationalityData>( MethodsHelper.GetUrlAPI(), "/api", "/Nationalities", "", mainViewModel.Token.TokenType, mainViewModel.Token.AccessToken); if (!response.IsSuccess) { // Define the status of the controls this.SetStatusControl(true, false, 0); await this.dialogService.ShowMessage( "Error", response.Message, "Accept"); return; } this.listNationalities = new List <NationalityData>((List <NationalityData>)response.Result); this.Nationalities = new ObservableCollection <NationalityData>( listNationalities.OrderBy(n => n.NationalityId)); // Define the status of the controls this.SetStatusControl(true, false, 0); }
private async void Save() { var response = MethodsHelper.IsValidField( "I", 8, 20, "number tracking", this.Tracking, true, false, string.Empty); if (!response.IsSuccess) { await this.dialogService.ShowMessage( "Error", response.Message, "Accept"); return; } response = MethodsHelper.IsValidField( "I", 8, 20, "number tracking", this.Tracking, true, false, string.Empty); if (!response.IsSuccess) { await this.dialogService.ShowMessage( "Error", response.Message, "Accept"); return; } // Define control format this.SetStatusControl(false, true, 1); response = await apiservices.CheckConnection(); if (!response.IsSuccess) { // Define control format this.SetStatusControl(true, false, 0); await this.dialogService.ShowMessage( "Error", response.Message, "Accept"); return; } var zoomDataItem = new ZoomDataItem { Tracking = this.Tracking, UserId = mainViewModel.UserData.UserId, ZoomDataId = 0, }; // Save the data CatvData response = await apiservices.Post <ZoomDataItem>( MethodsHelper.GetUrlAPI(), "/api", "/ZoomDatas", mainViewModel.Token.TokenType, mainViewModel.Token.AccessToken, zoomDataItem); if (!response.IsSuccess) { // Define control format SetStatusControl(true, false, 0); await dialogService.ShowMessage( "Error", response.Message, "Accept"); return; } // Add new record cantvViewModel.LoadUserData(); // Define control format this.SetStatusControl(true, false, 0); // Navigate to back await this.navigationService.GoBackOnMaster(); }
private async void Register() { // Validate the field of form var response = MethodsHelper.IsValidField( "S", 3, 20, "firts name", this.FirtsName, true, false, string.Empty); if (!response.IsSuccess) { await dialogService.ShowMessage( "Error", response.Message, "Accept"); return; } response = MethodsHelper.IsValidField( "S", 3, 20, "last name", this.LastName, true, false, string.Empty); if (!response.IsSuccess) { await dialogService.ShowMessage( "Error", response.Message, "Accept"); return; } response = MethodsHelper.IsValidField( "S", 0, 0, "email", this.Email, false, false, string.Empty); if (!response.IsSuccess) { await dialogService.ShowMessage( "Error", response.Message, "Accept"); return; } var isValidEmail = MethodsHelper.IsValidEmail(this.Email); if (!isValidEmail) { await dialogService.ShowMessage( "Error", "You must enter an valid email", "Accept"); return; } response = MethodsHelper.IsValidField( "S", 6, 10, "password", this.Password, true, false, string.Empty); if (!response.IsSuccess) { await dialogService.ShowMessage( "Error", response.Message, "Accept"); return; } response = MethodsHelper.IsValidField( "S", 6, 10, "password confirm", this.Confirm, true, true, this.Password); if (!response.IsSuccess) { await dialogService.ShowMessage( "Error", response.Message, "Accept"); return; } // Set status controls SetStatusControl(false, true, true, 1); response = await apiService.CheckConnection(); if (!response.IsSuccess) { // Set status controls SetStatusControl(true, true, false, 0); await dialogService.ShowMessage( "Error", response.Message, "Accept"); return; } // Use the user registration API var user = new User { AppName = MethodsHelper.GetAppName(), Email = this.Email, FirstName = this.FirtsName, LastName = this.LastName, Password = this.Password, UserTypeId = Convert.ToInt32("5"), }; response = await apiService.Post( MethodsHelper.GetUrlAPI(), "/api", "/Users", user); if (!response.IsSuccess) { // Set status controls SetStatusControl(true, true, false, 0); await dialogService.ShowMessage( "Error", response.Message, "Accept"); return; } // Set status controls SetStatusControl(true, true, false, 0); // Set Initialize the fields SetInitializaFields(); // Go back login await dialogService.ShowMessage( "Information", string.Format( "{0}{1}", "User registered successfully, you can now log in to the ", "application whit this username and password...!!!"), "Accept"); await navigationService.GoBackOnLogin(); }
private async void Save() { // Validate the field of form #region Current Email var response = MethodsHelper.IsValidField( "S", 0, 0, "email", this.CurrentEmail, false, false, string.Empty); if (!response.IsSuccess) { await dialogService.ShowMessage( "Error", response.Message, "Accept"); return; } var isValidEmail = MethodsHelper.IsValidEmail(this.CurrentEmail); if (!isValidEmail) { await dialogService.ShowMessage( "Error", "You must enter an valid current email", "Accept"); return; } #endregion Current Email // Verify if it is valid the email current if (!this.CurrentEmail.Equals(this.mainViewModel.UserData.Email)) { await dialogService.ShowMessage( "Error", "This email not are registered in the sistem...!!!", "Accept"); return; } #region New Email response = MethodsHelper.IsValidField( "S", 0, 0, "new email", this.NewEmail, false, false, string.Empty); if (!response.IsSuccess) { await dialogService.ShowMessage( "Error", response.Message, "Accept"); return; } isValidEmail = MethodsHelper.IsValidEmail(this.NewEmail); if (!isValidEmail) { await dialogService.ShowMessage( "Error", "You must enter an valid new email", "Accept"); return; } #endregion New Email #region Confirm Email response = MethodsHelper.IsValidField( "S", 0, 0, "confirm email", this.ConfirmEmail, false, false, string.Empty); if (!response.IsSuccess) { await dialogService.ShowMessage( "Error", response.Message, "Accept"); return; } isValidEmail = MethodsHelper.IsValidEmail(this.ConfirmEmail); if (!isValidEmail) { await dialogService.ShowMessage( "Error", "You must enter an valid confirm email", "Accept"); return; } #endregion Confirm Email #region Email Confirm and new Email response = MethodsHelper.IsValidField( "S", 0, 0, "email confirm", this.ConfirmEmail, false, true, this.NewEmail); if (!response.IsSuccess) { await dialogService.ShowMessage( "Error", response.Message, "Accept"); return; } #endregion Email Confirm and new Email // Validate that the emails are different if (this.CurrentEmail.Equals(this.NewEmail)) { await dialogService.ShowMessage( "Error", "The new email can not be the same as the current email .. !!!", "Accept"); return; } // Set status controls SetStatusControl(false, true, "Green", 1); response = await apiService.CheckConnection(); if (!response.IsSuccess) { // Set status controls SetStatusControl(true, false, "Green", 0); await dialogService.ShowMessage( "Error", response.Message, "Accept"); return; } // Use the user registration API var userEdit = new UserEdit { AppName = MethodsHelper.GetAppName(), Email = this.mainViewModel.UserData.Email, FirstName = this.mainViewModel.UserData.FirstName, LastName = this.mainViewModel.UserData.LastName, NewEmail = this.newEmail, Password = this.mainViewModel.UserData.Password, UserId = this.mainViewModel.UserData.UserId, UserTypeId = 5, }; response = await apiService.Put <UserEdit>( MethodsHelper.GetUrlAPI(), "/api", "/Users/PutUserEdit", "id", this.mainViewModel.Token.TokenType, this.mainViewModel.Token.AccessToken, userEdit); if (!response.IsSuccess) { // Set status controls SetStatusControl(true, false, "Green", 0); await dialogService.ShowMessage( "Error", response.Message, "Accept"); return; } // Set status controls SetStatusControl(true, false, "Green", 0); // Set Initialize the fields LoadValuesControls(0); // Go back login await dialogService.ShowMessage( "Information", "Successfully modified email, you must log in again...!!! ", "Accept"); // Navigate to LoginPage navigationService.SetMainPage("LoginPage"); }
private async void Recovery() { var response = MethodsHelper.IsValidField( "S", 0, 0, "email", this.Email, false, false, string.Empty); if (!response.IsSuccess) { await dialogService.ShowMessage( "Error", response.Message, "Accept"); return; } var isValidEmail = MethodsHelper.IsValidEmail(this.Email); if (!isValidEmail) { await dialogService.ShowMessage( "Error", "You must enter an valid email...!!!", "Accept"); return; } // Set status controls SetStatusControl(false, true, "Green", 1); response = await apiService.PasswordRecovery( MethodsHelper.GetUrlAPI(), "/api", "/Users/PasswordRecovery", this.Email); if (!response.IsSuccess) { // Set status controls SetStatusControl(true, false, "Green", 0); await dialogService.ShowMessage( "Error", response.Message, "Accept"); return; } // Set status controls SetStatusControl(true, false, "Green", 0); // Set Initialize the fields LoadValuesControls(0); // Go back login await dialogService.ShowMessage( "Information", "You new password has been successfully sent to email...!!!", "Accept"); // Navigate to LoginPage await navigationService.GoBackOnLogin(); }
private async void Delete() { if (await this.dialogService.ShowMessageConfirm( "Infomation", "Are you sure delete this record...?", "Yes", "No")) { // Check the connections to internet var response = await this.apiService.CheckConnection(); if (!response.IsSuccess) { await this.dialogService.ShowMessage( "Error", response.Message, "Accept"); return; } // Generate an object var cneIvssDataItem = new CneIvssDataItem { BirthDate = this.BirthDate, CneIvssDataId = this.CneIvssDataId, IdentificationCard = this.IdentificationCard, IsCne = this.IsCne, IsIvss = this.IsIvss, NationalityDatas = this.NationalityDatas, NationalityId = this.NationalityId, UserId = this.mainViewModel.UserData.UserId, }; // Delete the record response = await this.apiService.Post <CneIvssDataItem>( MethodsHelper.GetUrlAPI(), "/api", "/CneIvssDatas/PostCneIvssDataByOption/?_option=cne", this.mainViewModel.Token.TokenType, this.mainViewModel.Token.AccessToken, cneIvssDataItem); if (!response.IsSuccess) { await this.dialogService.ShowMessage( "Error", response.Message, "Accept"); return; } // Delete record this.cantvViewModel.UpdateCneData( -1, ToCneItemViewModel(cneIvssDataItem)); await dialogService.ShowMessage( "Infromation", string.Format( "Record: {0} remove successfully...!!!", cneIvssDataItem.GetCneIvssFull), "Accept"); } }
private async void Delete() { // Validate if delete the record if (await this.dialogService.ShowMessageConfirm( "Informtion", "Are you sure delete this record...?", "Yes", "No")) { // Validate connection to internet var response = await this.apiService.CheckConnection(); if (!response.IsSuccess) { await this.dialogService.ShowMessage( "Error", response.Message, "Accept"); return; } // Generate an object CantvDatas var cantvData = new CantvDataItem { CantvDataId = this.CantvDataId, CodePhone = this.CodePhone, NumberPhone = this.NumberPhone, UserId = this.mainViewModel.UserData.UserId, }; response = await this.apiService.Delete <CantvDataItem>( MethodsHelper.GetUrlAPI(), "/api", "/CantvDatas", this.mainViewModel.Token.TokenType, this.mainViewModel.Token.AccessToken, cantvData); if (!response.IsSuccess) { await this.dialogService.ShowMessage( "Error", response.Message, "Accept"); return; } // Invokate the method that removes a CantvDatas cantvData.UserId = 0; this.cantvViewModel.UpdateCantvData( -1, this.ToCantvItemViewModel(cantvData)); await this.dialogService.ShowMessage( "Information", string.Format( "Record: {0} remove successfully...!!!", cantvData.GetFullCantvData), "Accept"); } }
public static async Task NavigateToProfile(FacebookResponse profile) { if (profile == null) { mainViewModel.Login.SetStatusControl(true, true, false, 0); //await dialogService.ShowMessage( //"Error", //"the facebook response is not available, try later...!!!", //"Accept"); navigationService.SetMainPage("LoginPage"); // Application.Current.MainPage = new NavigationPage(new LoginPage()); return; } var token = await apiService.LoginFacebook( MethodsHelper.GetUrlAPI(), "/api", "/Users/LoginFacebook", profile); if (token == null) { mainViewModel.Login.SetStatusControl(true, true, false, 0); await dialogService.ShowMessage( "Error", "Login with facebook is not available, try later...!!!", "Accept"); // Application.Current.MainPage = new NavigationPage(new LoginPage()); navigationService.SetMainPage("LoginPage"); return; } // Get data of the user var response = await apiService.Get <UserDataResponse>( MethodsHelper.GetUrlAPI(), "/api/Users", "/GetServicesVzLaUSerByEmail", string.Format( "/?email={0}", token.UserName), token.TokenType, token.AccessToken); if (!response.IsSuccess) { mainViewModel.Login.SetStatusControl(true, true, false, 0); await dialogService.ShowMessage( "Error", response.Message, "Accept"); navigationService.SetMainPage("LoginPage"); return; } // Load values of the UserData LoadOfValueUserData( (UserDataResponse)response.Result, mainViewModel); // Load value to token mainViewModel.Token = token; // Gets an instance of the CantvViewModel mainViewModel.Cantv = new CantvViewModel(); // Set the MainPage to MasterPage navigationService.SetMainPage("MasterPage"); }
private async void Save() { if (this.mainViewModel.UserData.UserTypeId != 2) { // Validate the field of form var response = MethodsHelper.IsValidField( "S", 3, 20, "firts name", this.FirstName, true, false, string.Empty); if (!response.IsSuccess) { await dialogService.ShowMessage( "Error", response.Message, "Accept"); return; } response = MethodsHelper.IsValidField( "S", 3, 20, "last name", this.LastName, true, false, string.Empty); if (!response.IsSuccess) { await dialogService.ShowMessage( "Error", response.Message, "Accept"); return; } // Get image byte[] imageArray = null; if (file != null) { imageArray = FilesHelper.ReadFully(file.GetStream()); // file.Dispose(); } // Set status controls SetStatusControl(false, false, true, 1); response = await apiService.CheckConnection(); if (!response.IsSuccess) { // Set status controls SetStatusControl(true, true, false, 0); await dialogService.ShowMessage( "Error", response.Message, "Accept"); return; } // Use the user registration API var userEdit = new UserEdit { AppName = MethodsHelper.GetAppName(), Email = this.Email, FirstName = this.FirstName, ImageArray = imageArray, ImagePath = this.mainViewModel.UserData.ImagePath, LastName = this.LastName, Password = this.mainViewModel.UserData.Password, Telephone = this.Telephone, UserId = this.mainViewModel.UserData.UserId, UserTypeId = 5, }; response = await apiService.Put <UserEdit>( MethodsHelper.GetUrlAPI(), "/api", "/Users", this.mainViewModel.Token.TokenType, this.mainViewModel.Token.AccessToken, userEdit); if (!response.IsSuccess) { // Set status controls this.SetStatusControl(true, true, false, 0); await dialogService.ShowMessage( "Error", response.Message, "Accept"); return; } // Update data Image this.mainViewModel.UserData.FirstName = this.FirstName; this.mainViewModel.UserData.LastName = this.LastName; this.mainViewModel.UserData.Telephone = this.Telephone; this.mainViewModel.UserData.ImagePath = userEdit.ImagePath; // Set status controls this.SetStatusControl(true, true, false, 0); // Go back login await dialogService.ShowMessage( "Information", "Infromation updated successfully...!!!", "Accept"); } }
private async void Save() { var response = MethodsHelper.IsValidField( "I", 3, 3, "code phone", this.CodePhone, true, false, string.Empty); if (!response.IsSuccess) { await dialogService.ShowMessage( "Error", response.Message, "Accept"); return; } response = MethodsHelper.IsValidField( "I", 7, 7, "number phone", this.NuberPhone, true, false, string.Empty); if (!response.IsSuccess) { await dialogService.ShowMessage( "Error", response.Message, "Accept"); return; } // Define control format SetStatusControl(false, true, 1); response = await apiservices.CheckConnection(); if (!response.IsSuccess) { // Define control format SetStatusControl(true, false, 0); await dialogService.ShowMessage( "Error", response.Message, "Accept"); return; } this.editCantv.CodePhone = this.CodePhone; this.editCantv.NumberPhone = this.NuberPhone; // Save the data CatvData response = await apiservices.Put <CantvDataItem>( MethodsHelper.GetUrlAPI(), "/api", "/CantvDatas", mainViewModel.Token.TokenType, mainViewModel.Token.AccessToken, this.ToCantvItem(this.editCantv)); if (!response.IsSuccess) { // Define control format SetStatusControl(true, false, 0); await dialogService.ShowMessage( "Error", response.Message, "Accept"); return; } // Update record cantvViewModel.UpdateCantvData(0, this.editCantv); // Define control format SetStatusControl(true, false, 0); // Navigate to back await navigationService.GoBackOnMaster(); }
private async void Save() { var response = MethodsHelper.IsValidField( "I", 3, 3, "code phone", this.CodePhone, true, false, string.Empty); if (!response.IsSuccess) { await this.dialogService.ShowMessage( "Error", response.Message, "Accept"); return; } response = MethodsHelper.IsValidField( "I", 7, 7, "number phone", this.NuberPhone, true, false, string.Empty); if (!response.IsSuccess) { await this.dialogService.ShowMessage( "Error", response.Message, "Accept"); return; } // Define control format this.SetStatusControl(false, true, 1); response = await apiservices.CheckConnection(); if (!response.IsSuccess) { // Define control format this.SetStatusControl(true, false, 0); await this.dialogService.ShowMessage( "Error", response.Message, "Accept"); return; } var cantvData = new CantvDataItem { CodePhone = this.CodePhone, NumberPhone = this.NuberPhone, UserId = mainViewModel.UserData.UserId, }; // Save the data CatvData response = await apiservices.Post <CantvDataItem>( MethodsHelper.GetUrlAPI(), "/api", "/CantvDatas", mainViewModel.Token.TokenType, mainViewModel.Token.AccessToken, cantvData); if (!response.IsSuccess) { // Define control format SetStatusControl(true, false, 0); await dialogService.ShowMessage( "Error", response.Message, "Accept"); return; } // Add new record cantvData.CantvDataId = ((CantvData)response.Result).CantvDataId; cantvViewModel.UpdateCantvData( 1, this.ToCantvItemViewModel(cantvData)); // Define control format this.SetStatusControl(true, false, 0); // Navigate to back await this.navigationService.GoBackOnMaster(); }
private async void Save() { // Validate the field of form #region Current Password var response = MethodsHelper.IsValidField( "S", 0, 0, "current password", this.CurrentPassword, false, false, string.Empty); if (!response.IsSuccess) { await dialogService.ShowMessage( "Error", response.Message, "Accept"); return; } #endregion Current Password #region New Password response = MethodsHelper.IsValidField( "S", 6, 10, "new password", this.NewPassword, true, false, string.Empty); if (!response.IsSuccess) { await dialogService.ShowMessage( "Error", response.Message, "Accept"); return; } #endregion New Password #region Confirm Password response = MethodsHelper.IsValidField( "S", 6, 10, "password confirm", this.ConfirmPassword, true, true, this.NewPassword); if (!response.IsSuccess) { await dialogService.ShowMessage( "Error", response.Message, "Accept"); return; } #endregion Confirm Password // Set status controls SetStatusControl(false, true, "Green", 1); response = await apiService.CheckConnection(); if (!response.IsSuccess) { // Set status controls SetStatusControl(true, false, "Green", 0); await dialogService.ShowMessage( "Error", response.Message, "Accept"); return; } // Use the user registration API var userEdit = new UserEdit { AppName = MethodsHelper.GetAppName(), Email = this.mainViewModel.UserData.Email, FirstName = this.mainViewModel.UserData.FirstName, LastName = this.mainViewModel.UserData.LastName, NewEmail = this.mainViewModel.UserData.Email, Password = this.CurrentPassword, NewPassword = this.NewPassword, UserId = this.mainViewModel.UserData.UserId, UserTypeId = 5, }; response = await apiService.EditPassword( MethodsHelper.GetUrlAPI(), "/api", "/Users/EditPassword", this.mainViewModel.Token.TokenType, this.mainViewModel.Token.AccessToken, userEdit); if (!response.IsSuccess) { // Set status controls SetStatusControl(true, false, "Green", 0); await dialogService.ShowMessage( "Error", response.Message, "Accept"); return; } // Set status controls SetStatusControl(true, false, "Green", 0); // Set Initialize the fields LoadValuesControls(0); // Go back login await dialogService.ShowMessage( "Information", "Successfully modified password, you must log in again...!!! ", "Accept"); // Navigate to LoginPage navigationService.SetMainPage("LoginPage"); }
private async void Login() { // Validate the fields of form var response = MethodsHelper.IsValidField( "S", 0, 0, "email", this.Email, false, false, string.Empty); if (!response.IsSuccess) { await this.dialogService.ShowMessage( "Error", response.Message, "Accept"); return; } var isValidEmail = MethodsHelper.IsValidEmail(this.Email); if (!isValidEmail) { await this.dialogService.ShowMessage( "Error", "You must enter an valid email", "Accept"); return; } response = MethodsHelper.IsValidField( "S", 0, 0, "password", this.Password, false, false, string.Empty); if (!response.IsSuccess) { await this.dialogService.ShowMessage( "Error", response.Message, "Accept"); return; } // Establece el estatus de los controles this.SetStatusControl(false, true, true, 1); // Validate if there is an internet connection response = await apiService.CheckConnection(); if (!response.IsSuccess) { // Establece el estatus de los controles this.SetStatusControl(true, true, false, 0); await dialogService.ShowMessage( "Error", response.Message, "Accept"); return; } // Get user Token var token = await this.apiService.GetToken( Email, Password, MethodsHelper.GetUrlAPI()); if (token != null) { if (!string.IsNullOrEmpty(token.ErrorDescription)) { // EStablishes the status of controls this.SetStatusControl(true, true, false, 0); await this.dialogService.ShowMessage( "Error", token.ErrorDescription, "Accept"); return; } } else { // Establishes the status of controls this.SetStatusControl(true, true, false, 0); await this.dialogService.ShowMessage( "Error", "An error has occurred, try later...!!!", "Accept"); return; } // Get new instance of ViewModel (Token) this.mainViewModel.Token = token; // Get new instance of MenuViewModel // MainViewModel.GetInstance().Menu = new MenuViewModel(); // Establishes the status of controls this.SetInitialize(); this.SetStatusControl(true, true, false, 0); // Navigate to the page // await navigationService.NavigateOnMaster("MenuPage"); // MainViewModel.GetInstance().Cantv = new CantvViewModel(); this.mainViewModel.Cantv = new CantvViewModel(); // Define the MainPage this.navigationService.SetMainPage("MasterPage"); }
private async void Save() { // Validate the fields of the form if (this.NationalityId == 0) { await this.dialogService.ShowMessage( "Error", "You must select an nationality...!!!", "Accept"); return; } var response = MethodsHelper.IsValidField( "I", 8, 8, "identification card", this.IdentificationCard, true, false, string.Empty); if (!response.IsSuccess) { await this.dialogService.ShowMessage( "Error", response.Message, "Accept"); return; } // Define the status of the controls this.SetStatusControl(false, true, 1); // Check the connection internet response = await this.apiService.CheckConnection(); if (!response.IsSuccess) { // Define the status of the controls this.SetStatusControl(true, false, 0); await this.dialogService.ShowMessage( "Error", response.Message, "Accept"); return; } // Create the object var cneIvssData = new CneIvssDataItem { // BirthDate = this.BirthDate, BirthDate = DateTime.Today.Date, IdentificationCard = this.IdentificationCard, IsCne = true, IsIvss = false, NationalityId = this.NationalityId, UserId = this.mainViewModel.UserData.UserId, }; response = await this.apiService.Post <CneIvssDataItem>( MethodsHelper.GetUrlAPI(), "/api", "/CneIvssDatas/PostCneIvssDataInsertByOption/?_option=cne", mainViewModel.Token.TokenType, mainViewModel.Token.AccessToken, cneIvssData); if (!response.IsSuccess) { // Define the status of the controls this.SetStatusControl(true, false, 0); await dialogService.ShowMessage( "Error", response.Message, "Accept"); return; } // Add record to CneData this.cantvViewModel.UpdateCneData( 1, this.ToCneItemViewModel((CneIvssDataItem)response.Result)); // Navigate to back await this.navigationService.GoBackOnMaster(); // Define the status of the controls this.SetStatusControl(true, false, 0); }
public async void LoadUserData() { // Establishes the status of controls this.SetStatusControls(true); // Validate if there is an internet connection var response = await this.apiService.CheckConnection(); if (!response.IsSuccess) { // Establece el estatus de los controles this.SetStatusControls(false); await this.dialogService.ShowMessage( "Error", response.Message, "Accept"); return; } // Get data of the user response = await this.apiService.Get <UserDataResponse>( MethodsHelper.GetUrlAPI(), "/api/Users", "/GetServicesVzLaUSerByEmail", string.Format( "/?email={0}", mainViewModel.Token.UserName), mainViewModel.Token.TokenType, mainViewModel.Token.AccessToken); if (!response.IsSuccess) { // Establishes the status of controls this.SetStatusControls(false); await this.dialogService.ShowMessage( "Error", response.Message, "Accept"); return; } this.LoadOfValueUserData((UserDataResponse)response.Result); this.listCantvs = new List <CantvItemViewModel>(this.ToListCantvItemViewModel( this.mainViewModel.UserData.CantvDatas)); // Load valuen in the ObservableCollection this.Cantvs = new ObservableCollection <CantvItemViewModel>( this.listCantvs); // Select only data of cne this.listCnes = new List <CneItemViewModel>(this.ToListCneItemViewModel( mainViewModel.UserData.CneIvssDatas)); // Load valuen in the ObservableCollection this.Cnes = new ObservableCollection <CneItemViewModel>( this.listCnes); // Select only data on ivss this.lisIvsses = new List <IvssItemViewModel>( ToListIvssItemViewModel( this.mainViewModel.UserData.CneIvssDatas)); // Load values in the ObservableCollection this.Ivsses = new ObservableCollection <IvssItemViewModel>( this.lisIvsses); // Select data of teh zoom this.listZooms = new List <ZoomItemViewModel>( ToZoomItemViewModel(this.mainViewModel.UserData.ZoomDatas)); // Load value in the ObservabeCollection this.Zooms = new ObservableCollection <ZoomItemViewModel>( this.listZooms.OrderBy(lz => lz.Tracking)); // Establishes the status of controls this.SetStatusControls(false); }