예제 #1
0
        public override Android.Views.View GetView(int position, Android.Views.View convertView, Android.Views.ViewGroup parent)
        {
            // Get our object for position
            var item = doctors[position];
            var hosp = HospitalManager.GetHospital(item.HospitalID);

            //Try to reuse convertView if it's not  null, otherwise inflate it from our item layout
            // gives us some performance gains by not always inflating a new view
            // will sound familiar to MonoTouch developers with UITableViewCell.DequeueReusableCell()
            var view = (convertView ??
                        context.LayoutInflater.Inflate(
                            Resource.Layout.DoctorsListItem,
                            parent,
                            false)) as LinearLayout;
            // Find references to each subview in the list item's view
            var txtDoctorFullName = view.FindViewById <TextView> (Resource.Id.txtDoctorFullName);
            var txtDocSpeciality  = view.FindViewById <TextView> (Resource.Id.txtDocSpeciality);
            var txtDocHospital    = view.FindViewById <TextView> (Resource.Id.txtDocHospital);

            Common.SetCheck(view, item);

            txtDoctorFullName.Text = item.SecondName + ' ' + item.FirstName + ' ' + item.ThirdName;
            txtDocSpeciality.Text  = item.Speciality;
            txtDocHospital.Text    = hosp.Name;
            //Finally return the view
            return(view);
        }
예제 #2
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(); };
        }
예제 #3
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

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

            Title = Title + "(" + DateTime.Today.ToString("D") + ")";
            Setts sett = Common.GetSettings();

            DateTimeFormatInfo dfi = DateTimeFormatInfo.CurrentInfo;
            Calendar           cal = dfi.Calendar;
            int week = (cal.GetWeekOfYear(DateTime.Today, dfi.CalendarWeekRule, dfi.FirstDayOfWeek) - sett.weekOfStart) % 3;

            var choosenHospitals = (List <Hospital>)HospitalManager.GetChoosenHospitals(week, DateTime.Today.DayOfWeek);

            FindViewById <TextView> (Resource.Id.edtAnalyze).SetSingleLine(false);
            FindViewById <TextView> (Resource.Id.edtCommentForPharmacy).SetSingleLine(false);
            FindViewById <TextView> (Resource.Id.edtPOSmaterials).SetSingleLine(false);

            FindViewById <Button> (Resource.Id.btnShow).Clickable = false;
            adapter = new VisitListAdpter(this, choosenHospitals);
            var lvList = FindViewById <ListView> (Resource.Id.lvList);

            lvList.Adapter    = adapter;          //ArrayAdapter<String> (this, Android.Resource.Layout.SimpleListItemChecked, docs);
            lvList.ChoiceMode = ChoiceMode.Single;
            lvList.ItemClick += (object sender, AdapterView.ItemClickEventArgs e) => {
                doctor = adapter [e.Position];

                //presentations
                if (presents == null)
                {
                    var lblPresents = FindViewById <TextView> (Resource.Id.PresentLabel);
                    lblPresents.Visibility = ViewStates.Visible;
                    var btnShow = FindViewById <Button> (Resource.Id.btnShow);
                    btnShow.Visibility = ViewStates.Visible;
                    var spn = FindViewById <Spinner> (Resource.Id.spnPresents);
                    spn.Visibility = ViewStates.Visible;

                    string[] load = { "Загружается список презентаций..." };
                    spn.Adapter = new ArrayAdapter <String> (this, Android.Resource.Layout.SimpleListItem1, load);
                    new Thread(new ThreadStart(delegate {
                        //LOAD METHOD TO GET ACCOUNT INFO
                        RunOnUiThread(() => {
                            presents = Presentations.GetPresentations();
                            List <String> presentsTitle = new List <String> ();
                            for (int i = 0; i < presents.Count; i++)
                            {
                                for (int j = 0; j < presents [i].parts.Count; j++)
                                {
                                    presentsTitle.Add(presents [i].name + "." + presents [i].parts [j].name);
                                }
                            }

                            spn.Adapter = new ArrayAdapter <String> (this, Android.Resource.Layout.SimpleListItem1, presentsTitle.ToArray());
                        });
                    })).Start();
                }

                FindViewById <TextView> (Resource.Id.SecondNameLabel).Text       = "Фамилия: " + doctor.SecondName;
                FindViewById <TextView> (Resource.Id.FirstNameLabel).Text        = "Имя: " + doctor.FirstName;
                FindViewById <TextView> (Resource.Id.ThirdNameLabel).Text        = "Отчество: " + doctor.ThirdName;
                FindViewById <TextView> (Resource.Id.TelLabel).Text              = "Телефон: " + doctor.Tel;
                FindViewById <TextView> (Resource.Id.EmailLabel).Text            = "E-mail: " + doctor.Email;
                FindViewById <TextView> (Resource.Id.SpecialityLabel).Text       = "Специальность: " + doctor.Speciality;
                FindViewById <TextView> (Resource.Id.PositionLabel).Text         = "Должность: " + doctor.Position;
                FindViewById <TextView> (Resource.Id.HospitalLabel).Text         = "Поликлиника: " + HospitalManager.GetHospital(doctor.HospitalID).Name;
                FindViewById <TextView> (Resource.Id.CabinetLabel).Text          = "№ кабинета: " + doctor.Cabinet;
                FindViewById <TextView> (Resource.Id.edtAnalyze).Text            = doctor.LastVisitAnalyze;
                FindViewById <TextView> (Resource.Id.edtCommentForPharmacy).Text = doctor.LastCommForPharm;
                FindViewById <TextView> (Resource.Id.edtPOSmaterials).Text       = doctor.LastPOSmaterials;
            };

            FindViewById <Button> (Resource.Id.btnShow).Click += (object sender, EventArgs e) => {
                doctor.LastVisitAnalyze = FindViewById <TextView> (Resource.Id.edtAnalyze).Text;
                doctor.LastCommForPharm = FindViewById <TextView> (Resource.Id.edtCommentForPharmacy).Text;
                doctor.LastPOSmaterials = FindViewById <TextView> (Resource.Id.edtPOSmaterials).Text;
                DoctorManager.SaveDoctor(doctor);

                var slides         = new Intent(this, typeof(VisitPresentationView));
                int presentationID = 0;
                int partID         = FindViewById <Spinner> (Resource.Id.spnPresents).SelectedItemPosition;
                for (int i = 0; (i <= presents.Count - 1) && (partID > presents [i].parts.Count - 1); i++)
                {
                    presentationID = i + 1;
                    partID         = partID - presents [i].parts.Count;
                }
                slides.PutExtra("presentationID", presentationID);
                slides.PutExtra("partID", partID);
                slides.PutExtra("doctorID", adapter [lvList.CheckedItemPosition].ID);
                StartActivity(slides);
            };
        }