Пример #1
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);

            StoredInfo.retrieveData();

            // Get our button from the layout resource,
            // and attach an event to it
            Button b_AddPrescrip  = FindViewById <Button>(Resource.Id.addPrescrip);
            Button b_EditPrescrip = FindViewById <Button>(Resource.Id.editPrescrip);
            Button b_ViewPrescrip = FindViewById <Button>(Resource.Id.viewPrescrip);
            Button b_ClearData    = FindViewById <Button>(Resource.Id.clearData);

            b_AddPrescrip.Click += delegate
            {
                StartActivity(typeof(AddPrescription));
            };

            b_EditPrescrip.Click += delegate
            {
                StartActivity(typeof(EditPrescriptions));
            };

            b_ViewPrescrip.Click += delegate
            {
                StartActivity(typeof(ViewPrescriptions));
            };

            b_ClearData.Click += delegate
            {
                StoredInfo.allPrescriptions = new System.Collections.Generic.List <MedicationItem>();
                StoredInfo.saveData();
            };
        }
Пример #2
0
        private void SubmitButton_Click(object sender, EventArgs e)
        {
            if (!(medName.Text.Equals("") || doctorsName.Text.Equals("") || prescripCode.Text.Equals("")))
            {
                MedicationItem mitem = new MedicationItem();
                if (medName.Text.Equals(""))
                {
                    mitem.medName = "N/A";
                }
                else
                {
                    mitem.medName = medName.Text;
                }

                if (medAmount.Text.Equals(""))
                {
                    mitem.medAmount = "N/A";
                }
                else
                {
                    mitem.medAmount = medAmount.Text;
                }

                if (whatTime.Text.Equals(""))
                {
                    mitem.whatTime = "N/A";
                }
                else
                {
                    mitem.whatTime = whatTime.Text;
                }

                mitem.howOften = (int)howOftenSpinner.SelectedItemId;

                if (numDoses.Text.Equals(""))
                {
                    mitem.numDoses = 0;
                }
                else
                {
                    mitem.numDoses = int.Parse(numDoses.Text);
                }

                if (doctorsName.Text.Equals(""))
                {
                    mitem.doctorsName = "N/A";
                }
                else
                {
                    mitem.doctorsName = doctorsName.Text;
                }

                if (prescripCode.Text.Equals(""))
                {
                    mitem.prescripCode = "N/A";
                }
                else
                {
                    mitem.prescripCode = prescripCode.Text;
                }

                if (medPurpose.Text.Equals(""))
                {
                    mitem.medPurpose = "N/A";
                }
                else
                {
                    mitem.medPurpose = medPurpose.Text;
                }

                StoredInfo.allPrescriptions.Add(mitem);
                StoredInfo.saveData();

                StartActivity(typeof(MainActivity));
            }
        }
Пример #3
0
 private void DeleteButton_Click(object sender, EventArgs e)
 {
     StoredInfo.allPrescriptions.Remove(StoredInfo.allPrescriptions[prescripNum]);
     StoredInfo.saveData();
     StartActivity(typeof(EditPrescriptions));
 }