Esempio n. 1
0
        public iJobLead GetJobLead(int myJobLeadID)
        {
            //Here is where we decide the depth of information extracted for a Job Lead instance
            using (var ctx = new JobLeadContext())
            {
                iJobLead thisFullJobLead = ctx.JobLeads
                                           .Include("AgencyBroker")
                                           .Include("AgencyBroker.Brokers")
                                           .Include("AgencyBroker.Address")
                                           .Include("AgencyBroker.BrokerNotes")
                                           .Include("AgencyBroker.Contacts.Address")
                                           .Include("AgencyBroker.Contacts.Name")
                                           .Include("AgencyBroker.Contacts.ContactNotes")
                                           .Include("EmployerBroker")
                                           .Include("EmployerBroker.Brokers")
                                           .Include("EmployerBroker.Address")
                                           .Include("EmployerBroker.BrokerNotes")
                                           .Include("EmployerBroker.Contacts.Address")
                                           .Include("EmployerBroker.Contacts.Name")
                                           .Include("EmployerBroker.Contacts.ContactNotes")
                                           .Include("JobLeadNotes")
                                           .Where(s => s.JobLeadID == myJobLeadID)
                                           .FirstOrDefault <iJobLead>();

                //Apparently it is OK to return in a Using block. The finalising code will still be called.
                return(thisFullJobLead);
            }
        }
Esempio n. 2
0
        public frmJobLead()
        {
            InitializeComponent();

            //Forms should have no control over what concrete class is used.
            //We have a "factory" that handles this.
            myJobLead = InstanceFactory.JobLead();

            //Job status drop down list and current value
            cboJobStatusList.DataSource = myJobLead.StatusList;

            InitialiseBrokerDropdown(cboAgencyNames, true);
            InitialiseBrokerDropdown(cboEmployerNames, false);

            SetNotesCount();
        }
Esempio n. 3
0
        private void dataGridView_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            //A row has been double clicked. We need to get the JobLeadID value, extract the JobLead instance
            //and then pass this to the form to display the job lead.
            int jobLeadIDSelected = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["JobLeadID"].Value.ToString());

            //PUT THIS IN A Using BLOCK?
            JobLeadRepo thisJobLeadRepo = new JobLeadRepo();
            iJobLead    jobLeadSelected = thisJobLeadRepo.GetJobLead(jobLeadIDSelected);

            frmJobLead newJobLeadForm = new frmJobLead(jobLeadSelected);

            newJobLeadForm.ShowDialog();

            //Now reinitialise the Job Lead Grid
            ReloadJobLeadGrid();
        }
Esempio n. 4
0
        //We have an existing job lead instance to populate this form with
        public frmJobLead(iJobLead myJobInstance)
        {
            InitializeComponent();

            myJobLead = myJobInstance;

            //Creation date
            dateTimeCreationDateTime.Value = myJobLead.Date;

            //Job status drop down list and current value
            cboJobStatusList.DataSource = myJobLead.StatusList;
            //Set the status value in the drop down list to the value the JobLead instance has (if this is a new job lead, this will be null)
            cboJobStatusList.SelectedItem = myJobLead.Status != null ? myJobLead.Status : cboJobStatusList.Items[0].ToString();

            //An existing job may have an entry for agency and employer, or it may not (but at least one should be present).
            //If one is present, and the other is blank, we should initialise the blank one with the list of agencies/employers
            //the other deals with. If both are blank, we get all the agencies and employers for all the Broker instancies.

            //Check if we have an Agency Broker
            if (myJobLead.AgencyBroker == null)
            {
                //Do we have an Employer Broker
                if (myJobLead.EmployerBroker == null)
                {
                    //Initialise the Agency list with all the agencies
                    InitialiseBrokerDropdown(cboAgencyNames, true);
                }
                else
                {
                    //Initialise the Agency list with the agencies that work with this employer
                    //NOTE: THE SelectedValue_Changed EVENT WILL BE DOING THE SAME THING
                    InitialiseBrokerDropdown(cboAgencyNames, myJobLead.EmployerBroker);
                }
            }
            else
            {
                //Populate the Agency list with just one entry
                InitialiseBrokerDropdown(cboAgencyNames, myJobLead.AgencyBrokerID, myJobLead.AgencyBroker.Name);

                //Populate the Agency Contact list with all the contacts for this agent
                InitialiseContactDropDown(cboAgencyContactNames, myJobLead.AgencyBroker);

                //If we have an agency contact set, make that the selected item in the list
                if (myJobLead.AgencyContact != null)
                {
                    cboAgencyContactNames.SelectedValue = myJobLead.AgencyContactID;
                }
            }

            //Now do the same for an Employer Broker
            if (myJobLead.EmployerBroker == null)
            {
                //Do we have an Agency Broker
                if (myJobLead.AgencyBroker == null)
                {
                    //Initialise the Employer list with all employers
                    InitialiseBrokerDropdown(cboEmployerNames, false);
                }
                else
                {
                    //Initialise the Employer list with the employers that work with this agency
                    //NOTE: THE SelectedValue_Changed EVENT WILL BE DOING THE SAME THING
                    InitialiseBrokerDropdown(cboEmployerNames, myJobLead.AgencyBroker);
                }
            }
            else
            {
                //Populate the Employer list with just one entry
                InitialiseBrokerDropdown(cboEmployerNames, myJobLead.EmployerBrokerID, myJobLead.EmployerBroker.Name);

                //Populate the Employer Contact list with all the contacts for this agent
                InitialiseContactDropDown(cboEmployerContactNames, myJobLead.EmployerBroker);

                //If we have an employer contact set, make that the selected item in the list
                if (myJobLead.EmployerContact != null)
                {
                    cboEmployerContactNames.SelectedValue = myJobLead.EmployerContactID;
                }
            }

            //Now we just simply fill in the text values for the rest of the Job Lead.
            txtBoxJobTitle.Text               = myJobLead.JobTitle;
            txtBoxLeadSource.Text             = myJobLead.Source;
            txtBoxApplicationDocLocation.Text = myJobLead.CVOrApplicationLocation;
            txtBoxCoverLetterLocation.Text    = myJobLead.CoverLetterLocation;
            txtBoxRefOne.Text   = myJobLead.Ref_One;
            txtBoxRefTwo.Text   = myJobLead.Ref_Two;
            txtBoxRefThree.Text = myJobLead.Ref_Three;
            SetNotesCount();
        }