Beispiel #1
0
        public static BaseFieldModel ToBaseField(this Field field)
        {
            BaseFieldModel _result = new BaseFieldModel();

            _result.Id           = field.Id;
            _result.FormId       = field.FormId;
            _result.FieldName    = field.FieldName;
            _result.CreatedDate  = field.CreatedDate;
            _result.ModifiedDate = field.ModifiedDate;
            return(_result);
        }
        public static Field ToField(this BaseFieldModel field)
        {
            Field _result = new Field();

            if (field.Id.HasValue)
            {
                _result.Id = field.Id.GetValueOrDefault();
            }
            _result.FormId       = field.FormId;
            _result.FieldName    = field.FieldName;
            _result.CreatedDate  = field.CreatedDate;
            _result.ModifiedDate = field.ModifiedDate;
            return(_result);
        }
Beispiel #3
0
            public void Initialise(List <RequestData> requestDataList = null)
            {
                dataModuleObj = DMFactory.GetDMObject(settings);
                PrepareCommonHiddenFields();
                BaseFieldModel model       = null;
                object         fieldType   = null;
                int            i           = 0;
                string         key         = null;
                RequestData    requestData = null;

                // clear all tabs
                Tabs.Clear();
                // set default tab orientation
                DefaultTabType = dataModuleObj.DefaultTabType;
                foreach (var mConfig in dataModuleObj.MConfigs)
                {
                    fieldType = mConfig.FieldType;
                    //get the matching requested data
                    if (!(requestDataList == null))
                    {
                        requestData = requestDataList.Find(x => x.FieldName == (mConfig.ConfigurationItem.DefaultName + mConfig.UniqueId) && x.TableName == mConfig.ConfigurationItem.TableName);
                        if (requestData != null)
                        {
                            string updatedValue = requestData.UpdatedValue;
                            setUpdatedValue(mConfig, updatedValue);
                        }
                    }
                    model = null;
                    //Dim pageTexts As Dictionary(Of String, String) = settings.PageTexts
                    switch ((DataType)fieldType)
                    {
                    case DataType.TEXT:
                        model = new TextBoxFieldModel(i, mConfig);
                        break;

                    case DataType.TEXTAREA:
                        model = new TextAreaFieldModel(i, mConfig);
                        break;

                    case DataType.DROPDOWN:
                        model = new DropdownFieldModel(i, mConfig);
                        break;

                    case DataType.BOOL:
                    case DataType.BOOL_10:
                    case DataType.BOOL_YN:
                        model = new BooleanFieldModel(i, mConfig);
                        break;

                    case DataType.LABEL:
                        model = new LabelFieldModel(i, mConfig);
                        break;
                    }
                    key = mConfig.TabHeader;
                    if (model != null)
                    {
                        if (!Tabs.ContainsKey(key))
                        {
                            Tabs.Add(key, new TabContentModel(key, i == 0 ? true : false));
                        }
                        Tabs[key].Add(model);
                    }
                    i++;
                }
                BackURL = dataModuleObj.BackUrl();
            }