public ExportEventArgs(ExportType type, IExportElement document, bool sendByEmail, string fileName)
        {
            Settings = new ExportSettings();
            SetTitle(fileName);
            ExportType = type;
            SendByEmail = sendByEmail;

            ExportDocument(document);
        }
Ejemplo n.º 2
0
        public ExportEventArgs(ExportType type, IExportElement document, bool sendByEmail, string fileName)
        {
            Settings = new ExportSettings();
            SetTitle(fileName);
            ExportType  = type;
            SendByEmail = sendByEmail;

            ExportDocument(document);
        }
Ejemplo n.º 3
0
        public ExportFactory(Document doc, IExportElement exportHandle)
        {
            if (exportHandle == null || doc == null)
            {
                throw new NullReferenceException("exportHandle or doc parameter is null reference !!");
            }

            m_ExportLevel  = 5;
            m_Document     = doc;
            m_ExportHandle = exportHandle;
        }
Ejemplo n.º 4
0
        private void ExportDocument(IExportElement document)
        {
            ExportVisitor visitor;

            if (ExportType == ExportType.Html || ExportType == ExportType.Pdf)
            {
                visitor = new HtmlExportVisitor();
            }
            else
            {
                visitor = new CsvExportVisitor();
            }
            document.ExportTo(visitor);
            Document = visitor.GetResult();
        }
Ejemplo n.º 5
0
 public void ExportElement(IExportElement element, DataSet ds)
 {
     Type type = element.GetType();
     DataTable dt = ds.Tables[type.Name];
     if (dt == null)
     {
         throw new Exception("数据集中找不到对应表:" + type.Name);
     }
     DataRow dr = dt.NewRow();
     PropertyInfo[] props = type.GetProperties();
     if (props == null || props.Length == 0)
     {
         return;
     }
     foreach (PropertyInfo pro in props)
     {
         if (IsExport(pro))
         {
             FillDataColumn(pro, dr, element);
         }
     }
     dt.Rows.Add(dr);
 }
 public void Add(IExportElement element)
 {
     _Elements.Add(element);
 }
Ejemplo n.º 7
0
 private void FillDataColumn(PropertyInfo p, DataRow dr, IExportElement element)
 {
     dr[p.Name] = p.GetValue(element, null);
 }
Ejemplo n.º 8
0
 private void SetProperty(string propName, object value, IExportElement element)
 {
     try
     {
         PropertyInfo pro = element.GetType().GetProperty(propName);
         if (pro != null)
         {
             pro.SetValue(element, value, null);
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Ejemplo n.º 9
0
 private void FillCustom(CustomElement custom, IExportElement data)
 {
     PropertyInfo[] props = data.GetType().GetProperties();
     foreach (PropertyInfo prop in props)
     {
         PropertyInfo prop1 = custom.GetType().GetProperty(prop.Name);
         if (prop1 != null)
         {
             prop.SetValue(data, prop1.GetValue(custom), null);
         }
     }
 }
 private void ExportDocument(IExportElement document)
 {
     ExportVisitor visitor;
     if (ExportType == ExportType.Html || ExportType == ExportType.Pdf)
     {
         visitor = new HtmlExportVisitor();
     }
     else
     {
         visitor = new CsvExportVisitor();
     }
     document.ExportTo(visitor);
     Document = visitor.GetResult();
 }
 public void Add(IExportElement element)
 {
     _Elements.Add(element);
 }