Example #1
0
 private void button1_Click(object sender, EventArgs e)
 {
     FinData.FxjData fxj = new  FinData.FxjData();
     if (dataType.Text.Trim() == "")
     {
         MessageBox.Show("��ѡ����������!", "��Ϣ");
         return;
     }
     try
     {
         string callText;
         string dt = dataType.Text.Split('-')[0];
         if (newFileName.Text == "")
         {
             dataArray = fxj.GetData(dt, code.Text,Convert.ToInt32(cboRecordCount.Text.Trim()));
             callText = "fxjdata.GetData(\"" + dt + "\",\"" + code.Text.Trim() + "\",\""+cboRecordCount.Text.Trim()+"\")";
         }
         else
         {
             dataArray = fxj.GetData(dt, code.Text, newFileName.Text,Convert.ToInt32(cboRecordCount.Text.Trim()));
             callText = "fxjdata.GetData(\"" + dt + "\",\"" + code.Text.Trim() + "\",\"" + newFileName.Text.Trim() + "\",\"" + cboRecordCount.Text.Trim() + "\")";
         }
         //statusStrip1.Text = fxj.Msg;
         if (fxj.Error == 0 && dataArray.GetLength(0) > 0)
         {
             string[,] colname = fxj.GetFields(dt);
             dataGridView.DataSource = new ArrayDataView(dataArray);
             for (int i = 0; i < dataGridView.Rows.Count; i++)
             {
                 dataGridView.Rows[i].HeaderCell.Value = (i+1).ToString().Trim();
             }
             if (colname.GetLength(0) == dataGridView.Columns.Count)
             {
                 for (int i = 0; i < colname.GetLength(0); i++)
                 {
                     dataGridView.Columns[i].HeaderText = colname[i, 0] + "(" + colname[i, 1] + ")";
                 }
             }
             methodText.Text = callText;
         }
         else
         {
             methodText.Text = "";
             MessageBox.Show("û�����ݻ�������" + fxj.Msg);
         }
     }
     catch (Exception ex)
     {
         methodText.Text = "";
         MessageBox.Show(ex.Message);
     }
 }
Example #2
0
 private void button1_Click(object sender, EventArgs e)
 {
     FinData.FxjData fxj = new  FinData.FxjData();
     if (dataType.Text.Trim() == "")
     {
         MessageBox.Show("请选择数据类型!", "信息");
         return;
     }
     try
     {
         string callText;
         string dt = dataType.Text.Split('-')[0];
         if (newFileName.Text == "")
         {
             dataArray = fxj.GetData(dt, code.Text, Convert.ToInt32(cboRecordCount.Text.Trim()));
             callText  = "fxjdata.GetData(\"" + dt + "\",\"" + code.Text.Trim() + "\",\"" + cboRecordCount.Text.Trim() + "\")";
         }
         else
         {
             dataArray = fxj.GetData(dt, code.Text, newFileName.Text, Convert.ToInt32(cboRecordCount.Text.Trim()));
             callText  = "fxjdata.GetData(\"" + dt + "\",\"" + code.Text.Trim() + "\",\"" + newFileName.Text.Trim() + "\",\"" + cboRecordCount.Text.Trim() + "\")";
         }
         //statusStrip1.Text = fxj.Msg;
         if (fxj.Error == 0 && dataArray.GetLength(0) > 0)
         {
             string[,] colname       = fxj.GetFields(dt);
             dataGridView.DataSource = new ArrayDataView(dataArray);
             for (int i = 0; i < dataGridView.Rows.Count; i++)
             {
                 dataGridView.Rows[i].HeaderCell.Value = (i + 1).ToString().Trim();
             }
             if (colname.GetLength(0) == dataGridView.Columns.Count)
             {
                 for (int i = 0; i < colname.GetLength(0); i++)
                 {
                     dataGridView.Columns[i].HeaderText = colname[i, 0] + "(" + colname[i, 1] + ")";
                 }
             }
             methodText.Text = callText;
         }
         else
         {
             methodText.Text = "";
             MessageBox.Show("没有数据或发生错误。" + fxj.Msg);
         }
     }
     catch (Exception ex)
     {
         methodText.Text = "";
         MessageBox.Show(ex.Message);
     }
 }
