コード例 #1
0
        //refresh Method
        private void refreshEnrollment()
        {
            frmEnrolmmentInprogress frm = new frmEnrolmmentInprogress();

            if (frm.enrollmentBindingSource.List.Count > 0)
            {
                refreshScheduleCoursePriliminaryDate();
            }
        }
コード例 #2
0
        private void refreshScheduleCoursePriliminaryDate()
        {
            int _EnrollmentID           = 0;
            frmEnrolmmentInprogress frm = new frmEnrolmmentInprogress();

            if (frm.enrollmentBindingSource.List.Count > 0)
            {
                _EnrollmentID = ((Enrollment)(frm.enrollmentBindingSource.Current)).EnrollmentID;
            }
            populateCoursesToBeScheduled(_EnrollmentID);
        }
コード例 #3
0
        private void button1_Click(object sender, EventArgs e)
        {
            frmEnrolmmentInprogress frm = new frmEnrolmmentInprogress();

            Employee CurrentEmployeeLoggedIn = null;

            //Passes the employee object of the currentlly loggin
            frm.CurrentEmployeeLoggedIn = CurrentEmployeeLoggedIn;
            //Sets the parameters for the for to load the correct enrollments
            frm.CurrentEnrollmentID       = Convert.ToInt32(txtEnrollmentIDForInProgreesEnrollment.Text);
            frm.CurrentEquiryID           = Convert.ToInt32(txtEquriyIDForInprogressEnrollment.Text);
            frm.CurrentSelectedDepartment = (Common.Enum.EnumDepartments)(cboDepartmentsForInProgressEnrollment.SelectedValue);

            frm.ShowDialog();
        }
