예제 #1
0
파일: sqlSJ.cs 프로젝트: VISUS-Li/ZDR
        private void btnDCSJ_Selected_Click(object sender, EventArgs e)
        {
            delPwd DP = new delPwd();

            DP.Show();
            if (DP.rightYH != "1")
            {
                return;
            }
            List <string> listSFZ   = new List <string>();
            List <int>    RowsIndex = new List <int>();//记录选中行的集合

            //MessageBox.Show(sqlDataView.SelectedRows[1].Index.ToString());
            for (int j = dataGridView1.SelectedRows.Count - 1; j >= 0; j--)
            {
                RowsIndex.Add(dataGridView1.SelectedRows[j].Index);
            }

            foreach (int item in RowsIndex)
            {
                try
                {
                    //listSFZ.Add(dataGridView1[1, item].Value.ToString());
                    //string sqlguid = "select SJguid from JCRSJXX where JCRsfz='" + dataGridView1[1,item].Value.ToString()+ "'";
                    //string getGuid = sqlMethod(sqlguid, 1);
                    listSFZ.Add(dataGridView1[8, item].Value.ToString());
                }
                catch
                { MessageBox.Show("请勿选择空行", "提示"); return; }
            }
            string         path = "";
            SaveFileDialog SFD  = new SaveFileDialog();

            SFD.Title  = "选择存储地址";
            SFD.Filter = "Excel文件|*.xls";
            bool re = false;

            SFD.FileName = DateTime.Now.Year + "_" + DateTime.Now.Month + "_" + DateTime.Now.Day + "_" +
                           DateTime.Now.Hour + "_" + DateTime.Now.Minute + "_" + DateTime.Now.Second + "SJ";
            //SFD.ShowDialog();
            if (SFD.ShowDialog() == DialogResult.Cancel)
            {
                return;
            }
            path = SFD.FileName;
            re   = DCSJ_selected(path, listSFZ);
            if (re == true)
            {
                MessageBox.Show("导出成功!", "提示");
                dataGridView1.ClearSelection();
            }
            else
            {
                MessageBox.Show("导出失败!", "提示");
                dataGridView1.ClearSelection();
            }
        }
예제 #2
0
파일: sqlSJ.cs 프로젝트: VISUS-Li/ZDR
        private void btnDCSJ_one_Click(object sender, EventArgs e)
        {
            delPwd DP = new delPwd();

            DP.Show();
            if (DP.rightYH != "1")
            {
                return;
            }
            //List<int> RowsIndex = new List<int>();
            //for (int j = dataGridView1.SelectedRows.Count - 1; j >= 0; j--)
            //{
            //    RowsIndex.Add(dataGridView1.SelectedRows[j].Index);
            //}
            //获得要导出的对象的身份证集合
            List <string> listSFZ = new List <string>();

            for (int i = 0; i < dataGridView1.SelectedRows.Count; i++)
            {
                string sqlguid = "select SJguid from JCRSJXX where JCRsfz='" + dataGridView1[1, dataGridView1.CurrentRow.Index].Value.ToString() + "'";
                string getGuid = sqlMethod(sqlguid, 1);
                listSFZ.Add(getGuid);
            }
            string         path = "";
            SaveFileDialog SFD  = new SaveFileDialog();

            SFD.Title  = "选择存储地址";
            SFD.Filter = "Excel文件|*.xls";
            bool re = false;

            SFD.FileName = DateTime.Now.Year + "_" + DateTime.Now.Month + "_" + DateTime.Now.Day + "_" +
                           DateTime.Now.Hour + "_" + DateTime.Now.Minute + "_" + DateTime.Now.Second + "SJ";
            //SFD.ShowDialog();
            if (SFD.ShowDialog() == DialogResult.Cancel)
            {
                return;
            }
            path = SFD.FileName;
            re   = DCSJ_selected(path, listSFZ);
            if (re == true)
            {
                MessageBox.Show("导出成功!", "提示");
                dataGridView1.ClearSelection();
            }
            else
            {
                MessageBox.Show("导出失败!", "提示");
                dataGridView1.ClearSelection();
            }
        }