Example #3
0
        private void readFieldNames_Click(object sender, EventArgs e)
        {
            FinData.FxjData fxj = new FinData.FxjData();
            //string[,] s;
            if (dataType.Text.Trim() == "")
            {
                MessageBox.Show("请选择数据类型!", "信息");
                return;
            }
            try
            {
                string callText;
                string dt = dataType.Text.Split('-')[0];
                dataArray = fxj.GetFields(dt);
                callText  = "fxjdata.GetFields(\"" + dt + "\")";

                if (fxj.Error == 0 && dataArray.GetLength(0) > 0)
                {
                    dataGridView.DataSource = new ArrayDataView(dataArray);
                    for (int i = 0; i < dataGridView.Rows.Count; i++)
                    {
                        dataGridView.Rows[i].HeaderCell.Value = (i + 1).ToString().Trim();
                    }
                    dataGridView.Columns[0].HeaderText = "字段名称";
                    dataGridView.Columns[1].HeaderText = "字段说明";
                    dataGridView.Columns[2].HeaderText = "字段类型";
                    methodText.Text = callText;
                }
                else
                {
                    methodText.Text = "";
                    MessageBox.Show("没有数据或发生错误 " + fxj.Msg);
                }
            }
            catch (Exception ex)
            {
                methodText.Text = "";
                MessageBox.Show(ex.Message);
            }
        }
