예제 #1
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.activity_add_booking);
            operations = new DataOperations();

            btnSave         = FindViewById <Button>(Resource.Id.btnSave);
            btnBack         = FindViewById <Button>(Resource.Id.btnBack);
            dateBooking     = FindViewById <DatePicker>(Resource.Id.dateBooking);
            spinnerHospital = FindViewById <Spinner>(Resource.Id.spinnerHospital);
            DateTime current = DateTime.Now.AddDays(1);
            DateTime begin   = new DateTime(1970, 1, 1);

            dateBooking.MinDate = (long)((current - begin).TotalMilliseconds);

            username = Intent.GetStringExtra("UserName");

            btnSave.Click           += BtnSave_Click;
            btnBack.Click           += BtnBack_Click;
            dateBooking.DateChanged += DateBooking_DateChanged;

            hospitals = operations.GetHospitals();
            adapter   = new HospitalSpinnerAdapter(this, hospitals);
            spinnerHospital.Adapter = adapter;
        }
예제 #2
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);

            // Create your application here
            int doctorID = Intent.GetIntExtra("DoctorID", 0);
            //			if(doctorID > 0) {
                doctor = DoctorManager.GetDoctor(doctorID);
            //			}

            // set our layout to be the home screen
            SetContentView(Resource.Layout.DoctorDetails);

            SNameTextEdit   = FindViewById<EditText> (Resource.Id.txtSecondName);
            FNameTextEdit   = FindViewById<EditText> (Resource.Id.txtFirstName);
            TNameTextEdit   = FindViewById<EditText> (Resource.Id.txtThirdName);
            TelTextEdit     = FindViewById<EditText> (Resource.Id.txtTel);
            EmailTextEdit   = FindViewById<EditText> (Resource.Id.txtEmail);
            CabinetTextEdit = FindViewById<EditText> (Resource.Id.txtCabinet);

            SpecTextEdit  = FindViewById<AutoCompleteTextView> (Resource.Id.actxtSpeciality);
            ArrayAdapter SpecTextEditAdapter = new ArrayAdapter (this, Android.Resource.Layout.SimpleDropDownItem1Line, DoctorSpecialitys.GetSpecialitys());
            SpecTextEdit.Adapter = SpecTextEditAdapter;

            PosTextEdit   = FindViewById<AutoCompleteTextView> (Resource.Id.txtPosition);
            ArrayAdapter PosTextEditAdapter = new ArrayAdapter (this, Android.Resource.Layout.SimpleDropDownItem1Line,DoctorPositions.GetPositions() );
            PosTextEdit.Adapter = PosTextEditAdapter;

            saveButton = FindViewById<Button> (Resource.Id.btnSave);
            cancelDeleteButton = FindViewById<Button>(Resource.Id.btnCancelDelete);
            chIsDays = FindViewById<CheckBox> (Resource.Id.chIsDays);
            lstWorkTime = FindViewById<ListView> (Resource.Id.lstWorkTime);

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

            // SecondName
            if(SNameTextEdit != null) { SNameTextEdit.Text = doctor.SecondName; }

            // FirstName
            if(FNameTextEdit != null) { FNameTextEdit.Text = doctor.FirstName; }

            // ThirdName
            if(TNameTextEdit != null) { TNameTextEdit.Text = doctor.ThirdName; }

            // Telephone
            if(TelTextEdit != null) { TelTextEdit.Text = doctor.Tel; }

            // E-mail
            if(EmailTextEdit != null) { EmailTextEdit.Text = doctor.Email; }

            // Cabinet
            if(CabinetTextEdit != null) { CabinetTextEdit.Text = doctor.Cabinet; }

            // Speciality
            if(SpecTextEdit != null) { SpecTextEdit.Text = doctor.Speciality; }

            // Position
            if(PosTextEdit != null) { PosTextEdit.Text = doctor.Position; }

            // button clicks
            cancelDeleteButton.Click += (sender, e) => { CancelDelete(); };
            saveButton.Click += (sender, e) => { Save(); };

            workTimeItems = new List<Tuple<String, DateTime, WorkTime_Type, DateTime, WorkTime_Type>>();

            if (doctorID == 0) {
                chIsDays.Checked = true;
                doctor.wtKind = WorkTime_Kind.Days;
            } else {
                switch (doctor.wtKind) {
                case WorkTime_Kind.OddEven: { chIsDays.Checked = false; break; }
                case WorkTime_Kind.Days   : { chIsDays.Checked = true; break; }
                }
            }

            UpdateWorkTimeList();

            chIsDays.CheckedChange += (sender, e) => {
                if (chIsDays.Checked) { doctor.wtKind = WorkTime_Kind.Days; }
                else { doctor.wtKind = WorkTime_Kind.OddEven; }
                UpdateWorkTimeList();
            };

            /////////////////new code///////////////
            spnHospital = FindViewById<Spinner> (Resource.Id.spnHospital);
            hospitals = HospitalManager.GetHospitals();

            hospitalList = new Adapters.HospitalSpinnerAdapter(this, hospitals);
            spnHospital.Adapter = hospitalList;

            for (int i = 0; i < hospitals.Count; i++) {
                if (hospitals [i].ID == doctor.HospitalID) {
                    spnHospital.SetSelection (i + 1);
                }
            }

            spnHospital.ItemSelected += (sender, e) => {
                var s = sender as Spinner;
                if (e.Position == 0) {
                    doctor.HospitalID = -1;
                }
                else {
                    doctor.HospitalID = hospitals[e.Position - 1].ID;
                }
            };
            /////////////////new code///////////////
        }
