Exemplo n.º 1
0
        /// <summary>
        ///     Adds the search fields to the criteria panel
        /// </summary>
        private void InitialiseField(HtmlGenericControl row, Search.SearchParameter parameter, Int32 width)
        {
            BaseInputControl control = null;

            switch (parameter.FieldType)
            {
            case "textbox":
            case "jslookup": control = new TextField(); break;

            case "datepicker": control = new DateField(); break;

            case "checkbox": control = new CheckField(); break;

            case "select": control = this.InitialiseListField(parameter); break;
            }

            // Add the control to the parameter panel
            if (control != null)
            {
                control.ID             = parameter.FieldName;
                control.LabelText      = parameter.CustomLabel.TrimOrNullify() ?? parameter.DefaultLabel;
                control.DataBoundValue = parameter.FieldName;
                control.CssClass      += " col-md-" + width.ToString();
                if (parameter.FieldName == "PN_SURNAME")
                {
                    control.FieldValueRaw = (object)(string.IsNullOrEmpty(PersonSurname) ? "" : PersonSurname);
                }
                row.Controls.Add(control);
            }
        }
Exemplo n.º 2
0
        protected virtual void PopulateCustomFields(string recordId)
        {
            if (CustomFields != null)
            {
                foreach (ScreenCustomField field in CustomFields)
                {
                    // field.CustomFieldValues // don't access this directly - it will fetch the values for all records for this field.
                    ScreenCustomFieldValue fieldValue = ScreenCustomFieldValue.FetchByFieldIdAndRecordId(field.Id, recordId);
                    if (fieldValue != null)
                    {
                        //Control customField = FindControl(field.Name);
                        Control          root        = this; // this.Parent.ID == "ControlContainer" ? this.Parent.Parent : this;
                        BaseInputControl customField = this.GetControlTree <BaseInputControl>(root).Where(control => control.ID == field.Name).FirstOrDefault();
                        if (customField != null)
                        {
                            switch (field.CftypeId)
                            {
                            case "Text":
                            case "MultiLine":
                                customField.FieldValueRaw = fieldValue.Text;
                                break;

                            case "Checkbox":
                                customField.FieldValueRaw = fieldValue.Number == 1;
                                break;

                            case "Date":
                                customField.FieldValueRaw = fieldValue.Date;
                                break;

                            case "List":
                                customField.FieldValueRaw = fieldValue.IdValue;
                                break;

                            case "Number":
                                customField.FieldValueRaw = fieldValue.Number;
                                break;

                            case "PopupSearch":
                                PopupField popup = (customField as PopupField);
                                if (popup != null)
                                {
                                    popup.FieldValueRaw = fieldValue.IdValue;
                                    popup.FieldText     = fieldValue.Text;
                                    // Better to go and get the row from the database to ensure we get an up to date description on read - otherwise we are potentially showing stale data?
                                    // Abandoned this - there is no way of making it self-maintaining, i.e. no way of getting the object and description field returned by a particular search
                                    // using just the Url.
                                    //popup.FieldText = resolvePopupText(field, fieldValue);
                                }
                                break;
                            }
                        }
                    }
                }
            }
        }
Exemplo n.º 3
0
        private void LockField(BaseInputControl control)
        {
            if (!String.IsNullOrEmpty(this.PersonId) && !String.IsNullOrEmpty(this.OrganisationId))
            {
                control.IsReadOnly = ConfigurableBoolean.TrueEnforced;
            }

            //If called from Person screen checks if organisation is selected
            if (String.IsNullOrEmpty(this.Request.QueryString["id"]) && !String.IsNullOrEmpty(this.Request.QueryString["organisationId"]))
            {
                control.IsReadOnly = ConfigurableBoolean.TrueEnforced;
            }
        }
Exemplo n.º 4
0
 /// <summary>
 ///     Occurs when the reset button is clicked.
 /// </summary>
 protected void ResetButton_Click(object sender, EventArgs e)
 {
     this.SearchResult.IsHidden = UserInterface.ConfigurableBoolean.TrueEnforced;
     foreach (Search.SearchParameter parameter in this.SearchType.Parameters)
     {
         BaseInputControl control = this.SearchCriteria.Controls.OfType <HtmlGenericControl>().Select(row => row.FindControl(parameter.FieldName)).OfType <BaseInputControl>().FirstOrDefault();
         if (control != null)
         {
             if (String.Equals(parameter.DefaultValue, "now", StringComparison.OrdinalIgnoreCase))
             {
                 control.FieldValueRaw = DateTime.Now;
             }
             else if (!String.IsNullOrEmpty(parameter.DefaultValue))
             {
                 control.FieldValueRaw = parameter.DefaultValue;
             }
             else
             {
                 control.FieldValueRaw = null;
             }
         }
     }
 }
Exemplo n.º 5
0
 private void LockField(BaseInputControl control)
 {
     control.IsReadOnly = ConfigurableBoolean.TrueEnforced;
 }
Exemplo n.º 6
0
        protected virtual void CreateCustomFields()
        {
            if (CustomFields != null)
            {
                foreach (ScreenCustomField field in CustomFields)
                {
                    Control root = this; // this.Parent.ID == "ControlContainer" ? this.Parent.Parent : this;

                    ICustomFieldContainer container = GetControlTree <ICustomFieldContainer>(root).Where(control => control is Control && ((Control)control).ClientID == field.ParentControl).FirstOrDefault();
                    if (container == null)
                    {
                        container = GetControlTree <CustomFieldContainer>(root).FirstOrDefault();
                    }

                    BaseInputControl customField = null;
                    if (container != null)
                    {
                        switch (field.CftypeId)
                        {
                        case "Text":
                            customField = CreateCustomTextField(field);
                            break;

                        case "MultiLine":
                            customField = CreateCustomMultilineField(field);
                            break;

                        case "Checkbox":
                            customField = CreateCustomCheckboxField(field);
                            break;

                        case "Date":
                            customField = CreateCustomDateField(field);
                            break;

                        case "List":
                            customField = CreateCustomListField(field);
                            break;

                        case "Number":
                            customField = CreateCustomNumberField(field);
                            break;

                        case "PopupSearch":
                            customField = CreateCustomPopupField(field);
                            break;
                        }

                        if (customField != null && customField is ICanBeACustomField)
                        {
                            customField.LabelText      = field.Label;
                            customField.ID             = field.Name;
                            customField.DataBoundValue = "_customFields." + field.Name;
                            ((ICanBeACustomField)customField).CustomFieldId = field.Id;
                            ((ICanBeACustomField)customField).IsCustomField = true;

                            InjectCustomField(container, customField);
                        }
                    }
                }
            }
        }