Example #1
0
        private void DisposeAll()
        {
            if (fUser != null)
            {
                fUser.pnlBody.Parent = null;
                fUser.Dispose();
                fUser = null;
            }
            if (fpayment != null)
            {
                fpayment.pnlBody.Parent = null;
                fpayment.Dispose();
                fpayment = null;
            }
            if (fReportBillingInfo != null)
            {
                fReportBillingInfo.pnlBody.Parent = null;
                fReportBillingInfo.Dispose();
                fReportBillingInfo = null;
            }
            if (fTransportationExpenses != null)
            {
                fTransportationExpenses.pnlBody.Parent = null;
                fTransportationExpenses.Dispose();
                fTransportationExpenses = null;
            }
            if (fpayrollByInstructor != null)
            {
                fpayrollByInstructor.pnlBody.Parent = null;
                //fpayrollByInstructor.Close();
                fpayrollByInstructor.Dispose();

                fpayrollByInstructor = null;
            }
            if (fContact != null)
            {
                fContact.pnlBody.Parent = null;
                fContact.Dispose();
                fContact = null;
            }
            if (fDept != null)
            {
                fDept.pnlBody.Parent = null;
                fDept.Dispose();
                fDept = null;
            }
            if (fCourse != null)
            {
                fCourse.pnlBody.Parent = null;
                fCourse.Dispose();
                fCourse = null;
            }
            if (fProgram != null)
            {
                fProgram.pnlBody.Parent = null;
                fProgram.Dispose();
                fProgram = null;
            }
            if (fEvt != null)
            {
                fEvt.pnlBody.Parent = null;
                fEvt.Dispose();
                fEvt = null;
            }

            if (fCalendar != null)
            {
                fCalendar.pnlBody.Parent = null;
                //fCalendar.pnlBody.Parent = null;
                //fCalendar.Dispose();
                //fCalendar = null;
            }
        }
