Esempio n. 1
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            RestoreForm();

            var jsonnota = Intent.GetStringExtra("JsonEntrega");

            if (jsonnota == null)
            {
                entrega = null;
            }
            else
            {
                entrega  = new EntregaRepository().Get(int.Parse(jsonnota));
                operacao = "selecionado";
            }

            FindViews();
            BindData();
            BindViews();

            ocorr = PopulateOcorrenciaList();
            spinnerOcorrencia.Adapter = new ArrayAdapter <mySpinner>(this, Android.Resource.Layout.SimpleSpinnerDropDownItem, ocorr);

            if (entrega != null)
            {
                spinnerOcorrencia.SetSelection(getIndexByValue(spinnerOcorrencia, entrega.id_ocorrencia));
            }
        }
Esempio n. 2
0
        private void Delete(transportador.core.Model.Entrega ent)
        {
            AlertDialog.Builder alert = new AlertDialog.Builder(this);

            alert.SetTitle("Tem certeza que deseja excluir esta ocorrência?");
            alert.SetPositiveButton("Sim", (senderAlert, args) =>
            {
                try
                {
                    var entrega = new EntregaManager();
                    entrega.Delete(ent);

                    Toast.MakeText(this, entrega.mensagem, ToastLength.Short).Show();
                    FillList(dataEmissao);
                }
                catch (Exception ex)
                {
                    Toast.MakeText(this, ex.Message, ToastLength.Short).Show();
                }
            });
            alert.SetNegativeButton("Não", (senderAlert, args) =>
            {
            });

            RunOnUiThread(() =>
            {
                alert.Show();
            });
        }
Esempio n. 3
0
        private void BindModel()
        {
            if (entrega == null)
            {
                entrega = new transportador.core.Model.Entrega();
            }

            entrega.ds_NFE = txtCodigoNF.Text.ToString();

            string data     = (txtDataEntrega.Text + " " + txtHoraEntrega.Text);
            var    datahora = DateTime.Parse(data, CultureInfo.CreateSpecificCulture("pt-BR"));

            entrega.dt_entrega  = datahora;//DateTime.Parse(datahora);
            entrega.dt_inclusao = DateTime.Now;
            var minhaocorrencia = ocorr[spinnerOcorrencia.SelectedItemPosition];

            entrega.id_ocorrencia = minhaocorrencia.Id();
            entrega.ds_observacao = txtObservacao.Text.ToString();
            if (bytes != null)
            {
                entrega.Image       = bytes;
                entrega.ds_ImageUri = imagefile.AbsolutePath;
            }
            entrega.ds_geolocalizacao = txtGeolocalizacao.Text;
        }