Beispiel #1
0
        /// <summary>
        /// 实体类转dt等
        /// </summary>
        private static void aa()
        {
            ModelHandler <tksys> mh = new ModelHandler <tksys>();
            tkuser user             = new tkuser()
            {
                LoginName = "aa",
                Mail      = "dgae",
                Name      = "gegg"
            };
            tksys sys = new tksys()
            {
                ClickCount  = 0,
                Content     = "dagdafafd",
                DivName     = "agdafe",
                Explain     = "",
                ID          = 1,
                PublishDate = DateTime.Now,
                Link        = "fadfa",
                Poupose     = "agefda",
                Title       = "agefadfae",
                Type        = 1,
                UpdateCount = 0,
                user        = user
            };
            List <tksys> syss = new List <tksys>();

            syss.Add(sys);
            DataTable dt = mh.FillDataTable(syss);

            for (int i = 0; i <= dt.Rows.Count; i++)
            {
                Console.WriteLine(dt.Rows[0][i].ToString());
            }
            Console.WriteLine("Pause");
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            int int16 = 0x000014221E;

            Console.WriteLine(HexStringToASCII(int16.ToString()));
            Console.ReadKey();
            return;

            Expression <Func <int, bool> > funcExpression = num => num == 0;

            //开始解析 funcExpression 表达式
            ParameterExpression pExpression = funcExpression.Parameters[0];          //lambda 表达式参数
            BinaryExpression    body        = (BinaryExpression)funcExpression.Body; //lambda 表达式主体:num == 0

            Console.WriteLine($"解析:{pExpression.Name} => {body.Left} {body.NodeType} {body.Right}");

            //创建表达式树
            Expression <Action <int> >          actionExpression = n => Console.WriteLine(n);
            Expression <Func <int, bool> >      funcExpression1  = (n) => n < 0;
            Expression <Func <int, int, bool> > funcExpression2  = (n, m) => n - m == 0;


            int[] numbers = { 5, 4, 1, 3, 9, 8, 6, 7, 2, 0 };
            //此示例展示了如何通过将输入参数括在括号中来指定多个输入参数。
            var firstSmallNumbers = numbers.TakeWhile((n, index) => n >= index);

            //下面一行代码将生成一个序列,其中包含 numbers 数组中在 9 左侧的所有元素,因为它是序列中第一个不满足条件的数字:
            var firstNumbersLessThan6 = numbers.TakeWhile(n => n < 6);

            //此处显示了一个标准查询运算符,Count<TSource> 方法: (该参数类型为 Expression<Func> )
            int oddNumbers = numbers.Count(n => n % 2 == 1);

            // 当调用下面的 Func 委托时,该委托将返回 true 或 false 以指示输入参数是否等于 5:
            Func <int, bool> myFunc   = x => x == 5;
            bool             myFuncRe = myFunc(4);


            return;

            CGSopt cg = new CGSopt();

            cg.ReadCGS();
            return;

            FierBli npoi_test = new FierBli("C:/Users/s2903/Desktop/xx.xls");

            npoi_test.AddNewSheet("xx");

            return;



            TTT ttt1 = new TTT();
            var sst  = ttt1.Getay();

            return;

            DataTableOpr.Aida();

            return;

            TTT ttt = new TTT();

            #region 其他测试

            return;

            DlgTest dlg = new DlgTest();
            //BugTicketEventHandler bg = new BugTicketEventHandler(dlg.BugTicket);
            dlg.BugTicket(1, "xx");//
            //TODO: 未实现
            return;

            return;

            string[] vvs = new string[3];
            // ("xx", "vv", "zz")
            return;

            string xcrr = "{\"d\":\"[{\"Ent_Cnt\":\"8\",\"Ent_Comp\":\"0\",\"Ent_No\":\"0\"},{\"Ent_Cnt\":\"4\",\"Ent_Comp\":\"0\",\"Ent_No\":\"0\"}]\"}";
            xcrr = xcrr.Substring(0, xcrr.LastIndexOf("]") + 1);
            xcrr = xcrr.Substring(xcrr.IndexOf("["));

            string xx = string.Format("{0:E2}", 2);
            Console.WriteLine(xx);
            return;


            string tb = "KTL_KG001_DC_USERS_201605";
            tb = tb.Substring(tb.LastIndexOf("_") + 1);
            Console.WriteLine(tb);
            return;

            string sqar = GetQuar("20160522");
            Console.WriteLine(sqar);
            Console.ReadKey();
            return;

            //Test.gtest();
            Test.ymdiv("201603", "201605");
            return;


            double Balance       = 0;
            double Rate          = 0;
            int    Year          = 0;
            double TargetBalance = 0;
            Console.WriteLine("请输入你的本金");
            Balance = double.Parse(Console.ReadLine());
            Console.WriteLine("请输入当前的利率百分比");
            Rate = double.Parse(Console.ReadLine());
            Console.WriteLine("请输入你的目标收益");
            TargetBalance = double.Parse(Console.ReadLine());
            do
            {
                Balance *= (Rate / 100 + 1);
                Year++;
            }while(Balance < TargetBalance);
            Console.WriteLine("您将在{0}年内,获得{1}元的收益", Year, Balance);
            Console.ReadKey();



            return;

            tksys  t   = new tksys();
            string sql = t.Query();
            return;

            //pp();
            //return;
            //GuessAge();
            FindPass();

            return;

            OdbcConnection DB2Connection = new OdbcConnection("Driver={IBM DB2 ODBC DRIVER};Database=MT_GY;hostname=221.182.121.126;port=50000;protocol=TCPIP; uid=MT_GY; pwd=Gy###321");

            DB2Connection.Open();

            return;

            string encrypt = "356A192B7913B04C54574D18C28D46E6395428AB";//=1
            string voter, key;
            Utility.SymmetricEncryptor se = new Utility.SymmetricEncryptor(encrypt, encrypt);

            string Uentrypt = se.Decrypt(encrypt);

            Console.WriteLine(encrypt);
            Console.WriteLine(Uentrypt);
            Console.ReadKey();
            return;

            //
            string id = "I12345";
            id = id.Substring(0, 0);// id.Length - 1

            Console.WriteLine(id);
            Console.ReadKey();
            return;

            string a = "PZH_IBAS";
            a = a.Substring(0, a.IndexOf("_"));
            Console.WriteLine(a);
            Console.ReadKey();
            System.Diagnostics.EventLog.WriteEntry("tariff_detail_dt" + DateTime.Now.ToString("yyyyMMddHH24mmss"), "明细:", System.Diagnostics.EventLogEntryType.Information);

            return;

            Testdate dt = new Testdate();
            dt.bb();
            return;

            //aa();
            //testnpoi();
            string b = "ass";
            int    i = 0;
            //reftest(ref i, out b);
            Assembly assembly = Assembly.Load("ConsoleApplication1");
            Type     type     = assembly.GetType("Example");
            object   o        = Activator.CreateInstance(type);
            Console.WriteLine(i.ToString() + "," + b + "," + o.ToString());

            #endregion
        }