Пример #1
0
        private static TextBox GetDateTextBox(string id, int maxLength)
        {
            TextBox textBox = ScrudTextBox.GetTextBox(id, maxLength);

            textBox.Attributes["type"] = "date";
            return(textBox);
        }
Пример #2
0
        private static TextBox GetNumberTextBox(string id, int maxLength)
        {
            var textBox = ScrudTextBox.GetTextBox(id, maxLength);

            //textBox.Attributes["type"] = "number";
            return(textBox);
        }
Пример #3
0
        internal static void AddDecimalTextBox(HtmlTable htmlTable, string resourceClassName, string columnName, string label, string description,
                                               string defaultValue, bool isNullable, int maxLength, string domain, string errorCssClass, bool disabled)
        {
            using (TextBox textBox = ScrudTextBox.GetTextBox(columnName + "_textbox", maxLength))
            {
                if (string.IsNullOrWhiteSpace(label))
                {
                    label = ScrudLocalizationHelper.GetResourceString(resourceClassName, columnName);
                }

                using (CompareValidator validator = GetDecimalValidator(textBox, domain, errorCssClass))
                {
                    textBox.Text     = defaultValue;
                    textBox.ReadOnly = disabled;
                    textBox.CssClass = "decimal";

                    if (!string.IsNullOrWhiteSpace(description))
                    {
                        textBox.CssClass += " activating element";
                        textBox.Attributes.Add("data-content", description);
                    }

                    if (!isNullable)
                    {
                        RequiredFieldValidator required = ScrudFactoryHelper.GetRequiredFieldValidator(textBox,
                                                                                                       errorCssClass);
                        ScrudFactoryHelper.AddRow(htmlTable, label + Labels.RequiredFieldIndicator, textBox, validator,
                                                  required);
                        return;
                    }

                    ScrudFactoryHelper.AddRow(htmlTable, label, textBox, validator);
                }
            }
        }
Пример #4
0
        public static void AddDateTextBox(HtmlTable t, string columnName, string defaultValue, bool isNullable, int maxLength)
        {
            string label = MixERP.Net.Common.Helpers.LocalizationHelper.GetResourceString("FormResource", columnName);

            TextBox textBox = ScrudTextBox.GetTextBox(columnName + "_textbox", maxLength);

            textBox.CssClass = "date";

            CompareValidator validator = GetDateValidator(textBox);

            AjaxControlToolkit.CalendarExtender extender = new AjaxControlToolkit.CalendarExtender();

            textBox.Width            = 70;
            extender.ID              = textBox.ID + "_calendar_extender";
            extender.TargetControlID = textBox.ID;
            extender.PopupButtonID   = textBox.ID;

            if (!string.IsNullOrWhiteSpace(defaultValue))
            {
                textBox.Text = MixERP.Net.Common.Conversion.TryCastDate(defaultValue).ToShortDateString();
            }


            if (!isNullable)
            {
                RequiredFieldValidator required = ScrudFactoryHelper.GetRequiredFieldValidator(textBox);
                ScrudFactoryHelper.AddRow(t, label + Resources.ScrudResource.RequiredFieldIndicator, textBox, validator, required, extender);
                return;
            }

            ScrudFactoryHelper.AddRow(t, label, textBox, validator, extender);
        }
Пример #5
0
        internal static void AddDateTextBox(HtmlTable htmlTable, string resourceClassName, string columnName, string label, string description,
                                            string defaultValue, bool isNullable, string validatorCssClass, bool disabled)
        {
            if (htmlTable == null)
            {
                return;
            }

            if (string.IsNullOrWhiteSpace(columnName))
            {
                return;
            }

            string id = columnName + "_textbox";

            using (TextBox textBox = ScrudTextBox.GetTextBox(id, 100))
            {
                jQueryUI.AddjQueryUIDatePicker(null, id, null, null);

                if (string.IsNullOrWhiteSpace(label))
                {
                    label = ScrudLocalizationHelper.GetResourceString(resourceClassName, columnName);
                }

                textBox.Text     = GetLocalizedDate(defaultValue);
                textBox.ReadOnly = disabled;
                textBox.CssClass = "date";

                if (!string.IsNullOrWhiteSpace(description))
                {
                    textBox.CssClass += " activating element";
                    textBox.Attributes.Add("data-content", description);
                }

                using (CompareValidator dateValidator = GetDateValidator(textBox, validatorCssClass))
                {
                    if (!isNullable)
                    {
                        using (
                            RequiredFieldValidator required = ScrudFactoryHelper.GetRequiredFieldValidator(textBox,
                                                                                                           validatorCssClass))
                        {
                            ScrudFactoryHelper.AddRow(htmlTable, label + Labels.RequiredFieldIndicator, textBox,
                                                      dateValidator, required);
                            return;
                        }
                    }

                    ScrudFactoryHelper.AddRow(htmlTable, label, textBox, dateValidator);
                }
            }
        }
