Exemple #1
0
        public void SetContentData(IEnumerable <ColumnField> fields, ContentData form)
        {
            AddFieldAndValue("Num", form.Num);
            AddFieldAndValue("CreateDate", form.CreateDate);
            AddFieldAndValue("UpdateDate", form.UpdateDate);
            AddFieldAndValue("CreateAccountNum", form.CreateAccountNum);
            AddFieldAndValue("UpdateAccountNum", form.UpdateAccountNum);
            AddFieldAndValue("IsDel", form.IsDel);
            AddFieldAndValue("Status", form.Status);
            AddFieldAndValue("SiteNum", form.SiteNum);
            AddFieldAndValue("ColumnNum", form.ColumnNum);
            AddFieldAndValue("CategoryNum", form.CategoryNum);
            AddFieldAndValue("SeoTitle", form.SeoTitle);
            AddFieldAndValue("SeoKeyword", form.SeoKeyword);
            AddFieldAndValue("SeoDesc", form.SeoDesc);
            AddFieldAndValue("ClickCount", form.ClickCount);
            AddFieldAndValue("IsTop", form.IsTop);

            foreach (var columnField in fields)
            {
                var formFieldName = columnField.Name.ToFieldNameLower();
                var value         = form.ContainsKey(formFieldName) ? form[formFieldName] : "";

                switch (columnField.OptionType)
                {
                case ReactFormItemType.Input:
                case ReactFormItemType.Editor:
                case ReactFormItemType.TextArea:
                case ReactFormItemType.Select:
                case ReactFormItemType.Upload:
                case ReactFormItemType.Tags:
                case ReactFormItemType.Cascader:
                    AddFieldAndValue(columnField.Name, value.ToStr());
                    break;

                case ReactFormItemType.Password:
                    AddFieldAndValue(columnField.Name, Md5Helper.GetMD5_32(value.ToStr()));
                    break;

                case ReactFormItemType.Switch:
                    break;

                case ReactFormItemType.Radio:
                    break;

                case ReactFormItemType.CheckBox:
                    break;

                case ReactFormItemType.DataPicker:
                    break;

                case ReactFormItemType.RangePicker:
                    break;

                case ReactFormItemType.Region:
                    break;

                default:
                    throw new Exception("无处理分类逻辑");
                }
            }
        }