コード例 #1
0
        private void BtnImportJudeg_Click(object sender, RoutedEventArgs e)
        {
            var ofd = FileDialogFactory.GetOFD(DataFileInfo.ExcelSAndTxtFilter);

            if (!(bool)ofd.ShowDialog())
            {
                return;
            }
            DataTable dt = null;

            switch (ofd.FilterIndex)
            {
            case 1:
            case 2: dt = ExcelIO.Read(ofd.FileName); break;

            case 3: dt = TxtIO.Read(ofd.FileName, ','); break;

            default: return;
            }
            if (dt == null)
            {
                return;
            }
            updateJudgeContext(new JudgeListViewModel(dt));
            FadeInOutTextBlockHelper.MakeFadeInOut(greenPromptTB, "导入成功");
        }
コード例 #2
0
        protected void btnInstall_Click(object sender, EventArgs e)
        {
            string ip = txtIP.Text.Trim();
            string user = txtDbUsername.Text.Trim();
            string pwd = txtDbPwd.Text.Trim();
            string dbName = txtDbName.Text.Trim(), dbName2 = txtDbName2.Text.Trim();
            string dbVersion = ddlVersion.SelectedValue;
            string constr    = "";

            //链接数据库,执行脚本
            if (dbName2 != "")
            {
                constr = "data source=" + ip + "\\" + dbName2 + ";uid=" + user + ";pwd=" + pwd + ";database=" + dbName + "";    // 定义链接字符窜
            }
            else
            {
                constr = "data source=" + ip + ";uid=" + user + ";pwd=" + pwd + ";database=" + dbName + "";
            }
            SqlConnection conn = new SqlConnection(constr);

            conn.Open();
            SqlCommand cmd = new SqlCommand();

            cmd.Connection = conn;
            //ArrayList Lists = ExecuteSqlFile(Server.MapPath("../DB/MianDB.sql")); //调用ExecuteSqlFile()方法,反回 ArrayList对象;

            ArrayList Lists = ExecuteSqlFile(Server.MapPath("../DB/" + dbVersion)); //调用ExecuteSqlFile()方法,反回 ArrayList对象;


            string teststr;                           //定义遍历ArrayList 的变量;

            foreach (string varcommandText in Lists)
            {
                teststr = varcommandText;             //遍历并符值;
                //Response.Write(teststr + "|@|<br>");
                cmd.CommandText = teststr;            //为SqlCommand赋Sql语句;
                cmd.ExecuteNonQuery();                //执行
            }
            conn.Close();



            TxtIO.writeFile(logFile, "安装完成");
            if (!TxtIO.writeFile("../DB/conn.txt", constr))
            {
                Response.Write("conn写入失败<br>");
            }
            Response.Write("执行完毕,安装完成,<a href='../Admin/Login.aspx'>进入后台管理</a>");
            Response.End();
        }
コード例 #3
0
        private void BtnExport_Click(object sender, RoutedEventArgs e)
        {
            var sfd = FileDialogFactory.GetSFD(DataFileInfo.ExcelSAndTxtFilter);

            if (!(bool)sfd.ShowDialog())
            {
                return;
            }
            switch (sfd.FilterIndex)
            {
            case 1:
            case 2: ExcelIO.Write(sfd.FileName, rlvm.Table); break;

            case 3: TxtIO.Write(sfd.FileName, rlvm.Table, ','); break;

            default: return;
            }
        }
コード例 #4
0
        private void BtnExport_Click(object sender, RoutedEventArgs e)
        {
            var sfd = FileDialogFactory.GetSFD(DataFileInfo.ExcelSAndTxtFilter);

            if (!(bool)sfd.ShowDialog())
            {
                return;
            }
            switch (sfd.FilterIndex)
            {
            case 1:
            case 2: ExcelIO.Write(sfd.FileName, glvm.Table); break;

            case 3: TxtIO.Write(sfd.FileName, glvm.Table, ','); break;

            default: return;
            }
            FadeInOutTextBlockHelper.MakeFadeInOut(greenPromptTB, "导出成功");
        }