Exemplo n.º 1
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);

            // Create your application here
            int hospitalID = Intent.GetIntExtra("HospitalID", 0);
            if(hospitalID > 0) {
                hospital = HospitalManager.GetHospital(hospitalID);
            }

            // set our layout to be the home screen
            SetContentView(Resource.Layout.HospitalDetails);
            hospitalName = FindViewById<EditText>(Resource.Id.txtHospitalName);
            hospitalAdress = FindViewById<EditText>(Resource.Id.txtHospitalAdress);
            hospitalNearestMetro = FindViewById<EditText>(Resource.Id.txtHospitalNearestMetro);
            hospitalRegPhone = FindViewById<EditText>(Resource.Id.txtHospitalRegPhone);
            saveButton = FindViewById<Button>(Resource.Id.btnSave);

            // find all our controls
            cancelDeleteButton = FindViewById<Button>(Resource.Id.btnCancelDelete);

            // set the cancel delete based on whether or not it's an existing task
            if(cancelDeleteButton != null)
            { cancelDeleteButton.Text = (hospital.ID == 0 ? "Отмена" : "Удалить"); }

            // name
            if(hospitalName != null) { hospitalName.Text = hospital.Name; }

            // adress
            if(hospitalAdress != null) { hospitalAdress.Text = hospital.Adress; }

            // adress
            if(hospitalNearestMetro != null) { hospitalNearestMetro.Text = hospital.NearestMetro; }

            // adress
            if(hospitalRegPhone != null) { hospitalRegPhone.Text = hospital.RegPhone; }

            // button clicks
            cancelDeleteButton.Click += (sender, e) => { CancelDelete(); };
            saveButton.Click += (sender, e) => { Save(); };
        }
Exemplo n.º 2
0
 public static int SaveHospital(Hospital item)
 {
     return HospitalRepository.SaveHospital(item);
 }
Exemplo n.º 3
0
 public static int HospitalCompare(Hospital hosp1, Hospital hosp2)
 {
     return String.CompareOrdinal (hosp1.Name, hosp2.Name);
 }
        /// <summary>
        /// Insert or update a task
        /// </summary>
        public static int SaveHospital(Hospital item)
        {
            var max = 0;
            if (hospitals.Count > 0)
                max = hospitals.Max(x => x.ID);

            if (item.ID == 0) {
                item.ID = ++max;
                hospitals.Add (item);
            } else {
                var i = hospitals.Find (x => x.ID == item.ID);
                i = item; // replaces item in collection with updated value
            }

            WriteXml ();
            return max;
        }
Exemplo n.º 5
0
 public static void SetCheck(View v, Hospital hospital)
 {
     var img = (ImageView) v.FindViewWithTag("imgCheck");
     img.Visibility = ViewStates.Gone;
     //			if(hospital.IsChosen) {
     //				img.SetImageResource(Android.Resource.Drawable.CheckboxOnBackground);
     //			} else {
     //				img.SetImageResource(Android.Resource.Drawable.CheckboxOffBackground);
     //			}
 }