Cs/PrinterGateway.cs

(开头部分) 2KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Reflection;
using Printer.Cs.EntityConfig;
using System.Data;
namespace Printer.Cs
{
    public sealed class PrinterGateway
    {
        public static PrinterGateway Default;

        #region 打印方法
        public void Printer<EntityType>(EntityType obj, string text, string caption) where EntityType : EntityConfigBase
        {
            PrinterHelper printerHelper = new PrinterHelper();
            if (!string.IsNullOrEmpty(text) && !string.IsNullOrEmpty(caption))
            {
                printerHelper.StartPrint(obj, text, caption);
            }
            else
            {
                printerHelper.StartPrint(obj);
            }
        }

        public void Printer<EntityType>(EntityType obj) where EntityType : EntityConfigBase
        {
            Printer<EntityType>(obj, string.Empty, string.Empty);
        }
        #endregion

        #region 赋值方法

        public void FillData<EntityType>(EntityType obj, DataRow row) where EntityType : EntityConfigBase
        {
            PropertyInfo[] properties = obj.GetType().GetProperties();
            foreach (DataColumn Column in row.Table.Columns)
            {
                foreach (PropertyInfo p in properties)
                {
                    if (p.Name.ToUpper() == Column.ColumnName.ToUpper())
                    {
                        if (Column.ColumnName.ToUpper() == "FJ")
                        {
                            p.SetValue(obj, GetNoteList(Convert.ToString(row[Column.ColumnName])), null);
                        }
                        else
                        {
                            if (row[Column.ColumnName] != null)
                            {
                                p.SetValue(obj, Convert.ToString(row[Column.ColumnName]), null);
                            }
                        }
                        break;
                    }
                }
            }
        }
后面还有 23 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。