コード例 #4
0
        private void dgvNewEnquiryTab_CurriculumEnquiry_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            //colNewEnquiry_Curriculum.Name
            //dgvNewEnquiryTab_CurriculumEnquiry.Rows[e.RowIndex].Cells[e.ColumnIndex].
            //row.Cells[colNewEnquiry_Curriculum.Index].Value
            // MessageBox.Show("Col Index : " + dgvNewEnquiryTab_CurriculumEnquiry.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString());

            CurriculumEnquiry CE = (CurriculumEnquiry)dgvNewEnquiryTab_CurriculumEnquiry.Rows[e.RowIndex].DataBoundItem;

            Data.Models.Enquiry CurrentEnquiryObj = (Data.Models.Enquiry)NewEnquiryTab_NewEnquiryBindingSource.Current;
            switch (e.ColumnIndex)
            {
            case 1:
                //Close the enquiry
                DialogResult Rtn = MessageBox.Show("Are you Sure that you wish to Close this Enquiry?", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
                if (Rtn == DialogResult.Yes)
                {
                    using (var Dbconnection = new MCDEntities())
                    {
                        Dbconnection.CurriculumEnquiries.Attach(CE);
                        CE.EnquiryStatusID = (int)EnumEnquiryStatuses.Enquiry_Closed;
                        CE.LastUpdated     = DateTime.Now;
                        Dbconnection.Entry <CurriculumEnquiry>(CE).State = System.Data.Entity.EntityState.Modified;
                        Dbconnection.SaveChanges();
                        Dbconnection.CurriculumEnquiries.Remove(CE);
                    };
                }
                if (curriculumEnquiriesBindingSource.Count == 0)
                {
                    refreshNewEnquiry();
                }

                break;

            //Accept the Enquiry
            case 2:
                using (frmSendEmail frm = new frmSendEmail())
                {
                    List <ContactDetail> CustomEmailPerson = (from a in CurrentEnquiryObj.Individuals
                                                              from b in a.ContactDetails
                                                              where b.ContactTypeID == (int)Common.Enum.EnumContactTypes.Email_Address
                                                              select b).ToList <ContactDetail>();

                    //Sets the Email Address For the Currently Selected Contact For this Enquiry
                    foreach (ContactDetail ConDetObj in CustomEmailPerson)
                    {
                        if (frm.txtTestingToAddress.Text.Length > 0)
                        {
                            frm.txtTestingToAddress.Text += ";";
                        }
                        frm.txtTestingToAddress.Text += ConDetObj.ContactDetailValue;
                    }

                    frm.txtTestSubject.Text = "Enquiry No: ( " + CE.EnquiryID + "-" + CE.CurriculumEnquiryID + " ) Enquiry Feed Back";

                    frm.ShowDialog();
                    using (var Dbconnection = new MCDEntities())
                    {
                        EquiryHistory hist = new EquiryHistory
                        {
                            EnquiryID  = CE.EnquiryID,
                            EmployeeID = this.CurrentEmployeeLoggedIn.EmployeeID,
                            LookupEquiyHistoryTypeID = (int)EnumEquiryHistoryTypes.Enquiry_Custom_Email_Message_Sent,
                            DateEnquiryUpdated       = DateTime.Now,
                            EnquiryNotes             = "Custom Message Sent To Client Via Email\nSubject of the Message was:\n\n{" + frm.txtTestSubject.Text + "}\n\nBody Of the Message read:\n" + frm.txtTestMessage.Text
                        };
                        Dbconnection.EquiryHistories.Add(hist);
                        int IsSaved = Dbconnection.SaveChanges();
                        if (IsSaved > 0)
                        {
                            Dbconnection.CurriculumEnquiries.Attach(CE);
                            CE.LastUpdated = DateTime.Now;
                            Dbconnection.Entry <CurriculumEnquiry>(CE).State = EntityState.Modified;
                            Dbconnection.SaveChanges();
                        }
                        dgvNewEnquiryTab_CurriculumEnquiry.Refresh();
                    };
                }



                break;

            //Close the Equiry
            case 3:

                frmEnquiryViewHistory frm5 = new frmEnquiryViewHistory();
                frm5.CurrentEnquiryID = CurrentEnquiryObj.EnquiryID;
                frm5.ShowDialog();
                break;

            case 8:
                if (CurrentEnquiryObj.InitialConsultationComplete)
                {
                    if (!CE.InitialCurriculumEnquiryDocumentationSent)
                    {
                        frmInitailDocumentation frm3 = new frmInitailDocumentation();
                        frm3.ShowDialog();
                        if (!frm3.IsCanceled)
                        {
                            if (frm3.UseEmail)
                            {
                                frmSendEmail frm1 = new frmSendEmail();

                                List <ContactDetail> you = (from a in CurrentEnquiryObj.Individuals
                                                            from b in a.ContactDetails
                                                            where b.ContactTypeID == (int)Common.Enum.EnumContactTypes.Email_Address
                                                            select b).ToList <ContactDetail>();

                                //Sets the Email Address For the Currently Selected Contact For this Enquiry
                                foreach (ContactDetail ConDetObj in you)
                                {
                                    if (frm1.txtTestingToAddress.Text.Length > 0)
                                    {
                                        frm1.txtTestingToAddress.Text += ";";
                                    }
                                    frm1.txtTestingToAddress.Text += ConDetObj.ContactDetailValue;
                                }

                                frm1.txtTestSubject.Text = "Enquiry No: ( " + CurrentEnquiryObj.EnquiryID + "-" + CE.CurriculumEnquiryID + " ) Enquiry Feed Back";

                                using (var Dbconnection = new MCDEntities())
                                {
                                    List <MessageTemplate> MT = (from a in Dbconnection.MessageTemplates
                                                                 from b in a.Files
                                                                 where a.ProcessStepID == (int)EnumProcessSteps.Enquiry__Apprenticeship__Step_1__Documentation_To_Send
                                                                 select a).ToList <MessageTemplate>();

                                    MessageTemplate CurrentMessageTemplate = MT.FirstOrDefault <MessageTemplate>();
                                    string          Mess = "Good Day " + txtNewEnquiryTab_ContactPersonTitle.Text + " " + txtNewEnquiryTab_ContactPersonFirstName.Text + " " + txtNewEnquiryTab_ContactPersonLastName.Text + "\n \n";
                                    frm1.txtTestMessage.Text = "Please Reference the Following Line Equiry Number when returning any documentation: \n" +
                                                               "Enquiry No " + CE.EnquiryID + "-" + CE.CurriculumEnquiryID + "\n" + Mess + CurrentMessageTemplate.Message;
                                    foreach (MessageTemplate MTObj in MT)
                                    {
                                        foreach (Data.Models.File FileObj in MTObj.Files)
                                        {
                                            frm1.AttachmentsUsingDbImageFileID.Add(FileObj.FileID);
                                        }
                                    }
                                };
                                frm1.ShowDialog();
                                using (var Dbconnection = new MCDEntities())
                                {
                                    EquiryHistory hist = new EquiryHistory
                                    {
                                        EnquiryID  = CE.EnquiryID,
                                        EmployeeID = this.CurrentEmployeeLoggedIn.EmployeeID,
                                        LookupEquiyHistoryTypeID = (int)EnumEquiryHistoryTypes.Enquiry_Initial_Documentation_Sent,
                                        DateEnquiryUpdated       = DateTime.Now,
                                        EnquiryNotes             = "Documentation Sent To Client Via Email"
                                    };
                                    Dbconnection.EquiryHistories.Add(hist);
                                    int IsSaved = Dbconnection.SaveChanges();
                                    if (IsSaved > 0)
                                    {
                                        Dbconnection.CurriculumEnquiries.Attach(CE);
                                        CE.InitialCurriculumEnquiryDocumentationSent = true;
                                        CE.LastUpdated = DateTime.Now;
                                        Dbconnection.Entry <CurriculumEnquiry>(CE).State = EntityState.Modified;
                                        Dbconnection.SaveChanges();
                                    }
                                    dgvNewEnquiryTab_CurriculumEnquiry.Refresh();
                                };
                            }
                            else
                            {
                                using (var Dbconnection = new MCDEntities())
                                {
                                    EquiryHistory hist = new EquiryHistory
                                    {
                                        EnquiryID  = CE.EnquiryID,
                                        EmployeeID = this.CurrentEmployeeLoggedIn.EmployeeID,
                                        LookupEquiyHistoryTypeID = (int)EnumEquiryHistoryTypes.Enquiry_Initial_Documentation_Sent,
                                        DateEnquiryUpdated       = DateTime.Now,
                                        EnquiryNotes             = "Documentation Manually Given To Client"
                                    };
                                    Dbconnection.EquiryHistories.Add(hist);
                                    int IsSaved = Dbconnection.SaveChanges();
                                    if (IsSaved > 0)
                                    {
                                        Dbconnection.CurriculumEnquiries.Attach(CE);
                                        CE.InitialCurriculumEnquiryDocumentationSent = true;
                                        CE.LastUpdated = DateTime.Now;
                                        Dbconnection.Entry <CurriculumEnquiry>(CE).State = EntityState.Modified;
                                        Dbconnection.SaveChanges();
                                        dgvNewEnquiryTab_CurriculumEnquiry.Refresh();
                                    }
                                };
                            }
                        }
                    }
                    else
                    {
                        MessageBox.Show("Documentation Already Sent,\nUse Send Mail Option to send additional Mail.\nSee History For Details.", "Info", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
                else
                {
                    MessageBox.Show("Initial Contsultation Not Completed!", "Info", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }

                break;

            case 10:
                if (CE.Curriculum.DepartmentID == (int)EnumDepartments.Apprenticeship)
                {
                    if (CE.EnrollmentQuanity >= CE.Enrollments.Count)
                    {
                        frmApprenticeshipEnrollmentFormV2 frm6 = new frmApprenticeshipEnrollmentFormV2();
                        frm6.CurrentCurriculumEnquiry = CE;
                        curriculumEnquiriesBindingSource.ResetItem(e.RowIndex);
                        frm6.ShowDialog();
                        //Check to see if the amoount required to be enrolled equal the amount that have been enrolled.
                        //if (CE.EnrollmentQuanity <= CE.Enrollments.Count)
                        //{
                        //    using (var Dbconnection = new MCDEntities())
                        //    {
                        //        Dbconnection.CurriculumEnquiries.Attach(CE);
                        //        CE.EnquiryStatusID = (int)EnumEnquiryStatuses.Enquiry_Closed;
                        //        CE.LastUpdated = DateTime.Now;
                        //        Dbconnection.Entry<CurriculumEnquiry>(CE).State = System.Data.Entity.EntityState.Modified;
                        //        Dbconnection.SaveChanges();
                        //        Dbconnection.CurriculumEnquiries.Remove(CE);
                        //        int currentIndex = NewEnquiryTab_NewEnquiryBindingSource.Position;
                        //        refreshNewEnquiry();
                        //        NewEnquiryTab_NewEnquiryBindingSource.Position = currentIndex;
                        //        dgvNewEnquiryTab_CurriculumEnquiry.Refresh();

                        //    };
                        //}
                        DialogResult Rtn1 = MessageBox.Show("Do you wish to View the Enrollment,and course selection?", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
                        if (Rtn1 == DialogResult.Yes)
                        {
                            using (frmEnrolmmentInprogress frm = new frmEnrolmmentInprogress())
                            {
                                frm.CurrentEmployeeLoggedIn   = this.CurrentEmployeeLoggedIn;
                                frm.CurrentSelectedDepartment = (Common.Enum.EnumDepartments)CE.Curriculum.DepartmentID;
                                // frmStudentCourseEnrollmentV2 frm7 = new frmStudentCourseEnrollmentV2();
                                frm.ShowDialog();
                            }
                        }
                    }
                }


                //frm6.CurrentEnrollments.ApprienticeshipEnrollment.(CE);
                break;

            case 11:
                using (frmEnrollmentSelectionForEquiry frm = new frmEnrollmentSelectionForEquiry())
                {
                    frm.SelectedCurriculumEnquiryID = CE.CurriculumEnquiryID;
                    frm.ShowDialog();
                    if (frm.SelectedEnrollmentID != 0)
                    {
                        using (frmEnrolmmentInprogress innerFrm = new frmEnrolmmentInprogress())
                        {
                            innerFrm.CurrentEmployeeLoggedIn   = this.CurrentEmployeeLoggedIn;
                            innerFrm.CurrentSelectedDepartment = (Common.Enum.EnumDepartments)CE.Curriculum.DepartmentID;
                            innerFrm.CurrentEnrollmentID       = frm.SelectedEnrollmentID;
                            innerFrm.ShowDialog();
                        }
                    }
                }



                break;
            }
        }
コード例 #5
0
        private void dgvInProgressCurriculumEnquiries_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            Data.Models.Enquiry CurrentEnquiry = (Data.Models.Enquiry)enquiryInprogressBindingSource.Current;
            CurriculumEnquiry   CE             = (CurriculumEnquiry)dgvInProgressCurriculumEnquiries.Rows[e.RowIndex].DataBoundItem;

            switch (e.ColumnIndex)
            {
            case 1:
                if (CE.EnquiryStatusID != (int)EnumEnquiryStatuses.Enquiry_Closed)
                {
                    DialogResult Rtn = MessageBox.Show("Are you sure that you wish to Close this Enquiry Item?", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
                    if (Rtn == DialogResult.Yes)
                    {
                        using (var Dbconnection = new MCDEntities())
                        {
                            Dbconnection.CurriculumEnquiries.Attach(CE);
                            CE.EnquiryStatusID = (int)EnumEnquiryStatuses.Enquiry_Closed;
                            CE.LastUpdated     = DateTime.Now;
                            Dbconnection.Entry <CurriculumEnquiry>(CE).State = System.Data.Entity.EntityState.Modified;
                            Dbconnection.SaveChanges();
                            EquiryHistory hist = new EquiryHistory
                            {
                                EnquiryID  = CurrentEnquiry.EnquiryID,
                                EmployeeID = this.CurrentEmployeeLoggedIn.EmployeeID,
                                LookupEquiyHistoryTypeID = (int)EnumEquiryHistoryTypes.Curriculum_Enquiry_Item_Closed,
                                DateEnquiryUpdated       = DateTime.Now,
                                EnquiryNotes             = "Curriculum Enquiry Line Item Closed, Item Removed - " + CE.Curriculum.CurriculumName + "- For Enquiry Ref: " + CurrentEnquiry.EnquiryID
                            };

                            Dbconnection.EquiryHistories.Add(hist);
                            int IsSaved = Dbconnection.SaveChanges();

                            refreshInProgressEnquiry(CurrentSelectedEnquiryID);
                        };
                    }
                }
                else
                {
                    DialogResult Rtn = MessageBox.Show("Are you sure that you wish to Close this Enquiry Item?", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
                    if (Rtn == DialogResult.Yes)
                    {
                        using (var Dbconnection = new MCDEntities())
                        {
                            Dbconnection.CurriculumEnquiries.Attach(CE);
                            CE.EnquiryStatusID = (int)EnumEnquiryStatuses.Enrollment_In_Progress;
                            CE.LastUpdated     = DateTime.Now;
                            Dbconnection.Entry <CurriculumEnquiry>(CE).State = System.Data.Entity.EntityState.Modified;
                            Dbconnection.SaveChanges();
                            EquiryHistory hist = new EquiryHistory
                            {
                                EnquiryID  = CurrentEnquiry.EnquiryID,
                                EmployeeID = this.CurrentEmployeeLoggedIn.EmployeeID,
                                LookupEquiyHistoryTypeID = (int)EnumEquiryHistoryTypes.Curriculum_Enquiry_Item_Reinstated,
                                DateEnquiryUpdated       = DateTime.Now,
                                EnquiryNotes             = "Curriculum Enquiry Line Item Reinstated, Item Reinstated - " + CE.Curriculum.CurriculumName + "- For Enquiry Ref: " + CurrentEnquiry.EnquiryID
                            };

                            Dbconnection.EquiryHistories.Add(hist);
                            int IsSaved = Dbconnection.SaveChanges();

                            refreshInProgressEnquiry(CurrentSelectedEnquiryID);
                        };
                    }
                }


                break;

            case 6:
                if (CE.Curriculum.DepartmentID == (int)EnumDepartments.Apprenticeship)
                {
                    using (var Dbconnection = new MCDEntities())
                    {
                        Dbconnection.CurriculumEnquiries.Attach(CE);
                        if (!(Dbconnection.Entry(CE).Collection(a => a.Enrollments).IsLoaded))
                        {
                            Dbconnection.Entry(CE).Collection(a => a.Enrollments).Load();
                        }
                    };
                    if (CE.EnrollmentQuanity > CE.Enrollments.Count)
                    {
                        using (frmApprenticeshipEnrollmentForm frm = new frmApprenticeshipEnrollmentForm())
                        {
                            frm.CurrentCurriculumEnquiry = CE;
                            frm.ShowDialog();
                            curriculumEnquiryInprogressBindingSource.ResetCurrentItem();
                            //this.refreshInProgressEnquiry(CurrentSelectedEnquiryID);

                            if (frm.IsSuccessfullySaved)
                            {
                                DialogResult Rtn1 = MessageBox.Show("Do you wish to process this new enrollment now?", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
                                if (Rtn1 == DialogResult.Yes)
                                {
                                    using (frmEnrolmmentInprogress frmInner = new frmEnrolmmentInprogress())
                                    {
                                        frmInner.CurrentEmployeeLoggedIn   = this.CurrentEmployeeLoggedIn;
                                        frmInner.CurrentSelectedDepartment = (Common.Enum.EnumDepartments)CE.Curriculum.DepartmentID;
                                        // frmStudentCourseEnrollmentV2 frm7 = new frmStudentCourseEnrollmentV2();
                                        frmInner.ShowDialog();
                                    }
                                }
                            }
                        }
                    }
                }
                break;

            case 7:
                //ensure that the Enrollments are refershed
                using (var Dbconnection = new MCDEntities())
                {
                    Dbconnection.CurriculumEnquiries.Attach(CE);
                    if (!(Dbconnection.Entry(CE).Collection(a => a.Enrollments).IsLoaded))
                    {
                        Dbconnection.Entry(CE).Collection(a => a.Enrollments).Load();
                    }
                };
                //IF any enrollments exists then open Selection list else Do Nothing.
                if (CE.Enrollments.Count > 0)
                {
                    //Open thje list of linked Enrollments that are in progress
                    using (frmEnrollmentSelectionForEquiry frm = new frmEnrollmentSelectionForEquiry())
                    {
                        frm.SelectedCurriculumEnquiryID = CE.CurriculumEnquiryID;
                        frm.ShowDialog();
                        if (frm.SelectedEnrollmentID != 0)
                        {
                            using (frmEnrolmmentInprogress innerFrm = new frmEnrolmmentInprogress())
                            {
                                innerFrm.CurrentEmployeeLoggedIn   = this.CurrentEmployeeLoggedIn;
                                innerFrm.CurrentSelectedDepartment = (Common.Enum.EnumDepartments)CE.Curriculum.DepartmentID;
                                innerFrm.CurrentEnrollmentID       = frm.SelectedEnrollmentID;
                                innerFrm.ShowDialog();
                            }
                        }
                    }
                }
                else
                {
                    MessageBox.Show("There are currently no enrollments for this enquiry.", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                break;
            }
        }