Example #1
0
        internal static void SetNullCtrlVal(Control place, FieldMapAttribute fieldMap)
        {
            bool flag = string.IsNullOrEmpty(fieldMap.CtrlId);

            if (!flag)
            {
                Control ctrl  = place.FindControl(fieldMap.CtrlId);
                bool    flag2 = ctrl == null;
                if (!flag2)
                {
                    switch (fieldMap.CtrlType)
                    {
                    case ControlType.HiddenField:
                        ((TimHiddenField)ctrl).Value = "";
                        break;

                    case ControlType.TextBox:
                        ((TimTextBox)ctrl).Text = "";
                        break;

                    case ControlType.NumericTextBox:
                        ((TimNumericTextBox)ctrl).Value = 0.0;
                        break;

                    case ControlType.NumericUpDown:
                        ((TimNumericUpDown)ctrl).Value = 0;
                        break;

                    case ControlType.CheckBox:
                        ((TimCheckBox)ctrl).Checked = false;
                        break;

                    case ControlType.CheckBoxList:
                        ((TimCheckBoxList)ctrl).CheckedValue = "";
                        break;

                    case ControlType.DropDownList:
                        ((TimDropDownList)ctrl).SelectedValue = "";
                        break;

                    case ControlType.DateTime:
                        ((TimDateTime)ctrl).Text = "";
                        break;

                    case ControlType.Date:
                        ((TimDate)ctrl).Text = "";
                        break;

                    case ControlType.CheckedBoxList:
                        ((TimCheckedBoxList)ctrl).CheckedValue = "";
                        break;

                    case ControlType.HtmlEditor:
                        ((TimCKEditor)ctrl).Text = "";
                        break;
                    }
                }
            }
        }
Example #2
0
 private bool ParameterBehavior(IHttpBehavior behavior, string paramName, FieldMapAttribute attr, EnctypeAttribute enctype, int argIndex, Encoding encoding, Formatters.IFormatter formatter)
 {
     if (attr == null)
     {
         return(false);
     }
     behavior.FieldKeys.Add(new FieldMapParameterBehavior(paramName, argIndex, encoding, formatter)
     {
         IsEncodeKey   = attr.IsEncodeKey ?? enctype.DefaultEncodeKey,
         IsEncodeValue = attr.IsEncodeValue ?? enctype.DefaultEncodeValue
     });
     return(true);
 }
Example #3
0
        internal static void SetCopyCtrlVal(Control place, FieldMapAttribute fieldMap)
        {
            bool flag = string.IsNullOrEmpty(fieldMap.CtrlId);

            if (!flag)
            {
                bool key = fieldMap.Key;
                if (key)
                {
                    Control ctrl  = place.FindControl(fieldMap.CtrlId);
                    bool    flag2 = ctrl == null;
                    if (!flag2)
                    {
                        switch (fieldMap.CtrlType)
                        {
                        case ControlType.HiddenField:
                            ((TimHiddenField)ctrl).Value = fieldMap.DefValue;
                            break;

                        case ControlType.TextBox:
                            ((TimTextBox)ctrl).Text = fieldMap.DefValue;
                            break;

                        case ControlType.NumericTextBox:
                            ((TimNumericTextBox)ctrl).Value = (string.IsNullOrEmpty(fieldMap.DefValue.TrimEnd(new char[]
                            {
                                ' '
                            })) ? 0.0 : fieldMap.DefValue.ToDouble());
                            break;

                        case ControlType.NumericUpDown:
                            ((TimNumericUpDown)ctrl).Value = (string.IsNullOrEmpty(fieldMap.DefValue.TrimEnd(new char[]
                            {
                                ' '
                            })) ? 0 : fieldMap.DefValue.ToInt());
                            break;

                        case ControlType.CheckBox:
                            ((TimCheckBox)ctrl).Checked = fieldMap.DefValue.Trim().ToBool();
                            break;

                        case ControlType.CheckBoxList:
                            ((TimCheckBoxList)ctrl).CheckedValue = fieldMap.DefValue;
                            break;

                        case ControlType.DropDownList:
                            ((TimDropDownList)ctrl).SelectedValue = fieldMap.DefValue.Trim();
                            break;

                        case ControlType.DateTime:
                            ((TimDateTime)ctrl).Text = fieldMap.DefValue.Trim();
                            break;

                        case ControlType.Date:
                            ((TimDate)ctrl).Text = (string.IsNullOrEmpty(fieldMap.DefValue) ? "" : fieldMap.DefValue.Trim().ToDate().ToShortDateString());
                            break;

                        case ControlType.CheckedBoxList:
                            ((TimCheckedBoxList)ctrl).CheckedValue = fieldMap.DefValue;
                            break;

                        case ControlType.HtmlEditor:
                            ((TimCKEditor)ctrl).Text = fieldMap.DefValue;
                            break;
                        }
                    }
                }
            }
        }
Example #4
0
        internal static void GetCtrlValByPage(Control place, FieldMapAttribute fieldMap)
        {
            bool flag = string.IsNullOrEmpty(fieldMap.CtrlId);

            if (!flag)
            {
                Control ctrl  = place.FindControl(fieldMap.CtrlId);
                bool    flag2 = ctrl == null;
                if (!flag2)
                {
                    switch (fieldMap.CtrlType)
                    {
                    case ControlType.HiddenField:
                        fieldMap.NewValue = ((TimHiddenField)ctrl).Value.TrimEnd(new char[]
                        {
                            ' '
                        });
                        break;

                    case ControlType.TextBox:
                        fieldMap.NewValue = ((TimTextBox)ctrl).Text.TrimEnd(new char[]
                        {
                            ' '
                        });
                        break;

                    case ControlType.NumericTextBox:
                        fieldMap.NewValue = ((TimNumericTextBox)ctrl).Value.ToString();
                        break;

                    case ControlType.NumericUpDown:
                        fieldMap.NewValue = ((TimNumericUpDown)ctrl).Value.ToString();
                        break;

                    case ControlType.CheckBox:
                        fieldMap.NewValue = ((TimCheckBox)ctrl).Checked.ToYOrN();
                        break;

                    case ControlType.CheckBoxList:
                        fieldMap.NewValue = ((TimCheckBoxList)ctrl).CheckedValue;
                        break;

                    case ControlType.DropDownList:
                        fieldMap.NewValue = ((TimDropDownList)ctrl).SelectedValue;
                        break;

                    case ControlType.DateTime:
                        fieldMap.NewValue = ((TimDateTime)ctrl).Text;
                        break;

                    case ControlType.Date:
                        fieldMap.NewValue = ((TimDate)ctrl).Text;
                        break;

                    case ControlType.CheckedBoxList:
                        fieldMap.NewValue = ((TimCheckedBoxList)ctrl).CheckedValue;
                        break;

                    case ControlType.HtmlEditor:
                        fieldMap.NewValue = ((TimCKEditor)ctrl).Text;
                        break;
                    }
                    bool key = fieldMap.Key;
                    if (key)
                    {
                        fieldMap.NewValue = (string.IsNullOrWhiteSpace(fieldMap.NewValue.Trim()) ? " " : fieldMap.NewValue.Trim());
                    }
                }
            }
        }