Example #1
0
        private void ConfigureClientReferences()
        {
            if (m_isUpdate)
            {
                // Populate the repeater control with the current reference fields
                Entities.OrganisationReferenceCollection clientReferences = new Entities.OrganisationReferenceCollection();
                foreach (Entities.JobReference reference in m_job.References)
                {
                    clientReferences.Add(reference.OrganisationReference);
                }

                repReferences.DataSource = clientReferences;
                repReferences.DataBind();
            }
            else
            {
                Facade.IOrganisationReference facOrganisationReference = new Facade.Organisation();
                m_clientReferences = facOrganisationReference.GetReferencesForOrganisationIdentityId(m_job.IdentityId, true);

                if (m_clientReferences != null)
                {
                    // Populate the repeater control with the required reference fields
                    repReferences.DataSource = m_clientReferences;
                    repReferences.DataBind();
                }
            }
        }
Example #2
0
        private void PopulateStaticControls()
        {
            cboJobState.DataSource = Enum.GetNames(typeof(eJobState));
            cboJobState.DataBind();
            cboJobState.SelectedValue = eJobState.ReadyToInvoice.ToString();

            // Invoice Sort Type
            rdoSortType.DataSource = Enum.GetNames(typeof(eInvoiceSortType));
            rdoSortType.DataBind();
            rdoSortType.Items[0].Selected = true;

            // Invoice Type
            rdoInvoiceType.Items.Add(new ListItem("Normal Invoice/Self Bill"));
            rdoInvoiceType.Items.Add(new ListItem("Sub Contractor"));
            //rdoInvoiceType.Items[0].Selected = true;

            if (m_IdentityId != 0)
            {
                //Get the Client name for id.
                Facade.IOrganisation facOrg = new Facade.Organisation();
                string name = facOrg.GetNameForIdentityId(m_IdentityId);

                cboClient.SelectedValue = m_IdentityId.ToString();
                cboClient.Text          = name;

                // Add client specific references to sort collection
                Facade.IOrganisationReference            facOrgRef = new Facade.Organisation();
                Entities.OrganisationReferenceCollection eOrf      = facOrgRef.GetReferencesForOrganisationIdentityId(m_IdentityId, true);

                foreach (Entities.OrganisationReference ocr in eOrf)
                {
                    rdoSortType.Items.Add(new ListItem(ocr.Description));
                }
            }
        }
Example #3
0
        private void repReferences_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                Entities.OrganisationReferenceCollection organisationReferences = (Entities.OrganisationReferenceCollection)repReferences.DataSource;

                HtmlInputHidden hidOrganisationReferenceId = (HtmlInputHidden)e.Item.FindControl("hidOrganisationReferenceId");
                PlaceHolder     plcHolder = (PlaceHolder)e.Item.FindControl("plcHolder");

                int organisationReferenceId = Convert.ToInt32(hidOrganisationReferenceId.Value);

                // Configure the validator controls
                CustomValidator validatorControl = null;

                Entities.OrganisationReference reference = organisationReferences.FindByReferenceId(organisationReferenceId);
                switch (reference.DataType)
                {
                case eOrganisationReferenceDataType.Decimal:
                    validatorControl = new CustomValidator();
                    validatorControl.ServerValidate += new ServerValidateEventHandler(validatorControl_ServerValidateDecimal);
                    break;

                case eOrganisationReferenceDataType.FreeText:
                    // No additional validation required.
                    break;

                case eOrganisationReferenceDataType.Integer:
                    validatorControl = new CustomValidator();
                    validatorControl.ServerValidate += new ServerValidateEventHandler(validatorControl_ServerValidateInteger);
                    break;
                }

                if (validatorControl != null)
                {
                    // Configure the validator properties
                    validatorControl.ControlToValidate = "txtReferenceValue";
                    validatorControl.Display           = ValidatorDisplay.Dynamic;
                    validatorControl.ErrorMessage      = "Please supply a " + reference.Description + ".";
                    validatorControl.Text = "<img src=\"../images/error.png\"  Title=\"Please supply a " + reference.Description + ".\" />";
                    validatorControl.EnableClientScript = false;

                    plcHolder.Controls.Add(validatorControl);
                }
            }
        }
Example #4
0
        private void repReferences_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            Entities.OrganisationReferenceCollection organisationReferences = (Entities.OrganisationReferenceCollection)repReferences.DataSource;

            HtmlInputHidden hidOrganisationReferenceId = (HtmlInputHidden)e.Item.FindControl("hidOrganisationReferenceId");
            PlaceHolder     plcHolder = (PlaceHolder)e.Item.FindControl("plcHolder");

            int organisationReferenceId = Convert.ToInt32(hidOrganisationReferenceId.Value);

            if (!IsPostBack && m_job.References != null)
            {
                // Make sure the value is in place
                TextBox txtReferenceValue          = (TextBox)e.Item.FindControl("txtReferenceValue");
                Entities.JobReference currentValue = m_job.References.GetForReferenceId(organisationReferenceId);
                if (currentValue != null)
                {
                    txtReferenceValue.Text = currentValue.Value;
                }
            }

            // Configure the validator controls
            CustomValidator validatorControl = null;

            Entities.OrganisationReference reference = organisationReferences.FindByReferenceId(organisationReferenceId);
            switch (reference.DataType)
            {
            case eOrganisationReferenceDataType.Decimal:
                validatorControl = new CustomValidator();
                validatorControl.ServerValidate += new ServerValidateEventHandler(validatorControl_ServerValidateDecimal);
                break;

            case eOrganisationReferenceDataType.FreeText:
                // No additional validation required.
                break;

            case eOrganisationReferenceDataType.Integer:
                validatorControl = new CustomValidator();
                validatorControl.ServerValidate += new ServerValidateEventHandler(validatorControl_ServerValidateInteger);
                break;
            }

            if (validatorControl != null)
            {
                // Configure the validator properties
                validatorControl.ControlToValidate = "txtReferenceValue";
                validatorControl.Display           = ValidatorDisplay.Dynamic;
                validatorControl.ErrorMessage      = "Please supply a " + reference.Description + ".";
                validatorControl.Text = "<img src=\"../../images/error.png\"  Title=\"Please supply a " + reference.Description + ".\" />";
                validatorControl.EnableClientScript = false;

                plcHolder.Controls.Add(validatorControl);
            }

            if (m_isUpdate)
            {
                // Populate the text box with the value already configured for the reference
                TextBox txtReferenceValue = (TextBox)e.Item.FindControl("txtReferenceValue");

                // Find the reference
                Entities.JobReference jobReference = m_job.References.GetForReferenceId(organisationReferenceId);
                if (jobReference != null)
                {
                    txtReferenceValue.Text = jobReference.Value;
                }
            }
        }