Example #4
0
        private void readFieldNames_Click(object sender, EventArgs e)
        {
            FinData.FxjData fxj = new FinData.FxjData();
            //string[,] s;
            if (dataType.Text.Trim() == "")
            {
                MessageBox.Show("��ѡ����������!","��Ϣ");
                return;
            }
            try
            {
                string callText;
                string dt = dataType.Text.Split('-')[0];
                dataArray = fxj.GetFields(dt);
                callText = "fxjdata.GetFields(\"" + dt + "\")";

                if (fxj.Error == 0 && dataArray.GetLength(0) > 0)
                {
                    dataGridView.DataSource = new ArrayDataView(dataArray);
                    for (int i = 0; i < dataGridView.Rows.Count; i++)
                    {
                        dataGridView.Rows[i].HeaderCell.Value = (i + 1).ToString().Trim();
                    }
                    dataGridView.Columns[0].HeaderText ="�ֶ�����";
                    dataGridView.Columns[1].HeaderText = "�ֶ�˵��";
                    dataGridView.Columns[2].HeaderText = "�ֶ�����";
                    methodText.Text = callText;
                }
                else
                {
                    methodText.Text = "";
                    MessageBox.Show("û�����ݻ������� " + fxj.Msg);
                }
            }
            catch (Exception ex)
            {
                methodText.Text = "";
                MessageBox.Show(ex.Message);
            }
        }
        private void button1_Click(object sender, EventArgs e)
        {
            if (button1.Text == "ȡ��(&C)")
            {
                if (MessageBox.Show("ȷ��Ҫ�ж�����ת����", "ȷ��", MessageBoxButtons.OKCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.OK)
                {
                    stopConverting = true;
                    outputBox.Enabled = true;
                    treeView1.Enabled = true;
                    status3.Text += DateTime.Now.ToString("HH:mm:ss") + ":�ж�ת��!\n";
                }
                return;
            }

            if (treeView1.Nodes.Count < 1)
            {
                MessageBox.Show("û���ҵ����ݣ�", "����");
                return;
            }
            if (descPath.Text.Trim() == "")
            {
                MessageBox.Show("��ѡ��Ŀ���ļ��У�", "����");
                descPath.Focus();
                return;
            }
            if(Directory.Exists(descPath.Text)==false)
            {
                MessageBox.Show("�ļ��С�" + descPath.Text +"�������ڣ�������ѡ��򴴽���", "����",MessageBoxButtons.OK);
                descPath.Focus();
                return;
            }
            if (MessageBox.Show("ת������ʱ����������ѡ���ڡ�" + descPath.Text.Trim() + "���д�������ļ���ͬ���ļ��������ǣ�\n\nȷ����ʼת����","ȷ��",MessageBoxButtons.OKCancel,MessageBoxIcon.Question,MessageBoxDefaultButton.Button2)!=DialogResult.OK)
            {
                return;
            }

            //ת������
            int errorCounts = 0;
            button1.Text = "ȡ��(&C)";
            status.Text = "";
            status2.Text = "";
            status3.Text = DateTime.Now.ToString("HH:mm:ss") + ":��ʼת��...\n";
            outputBox.Enabled = false;
            treeView1.Enabled = false;
            try
            {
                FxjData fxj = new FxjData();
                string[,] x;
                string s="";
                string sepChar = seperateChar.Text;
                for (int i = 0; i < treeView1.Nodes.Count ; i++)
                {
                    if (treeView1.Nodes[i].Nodes.Count > 0)
                    {
                        string[,] codes = fxj.GetData("dm", treeView1.Nodes[i].Nodes[0].Text.Split('|')[1],0);
                        foreach (TreeNode node in treeView1.Nodes[i].Nodes)
                        {

                            if (node.Checked)
                            {
                                status.Text = node.Text.Split('|')[1] + node.Text.Split('|')[2];
                                status3.Text += DateTime.Now.ToString("HH:mm:ss") + ":��ʼת��" + status.Text + " \n";
                                Application.DoEvents();
                                switch (node.Text.Split('|')[2])
                                {
                                    case "dm":
                                        StreamWriter swdm = new StreamWriter(descPath.Text + @"\" + node.Text.Split('|')[3], false);
                                        x = fxj.GetFields("dm");
                                        for (int ii = 0; ii < x.GetLength(0); ii++)
                                        {
                                            swdm.Write(x[ii, 0] + "(" + x[ii, 1] + ")" + sepChar);

                                        }
                                        swdm.WriteLine();
                                        x = fxj.GetData("dm", node.Text.Split('|')[1],0);
                                        if (fxj.Error == 1 && errorCounts < 10) { status3.Text += DateTime.Now.ToString("HH:mm:ss") + ":" + node.Text.Split('|')[1] + "," + fxj.Msg + (errorCounts == 9 ? "\n ������������" : "") + " \n"; errorCounts++; }
                                        for (int ii = 0; ii < x.GetLength(0); ii++)
                                        {
                                            status2.Text = x[ii, 0];
                                            Application.DoEvents();
                                            if (stopConverting) { swdm.Close(); return; }
                                            for (int jj = 0; jj < x.GetLength(1); jj++)
                                            {
                                                swdm.Write(x[ii, jj] + sepChar);
                                            }
                                            swdm.WriteLine();
                                        }
                                        swdm.Close();
                                        status3.Text += DateTime.Now.ToString("HH:mm:ss") + ":����" + node.Text.Split('|')[3] + " \n";
                                        break;
                                    case "bk":
                                    case "pj":
                                        StreamWriter sw0 = new StreamWriter(descPath.Text + @"\" + node.Text.Split('|')[3], false);
                                        x = fxj.GetFields(node.Text.Split('|')[2]);
                                        for (int ii = 0; ii < x.GetLength(0); ii++)
                                        {
                                            sw0.Write(x[ii, 0] + "(" + x[ii, 1] + ")" + sepChar);

                                        }
                                        sw0.WriteLine();
                                        x = fxj.GetData(node.Text.Split('|')[2], "",0);
                                        if (fxj.Error == 1 && errorCounts < 10) { status3.Text += DateTime.Now.ToString("HH:mm:ss") + ":" + node.Text.Split('|')[2] + "," + fxj.Msg + (errorCounts == 9 ? "\n ������������" : "") + " \n"; errorCounts++; }
                                        for (int ii = 0; ii < x.GetLength(0); ii++)
                                        {
                                            status2.Text = x[ii, 0];
                                            Application.DoEvents();
                                            if (stopConverting) { sw0.Close(); return; }
                                            for (int jj = 0; jj < x.GetLength(1); jj++)
                                            {
                                                sw0.Write(x[ii, jj] + sepChar);
                                            }
                                            sw0.WriteLine();
                                        }
                                        sw0.Close();
                                        status3.Text += DateTime.Now.ToString("HH:mm:ss") + ":����" + node.Text.Split('|')[3] + " \n";
                                        break;
                                    default:
                                        StreamWriter sw = new StreamWriter(descPath.Text + @"\" + node.Text.Split('|')[3], false);
                                        x = fxj.GetFields(node.Text.Split('|')[2]);
                                        for (int ii = 0; ii < x.GetLength(0); ii++)
                                        {
                                            sw.Write(x[ii, 0] + "(" + x[ii, 1] + ")" + sepChar);

                                        }
                                        sw.WriteLine();
                                        for (int c = 0; c < codes.GetLength(0); c++)
                                        {
                                            if (fxj.GetCodeType(codes[c, 0]) != "")
                                            {
                                                status2.Text = codes[c, 0];
                                                Application.DoEvents();

                                                x = fxj.GetData(node.Text.Split('|')[2], codes[c, 0], node.Text.Split('|')[4],0);
                                                if (fxj.Error == 1 && errorCounts < 10) { status3.Text += DateTime.Now.ToString("HH:mm:ss") + ":" + codes[c, 0] + "," + fxj.Msg + (errorCounts==9?"\n ������������":"") + " \n"; errorCounts++; }
                                                for (int ii = 0; ii < x.GetLength(0); ii++)
                                                {
                                                    if (stopConverting) { sw.Close(); return; }
                                                    s = "";
                                                    for (int jj = 0; jj < x.GetLength(1); jj++)
                                                    {
                                                        s += x[ii, jj] + sepChar;
                                                    }
                                                    sw.WriteLine(s);
                                                }
                                            }

                                        }
                                        status3.Text += DateTime.Now.ToString("HH:mm:ss") + ":����" + node.Text.Split('|')[3] + " \n";
                                        sw.Close();
                                        break;
                                }
                            }

                        }

                    }

                }
            }//try
            catch (Exception ex)
            {
                status3.Text += "��������" + ex.Message+"\n";
            }
            finally
            {
                button1.Text = "ת��(&T)";
                stopConverting = false;
                outputBox.Enabled = true;
                treeView1.Enabled = true;
                status3.Text += DateTime.Now.ToString("HH:mm:ss") + ":ת������.\n";
            }
        }