Exemplo n.º 1
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.UserRegister);
            // Create your application here
            var user = new DataModels.DataModels();

            currentUser = AuthService.GetCredentials();//user.GetUser(AuthService.Alias, AuthService.Password);

            SetUserData();

            btnRegister.Click += BtnRegister_Click;
            btnReturn.Click   += BtnReturn_Click;
        }
        private DataModels.DataModels.Usuario GetFormData()
        {
            var      model         = new DataModels.DataModels.Usuario();
            EditText txtName       = FindViewById <EditText>(Resource.Id.txtUrUserName);
            EditText txtLastName   = FindViewById <EditText>(Resource.Id.txtUrUserLastName);
            EditText txtAlias      = FindViewById <EditText>(Resource.Id.txtUrAlias);
            EditText txtPass       = FindViewById <EditText>(Resource.Id.txtUrPassword);
            EditText txtMovilPhone = FindViewById <EditText>(Resource.Id.txtUrPhone);
            EditText txtCodArea    = FindViewById <EditText>(Resource.Id.txtUrCodArea);
            EditText txtPhone2     = FindViewById <EditText>(Resource.Id.txtUrPhone2);
            EditText txtMail       = FindViewById <EditText>(Resource.Id.txtUrMail);
            EditText txtAdress     = FindViewById <EditText>(Resource.Id.txtUrAddress);
            Spinner  spnCity       = FindViewById <Spinner>(Resource.Id.sprUrCity);

            var spnUrTypeOfTruckSelectedItem = spnUrTypeOfTruck.SelectedItem;

            if (!string.IsNullOrEmpty(txtName.Text.Trim()) && !string.IsNullOrEmpty(txtLastName.Text.Trim()) &&
                !string.IsNullOrEmpty(txtAlias.Text.Trim()) && !string.IsNullOrEmpty(txtMovilPhone.Text.Trim()) &&
                !string.IsNullOrEmpty(txtMail.Text.Trim()) && !string.IsNullOrEmpty(txtAdress.Text.Trim()) &&
                !string.IsNullOrEmpty(txtPass.Text.Trim()))
            {
                model = new DataModels.DataModels.Usuario(
                    txtAlias.Text,
                    txtPass.Text,
                    txtName.Text,
                    txtLastName.Text,
                    typeOfUser,
                    txtMovilPhone.Text,
                    txtCodArea.Text,
                    txtMail.Text,
                    spnUrCity.SelectedItem.ToString(),
                    txtAdress.Text,
                    DateTime.Now,
                    DateTime.Now,
                    txtPhone2.Text,
                    0,
                    txtUrLicenceNumber.Text,
                    spnUrTypeOfTruckSelectedItem != null ? spnUrTypeOfTruckSelectedItem.ToString() : "",
                    0f);
            }

            return(model);
        }