コード例 #1
0
        /// <summary>
        /// Checks whether a given field should be editable and makes appropriate
        /// changes.  If the property is an ObjectID and the BO
        /// is not new, then editing should not be done.
        /// </summary>
        /// <param name="field">The field being added</param>
        /// <param name="ctl">The control being prepared</param>
        /// <returns>Returns true if editable</returns>
        private bool CheckIfEditable(UIFormField field, IControlHabanero ctl)
        {
            bool editable = field.Editable;
            if (editable)
            {
                if (_firstControl == null)
                {
                    _firstControl = ctl;
                }
            }
            if (editable)
            {
                object parameterValue = field.GetParameterValue("editable");
                if (parameterValue != null) editable = Convert.ToBoolean(parameterValue);

                parameterValue = field.GetParameterValue("readWriteRule");
                string writeRule = "";
                if (parameterValue != null) writeRule = Convert.ToString(parameterValue);
                if (writeRule.Length > 0)
                {
                    if (writeRule == "ReadOnly") editable = false;
                    if (writeRule == "WriteNew")
                    {
                        if (_currentBusinessObject.Status.IsNew)
                        {
                            editable = true;
                        }
                        else editable = false;

                    }
                    if (writeRule == "WriteNotNew")
                    {
                        if (_currentBusinessObject.Status.IsNew)
                        {
                            editable = false;
                        }
                        else editable = true;
                    }
                }
            }
            return editable;
        }
コード例 #2
0
        /// <summary>
        /// Checks for a range of parameters that may apply to some or all fields
        /// </summary>
        private static void CheckGeneralParameters(UIFormField field, IControlHabanero ctl)
        {
            if (field.GetParameterValue("alignment") != null)
            {
                //TODO_Port needs to be tested.

                //string alignmentParam = field.GetParameterValue("alignment").ToString().ToLower().Trim();
                //Gizmox.WebGUI.Forms.HorizontalAlignment alignment;
                //if (alignmentParam == "left") alignment = Gizmox.WebGUI.Forms.HorizontalAlignment.Left;
                //else if (alignmentParam == "right") alignment = Gizmox.WebGUI.Forms.HorizontalAlignment.Right;
                //else if (alignmentParam == "center") alignment = Gizmox.WebGUI.Forms.HorizontalAlignment.Center;
                //else if (alignmentParam == "centre") alignment = Gizmox.WebGUI.Forms.HorizontalAlignment.Center;
                //else
                //{
                //    throw new InvalidXmlDefinitionException(String.Format(
                //                                                "In a 'parameter' element, the value '{0}' given for 'alignment' was " +
                //                                                "invalid.  The available options are: left, right, center and centre.",
                //                                                alignmentParam));
                //}
                // if (ctl is ITextBox) ((ITextBox) ctl).TextAlign = alignment;
                // this if (ctl is INumericUpDown) ((INumericUpDown) ctl).TextAlign = alignment;
            }
        }