예제 #3
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Create your application here
            int doctorID = Intent.GetIntExtra("DoctorID", 0);

//			if(doctorID > 0) {
            doctor = DoctorManager.GetDoctor(doctorID);
//			}

            // set our layout to be the home screen
            SetContentView(Resource.Layout.DoctorDetails);

            SNameTextEdit   = FindViewById <EditText> (Resource.Id.txtSecondName);
            FNameTextEdit   = FindViewById <EditText> (Resource.Id.txtFirstName);
            TNameTextEdit   = FindViewById <EditText> (Resource.Id.txtThirdName);
            TelTextEdit     = FindViewById <EditText> (Resource.Id.txtTel);
            EmailTextEdit   = FindViewById <EditText> (Resource.Id.txtEmail);
            CabinetTextEdit = FindViewById <EditText> (Resource.Id.txtCabinet);

            SpecTextEdit = FindViewById <AutoCompleteTextView> (Resource.Id.actxtSpeciality);
            ArrayAdapter SpecTextEditAdapter = new ArrayAdapter(this, Android.Resource.Layout.SimpleDropDownItem1Line, DoctorSpecialitys.GetSpecialitys());

            SpecTextEdit.Adapter = SpecTextEditAdapter;

            PosTextEdit = FindViewById <AutoCompleteTextView> (Resource.Id.txtPosition);
            ArrayAdapter PosTextEditAdapter = new ArrayAdapter(this, Android.Resource.Layout.SimpleDropDownItem1Line, DoctorPositions.GetPositions());

            PosTextEdit.Adapter = PosTextEditAdapter;

            saveButton         = FindViewById <Button> (Resource.Id.btnSave);
            cancelDeleteButton = FindViewById <Button>(Resource.Id.btnCancelDelete);
            chIsDays           = FindViewById <CheckBox> (Resource.Id.chIsDays);
            lstWorkTime        = FindViewById <ListView> (Resource.Id.lstWorkTime);


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

            // SecondName
            if (SNameTextEdit != null)
            {
                SNameTextEdit.Text = doctor.SecondName;
            }

            // FirstName
            if (FNameTextEdit != null)
            {
                FNameTextEdit.Text = doctor.FirstName;
            }

            // ThirdName
            if (TNameTextEdit != null)
            {
                TNameTextEdit.Text = doctor.ThirdName;
            }

            // Telephone
            if (TelTextEdit != null)
            {
                TelTextEdit.Text = doctor.Tel;
            }

            // E-mail
            if (EmailTextEdit != null)
            {
                EmailTextEdit.Text = doctor.Email;
            }

            // Cabinet
            if (CabinetTextEdit != null)
            {
                CabinetTextEdit.Text = doctor.Cabinet;
            }

            // Speciality
            if (SpecTextEdit != null)
            {
                SpecTextEdit.Text = doctor.Speciality;
            }

            // Position
            if (PosTextEdit != null)
            {
                PosTextEdit.Text = doctor.Position;
            }

            // button clicks
            cancelDeleteButton.Click += (sender, e) => { CancelDelete(); };
            saveButton.Click         += (sender, e) => { Save(); };

            workTimeItems = new List <Tuple <String, DateTime, WorkTime_Type, DateTime, WorkTime_Type> >();

            if (doctorID == 0)
            {
                chIsDays.Checked = true;
                doctor.wtKind    = WorkTime_Kind.Days;
            }
            else
            {
                switch (doctor.wtKind)
                {
                case WorkTime_Kind.OddEven: { chIsDays.Checked = false; break; }

                case WorkTime_Kind.Days: { chIsDays.Checked = true; break; }
                }
            }

            UpdateWorkTimeList();

            chIsDays.CheckedChange += (sender, e) => {
                if (chIsDays.Checked)
                {
                    doctor.wtKind = WorkTime_Kind.Days;
                }
                else
                {
                    doctor.wtKind = WorkTime_Kind.OddEven;
                }
                UpdateWorkTimeList();
            };

            /////////////////new code///////////////
            spnHospital = FindViewById <Spinner> (Resource.Id.spnHospital);
            hospitals   = HospitalManager.GetHospitals();

            hospitalList        = new Adapters.HospitalSpinnerAdapter(this, hospitals);
            spnHospital.Adapter = hospitalList;

            for (int i = 0; i < hospitals.Count; i++)
            {
                if (hospitals [i].ID == doctor.HospitalID)
                {
                    spnHospital.SetSelection(i + 1);
                }
            }

            spnHospital.ItemSelected += (sender, e) => {
                var s = sender as Spinner;
                if (e.Position == 0)
                {
                    doctor.HospitalID = -1;
                }
                else
                {
                    doctor.HospitalID = hospitals[e.Position - 1].ID;
                }
            };
            /////////////////new code///////////////
        }