Пример #6
0
        internal static void AddNumberTextBox(HtmlTable htmlTable, string resourceClassName, string columnName, string defaultValue, bool isSerial, bool isNullable, int maxLength, string domain, string errorCssClass, Assembly assembly, bool disabled)
        {
            if (htmlTable == null)
            {
                return;
            }

            if (string.IsNullOrWhiteSpace(columnName))
            {
                return;
            }

            using (TextBox textBox = ScrudTextBox.GetTextBox(columnName + "_textbox", maxLength))
            {
                using (CompareValidator numberValidator = GetNumberValidator(textBox, domain, errorCssClass))
                {
                    string label = ScrudLocalizationHelper.GetResourceString(assembly, resourceClassName, columnName);

                    if (!string.IsNullOrWhiteSpace(defaultValue))
                    {
                        if (!defaultValue.StartsWith("nextVal", StringComparison.OrdinalIgnoreCase))
                        {
                            textBox.Text = defaultValue;
                        }
                    }

                    textBox.ReadOnly = disabled;

                    if (isSerial)
                    {
                        textBox.ReadOnly = true;
                    }
                    else
                    {
                        if (!isNullable)
                        {
                            using (RequiredFieldValidator required = ScrudFactoryHelper.GetRequiredFieldValidator(textBox, errorCssClass))
                            {
                                ScrudFactoryHelper.AddRow(htmlTable, label + Titles.RequiredFieldIndicator, textBox, numberValidator, required);
                                return;
                            }
                        }
                    }

                    ScrudFactoryHelper.AddRow(htmlTable, label, textBox, numberValidator);
                }
            }
        }
Пример #7
0
        public static void AddDecimalTextBox(HtmlTable htmlTable, string resourceClassName, string columnName, string defaultValue, bool isNullable, int maxLength, string domain)
        {
            var textBox = ScrudTextBox.GetTextBox(columnName + "_textbox", maxLength);
            var label   = LocalizationHelper.GetResourceString(resourceClassName, columnName);

            var validator = GetDecimalValidator(textBox, domain);

            textBox.Text = defaultValue;

            if (!isNullable)
            {
                var required = ScrudFactoryHelper.GetRequiredFieldValidator(textBox);
                ScrudFactoryHelper.AddRow(htmlTable, label + ScrudResource.RequiredFieldIndicator, textBox, validator, required);
                return;
            }

            ScrudFactoryHelper.AddRow(htmlTable, label, textBox, validator);
        }
Пример #8
0
        public static void AddDecimalTextBox(HtmlTable t, string columnName, string defaultValue, bool isNullable, int maxLength, string domain)
        {
            TextBox textBox = ScrudTextBox.GetTextBox(columnName + "_textbox", maxLength);
            string  label   = MixERP.Net.Common.Helpers.LocalizationHelper.GetResourceString("FormResource", columnName);

            CompareValidator validator = GetDecimalValidator(textBox, domain);

            textBox.Text = defaultValue;

            if (!isNullable)
            {
                RequiredFieldValidator required = ScrudFactoryHelper.GetRequiredFieldValidator(textBox);
                ScrudFactoryHelper.AddRow(t, label + Resources.ScrudResource.RequiredFieldIndicator, textBox, validator, required);
                return;
            }

            ScrudFactoryHelper.AddRow(t, label, textBox, validator);
        }
Пример #9
0
        internal static void AddDateTextBox(HtmlTable htmlTable, string resourceClassName, string columnName, string defaultValue, bool isNullable, string validatorCssClass, Assembly assembly, bool disabled)
        {
            if (htmlTable == null)
            {
                return;
            }

            if (string.IsNullOrWhiteSpace(columnName))
            {
                return;
            }

            string id = columnName + "_textbox";

            using (TextBox textBox = ScrudTextBox.GetTextBox(id, 100))
            {
                Net.Common.jQueryHelper.jQueryUI.AddjQueryUIDatePicker(null, id, null, null);

                string label = ScrudLocalizationHelper.GetResourceString(assembly, resourceClassName, columnName);

                textBox.Text     = GetLocalizedDate(defaultValue);
                textBox.ReadOnly = disabled;
                textBox.CssClass = "date";

                using (CompareValidator dateValidator = GetDateValidator(textBox, validatorCssClass))
                {
                    if (!isNullable)
                    {
                        using (RequiredFieldValidator required = ScrudFactoryHelper.GetRequiredFieldValidator(textBox, validatorCssClass))
                        {
                            ScrudFactoryHelper.AddRow(htmlTable, label + Titles.RequiredFieldIndicator, textBox, dateValidator, required);
                            return;
                        }
                    }

                    ScrudFactoryHelper.AddRow(htmlTable, label, textBox, dateValidator);
                }
            }
        }
Пример #10
0
        internal static void AddDecimalTextBox(HtmlTable htmlTable, string resourceClassName, string columnName, string defaultValue, bool isNullable, int maxLength, string domain, string errorCssClass, Assembly assembly, bool disabled)
        {
            using (TextBox textBox = ScrudTextBox.GetTextBox(columnName + "_textbox", maxLength))
            {
                string label = ScrudLocalizationHelper.GetResourceString(assembly, resourceClassName, columnName);

                using (CompareValidator validator = GetDecimalValidator(textBox, domain, errorCssClass))
                {
                    textBox.Text     = defaultValue;
                    textBox.ReadOnly = disabled;

                    if (!isNullable)
                    {
                        RequiredFieldValidator required = ScrudFactoryHelper.GetRequiredFieldValidator(textBox, errorCssClass);
                        ScrudFactoryHelper.AddRow(htmlTable, label + Titles.RequiredFieldIndicator, textBox, validator, required);
                        return;
                    }

                    ScrudFactoryHelper.AddRow(htmlTable, label, textBox, validator);
                }
            }
        }