Пример #1
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";

            string path     = context.Server.MapPath("upload");
            string fileName = string.Format(@"{0}\{1}\{2}", path, "groupTrailDate", context.Request.QueryString["filename"]);

            key = System.IO.Path.GetFileName(fileName);

            HttpRuntime.Cache[this.key] = "";


            string projectCode = "";
            string taskCode    = "";
            string scriptCode  = "";
            string userId      = context.Request.QueryString["userid"];   // "4028b48152632a160152635092f7000e";
            string userName    = context.Request.QueryString["username"]; //"shaozj";
            int    times       = 0;

            string[] t1 = System.IO.Path.GetFileNameWithoutExtension(fileName).Split('@');

            // 能够解开
            if (t1.Length > 1)
            {
                string[] t2 = t1[1].Split(',');
                if (t2.Length > 3)
                {
                    projectCode = t2[0];
                    taskCode    = t2[1];
                    scriptCode  = t2[2];
                    int.TryParse(t2[3], out times);
                }

                BetchLogic bl = new BetchLogic(
                    userId, userName,
                    projectCode, taskCode, scriptCode, times, fileName);

                bl.CompleteEvent += Bl_CompleteEvent;
                bl.MessageEvent  += Bl_MessageEvent;

                //if (bl.init())
                //{
                //    bl.run();

                //}


                Thread thread = new Thread(new ThreadStart(() =>
                {
                    if (bl.init())
                    {
                        bl.run();
                    }
                }));

                thread.Start();

                context.Response.Write("run");
            }
        }
Пример #2
0
        static void Main(string[] args)
        {
            //WriteLog100W.Write();
            string dbPath = @"C:\sql\db格式数据示例.db";

            //SQLiteHelper sh = new SQLiteHelper(dbPath);
            //var r = SQLiteImportHelper.GetDataTable(dbPath);

            //string fileName = @"E:\work\wuxi\db.db";

            try
            {
                string     fileName    = @"c:\db.db";
                string     userName    = "******";
                string     userId      = "4028b48152632a160152635092f7000e";
                string     projectCode = "tdm2test";
                string     taskCode    = "1.1.1.2";
                string     scriptCode  = "trainGroup2019002";
                int        times       = 3;
                BetchLogic bl          = new BetchLogic(
                    userId, userName,
                    projectCode, taskCode, scriptCode, times, fileName);

                if (bl.init())
                {
                    bl.run();

                    Console.WriteLine("完成了");
                }
            }
            catch (System.Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }

            Console.ReadLine();
        }