public JabberFormItem(FormItemType intType, string strName, string strTitle, bool blnRequired)
 {
     Type = intType;
     Name = strName;
     Title = strTitle;
     IsRequired = blnRequired;
 }
示例#2
0
 public static FormItemType StringToFormItemType(String s)
 {
     try
     {
         FormItemType type = (FormItemType)Enum.Parse(typeof(FormItemType), s, true);
         return(type);
     }
     catch
     {
         Debug.WriteLine("Fehler beim Parsen von String zu FormItemType: " + s);
         return(FormItemType.Subheader);
     }
 }
示例#3
0
        public override FrameworkElement getFrameworkElementFromItem(FormItem item, PhoneApplicationPage sender)
        {
            FormPage = (EditPage)sender;
            try
            {
                FormItemType type = EnumerationMatcher.StringToFormItemType(item.ControlType);

                switch (type)
                {
                case FormItemType.Subheader:
                    return(giveMeATextBlock(item));

                case FormItemType.TextBox:
                    return(giveMeATextBoxOrTextBlock(item));

                case FormItemType.ListPicker:
                    return(giveMeAListPicker(item));

                case FormItemType.Photo:
                    return(giveMeAPhotoButton(item));

                case FormItemType.CheckBox:
                    return(giveMeACheckBox(item));

                case FormItemType.PageLink:
                    return(giveMeAPageLink(item));

                case FormItemType.Listing:
                    return(giveMeAList(item));
                }
                return(null);
            }
            catch
            {
                return(null);
            }
        }
        public override FrameworkElement getFrameworkElementFromItem(FormItem item, PhoneApplicationPage sender)
        {
            SignPage = (SignPages)sender;
            try
            {
                FormItemType type = EnumerationMatcher.StringToFormItemType(item.ControlType);

                switch (type)
                {
                case FormItemType.Header:
                    return(giveMeAHeader(item));

                case FormItemType.Subheader:
                    return(giveMeASubheader(item));

                case FormItemType.TextBox:
                    return(giveMeATextBoxAsTextBlock(item));

                case FormItemType.ListPicker:
                    return(giveMeATextBoxAsTextBlock(item));

                case FormItemType.Photo:
                    return(giveMeAPhoto(item));

                case FormItemType.CheckBox:
                    return(giveMeACheckedCheckBox(item));

                case FormItemType.Listing:
                    return(giveMeASignableList(item));
                }
                return(null);
            }
            catch
            {
                return(null);
            }
        }
示例#5
0
        /// <summary>
        /// 添加列信息
        /// </summary>
        /// <param name="name"></param>
        /// <param name="formItemType"></param>
        /// <param name="desc"></param>
        /// <param name="isPrimaryKey"></param>
        /// <param name="isSystem"></param>
        /// <param name="sort"></param>
        /// <returns></returns>
        public ColumnInfo AddColumnInfo(string name, FormItemType formItemType, string desc, bool isPrimaryKey, bool isSystem, int sort = 0)
        {
            name = name.Replace(" ", ""); //去空格处理

            #region 数据校验
            if (string.IsNullOrEmpty(name))
            {
                throw new MyFX.Core.Exceptions.DomainException("添加失败,列名不能为空");
            }

            if (this.CheckColumnExist(name))
            {
                throw new MyFX.Core.Exceptions.DomainException(string.Format("添加失败,已存在相同的列[{0}]", name));
            }

            if (isPrimaryKey && this.CheckPrimaryKey())
            {
                throw new MyFX.Core.Exceptions.DomainException(string.Format("不能将[{0}]设为主键列,主键列已存在", name));
            }
            #endregion

            ColumnInfo info = new ColumnInfo();
            info.Name         = name;
            info.Desc         = desc;
            info.IsPrimaryKey = isPrimaryKey;
            info.IsSystem     = isSystem;
            info.FormItemType = formItemType;

            #region 适配表单项
            switch (formItemType)
            {
            case FormItemType.Text:
                info.Type = "nvarchar(200)";
                break;

            case FormItemType.BigText:
                info.Type = "nvarchar(4000)";
                break;

            case FormItemType.Number:
                info.Type = "int";
                break;

            case FormItemType.Double:
                info.Type = "double";
                break;

            case FormItemType.DateTime:
                info.Type = "datetime";
                break;

            case FormItemType.Money:
                info.Type = "decimal";
                break;

            case FormItemType.RadioButtonList:
                info.Type = "nvarchar(50)";
                break;

            case FormItemType.CheckBoxList:
                info.Type = "nvarchar(50)";
                break;

            case FormItemType.DropDownList:
                info.Type = "nvarchar(50)";
                break;

            case FormItemType.Image:
                info.Type = "nvarchar(200)";
                break;

            case FormItemType.File:
                info.Type = "nvarchar(200)";
                break;

            default:
                throw new MyFX.Core.Exceptions.DomainException("不支持的表单项类型");
            }
            #endregion

            #region 设置排序值
            info.Sort = sort <= 0 ? GetMaxSort() + 1 : sort;
            #endregion

            _columnInfos.Add(info);
            return(info);
        }