예제 #3
0
        private void DCselected_Click(object sender, EventArgs e)
        {
            delPwd DP = new delPwd();

            DP.Show();
            if (DP.rightYH != "1")
            {
                return;
            }
            DialogResult DR = MessageBox.Show("导出该对象的全部信息吗?", "提示:选择否则导出部分信息", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
            //获得要导出的对象的身份证集合
            List <string> listSFZ   = new List <string>();
            List <int>    RowsIndex = new List <int>();//记录选中行的集合

            //MessageBox.Show(sqlDataView.SelectedRows[1].Index.ToString());
            for (int j = sqlDataView.SelectedRows.Count - 1; j >= 0; j--)
            {
                RowsIndex.Add(sqlDataView.SelectedRows[j].Index);
            }

            foreach (int item in RowsIndex)
            {
                try
                {
                    listSFZ.Add(sqlDataView[7, item].Value.ToString());
                }
                catch
                { MessageBox.Show("请勿选择空行", "提示"); return; }
            }
            //for (int i = 0; i < sqlDataView.SelectedRows.Count; i++)
            //{
            //    try
            //    {
            //        listSFZ.Add(sqlDataView[7, sqlDataView.CurrentRow.Index + i].Value.ToString());
            //    }
            //    catch
            //    { MessageBox.Show("请勿选择空行", "提示");return; }

            //}
            string         path = "";
            SaveFileDialog SFD  = new SaveFileDialog();

            SFD.Title  = "选择存储地址";
            SFD.Filter = "Excel文件|*.xls";
            bool re = false;

            if (DR == DialogResult.No)
            {
                SFD.FileName = DateTime.Now.Year + "_" + DateTime.Now.Month + "_" + DateTime.Now.Day + "_" +
                               DateTime.Now.Hour + "_" + DateTime.Now.Minute + "_" + DateTime.Now.Second + "_部分基本信息";
                //SFD.ShowDialog();
                if (SFD.ShowDialog() == DialogResult.Cancel)
                {
                    return;
                }
                path = SFD.FileName;
                re   = saveAsExcelMode_MulRows(path, listSFZ.Count, 1, listSFZ);
            }
            else
            {
                SFD.FileName = DateTime.Now.Year + "_" + DateTime.Now.Month + "_" + DateTime.Now.Day + "_" +
                               DateTime.Now.Hour + "_" + DateTime.Now.Minute + "_" + DateTime.Now.Second + "_全部基本信息";
                //SFD.ShowDialog();
                if (SFD.ShowDialog() == DialogResult.Cancel)
                {
                    return;
                }
                path = SFD.FileName;
                re   = saveAsExcelMode_MulRows(path, listSFZ.Count, 2, listSFZ);
            }
            if (re == true)
            {
                MessageBox.Show("导出成功", "提示");
                sqlDataView.ClearSelection();
            }
            else
            {
                MessageBox.Show("导出失败", "提示");
                sqlDataView.ClearSelection();
            }
        }
예제 #4
0
        //设置线程
        public void RunDCinfo()
        {
            delPwd DP = new delPwd();

            DP.Show();
            if (DP.rightYH != "1")
            {
                return;
            }
            DialogResult DR = MessageBox.Show("导出该对象的全部信息吗?", "提示:选择否则导出部分信息", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
            //获得要导出的对象的身份证集合
            List <string> listSFZ = new List <string>();

            for (int i = 0; i < sqlDataView.SelectedRows.Count; i++)
            {
                listSFZ.Add(sqlDataView[7, sqlDataView.CurrentRow.Index].Value.ToString());
            }
            string         path = "";
            SaveFileDialog SFD  = new SaveFileDialog();

            SFD.Title  = "选择存储地址";
            SFD.Filter = "Excel文件|*.xls";
            bool re = false;

            if (DR == DialogResult.No)
            {
                SFD.FileName = DateTime.Now.Year + "_" + DateTime.Now.Month + "_" + DateTime.Now.Day + "_" +
                               DateTime.Now.Hour + "_" + DateTime.Now.Minute + "_" + DateTime.Now.Second + "_部分基本信息";
                //SFD.ShowDialog();
                if (SFD.ShowDialog() == DialogResult.Cancel)
                {
                    return;
                }
                path = SFD.FileName;
                re   = saveAsExcelMode_MulRows(path, listSFZ.Count, 1, listSFZ);
            }
            else
            {
                SFD.FileName = DateTime.Now.Year + "_" + DateTime.Now.Month + "_" + DateTime.Now.Day + "_" +
                               DateTime.Now.Hour + "_" + DateTime.Now.Minute + "_" + DateTime.Now.Second + "_全部基本信息";
                // SFD.ShowDialog();
                if (SFD.ShowDialog() == DialogResult.Cancel)
                {
                    return;
                }
                path = SFD.FileName;
                re   = saveAsExcelMode_MulRows(path, listSFZ.Count, 2, listSFZ);
            }
            if (re == true)
            {
                MessageBox.Show("导出成功", "提示");
                sqlDataView.ClearSelection();
            }
            else
            {
                MessageBox.Show("导出失败", "提示");
                sqlDataView.ClearSelection();
            }

            //持起主线程
            Thread.Sleep(0);
            //执行线程
            mythread.Abort();
        }