Пример #1
0
        private void LoadForm()
        {
            DataTable dt, dtElements = new DataTable();
            int       _componentID;

            dt = dataForm.GetForm(FormID);
            foreach (DataRow dr in dt.Rows)
            {
                FormNumber      = dr.IsNull("Code") == true ? "" : dr.Field <string>("Code");
                FormName        = dr.IsNull("Name") == true ? "" : dr.Field <string>("Name");
                FormDescription = dr.IsNull("Description") == true ? "" : dr.Field <string>("Description");
                Category        = dr.IsNull("Category") == true ? "" : dr.Field <string>("Category");
                _componentID    = dr.IsNull("FormComponentID") == true ? -1 : dr.Field <int>("FormComponentID");
            }
            dtElements = dt.DefaultView.ToTable(true, "elementid", "elementtype", "title", "code", "Mode", "elementattribute");
            foreach (DataRow dr in dtElements.Rows)
            {
                int         _elementid  = dr.IsNull("elementid") == true ? -1 : dr.Field <int>("elementid");
                FormElement formElement = FormElement.Instance(FormID, _elementid);
                formElement.FormID      = this.FormID;
                formElement.ElementID   = dr.IsNull("elementid") == true ? -1 : dr.Field <int>("elementid");
                formElement.Type        = dr.IsNull("elementtype") == true ? ElementType._form : dr.Field <ElementType>("elementtype");
                formElement.Title       = dr.IsNull("title") == true ? "" : dr.Field <string>("title");
                formElement.Code        = dr.IsNull("code") == true ? "" : dr.Field <string>("code");
                formElement.Mode        = dr.IsNull("Mode") == true ? FormMode._readonly : dr.Field <FormMode>("Mode");
                formElement.ComponentID = dr.IsNull("ComponentID") == true ? -1 : dr.Field <int>("ComponentID");
                List <ElementAttribute> _elementAttributes = dr.IsNull("elementattribute") == true ? new List <ElementAttribute>() :
                                                             Newtonsoft.Json.JsonConvert.DeserializeObject <List <ElementAttribute> >(dr.Field <string>("elementattribute"));
                foreach (ElementAttribute em in _elementAttributes)
                {
                    formElement.AddElementAttribute(em);
                }
                this.Add(formElement);
            }
        }
Пример #2
0
        public override FormElement Add(int formID, ElementType type, string title, string code, FormMode mode)
        {
            FormElement fm = FormElement.Instance(formID, type, title, code, mode);

            FormElements.Add(fm);
            return(fm);
        }
Пример #3
0
 public abstract FormElement Add(FormElement formElement);
Пример #4
0
 public override FormElement Add(FormElement formElement)
 {
     FormElements.Add(formElement);
     return(formElement);
 }