Esempio n. 1
0
        private void UpdateReferences()
        {
            int identityId = int.Parse(cboClient.SelectedValue);
            List <Entities.JobReference> references = new List <Entities.JobReference>();

            Facade.IOrganisationReference facOrganisationReference = new Facade.Organisation();

            foreach (RepeaterItem item in repReferences.Items)
            {
                int    referenceId    = Convert.ToInt32(((HtmlInputHidden)item.FindControl("hidOrganisationReferenceId")).Value);
                string referenceValue = ((TextBox)item.FindControl("txtReferenceValue")).Text;

                // Create a new reference and add it to the reference collection
                Entities.JobReference jobReference = new Entities.JobReference();
                jobReference.JobId = m_jobId;
                jobReference.Value = referenceValue;
                jobReference.OrganisationReference = facOrganisationReference.GetReferenceForOrganisationReferenceId(referenceId);
                references.Add(jobReference);
            }

            Facade.IJob facJob = new Facade.Job();
            facJob.ChangeClient(m_jobId, identityId, references, ((Entities.CustomPrincipal)Page.User).UserName);

            mwhelper.CloseForm     = true;
            mwhelper.CausePostBack = true;
            mwhelper.OutputData    = "<changeClient />";
        }
        /// <summary>
        /// Retrieves the reference identified by m_referenceId from the organisation and populates the form controls.
        /// Only occurs in update mode.
        /// </summary>
        private void LoadReference()
        {
            // retrieve the reference and store it in viewstate
            Facade.IOrganisationReference facOrganisationReference = new Facade.Organisation();
            m_reference = facOrganisationReference.GetReferenceForOrganisationReferenceId(m_referenceId);
            ViewState[C_REFERENCE_VS] = m_reference;

            // populate the form controls
            txtDescription.Text       = m_reference.Description;
            cboDataType.SelectedValue = Utilities.UnCamelCase(m_reference.DataType.ToString());
            cboStatus.SelectedValue   = Utilities.UnCamelCase(m_reference.Status.ToString());

            btnAdd.Text = "Update";
        }