Beispiel #1
0
        private void btn_CopyByIC_Click(object sender, EventArgs e)
        {
            string ICCard, Name;
            string mPath = this.textPath.Text;
            DirectoryInfo di;

            try
            {
                di = new DirectoryInfo(mPath);
            }
            catch (Exception err)
            {
                MessageBox.Show(err.Message);
            }

            FileInfo[] filelist = di.GetFiles("*.jpg");
            foreach (FileInfo fi in filelist)
            {
                ICCard = fi.Name.Split('.')[0];
                DataTable ManListInfo;
                OracleHelper newhelp = new OracleHelper();
                string sql = @"SELECT T.NAME, T.USED_NAME, T.CREATE_DATE
                                FROM cimc_lbr_idcard_read_trans_vie T
                                WHERE T.USED_NAME='" + ICCard + "'";

                try
                {
                    ManListInfo = newhelp.GetDataTable(sql);
                }
                catch (System.Exception ex)
                {
                    continue;
                }
                Name = ManListInfo.Rows[0]["Name"].ToString();
                if (Name == string.Empty)
                {
                    continue;
                }

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

                if (File.Exists(mPath + "NAME\\" + Name + ".jpg"))
                {
                    try
                    {
                        File.Copy(fi.Name, mPath + "NAME\\" + Name + "_" + ICCard + ".jpg", true);
                        continue;
                    }
                    catch (System.Exception err)
                    {
                        continue;
                    }
                }

                try
                {
                    File.Copy(fi.Name, mPath + "NAME\\" + Name + ".jpg", true);
                }
                catch (System.Exception ex)
                {
                    continue;
                }
            }

            MessageBox.Show("�������");
        }
        private void btn_CopyByIC_Click(object sender, EventArgs e)
        {
            string        ICCard, Name;
            string        mPath = this.textPath.Text;
            DirectoryInfo di;

            try
            {
                di = new DirectoryInfo(mPath);
            }
            catch (Exception err)
            {
                MessageBox.Show(err.Message);
            }

            FileInfo[] filelist = di.GetFiles("*.jpg");
            foreach (FileInfo fi in filelist)
            {
                ICCard = fi.Name.Split('.')[0];
                DataTable    ManListInfo;
                OracleHelper newhelp = new OracleHelper();
                string       sql     = @"SELECT T.NAME, T.USED_NAME, T.CREATE_DATE 
                                FROM cimc_lbr_idcard_read_trans_vie T 
                                WHERE T.USED_NAME='" + ICCard + "'";

                try
                {
                    ManListInfo = newhelp.GetDataTable(sql);
                }
                catch (System.Exception ex)
                {
                    continue;
                }
                Name = ManListInfo.Rows[0]["Name"].ToString();
                if (Name == string.Empty)
                {
                    continue;
                }

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

                if (File.Exists(mPath + "NAME\\" + Name + ".jpg"))
                {
                    try
                    {
                        File.Copy(fi.Name, mPath + "NAME\\" + Name + "_" + ICCard + ".jpg", true);
                        continue;
                    }
                    catch (System.Exception err)
                    {
                        continue;
                    }
                }

                try
                {
                    File.Copy(fi.Name, mPath + "NAME\\" + Name + ".jpg", true);
                }
                catch (System.Exception ex)
                {
                    continue;
                }
            }

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