Пример #1
0
 private void FormReqAppt_Load(object sender, EventArgs e)
 {
     for (int i = 0; i < SchoolClasses.List.Length; i++)
     {
         comboClass.Items.Add(SchoolClasses.GetDescript(SchoolClasses.List[i]));
     }
     if (comboClass.Items.Count > 0)
     {
         comboClass.SelectedIndex = 0;
     }
     for (int i = 0; i < SchoolCourses.List.Length; i++)
     {
         comboCourse.Items.Add(SchoolCourses.GetDescript(SchoolCourses.List[i]));
     }
     if (comboCourse.Items.Count > 0)
     {
         comboCourse.SelectedIndex = 0;
     }
     comboInstructor.Items.Add(Lan.g(this, "None"));
     comboInstructor.SelectedIndex = 0;
     for (int i = 0; i < ProviderC.ListShort.Count; i++)
     {
         comboInstructor.Items.Add(ProviderC.ListShort[i].GetLongDesc());
         //if(ProviderC.List[i].ProvNum==ReqCur.InstructorNum) {
         //	comboInstructor.SelectedIndex=i+1;
         //}
     }
     FillStudents();
     FillReqs();
     reqsAttached = ReqStudents.GetForAppt(AptNum);
     if (reqsAttached.Count > 0)
     {
         comboInstructor.SelectedIndex = Providers.GetIndex(reqsAttached[0].ProvNum) + 1;            //this will turn a -1 into a 0.
     }
     FillAttached();
 }
Пример #2
0
        private void FormReqStudentEdit_Load(object sender, System.EventArgs e)
        {
            //There should only be two types of users who are allowed to get this far:
            //Students editing their own req, and users with setup perm.  But we will double check.
            Provider provUser = Providers.GetProv(Security.CurUser.ProvNum);

            if (provUser != null && provUser.SchoolClassNum != 0)         //A student is logged in
            //the student only has permission to view/attach/detach their own requirements
            {
                if (provUser.ProvNum != ReqCur.ProvNum)
                {
                    //but this should never happen
                    MsgBox.Show(this, "Students may only edit their own requirements.");
                    butDelete.Enabled = false;
                    butOK.Enabled     = false;
                }
                else                 //the student matches
                {
                    butDelete.Enabled         = false;
                    textDateCompleted.Enabled = false;
                    butNow.Enabled            = false;
                    comboInstructor.Enabled   = false;
                    //a student is only allowed to change the patient and appointment.
                }
            }
            else                                                                        //A student is not logged in
            {
                if (!Security.IsAuthorized(Permissions.Setup, DateTime.MinValue, true)) //suppress message
                {
                    butDelete.Enabled = false;
                    butOK.Enabled     = false;
                }
            }
            textStudent.Text     = Providers.GetLongDesc(ReqCur.ProvNum);
            textCourse.Text      = SchoolCourses.GetDescript(ReqCur.SchoolCourseNum);
            textDescription.Text = ReqCur.Descript;
            if (ReqCur.DateCompleted.Year > 1880)
            {
                textDateCompleted.Text = ReqCur.DateCompleted.ToShortDateString();
            }
            //if an apt is attached, then the same pat must be attached.
            Patient pat = Patients.GetPat(ReqCur.PatNum);

            if (pat != null)
            {
                textPatient.Text = pat.GetNameFL();
            }
            Appointment apt = Appointments.GetOneApt(ReqCur.AptNum);

            if (apt != null)
            {
                if (apt.AptStatus == ApptStatus.UnschedList)
                {
                    textAppointment.Text = Lan.g(this, "Unscheduled");
                }
                else
                {
                    textAppointment.Text = apt.AptDateTime.ToShortDateString() + " " + apt.AptDateTime.ToShortTimeString();
                }
                textAppointment.Text += ", " + apt.ProcDescript;
            }
            comboInstructor.Items.Add(Lan.g(this, "None"));
            comboInstructor.SelectedIndex = 0;
            for (int i = 0; i < ProviderC.ListShort.Count; i++)
            {
                comboInstructor.Items.Add(ProviderC.ListShort[i].GetLongDesc());
                if (ProviderC.ListShort[i].ProvNum == ReqCur.InstructorNum)
                {
                    comboInstructor.SelectedIndex = i + 1;
                }
            }
        }