Example #2
0
        private void OpenBrowse(string caller)
        {
            bool isProgram = false;
            Cursor = Cursors.WaitCursor;
            if (caller != "Event") tbtnDuplicate.Enabled = true;
            else tbtnDuplicate.Enabled = false;

            if (Common.LogonType == 2)
            {
                tbtnDelete.Enabled = false;
                tbtnNew.Enabled = false;
                tbtnDuplicate.Enabled = false;

            }
            Common.LockWindow(Handle);
            try
            {
                if (caller == "User")
                {
                    if (fUser == null)
                    {
                        DisposeAll();
                        MenuOption = "User...";
                        Common.Caption = "User";
                        fUser = new frmUserBrw();
                        fUser.pnl_Find.Height = 0;
                        fUser.LoadUser();
                        //tbtnOpen.Visible = true;
                    }
                    fUser.pnlBody.Parent = pnlMain;
                    if (fUser.GetRecordCount() <= 0)
                    {
                        EnableDisable(false);
                        fUser.pnl_Find.Height = 0;
                    }
                    else
                    {
                        EnableDisable(true);
                    }
                    fUser.grdUser.Focus();
                }
                else if (caller == "Contact")
                {
                    if (fContact == null)
                    {
                        DisposeAll();
                        fContact = new frmContactBrw();
                        fContact.pnl_Find.Height = 0;
                        //tbtnOpen.Visible = true;
                    }

                    MenuOption = "Contact...";
                    Common.Caption = "Contact";
                    fContact.LoadContact("Contact");

                    fContact.Option = "Contact";
                    fContact.pnlBody.Parent = pnlMain;
                    if (fContact.GetRecordCount() <= 0)
                    {
                        EnableDisable(false);
                        fContact.pnl_Find.Height = 0;
                    }
                    else
                    {
                        EnableDisable(true);
                    }
                    fContact.grdContact.Focus();
                }
                else if (caller == "InstructorPayment")
                {
                    if (fpayment == null)
                    {
                        DisposeAll();
                        fpayment = new frmInstructorPayroll();
                        fpayment.pnlBody.Parent = pnlMain;
                    }
                    MenuOption = "Pay Details By Instructor...";
                    Common.Caption = "Pay Details By Instructor";
                    fpayment.LoadData();

                }
                else if (caller == "ReportBillingInfo")
                {
                    if (fReportBillingInfo == null)
                    {
                        DisposeAll();
                        fReportBillingInfo = new frmReportBillingInfo();
                        fReportBillingInfo.pnlBody.Parent = pnlMain;
                    }
                    MenuOption = "Billing Information By Client...";
                    Common.Caption = "Billing Information By Client";
                    fReportBillingInfo.LoadData();

                }
                else if (caller == "TransportationExpenses")
                {
                    if (fTransportationExpenses == null)
                    {
                        DisposeAll();
                        fTransportationExpenses = new TransportationExpenses();
                        fTransportationExpenses.pnlBody.Parent = pnlMain;
                    }
                    MenuOption = "Transportation Expenses...";
                    Common.Caption = "Transportation Expenses";
                    fTransportationExpenses.LoadData();
                }
                else if (caller == "InstructorPayroll")
                {
                    if (fpayrollByInstructor == null)
                    {
                        DisposeAll();
                        fpayrollByInstructor = new frmPayrollByInstructor();
                        fpayrollByInstructor.pnlBody.Parent = pnlMain;
                    }
                    MenuOption = "Payroll By Instructor...";
                    Common.Caption = "Payroll By Instructor";
                    fpayrollByInstructor.LoadData();
                }
                else if (caller == "Instructor")
                {
                    if (fContact == null)
                    {
                        DisposeAll();
                        fContact = new frmContactBrw();
                        fContact.pnl_Find.Height = 0;
                        //tbtnOpen.Visible = true;
                    }
                    MenuOption = "Instructor...";
                    Common.Caption = "Instructor";
                    fContact.LoadContact("Instructor");

                    fContact.Option = "Instructor";
                    fContact.pnlBody.Parent = pnlMain;
                    if (fContact.GetRecordCount() <= 0)
                    {
                        EnableDisable(false);
                        fContact.pnl_Find.Height = 0;
                    }
                    else
                    {
                        EnableDisable(true);
                    }
                    fContact.grdContact.Focus();
                }
                else if (caller == "Client")
                {
                    if (fContact == null)
                    {
                        DisposeAll();
                        fContact = new frmContactBrw();
                        fContact.pnl_Find.Height = 0;
                        //tbtnOpen.Visible = true;
                    }

                    MenuOption = "Client...";
                    Common.Caption = "Client";
                    fContact.Option = "Client";
                    fContact.LoadContact("Client");

                    fContact.pnlBody.Parent = pnlMain;
                    if (fContact.GetRecordCount() <= 0)
                    {
                        EnableDisable(false);
                        fContact.pnl_Find.Height = 0;
                    }
                    else
                    {
                        EnableDisable(true);
                    }
                    fContact.grdContact.Focus();
                }
                else if (caller == "Department")
                {
                    if (fDept == null)
                    {
                        DisposeAll();
                        MenuOption = "Department...";
                        Common.Caption = "Department";
                        fDept = new frmDeptBrw();
                        fDept.pnl_Find.Height = 0;
                        fDept.LoadDepartment();
                        //tbtnOpen.Visible = true;
                    }

                    fDept.pnlBody.Parent = pnlMain;
                    if (fDept.GetRecordCount() <= 0)
                    {
                        EnableDisable(false);
                        fDept.pnl_Find.Height = 0;
                    }
                    else
                    {
                        EnableDisable(true);
                    }
                    fDept.grdDept.Focus();
                }
                else if (caller == "Class")
                {
                    if (fCourse == null)
                    {
                        DisposeAll();
                        MenuOption = "Class...";
                        Common.Caption = "Class";
                        fCourse = new frmCourseBrw();
                        fCourse.LoadCourse();
                        //tbtnOpen.Visible = true;
                    }
                    fCourse.pnlBody.Parent = pnlMain;
                    if (fCourse.GetRecordCount() <= 0)
                    {
                        EnableDisable(false);
                        fCourse.pnl_Find.Height = 0;
                    }
                    else
                    {
                        EnableDisable(true);
                    }
                    fCourse.grdCourse.Focus();
                }
                else if (caller == "Program")
                {
                    if (fProgram == null)
                    {
                        DisposeAll();

                        MenuOption = "Program...";
                        Common.Caption = "Program";
                        fProgram = new frmProgBrw();
                        fProgram.pnl_Find.Height = 0;

                        fProgram.LoadProgram();
                        //tbtnOpen.Visible = true;
                    }
                    isProgram = true;
                    tbtnInfoProgram.Visible = true;
                    fProgram.pnlBody.Parent = pnlMain;
                    if (fProgram.GetRecordCount() <= 0)
                    {
                        EnableDisable(false);
                        fProgram.pnl_Find.Height = 0;
                    }
                    else
                    {
                        EnableDisable(true);
                    }
                    fProgram.grdProgram.Focus();
                }
                else if (caller == "Event")
                {
                    if (fEvt == null)
                    {
                        DisposeAll();
                        MenuOption = "Event...";
                        Common.Caption = "Event";
                        fEvt = new frmEventBrw();
                        fEvt.pnl_Find.Height = 0;
                        fEvt.LoadEvent();
                        //fEvt.LoadFilterSettings();
                        //tbtnOpen.Visible = true;
                    }
                    tbtnInfoProgram.Visible = false;
                    fEvt.pnlBody.Parent = pnlMain;
                    if (fEvt.GetRecordCount() <= 0)
                    {
                        EnableDisable(false);
                        fEvt.pnl_Find.Height = 0;
                    }
                    else
                    {
                        EnableDisable(true);
                    }
                    fEvt.grdEvent.Focus();
                }
                else if (caller == "DayCalendar")
                {
                    tbtnInfoProgram.Visible = false;
                    DisposeAll();
                    OpenCalendar("Day");
                    EnableDisable(true);
                }
                else if (caller == "WeekCalendar")
                {

                    DisposeAll();
                    OpenCalendar("Week");
                    EnableDisable(true);
                }
                else if (caller == "MonthCalendar")
                {
                    DisposeAll();
                    OpenCalendar("Month");
                    EnableDisable(true);
                }
                tbtnInfoProgram.Visible = isProgram;
            }
            catch (Exception ex)
            {
                MessageBox.Show("Eated Exception!" + "/n/n" + ex.Message+ex.StackTrace, "Scheduler");
            }
            finally
            {
                Common.UnLockWindow();
                Cursor = Cursors.Default;
            }
        }