コード例 #1
0
        public static string FieldToHtml(SignFieldsModel field) 
        {
            var html = "";
            
            var tpe = (field.Type != null) ? field.Type : "textfield";

            switch (tpe)
            {
                
                case "textfield":                    
                    var txt = new TextFields(field.Name, field.Label, field.Required);                    
                    html += txt.GetHtml();                    
                    break;

                case "civilite":
                    var cv = new CiviliteField(field.Name, field.Label, field.Required);
                    html += cv.GetHtml();
                    break;

                case "checkbox":
                    var chk = new CheckBox(field.Name, field.Label);
                    html += chk.GetHtml();
                    break;

                case "radio":
                    var rad = new Radio(field.Name, field.Label);
                    html += rad.GetHtml();
                    break;

                case "textarea":
                    var area = new TextArea(field.Name, field.Label, field.Required);
                    html += area.GetHtml();
                    break;

                case "ibanfield":
                    var iban = new IbanField(field.Name, field.Label, field.Required);
                    html += iban.GetHtml();
                    break;
                    
            }

            return html;
        }
コード例 #2
0
        public static Fields FieldModelToEntity(SignFieldsModel model)
        {
            var entity = new Fields {                
                NameKey = model.Name,
                Label = model.Label,
                Type = model.Type,
                IsShared = model.IsShared,
                DateCreated = model.DateCreated,
                Order = model.Order,
                Required = model.Required
            };
            if (model.IdField != null) entity.IdField = model.IdField.GetValueOrDefault();
            if (model.IdDocumentModel != null) entity.IdDocumentModel = model.IdDocumentModel.GetValueOrDefault();
            if (model.IdDocumentSection != null) entity.IdDocumentSection = model.IdDocumentSection.GetValueOrDefault();

            return entity;
        }
コード例 #3
0
 public static SignFieldsModel FieldEntityToModel(Fields entity, bool readOnly = false)
 {
     int idInt;
     int.TryParse(entity.IdField.ToString(), out idInt);
     var model = new SignFieldsModel {
         IdField = idInt,
         IdDocumentModel = entity.IdDocumentModel,
         IdDocumentSection = entity.IdDocumentSection,
         Name = entity.NameKey,
         Label = entity.Label,
         Type = entity.Type,
         IsShared = entity.IsShared,
         DateCreated = entity.DateCreated.GetValueOrDefault(),
         Required = entity.Required.GetValueOrDefault(),
         Order = entity.Order,
         IsReadOnly = readOnly
     };
     return model;
 }
コード例 #4
0
 private static void SetReadOnlyFields(ref SignFieldsModel field) 
 {
     field.IsReadOnly = true;
 }