public string CreateEditor(DocumentType documentType)
 {
     StringBuilder sb = new StringBuilder();
     foreach (var property in documentType.Properties)
     {
         sb.Append(registry.Lookup(property.Type).CreateEditor(property, ""));
     }
     return sb.ToString();
 }
 public string CreateEditor(DocumentType documentType, DocumentTranslation documentTranslation)
 {
     StringBuilder sb = new StringBuilder();
     foreach (var property in documentType.Properties)
     {
         if (documentTranslation.PropertyValues.ContainsKey(property))
         {
             sb.Append(registry.Lookup(property.Type).CreateEditor(property, documentTranslation.PropertyValues[property]));
         }
         else
         {
             sb.Append(registry.Lookup(property.Type).CreateEditor(property, ""));
         }
     }
     return sb.ToString();
 }
        public DocumentTranslation GetDocumentTranslation(DocumentType documentType, IDictionary<string, object> formValues)
        {
            DocumentTranslation translation = new DocumentTranslation();
            foreach (var item in documentType.Properties)
            {
                string key = "Property" + item.Name;
                if (!formValues.ContainsKey(key))
                {
                    translation.PropertyValues.Add(item, "");
                    continue;
                }

                if (item.IsFile)
                {
                    logger.Debug("This is file " + key);
                    HttpPostedFileBase file = formValues[key] as HttpPostedFileBase;
                    if (file == null || file.ContentLength == 0)
                    {
                        logger.Debug("File is null");
                        continue;
                    }

                    Resource resource = new Resource();
                    resource.OriginalFileName = Path.GetFileName(file.FileName);
                    resource.InputStream = file.InputStream;
                    resource.Group = "Image";
                    (item as ResourceProperty).Resource = resource;
                    translation.PropertyValues.Add(item, "");
                }
                else
                {
                    translation.PropertyValues.Add(item, formValues[key] as string);
                }
            }
            return translation;
        }
 public static HtmlString RenderDocumentTranslationEditor(this HtmlHelper htmlHelper, DocumentType documentType, DocumentTranslation documentTranslation)
 {
     return new HtmlString(ServiceFactory.Get<IDocumentTranslationEditor>().CreateEditor(documentType, documentTranslation));
 }