private void button1_Click(object sender, EventArgs e)
        {
            string html_filename = Basic_HTB_Info.baseFilePath + "\\temp\\" + String.Format("{0}_{1}.htm", psi_id, pitem);
            Field_Html_Print h_o = null;
            Field_Html_Print h_o_xls = null;
            if (prcx == "RCFJH") 
            {
                h_o = new FieldJH_Html_Print(psi_id, pitem, prcx, conn, html_filename,new RC_F_GR(),false);
                h_o_xls = new FieldJH_Html_Print(psi_id, pitem, prcx, conn, html_filename.Replace(".htm",".xls"), new RC_F_GR(), false);
            }
            else
            {
                h_o=new Field_Html_Print(psi_id, pitem, prcx, conn, html_filename,new RC_F_GR(),false);
                h_o_xls = new Field_Html_Print(psi_id, pitem, prcx, conn, html_filename.Replace(".htm",".xls"), new RC_F_GR(), false);
            }
            Form_RC_OUT_RESULT out_r = new Form_RC_OUT_RESULT(h_o.html_filename);
            out_r.MdiParent = this.MdiParent;
            out_r.Show();
            FileInfo info = new FileInfo(html_filename);
            FileInfo info_xls = new FileInfo(html_filename.Replace(".htm",".xls"));
            if (info.Exists)
            {
                if (MessageBox.Show("是否公布名單?", "", MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    info.CopyTo(Basic_HTB_Info.cfg.report_to_public + string.Format("\\{0}名單.htm", pitem), true);
                    info_xls.CopyTo(Basic_HTB_Info.cfg.report_to_public + string.Format("\\{0}名單.xls", pitem), true);
                }
                // MessageBox.Show("檔案CopyTo Temp");
            }

        }
Exemplo n.º 2
0
 private void DownXls_F_ITEM_NAME(String extra_filename)
 {
     FolderBrowserDialog fbd = new FolderBrowserDialog();
     fbd.SelectedPath = Basic_HTB_Info.cfg.TempdataKey("path1");
     if (fbd.ShowDialog() == DialogResult.OK)
     {
         Basic_HTB_Info.cfg.tempdata["path1"] = fbd.SelectedPath;
         MPPFORM.ListBoxForm lbf = new MPPFORM.ListBoxForm();
         using (OdbcConnection conn = new OdbcConnection(Basic_HTB_Info.Conn_Str))
         {
             conn.Open();
             OdbcDataReader dr = new OdbcCommand("select fi_id,f_item,rcx from field_item;", conn).ExecuteReader();
             while (dr.Read())
             {
                 lbf.lb.Items.Add(String.Format("{0}:{1}:{2}", dr[0], dr[1], dr[2]));
             }
             if (lbf.ShowDialog() == DialogResult.OK)
             {
                 foreach (string s in lbf.lb.CheckedItems)
                 {
                     string[] s_ar = s.Split(':');
                     string si_id = s_ar[0];
                     string item = s_ar[1];
                     string rcx = s_ar[2];
                     if (item.Contains("跳高"))
                     {
                         string f_name = String.Format("{0}\\{1}.{2}", fbd.SelectedPath, item, extra_filename);
                         Field_Html_Print rc_html_p = new FieldJH_Html_Print(si_id, item, rcx, conn, f_name,new RC_F_GR(),false);
                     }
                     else
                     {
                         string f_name = String.Format("{0}\\{1}.{2}", fbd.SelectedPath, item, extra_filename);
                         Field_Html_Print rc_html_p = new Field_Html_Print(si_id, item, rcx, conn, f_name,new RC_F_GR(),false);
                     }
                 }
             }
             conn.Close();
         }
     }
 }
        private void Form_Input_RC_Client_FormClosed(object sender, FormClosedEventArgs e)
        {
            if (Basic_HTB_Info.cfg.temp_dir != null)
            {
                Field_Html_Print h_o = null;
                string html_filename = Basic_HTB_Info.cfg.temp_dir + "\\" + String.Format("{0}_{1}.htm", psi_id, pitem);
                if (prcx == "RCFJH")
                {
                    h_o = new FieldJH_Html_Print(psi_id, pitem, prcx, conn, html_filename, new RC_F_GR(), false);
                }
                else
                {
                    h_o = new Field_Html_Print(psi_id, pitem, prcx, conn, html_filename, new RC_F_GR(), false);
                }

                
                try
                {
                    String url = "ftp://" + Basic_HTB_Info.cfg.DB_HOST + "/" + String.Format("{0}_{1}.htm", psi_id, pitem);
                    MPPNET.MPPFtp.ftp_up_file(url, h_o.html_filename, "sportday", "701100", Encoding.GetEncoding(950));
                }
                catch (Exception ftp_e)
                {
                    MessageBox.Show(ftp_e.Message + ":多於一個用戶登入;");
                }
                Form_RC_OUT_RESULT out_r = new Form_RC_OUT_RESULT(h_o.html_filename);
                out_r.MdiParent = this.MdiParent;
                out_r.Show();
            }
            
            if (conn != null)
            {
                if (conn.State == ConnectionState.Open)
                {
                    conn.Close();
                    conn.Dispose();
                }
            }
        }