private void btn_CreateImage(object sender, EventArgs e)
        {
            DataTable ManListInfo;
            OracleHelper newhelp = new OracleHelper();
            string sql = @"SELECT T.RECORD_ID, T.ID_NO,T.ID_PREFIX, T.NAME, T.USED_NAME, T.CREATE_DATE
                            FROM cimc_lbr_idcard_read_trans_vie T
                            WHERE TO_DATE(T.CREATE_DATE,'YYYY-MM-DD') BETWEEN TO_DATE('2013-03-22','YYYY-MM-DD') AND TO_DATE('2013-03-22','YYYY-MM-DD')";

            try
            {
                ManListInfo = newhelp.GetDataTable(sql);
            }
            catch (System.Exception ex)
            {
                MessageBox.Show(ex.Message);
                return;
            }
            string mPath = "D:\\ICCARD_PHOTO\\2013\\03\\22\\";
            for (int i = 0; i < ManListInfo.Rows.Count; i++)
            {
                string ICCard = ManListInfo.Rows[i]["USED_NAME"].ToString();
                if (ICCard==string.Empty)
                {
                    continue;
                }
                string filename = mPath + ICCard + ".jpg";
                File.Create(filename);
            }
            MessageBox.Show("done");
        }
        private void btn_CopyByIC_Click(object sender, EventArgs e)
        {
            if (this.dTime_start.Value.Date > this.dTime_end.Value.Date)
            {
                MessageBox.Show("截止日期应不小于起始日期!");
                return;
            }

            string StartTime = this.dTime_start.Value.ToString().Split(' ')[0];
            string EndTime = this.dTime_end.Value.ToString().Split(' ')[0];

            string mDate, Year, Month, Day;
            string RecordID, IDSuffixNum, ICCard, Name;

            DataTable ManListInfo;
            OracleHelper newhelp = new OracleHelper();
            string sql = @"SELECT T.RECORD_ID, T.ID_NO,T.ID_PREFIX, T.NAME, T.USED_NAME, T.CREATE_DATE
                            FROM cimc_lbr_idcard_read_trans_vie T
                            WHERE TO_DATE(T.CREATE_DATE,'YYYY-MM-DD') BETWEEN TO_DATE('" + StartTime + "','YYYY-MM-DD') AND TO_DATE('" + EndTime + "','YYYY-MM-DD')";

            try
            {
                ManListInfo = newhelp.GetDataTable(sql);
            }
            catch (System.Exception ex)
            {
                MessageBox.Show(ex.Message);
                return;
            }

            if (ManListInfo.Rows.Count == 0)
            {
                MessageBox.Show("数据库中未查到此时间段人员信息");
                return;
            }
            this.dGV_infolist.DataSource = ManListInfo;

            for (int i = 0; i < ManListInfo.Rows.Count; i++)
            {
                RecordID = ManListInfo.Rows[i]["RECORD_ID"].ToString();
                ICCard = ManListInfo.Rows[i]["USED_NAME"].ToString();
                Name = ManListInfo.Rows[i]["Name"].ToString();
                IDSuffixNum = ManListInfo.Rows[i]["ID_PREFIX"].ToString();
                string mPath = "D:\\ICCARD_PHOTO\\";
                mDate = ManListInfo.Rows[i]["CREATE_DATE"].ToString();
                Year = mDate.Split('-')[0];
                Month = mDate.Split('-')[1];
                Day = mDate.Split('-')[2];

                if (this.textPath.Text == string.Empty)
                {
                    mPath += Year + "\\" + Month + "\\" + Day + "\\";
                    if (!Directory.Exists(mPath))
                    {
                        MessageBox.Show("入职日期的路径不存在, 请手动选择或建立相应文件夹");
                        return;
                    }
                }
                else
                {
                    mPath = this.textPath.Text+"\\";
                }

                if (!Directory.Exists(mPath + "NAME"))
                {
                    Directory.CreateDirectory(mPath + "NAME");
                }

                string JpgName = mPath + ICCard + ".jpg";
                if (File.Exists(JpgName))
                {
                    //Name
                    if (Name == string.Empty)
                    {
                        CallProce(RecordID, "0", "0", "Name Not Exists in database");
                        continue;
                    }
                    if (!Directory.Exists(mPath + "NAME"))
                    {
                        try
                        {
                            Directory.CreateDirectory(mPath + "NAME");
                        }
                        catch (System.Exception ex)
                        {
                            CallProce(RecordID, "0", "0", "Can not create Name dir: " + mPath + "NAME" + ex.Message);
                            continue;
                        }

                    }
                    else
                    {
                        if (File.Exists(mPath + "NAME\\" + Name + ".jpg"))
                        {
                            try
                            {
                                File.Copy(JpgName, mPath + "NAME\\" + Name + "_" + IDSuffixNum + ".jpg", true);
                                CallProce(RecordID, "0", "1", ICCard + ".jpg Copy Succeed");
                                continue;
                            }
                            catch (System.Exception err)
                            {
                                CallProce(RecordID, "1", "0", err.Message);
                                continue;
                            }
                        }

                        try
                        {
                            File.Copy(JpgName, mPath + "NAME\\" + Name + ".jpg", true);
                            CallProce(RecordID, "0", "1", ICCard + ".jpg Copy Succeed");
                        }
                        catch (System.Exception ex)
                        {
                            CallProce(RecordID, "0", "0", ex.Message);
                            continue;
                        }
                    }
                }
            }

            MessageBox.Show("复制完毕");
        }