コード例 #1
0
        public void SetHospitalsOffices(UserEntity user)
        {
            panel1.Controls.Clear();
            _hoctl = new SelectHospitalOfficeControl(user.Hospitals, user.Offices);
            _hoctl.EnterEventHandler += _hoctl_EnterEventHandler;
            _hoctl.Dock = DockStyle.Fill;
            panel1.Controls.Add(_hoctl);
            _hoctl.SetValue(user.PreviousOffice.hospitalId, user.PreviousOffice.officeId);

            if (user.Hospitals.Count == 1 && user.Offices.Count == 1)
            {
                if (SelectHospital != null)
                {
                    Hospital     hp = user.Hospitals[0];
                    OfficeEntity of = user.Offices[0];
                    user.CurrentHospital = hp;
                    user.CurrentOffice   = of;
                    SelectHospital(new HospitalEventArgs(hp, of));
                    return;
                }
            }
            else if (user.AutoLogin == true)
            {
                OfficeEntity of = user.Offices.Find((i) => { return(i.officeId == user.CurrentOffice.officeId); });
                Hospital     hp = user.Hospitals.Find((i) => { return(i.hospitalId == user.CurrentHospital.hospitalId); });

                if (SelectHospital != null && hp != null && of != null)
                {
                    user.CurrentHospital = hp;
                    user.CurrentOffice   = of;
                    SelectHospital(new HospitalEventArgs(hp, of));
                    return;
                }
            }

            _hoctl.SetFocus();
        }
コード例 #2
0
        public void SetHospitalsOffices(UserEntity user )
        {
            panel1.Controls.Clear();
            _hoctl = new SelectHospitalOfficeControl(user.Hospitals, user.Offices);
            _hoctl.EnterEventHandler += _hoctl_EnterEventHandler;
            _hoctl.Dock = DockStyle.Fill;
            panel1.Controls.Add(_hoctl);
            _hoctl.SetValue(user.PreviousOffice.hospitalId, user.PreviousOffice.officeId);
              
            if (user.Hospitals.Count == 1 && user.Offices.Count == 1)
            {
                if (SelectHospital != null)
                {
                    Hospital hp = user.Hospitals[0];
                    OfficeEntity of = user.Offices[0];
                    user.CurrentHospital = hp;
                    user.CurrentOffice = of;
                    SelectHospital(new HospitalEventArgs(hp, of));
                    return;
                }
            }
            else if (user.AutoLogin == true )
            {
                OfficeEntity of = user.Offices.Find((i) => { return i.officeId == user.CurrentOffice.officeId; });
                Hospital hp = user.Hospitals.Find((i) => { return i.hospitalId == user.CurrentHospital.hospitalId; });
                
                if (SelectHospital != null && hp != null && of != null )
                {
                    user.CurrentHospital = hp;
                    user.CurrentOffice = of;               
                    SelectHospital(new HospitalEventArgs(hp,of));
                    return;
                }
            }

            _hoctl.SetFocus();
        }