예제 #1
0
        public void createBatch(string location)
        {
            string batchName = new DirectoryInfo(location).Name;
            var    fBatch    = new tbl_Batch
            {
                fBatchName   = batchName,
                fusercreate  = txt_UserCreate.Text,
                fdatecreated = DateTime.Now,
                fPathPicture = location,
                fLocation    = txt_Location.Text + "\\" + batchName + "\\",
                fSoLuongAnh  = Directory.GetFiles(location).Length.ToString(),
                LoaiBatch    = "Getsu"
            };

            Global.Db.tbl_Batches.InsertOnSubmit(fBatch);
            Global.Db.SubmitChanges();

            string searchFolder = txt_PathFolder.Text + "\\" + new DirectoryInfo(location).Name;
            var    filters      = new String[] { "jpg", "jpeg", "png", "gif", "tiff", "bmp" };

            string[] tmp  = GetFilesFrom(searchFolder, filters, false);
            string   temp = Global.StrPath + "\\" + batchName;

            Directory.CreateDirectory(temp);
            string imageJPG = "";

            var filters1 = new String[] { "jpg", "jpeg", "png", "gif", "tiff", "bmp" };

            string[] tmp1 = GetFilesFrom(location, filters1, false);
            foreach (string s in tmp1)
            {
                FileInfo  fi        = new FileInfo(location);
                tbl_Image tempImage = new tbl_Image
                {
                    fbatchname            = batchName,
                    idimage               = Path.GetFileName(fi.ToString()),
                    ReadImageDESo         = 0,
                    CheckedDESo           = 0,
                    TienDoDESO            = "Hình chưa nhập",
                    ReadImageDESO_Good    = 1,
                    ReadImageDESO_NotGood = 1
                };
                Global.Db.tbl_Images.InsertOnSubmit(tempImage);
                Global.Db.SubmitChanges();
                string des = location + @"\" + Path.GetFileName(fi.ToString());
                fi.CopyTo(des);
                progressBarControl1.PerformStep();
                progressBarControl1.Update();
            }
        }
예제 #2
0
        private void UpLoadSingle()
        {
            progressBarControl1.EditValue              = 0;
            progressBarControl1.Properties.Step        = 1;
            progressBarControl1.Properties.PercentView = true;
            progressBarControl1.Properties.Maximum     = _lFileNames.Length;
            progressBarControl1.Properties.Minimum     = 0;
            var batch = (from w in Global.Db.tbl_Batches.Where(w => w.fBatchName == txt_BatchName.Text) select w.fBatchName).FirstOrDefault();

            if (!string.IsNullOrEmpty(txt_ImagePath.Text))
            {
                if (string.IsNullOrEmpty(batch))
                {
                    var fBatch = new tbl_Batch
                    {
                        fBatchName    = txt_BatchName.Text,
                        fusercreate   = txt_UserCreate.Text,
                        fdatecreated  = DateTime.Now,
                        fPathPicture  = txt_ImagePath.Text,
                        fLocation     = txt_Location.Text + "\\" + txt_BatchName.Text + "\\",
                        fSoLuongAnh   = _soluonghinh.ToString(),
                        LoaiBatch     = "Getsu",
                        ChiaUser      = ck_ChiaUser.Checked,
                        CongKhaiBatch = false
                                        //LoaiBatch = rg_LoaiBatch.Properties.Items[rg_LoaiBatch.SelectedIndex].Description
                    };
                    Global.Db.tbl_Batches.InsertOnSubmit(fBatch);
                    Global.Db.SubmitChanges();
                }
                else
                {
                    MessageBox.Show(@"Batch exists please enter another batch name!");
                    return;
                }
            }
            else
            {
                MessageBox.Show(@"You have not selected an image yet!");
                return;
            }
            string temp = Global.StrPath + "\\" + txt_BatchName.Text;

            if (!Directory.Exists(temp))
            {
                Directory.CreateDirectory(temp);
            }
            else
            {
                MessageBox.Show(@"Batch named batch!");
                return;
            }
            foreach (string i in _lFileNames)
            {
                FileInfo fi = new FileInfo(i);

                if (ck_ChiaUser.Checked)
                {
                    tbl_Image tempImage = new tbl_Image
                    {
                        fbatchname            = txt_BatchName.Text,
                        idimage               = Path.GetFileName(fi.ToString()),
                        ReadImageDESo         = 0,
                        CheckedDESo           = 0,
                        TienDoDESO            = "Hình chưa nhập",
                        ReadImageDESO_Good    = 0,
                        ReadImageDESO_NotGood = 0
                    };
                    Global.Db.tbl_Images.InsertOnSubmit(tempImage);
                    Global.Db.SubmitChanges();
                }
                else
                {
                    tbl_Image tempImage = new tbl_Image
                    {
                        fbatchname            = txt_BatchName.Text,
                        idimage               = Path.GetFileName(fi.ToString()),
                        ReadImageDESo         = 0,
                        CheckedDESo           = 0,
                        TienDoDESO            = "Hình chưa nhập",
                        ReadImageDESO_Good    = 1,
                        ReadImageDESO_NotGood = 1
                    };
                    Global.Db.tbl_Images.InsertOnSubmit(tempImage);
                    Global.Db.SubmitChanges();
                }

                string des = temp + @"\" + Path.GetFileName(fi.ToString());
                fi.CopyTo(des);
                progressBarControl1.PerformStep();
                progressBarControl1.Update();
            }
            MessageBox.Show(@"Create a new batch successfully!");
            progressBarControl1.EditValue = 0;
            txt_BatchName.Text            = "";
            txt_ImagePath.Text            = "";
            lb_SoLuongHinh.Text           = "";
        }
예제 #3
0
        public void createBatch(string location, string server, string batch, string excellocation)
        {
            string batchName = new DirectoryInfo(location).Name;
            var    fBatch    = new tbl_Batch
            {
                fBatchName    = batch,
                fusercreate   = txt_UserCreate.Text,
                fdatecreated  = DateTime.Now,
                fPathPicture  = location,
                fLocation     = excellocation,
                fSoLuongAnh   = Directory.GetFiles(location).Length.ToString(),
                LoaiBatch     = "Getsu",
                ChiaUser      = ck_ChiaUser.Checked,
                CongKhaiBatch = false
            };

            Global.Db.tbl_Batches.InsertOnSubmit(fBatch);
            Global.Db.SubmitChanges();
            string imageJPG = "";

            var filters1 = new String[] { "jpg", "jpeg", "png", "gif", "tiff", "bmp" };

            string[] tmp1 = GetFilesFrom(location, filters1, false);
            progressBarControl1.EditValue              = 0;
            progressBarControl1.Properties.Step        = 1;
            progressBarControl1.Properties.PercentView = true;
            progressBarControl1.Properties.Maximum     = tmp1.Length;
            progressBarControl1.Properties.Minimum     = 0;
            foreach (string s in tmp1)
            {
                FileInfo fi = new FileInfo(s);
                if (ck_ChiaUser.Checked)
                {
                    tbl_Image tempImage = new tbl_Image
                    {
                        fbatchname            = batch,
                        idimage               = Path.GetFileName(fi.ToString()),
                        ReadImageDESo         = 0,
                        CheckedDESo           = 0,
                        TienDoDESO            = "Hình chưa nhập",
                        ReadImageDESO_Good    = 0,
                        ReadImageDESO_NotGood = 0
                    };
                    Global.Db.tbl_Images.InsertOnSubmit(tempImage);
                    Global.Db.SubmitChanges();
                }
                else
                {
                    tbl_Image tempImage = new tbl_Image
                    {
                        fbatchname            = batch,
                        idimage               = Path.GetFileName(fi.ToString()),
                        ReadImageDESo         = 0,
                        CheckedDESo           = 0,
                        TienDoDESO            = "Hình chưa nhập",
                        ReadImageDESO_Good    = 1,
                        ReadImageDESO_NotGood = 1
                    };
                    Global.Db.tbl_Images.InsertOnSubmit(tempImage);
                    Global.Db.SubmitChanges();
                }
                string des = server + @"\" + Path.GetFileName(fi.ToString());
                fi.CopyTo(des);
                progressBarControl1.PerformStep();
                progressBarControl1.Update();
            }
        }
예제 #4
0
        private void UpLoadMulti()
        {
            List <string> lStrBath = new List <string>();

            lStrBath.AddRange(Directory.GetDirectories(txt_PathFolder.Text));
            progressBarControl1.EditValue              = 0;
            progressBarControl1.Properties.Step        = 1;
            progressBarControl1.Properties.PercentView = true;
            progressBarControl1.Properties.Maximum     = lStrBath.Count;
            progressBarControl1.Properties.Minimum     = 0;
            foreach (string item in lStrBath)
            {
                string batchName = new DirectoryInfo(item).Name;
                var    fBatch    = new tbl_Batch
                {
                    fBatchName   = batchName,
                    fusercreate  = txt_UserCreate.Text,
                    fdatecreated = DateTime.Now,
                    fPathPicture = item,
                    fLocation    = txt_Location.Text + "\\" + batchName + "\\",
                    fSoLuongAnh  = Directory.GetFiles(item).Length.ToString(),
                    LoaiBatch    = "Getsu"
                };
                Global.Db.tbl_Batches.InsertOnSubmit(fBatch);
                Global.Db.SubmitChanges();

                string   searchFolder = txt_PathFolder.Text + "\\" + new DirectoryInfo(item).Name;
                var      filters      = new String[] { "jpg", "jpeg", "png", "gif", "tiff", "bmp" };
                string[] tmp          = GetFilesFrom(searchFolder, filters, false);
                string   temp         = Global.StrPath + "\\" + batchName;
                Directory.CreateDirectory(temp);
                string imageJPG = "";
                foreach (string i in tmp)
                {
                    FileInfo  fi        = new FileInfo(i);
                    tbl_Image tempImage = new tbl_Image
                    {
                        fbatchname            = batchName,
                        idimage               = Path.GetFileName(fi.ToString()),
                        ReadImageDESo         = 0,
                        CheckedDESo           = 0,
                        TienDoDESO            = "Hình chưa nhập",
                        ReadImageDESO_Good    = 1,
                        ReadImageDESO_NotGood = 1
                    };
                    Global.Db.tbl_Images.InsertOnSubmit(tempImage);
                    Global.Db.SubmitChanges();
                    string des = temp + @"\" + Path.GetFileName(fi.ToString());
                    fi.CopyTo(des);
                    progressBarControl1.PerformStep();
                    progressBarControl1.Update();
                }
                progressBarControl1.PerformStep();
                progressBarControl1.Update();
            }
            MessageBox.Show(@"Create a new batch successfully!");
            progressBarControl1.EditValue = 0;
            txt_BatchName.Text            = "";
            txt_ImagePath.Text            = "";
            lb_SoLuongHinh.Text           = "";
        }
예제 #5
0
        private void UpLoadMulti_5Folder()
        {
            List <string> lStrBath1 = new List <string>();
            List <string> lStrBath2 = new List <string>();
            List <string> lStrBath3 = new List <string>();
            List <string> lStrBath4 = new List <string>();

            lStrBath1.AddRange(Directory.GetDirectories(txt_PathFolder.Text));
            int    k          = 0;
            int    total      = lStrBath1.Count;
            string pathserver = @"\" + new DirectoryInfo(txt_PathFolder.Text).Name;
            string pathexcel  = @"X:";
            string s          = new DirectoryInfo(txt_PathFolder.Text).Name;

            createFolder(s);
            int       n  = 0;
            DataTable dt = new DataTable();

            dt.Columns.AddRange(new[] { new DataColumn("ImageID", typeof(string)) });
            foreach (string item1 in lStrBath1)
            {
                string pathserver1 = pathserver + @"\" + new DirectoryInfo(item1).Name;
                string litem1      = s + @"\" + new DirectoryInfo(item1).Name;
                createFolder(litem1);
                lStrBath2.Clear();
                lStrBath2.AddRange(Directory.GetDirectories(item1));
                if (lStrBath2.Count > 0)
                {
                    foreach (string item2 in lStrBath2)
                    {
                        string litem2 = litem1 + @"\" + new DirectoryInfo(item2).Name;
                        createFolder(litem2);
                        lStrBath3.Clear();
                        lStrBath3.AddRange(Directory.GetDirectories(item2));
                        if (lStrBath3.Count > 0)
                        {
                            foreach (string item3 in lStrBath3)
                            {
                                string pathserver2 = pathserver1 + @"\" + new DirectoryInfo(item3).Name;
                                string litem3      = litem2 + @"\" + new DirectoryInfo(item3).Name;
                                createFolder(litem3);
                                lStrBath4.Clear();
                                lStrBath4.AddRange(Directory.GetDirectories(item3));
                                if (lStrBath4.Count > 0)
                                {
                                    for (int i = 0; i < lStrBath4.Count; i++)
                                    {
                                        string FolderNameTemp = new DirectoryInfo(lStrBath4[i]).Name;
                                        if (true /*FolderNameTemp.Substring(0, 7) == "2225000"*/)
                                        {
                                            string batchID     = (new DirectoryInfo(lStrBath4[i]).Name + txt_DateCreate.Text).Replace("/", "").Replace(@"\", "").Replace(@":", "").Replace(@"-", "");
                                            string pathserver3 = pathserver2 + @"\" + new DirectoryInfo(lStrBath4[i]).Name + @"\";
                                            string litem4      = litem3 + @"\" + batchID;
                                            dt.Clear();
                                            int m = 0;
                                            n += 1;
                                            lb_SobatchHoanThanh.Text = n + @" :";
                                            var      filters           = new String[] { "jpg", "jpeg", "tif" };
                                            string[] pathImageLocation = GetFilesFrom(lStrBath4[i], filters, true);

                                            var fBatch = new tbl_Batch
                                            {
                                                BatchID       = batchID,
                                                BatchName     = new DirectoryInfo(lStrBath4[i]).Name,
                                                UserCreate    = txt_UserCreate.Text,
                                                DateCreate    = DateTime.Now,
                                                PathServer    = pathserver1 + @"\" + new DirectoryInfo(item2).Name + @"\" + new DirectoryInfo(item3).Name + @"\",
                                                PathPicture   = pathexcel + pathserver3,
                                                Location      = txt_PathFolder.Text,
                                                NumberImage   = pathImageLocation.Length + "",
                                                ChiaUser      = chk_ChiaUser.Checked ? true : false,
                                                CongKhaiBatch = false,
                                            };
                                            Global.Db.tbl_Batches.InsertOnSubmit(fBatch);
                                            Global.Db.SubmitChanges();

                                            progressBar1.Step    = 1;
                                            progressBar1.Value   = 1;
                                            progressBar1.Maximum = pathImageLocation.Count();
                                            progressBar1.Minimum = 0;
                                            ModifyProgressBarColor.SetState(progressBar1, 1);
                                            for (int j = 0; j < pathImageLocation.Count(); j++)
                                            {
                                                FileInfo fi = new FileInfo(pathImageLocation[j]);
                                                dt.Rows.Add(fi.Name);
                                            }
                                            string        ConnectionString = Global.Db.Connection.ConnectionString;
                                            SqlConnection con = new SqlConnection(ConnectionString);
                                            con.Open();
                                            SqlCommand cmd = new SqlCommand("Insert_Image", con);
                                            cmd.CommandTimeout = 10 * 60;
                                            cmd.CommandType    = CommandType.StoredProcedure;
                                            cmd.Parameters.AddWithValue("@BatchID", batchID);
                                            cmd.Parameters.AddWithValue("@ListIdImage", dt);
                                            cmd.Parameters.AddWithValue("@ChiaUser", chk_ChiaUser.Checked ? 1 : 0);
                                            cmd.ExecuteNonQuery();
                                            con.Close();
                                            string temp = Global.StrPath + "\\" + litem4;
                                            if (!Directory.Exists(temp))
                                            {
                                                Directory.CreateDirectory(temp);
                                            }
                                            else
                                            {
                                                MessageBox.Show("Bị trùng tên batch!");
                                                return;
                                            }
                                            for (int j = 0; j < pathImageLocation.Count(); j++)
                                            {
                                                File.Copy(pathImageLocation[j], temp + @"\" + new FileInfo(pathImageLocation[j]).Name);
                                                lb_SoImageDaHoanThanh.Text = (j + 1) + @"\" + pathImageLocation.Count();
                                                m += 1;
                                                progressBar1.PerformStep();
                                            }
                                            lb_SoImageDaHoanThanh.Text = m + @"/" + pathImageLocation.Length;
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                k++;
            }
            MessageBox.Show(@"Tạo batch mới thành công!");
            txt_BatchName.Text     = "";
            txt_ImagePath.Text     = "";
            lb_SoLuongHinh.Text    = "";
            txt_PathFolder.Text    = "";
            txt_Path.Text          = @"X:\N\13";
            btn_Browser.Enabled    = true;
            txt_PathFolder.Enabled = true;
            txt_Path.Enabled       = true;
        }
예제 #6
0
        private void UpLoadMulti()
        {
            try
            {
                btn_Browser.Enabled    = false;
                txt_PathFolder.Enabled = false;
                txt_Path.Enabled       = false;
                List <string> lStrBath = new List <string>();
                lStrBath.AddRange(Directory.GetDirectories(txt_PathFolder.Text));
                int    countBatchExists = 0;
                string listBatchExxists = "";
                for (int i = 0; i < lStrBath.Count; i++)
                {
                    sBatchID = (new DirectoryInfo(lStrBath[i]).Name + txt_DateCreate.Text).Replace("/", "").Replace(@"\", "").Replace(@":", "").Replace(@"-", "");
                    batch    = (from w in Global.Db.tbl_Batches.Where(w => w.BatchID == sBatchID) select w.BatchID).FirstOrDefault();
                    if (!string.IsNullOrEmpty(batch))
                    {
                        countBatchExists += 1;
                        listBatchExxists += lStrBath[i] + "\r\n";
                    }
                }
                if (countBatchExists > 0)
                {
                    MessageBox.Show("Batch đã tồn tại :\r\n" + listBatchExxists);
                    btn_Browser.Enabled    = true;
                    txt_PathFolder.Enabled = true;
                    txt_Path.Enabled       = true;
                    return;
                }
                int       n  = 0;
                DataTable dt = new DataTable();
                dt.Columns.AddRange(new[] { new DataColumn("ImageID", typeof(string)) });
                foreach (string itemBatch in lStrBath)
                {
                    dt.Clear();
                    string batchName = "";
                    int    m         = 0;
                    batchName = (new DirectoryInfo(itemBatch).Name + txt_DateCreate.Text).Replace("/", "").Replace(@"\", "").Replace(@":", "").Replace(@"-", "");
                    n        += 1;
                    lb_SobatchHoanThanh.Text = n + @" :";
                    var      filters           = new String[] { "jpg", "jpeg", "tif" };
                    string[] pathImageLocation = GetFilesFrom(itemBatch, filters, true);

                    var fBatch = new tbl_Batch
                    {
                        BatchID       = batchName,
                        BatchName     = new DirectoryInfo(itemBatch).Name,
                        UserCreate    = txt_UserCreate.Text,
                        DateCreate    = DateTime.Now,
                        PathServer    = "",
                        PathPicture   = txt_Path.Text,
                        Location      = txt_PathFolder.Text,
                        NumberImage   = pathImageLocation.Length + "",
                        ChiaUser      = chk_ChiaUser.Checked ? true : false,
                        CongKhaiBatch = false,
                    };
                    Global.Db.tbl_Batches.InsertOnSubmit(fBatch);
                    Global.Db.SubmitChanges();

                    progressBar1.Step    = 1;
                    progressBar1.Value   = 1;
                    progressBar1.Maximum = pathImageLocation.Count();
                    progressBar1.Minimum = 0;
                    ModifyProgressBarColor.SetState(progressBar1, 1);

                    for (int i = 0; i < pathImageLocation.Count(); i++)
                    {
                        FileInfo fi = new FileInfo(pathImageLocation[i]);
                        dt.Rows.Add(fi.Name);
                    }
                    string        ConnectionString = Global.Db.Connection.ConnectionString;
                    SqlConnection con = new SqlConnection(ConnectionString);
                    con.Open();
                    SqlCommand cmd = new SqlCommand("Insert_Image", con);
                    cmd.CommandTimeout = 10 * 60;
                    cmd.CommandType    = CommandType.StoredProcedure;
                    cmd.Parameters.AddWithValue("@BatchID", batchName);
                    cmd.Parameters.AddWithValue("@ListIdImage", dt);
                    cmd.Parameters.AddWithValue("@ChiaUser", chk_ChiaUser.Checked ? 1 : 0);
                    cmd.ExecuteNonQuery();
                    con.Close();
                    string temp = Global.StrPath + "\\" + batchName;
                    if (!Directory.Exists(temp))
                    {
                        Directory.CreateDirectory(temp);
                    }
                    else
                    {
                        MessageBox.Show("Bị trùng tên batch!");
                        return;
                    }
                    for (int i = 0; i < pathImageLocation.Count(); i++)
                    {
                        File.Copy(pathImageLocation[i], temp + @"\" + new FileInfo(pathImageLocation[i]).Name);
                        lb_SoImageDaHoanThanh.Text = (i + 1) + @"\" + pathImageLocation.Count();
                        m += 1;
                        progressBar1.PerformStep();
                    }
                    lb_SoImageDaHoanThanh.Text = m + @"/" + pathImageLocation.Length;
                }
                MessageBox.Show(@"Tạo batch mới thành công!");
                txt_BatchName.Text  = "";
                txt_ImagePath.Text  = "";
                lb_SoLuongHinh.Text = "";
                txt_PathFolder.Text = "";
                txt_Path.Text       = @"X:\N\13";
                //btn_CreateBatch.Enabled = true;
                btn_Browser.Enabled    = true;
                txt_PathFolder.Enabled = true;
                txt_Path.Enabled       = true;
            }
            catch (Exception ex) { MessageBox.Show(ex.Message); }
        }
예제 #7
0
        private void UpLoadSingle()
        {
            if (txt_Path.Text == @"X:\N\13")
            {
                MessageBox.Show("Bạn đang để đường dẫn path mặc định. Vui lòng kiểm tra lại.");
                return;
            }
            progressBar1.Step    = 1;
            progressBar1.Value   = 1;
            progressBar1.Maximum = _lFileNames.Length;
            progressBar1.Minimum = 0;
            ModifyProgressBarColor.SetState(progressBar1, 1);

            string sBatchID = (txt_BatchName.Text + txt_DateCreate.Text).Replace("/", "").Replace(@"\", "").Replace(@":", "").Replace(@"-", "");
            var    batch    = (from w in Global.Db.tbl_Batches.Where(w => w.BatchID == sBatchID) select w.BatchID).FirstOrDefault();

            if (!string.IsNullOrEmpty(txt_ImagePath.Text))
            {
                if (string.IsNullOrEmpty(batch))
                {
                    var fBatch = new tbl_Batch
                    {
                        BatchID       = sBatchID,
                        BatchName     = txt_BatchName.Text,
                        UserCreate    = txt_UserCreate.Text,
                        DateCreate    = DateTime.Now,
                        PathServer    = "",
                        PathPicture   = txt_Path.Text,
                        Location      = txt_ImagePath.Text,
                        NumberImage   = soluonghinh.ToString(),
                        ChiaUser      = chk_ChiaUser.Checked ? true : false,
                        CongKhaiBatch = false,
                    };
                    Global.Db.tbl_Batches.InsertOnSubmit(fBatch);
                    Global.Db.SubmitChanges();
                }
                else
                {
                    MessageBox.Show("Batch đã tồn tại vui lòng điền tên batch khác!");
                    return;
                }
            }
            else
            {
                MessageBox.Show("Bạn chưa chọn hình ảnh!");
                return;
            }

            string temp = Global.StrPath + "\\" + sBatchID;

            if (!Directory.Exists(temp))
            {
                Directory.CreateDirectory(temp);
            }
            else
            {
                MessageBox.Show("Bị trùng tên batch!");
                return;
            }
            DataTable dt = new DataTable();

            dt.Columns.AddRange(new[] { new DataColumn("ImageID", typeof(string)) });
            for (int i = 0; i < _lFileNames.Count(); i++)
            {
                FileInfo fi = new FileInfo(_lFileNames[i]);
                dt.Rows.Add(fi.Name);
            }
            string        ConnectionString = Global.Db.Connection.ConnectionString;
            SqlConnection con = new SqlConnection(ConnectionString);
            SqlCommand    cmd = new SqlCommand("Insert_Image", con);

            cmd.CommandTimeout = 10 * 60;
            cmd.CommandType    = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@BatchID", sBatchID);
            cmd.Parameters.AddWithValue("@ListIdImage", dt);
            cmd.Parameters.AddWithValue("@ChiaUser", chk_ChiaUser.Checked ? 1 : 0);
            con.Open();
            cmd.ExecuteNonQuery();

            for (int i = 0; i < _lFileNames.Count(); i++)
            {
                File.Copy(_lFileNames[i], temp + @"\" + new FileInfo(_lFileNames[i]).Name);
                progressBar1.PerformStep();
                lb_SoImageDaHoanThanh.Text = (i + 1) + @"\" + _lFileNames.Count();
            }
            txt_DateCreate.Text = DateTime.Now.ToShortDateString() + "-" + DateTime.Now.ToShortTimeString();
            MessageBox.Show("Tạo batch mới thành công!");
            txt_BatchName.Text  = "";
            txt_ImagePath.Text  = "";
            txt_Path.Text       = @"X:\N\13";
            lb_SoLuongHinh.Text = "";
        }
        private void UpLoadMulti()
        {
            try
            {
                List <string> lStrBath = new List <string>();
                lStrBath.AddRange(Directory.GetDirectories(txt_PathFolder.Text));
                progressBarControl1.EditValue              = 0;
                progressBarControl1.Properties.Step        = 1;
                progressBarControl1.Properties.PercentView = true;
                progressBarControl1.Properties.Maximum     = lStrBath.Count;
                progressBarControl1.Properties.Minimum     = 0;
                foreach (string item in lStrBath)
                {
                    var fBatch = new tbl_Batch
                    {
                        fBatchName    = new DirectoryInfo(item).Name,
                        fusercreate   = txt_UserCreate.Text,
                        fdatecreated  = DateTime.Now,
                        fPathPicture  = item,
                        fLocation     = txt_Location.Text,
                        fSoLuongAnh   = Directory.GetFiles(item).Length.ToString(),
                        ChiaUser      = chk_ChiaUser.Checked ? true : false,
                        CongKhaiBatch = false
                    };
                    Global.db_BCL.tbl_Batches.InsertOnSubmit(fBatch);
                    Global.db_BCL.SubmitChanges();

                    string   searchFolder = txt_PathFolder.Text + "\\" + new DirectoryInfo(item).Name;
                    var      filters      = new String[] { "jpg", "jpeg", "png", "gif", "tiff", "bmp" };
                    string[] tmp          = GetFilesFrom(searchFolder, filters, false);
                    string   temp         = Global.StrPath + "\\" + new DirectoryInfo(item).Name;
                    Directory.CreateDirectory(temp);
                    string imageJPG = "";
                    foreach (string i in tmp)
                    {
                        FileInfo  fi        = new FileInfo(i);
                        tbl_Image tempImage = new tbl_Image
                        {
                            fbatchname           = new DirectoryInfo(item).Name,
                            idimage              = Path.GetFileName(fi.ToString()),
                            ReadImageDESo        = 0,
                            ReadImageDEJP        = 0,
                            CheckedDESo          = 0,
                            CheckedDEJP          = 0,
                            FlagReadDeSo_Good    = chk_ChiaUser.Checked ? 0 : 1,
                            FlagReadDeSo_NotGood = chk_ChiaUser.Checked ? 0 : 1,
                            TienDoDESO           = "Hình chưa nhập",
                            TienDoDEJP           = "Hình chưa nhập"
                        };
                        Global.db_BCL.tbl_Images.InsertOnSubmit(tempImage);
                        Global.db_BCL.SubmitChanges();
                        string des = temp + @"\" + Path.GetFileName(fi.ToString());
                        fi.CopyTo(des);
                        progressBarControl1.PerformStep();
                        progressBarControl1.Update();
                    }
                    progressBarControl1.PerformStep();
                    progressBarControl1.Update();
                }
                MessageBox.Show("Tạo batch mới thành công!");
                progressBarControl1.EditValue = 0;
                txt_BatchName.Text            = "";
                txt_ImagePath.Text            = "";
                lb_SoLuongHinh.Text           = "";
            }
            catch (Exception ex)
            {
                MessageBox.Show("Lỗi: \r\n" + ex.Message);
            }
            finally
            {
                chk_ChiaUser.Enabled = true;
            }
        }
 private void UpLoadSingle()
 {
     try
     {
         progressBarControl1.EditValue              = 0;
         progressBarControl1.Properties.Step        = 1;
         progressBarControl1.Properties.PercentView = true;
         progressBarControl1.Properties.Maximum     = _lFileNames.Length;
         progressBarControl1.Properties.Minimum     = 0;
         var batch = (from w in Global.db_BCL.tbl_Batches.Where(w => w.fBatchName == txt_BatchName.Text) select w.fBatchName).FirstOrDefault();
         if (!string.IsNullOrEmpty(txt_ImagePath.Text))
         {
             if (string.IsNullOrEmpty(batch))
             {
                 var fBatch = new tbl_Batch
                 {
                     fBatchName      = txt_BatchName.Text,
                     fusercreate     = txt_UserCreate.Text,
                     fdatecreated    = DateTime.Now,
                     fPathPicture    = txt_ImagePath.Text,
                     fLocation       = txt_Location.Text,
                     fSoLuongAnh     = soluonghinh.ToString(),
                     ChiaUser        = chk_ChiaUser.Checked ? true : false,
                     CongKhaiBatch   = false,
                     GiaTriTruongSo4 = txt_TruongSo4.Text,
                     TeninhThu2      = txt_TenHinhThu2.Text
                 };
                 Global.db_BCL.tbl_Batches.InsertOnSubmit(fBatch);
                 Global.db_BCL.SubmitChanges();
             }
             else
             {
                 MessageBox.Show("Batch đã tồn tại vui lòng điền tên batch khác!");
                 return;
             }
         }
         else
         {
             MessageBox.Show("Bạn chưa chọn hình ảnh!");
             return;
         }
         string temp = Global.StrPath + "\\" + txt_BatchName.Text;
         if (!Directory.Exists(temp))
         {
             Directory.CreateDirectory(temp);
         }
         else
         {
             MessageBox.Show("Bị trùng tên batch!");
             return;
         }
         foreach (string i in _lFileNames)
         {
             FileInfo  fi        = new FileInfo(i);
             tbl_Image tempImage = new tbl_Image
             {
                 fbatchname           = txt_BatchName.Text,
                 idimage              = Path.GetFileName(fi.ToString()),
                 ReadImageDESo        = 0,
                 ReadImageDEJP        = 0,
                 CheckedDESo          = 0,
                 CheckedDEJP          = 0,
                 FlagReadDeSo_Good    = chk_ChiaUser.Checked ? 0 : 1,
                 FlagReadDeSo_NotGood = chk_ChiaUser.Checked ? 0 : 1,
                 TienDoDESO           = "Hình chưa nhập",
                 TienDoDEJP           = "Hình chưa nhập"
             };
             Global.db_BCL.tbl_Images.InsertOnSubmit(tempImage);
             Global.db_BCL.SubmitChanges();
             string des = temp + @"\" + Path.GetFileName(fi.ToString());
             fi.CopyTo(des);
             progressBarControl1.PerformStep();
             progressBarControl1.Update();
         }
         MessageBox.Show("Tạo batch mới thành công!");
         progressBarControl1.EditValue = 0;
         txt_BatchName.Text            = "";
         txt_ImagePath.Text            = "";
         lb_SoLuongHinh.Text           = "";
     }
     catch (Exception ex)
     {
         MessageBox.Show("Lỗi: \r\n" + ex.Message);
     }
     finally
     {
         chk_ChiaUser.Enabled = true;
     }
 }
예제 #10
0
        private void UpLoadMulti()
        {
            btn_Browser.Enabled    = false;
            txt_PathFolder.Enabled = false;
            txt_Location.Enabled   = false;
            List <string> lStrBath = new List <string>();

            lStrBath.AddRange(Directory.GetDirectories(txt_PathFolder.Text));
            int    countBatchExists = 0;
            string listBatchExxists = "";

            for (int i = 0; i < lStrBath.Count; i++)
            {
                var batchExists = (from w in Global.db.tbl_Batches where w.fBatchName == new DirectoryInfo(lStrBath[i]).Name select w.fBatchName).ToList();
                if (batchExists.Count > 0)
                {
                    countBatchExists += 1;
                    listBatchExxists += batchExists[0] + "\r\n";
                }
            }
            if (countBatchExists > 0)
            {
                MessageBox.Show("Batch đã tồn tại :\r\n" + listBatchExxists);
                btn_Browser.Enabled    = true;
                txt_PathFolder.Enabled = true;
                txt_Location.Enabled   = true;
                return;
            }
            int n = 0;

            foreach (string itemBatch in lStrBath)
            {
                string batchName = "", loaiPhieu = "", pathPicture = "";
                int    m = 0;
                batchName = new DirectoryInfo(itemBatch).Name;
                if (batchName.IndexOf("AEON", StringComparison.Ordinal) >= 0 || batchName.IndexOf("aeon", StringComparison.Ordinal) >= 0)
                {
                    loaiPhieu = "AEON";
                }
                else if (batchName.IndexOf("ASAHI", StringComparison.Ordinal) >= 0 || batchName.IndexOf("asahi", StringComparison.Ordinal) >= 0)
                {
                    loaiPhieu = "ASAHI";
                }
                else if (batchName.IndexOf("EIZEN", StringComparison.Ordinal) >= 0 || batchName.IndexOf("eizen", StringComparison.Ordinal) >= 0)
                {
                    loaiPhieu = "EIZEN";
                }
                else if (batchName.IndexOf("YAMAMOTO", StringComparison.Ordinal) >= 0 || batchName.IndexOf("yamamoto", StringComparison.Ordinal) >= 0)
                {
                    loaiPhieu = "YAMAMOTO";
                }
                else if (batchName.IndexOf("YASUDA", StringComparison.Ordinal) >= 0 || batchName.IndexOf("yasuda", StringComparison.Ordinal) >= 0)
                {
                    loaiPhieu = "YASUDA";
                }
                else if (batchName.IndexOf("TAIYO", StringComparison.Ordinal) >= 0 || batchName.IndexOf("taiyo", StringComparison.Ordinal) >= 0)
                {
                    loaiPhieu = "TAIYO";
                }
                else
                {
                    continue;
                }

                n += 1;
                lb_SobatchHoanThanh.Text = n + @" :";

                pathPicture = itemBatch + @"\入力画像";
                var fBatch = new tbl_Batch
                {
                    fBatchName   = batchName,
                    fUserCreate  = txt_UserCreate.Text,
                    fDateCreated = DateTime.Now,
                    fPathPicture = pathPicture,
                    fLocation    = txt_Location.Text,
                    fSoLuongAnh  = Directory.GetFiles(pathPicture).Length.ToString(),
                    fLoaiPhieu   = loaiPhieu
                };
                Global.db.tbl_Batches.InsertOnSubmit(fBatch);
                Global.db.SubmitChanges();

                var      filters           = new String[] { "jpg", "jpeg", "png", "gif", "tif", "bmp" };
                string[] pathImageLocation = GetFilesFrom(pathPicture, filters, false);
                string   pathImageServer   = Global.StrPath + "\\" + new DirectoryInfo(itemBatch).Name;
                Directory.CreateDirectory(pathImageServer);
                string imageJPG = "";

                progressBar1.Step    = 1;
                progressBar1.Value   = 1;
                progressBar1.Maximum = pathImageLocation.Length;
                progressBar1.Minimum = 0;
                ModifyProgressBarColor.SetState(progressBar1, 1);

                foreach (string i in pathImageLocation)
                {
                    FileInfo  fi        = new FileInfo(i);
                    tbl_Image tempImage = new tbl_Image
                    {
                        fbatchname    = batchName,
                        idimage       = Path.GetFileName(fi.ToString()),
                        ReadImageDESo = 0,
                        CheckedDESo   = 0,
                        Checked_QC    = 0,
                        TienDoDESO    = "Hình chưa nhập",
                        CheckQC       = false
                    };

                    Global.db.tbl_Images.InsertOnSubmit(tempImage);
                    Global.db.SubmitChanges();
                    //tbl_TienDo tempTblTienDo = new tbl_TienDo
                    //{
                    //    IDProject = "JEMS",
                    //    fBatchName = txt_BatchName.Text,
                    //    Idimage = Path.GetFileName(fi.ToString()),
                    //    TienDoDeSo = "Hình chưa nhập",
                    //    UserCheckDeSo = "",
                    //    DateCreate = DateTime.Now
                    //};
                    //Global.db_BPO.tbl_TienDos.InsertOnSubmit(tempTblTienDo);
                    //Global.db_BPO.SubmitChanges();

                    string des = pathImageServer + @"\" + Path.GetFileName(fi.ToString());
                    fi.CopyTo(des);
                    m += 1;
                    lb_SoImageDaHoanThanh.Text = m + @"/" + pathImageLocation.Length;
                    progressBar1.PerformStep();
                }
            }
            MessageBox.Show(@"Tạo batch mới thành công!");
            txt_BatchName.Text          = "";
            txt_ImagePath.Text          = "";
            lb_SoLuongHinh.Text         = "";
            txt_PathFolder.Text         = "";
            txt_LoaiPhieu.SelectedIndex = 0;

            //btn_CreateBatch.Enabled = true;
            btn_Browser.Enabled    = true;
            txt_PathFolder.Enabled = true;
            txt_Location.Enabled   = true;
        }
예제 #11
0
        private void UpLoadSingle()
        {
            progressBar1.Step    = 1;
            progressBar1.Value   = 1;
            progressBar1.Maximum = _lFileNames.Length;
            progressBar1.Minimum = 0;
            ModifyProgressBarColor.SetState(progressBar1, 1);
            var batch = (from w in Global.db.tbl_Batches.Where(w => w.fBatchName == txt_BatchName.Text) select w.fBatchName).FirstOrDefault();

            if (!string.IsNullOrEmpty(txt_ImagePath.Text))
            {
                if (string.IsNullOrEmpty(batch))
                {
                    var fBatch = new tbl_Batch
                    {
                        fBatchName   = txt_BatchName.Text,
                        fUserCreate  = txt_UserCreate.Text,
                        fDateCreated = DateTime.Now,
                        fPathPicture = txt_ImagePath.Text,
                        fLocation    = txt_Location.Text,
                        fSoLuongAnh  = soluonghinh.ToString(),
                        fLoaiPhieu   = txt_LoaiPhieu.Text
                    };
                    Global.db.tbl_Batches.InsertOnSubmit(fBatch);
                    Global.db.SubmitChanges();


                    //DateTime timeStart = new DateTime(dateEdit_ngaybatdau.DateTime.Year,
                    //                            dateEdit_ngaybatdau.DateTime.Month,
                    //                            dateEdit_ngaybatdau.DateTime.Day,
                    //                            timeEdit_ngaybatdau.Time.Hour,
                    //                            timeEdit_ngaybatdau.Time.Minute,
                    //                            timeEdit_ngaybatdau.Time.Second);
                    //DateTime timeEnd = new DateTime(dateEdit_ngayketthuc.DateTime.Year,
                    //                                    dateEdit_ngayketthuc.DateTime.Month,
                    //                                    dateEdit_ngayketthuc.DateTime.Day,
                    //                                    timeEdit_ngayketthuc.Time.Hour,
                    //                                    timeEdit_ngayketthuc.Time.Minute,
                    //                                    timeEdit_ngayketthuc.Time.Second);
                    //int timeNotificationdeadline = 0;
                    //if (cbb_loaithoigian.Text == "Ngày")
                    //{
                    //    timeNotificationdeadline = Convert.ToInt32(nud_thoigiandeadline.Value * 24 * 60);
                    //}
                    //else if (cbb_loaithoigian.Text == "Giờ")
                    //{
                    //    timeNotificationdeadline = Convert.ToInt32(nud_thoigiandeadline.Value * 60);
                    //}
                    //else if (cbb_loaithoigian.Text == "Phút")
                    //{
                    //    timeNotificationdeadline = Convert.ToInt32(nud_thoigiandeadline.Value);
                    //}
                    //var fBatchEntry = new tbl_Batch_Entry()
                    //{
                    //    fIDProject = Global.StrIdProject,
                    //    fBatchName = txt_BatchName.Text,
                    //    fUserCreate = txt_UserCreate.Text,
                    //    fDateCreated = DateTime.Now,
                    //    fPathPicture = txt_ImagePath.Text,
                    //    fLocation = txt_Location.Text,
                    //    fSoLuongAnh = soluonghinh.ToString(),
                    //    fLoaiPhieu = txt_LoaiPhieu.Text,
                    //    fTimeStart = timeStart,
                    //    fTimeEnd = timeEnd,
                    //    fDeadlineNotificationTime = timeNotificationdeadline
                    //};
                    //Global.db_BPO.tbl_Batch_Entries.InsertOnSubmit(fBatchEntry);
                    //Global.db.SubmitChanges();
                }
                else
                {
                    MessageBox.Show("Batch đã tồn tại vui lòng điền tên batch khác!");
                    return;
                }
            }
            else
            {
                MessageBox.Show("Bạn chưa chọn hình ảnh!");
                return;
            }
            string temp = Global.StrPath + "\\" + txt_BatchName.Text;

            if (!Directory.Exists(temp))
            {
                Directory.CreateDirectory(temp);
            }
            else
            {
                MessageBox.Show("Bị trùng tên batch!");
                return;
            }
            foreach (string i in _lFileNames)
            {
                FileInfo  fi        = new FileInfo(i);
                tbl_Image tempImage = new tbl_Image
                {
                    fbatchname    = txt_BatchName.Text,
                    idimage       = Path.GetFileName(fi.ToString()),
                    ReadImageDESo = 0,
                    CheckedDESo   = 0,
                    Checked_QC    = 0,
                    TienDoDESO    = "Hình chưa nhập",
                    CheckQC       = false
                };
                Global.db.tbl_Images.InsertOnSubmit(tempImage);
                Global.db.SubmitChanges();

                tbl_TienDo tempTblTienDo = new tbl_TienDo
                {
                    IDProject     = "JEMS",
                    fBatchName    = txt_BatchName.Text,
                    Idimage       = Path.GetFileName(fi.ToString()),
                    TienDoDeSo    = "Hình chưa nhập",
                    UserCheckDeSo = "",
                    DateCreate    = DateTime.Now
                };
                Global.db_BPO.tbl_TienDos.InsertOnSubmit(tempTblTienDo);
                Global.db_BPO.SubmitChanges();

                string des = temp + @"\" + Path.GetFileName(fi.ToString());
                fi.CopyTo(des);
                progressBar1.PerformStep();
            }
            MessageBox.Show("Tạo batch mới thành công!");
            txt_BatchName.Text          = "";
            txt_ImagePath.Text          = "";
            lb_SoLuongHinh.Text         = "";
            txt_LoaiPhieu.SelectedIndex = 0;
        }
예제 #12
0
        private void UpLoadSingle()
        {
            progressBarControl1.EditValue              = 0;
            progressBarControl1.Properties.Step        = 1;
            progressBarControl1.Properties.PercentView = true;
            progressBarControl1.Properties.Maximum     = _lFileNames.Length;
            progressBarControl1.Properties.Minimum     = 0;
            var batch = (from w in Global.db.tbl_Batches.Where(w => w.fBatchName == txt_BatchName.Text) select w.fBatchName).FirstOrDefault();

            if (!string.IsNullOrEmpty(txt_ImagePath.Text))
            {
                if (string.IsNullOrEmpty(batch))
                {
                    var fBatch = new tbl_Batch
                    {
                        fBatchName   = txt_BatchName.Text,
                        fusercreate  = txt_UserCreate.Text,
                        fdatecreated = DateTime.Now,
                        fPathPicture = txt_ImagePath.Text,
                        fLocation    = txt_Location.Text,
                        fSoLuongAnh  = soluonghinh.ToString(),
                        LoaiBatch    = rg_LoaiBatch.Properties.Items[rg_LoaiBatch.SelectedIndex].Description
                    };
                    Global.db.tbl_Batches.InsertOnSubmit(fBatch);
                    Global.db.SubmitChanges();
                }
                else
                {
                    MessageBox.Show("Batch đã tồn tại vui lòng điền tên batch khác!");
                    return;
                }
            }
            else
            {
                MessageBox.Show("Bạn chưa chọn hình ảnh!");
                return;
            }
            string temp = Global.StrPath + "\\" + txt_BatchName.Text;

            if (!Directory.Exists(temp))
            {
                Directory.CreateDirectory(temp);
            }
            else
            {
                MessageBox.Show("Bị trùng tên batch!");
                return;
            }
            foreach (string i in _lFileNames)
            {
                FileInfo fi = new FileInfo(i);

                tbl_Image tempImage = new tbl_Image
                {
                    fbatchname            = txt_BatchName.Text,
                    idimage               = Path.GetFileName(fi.ToString()),
                    ReadImageDESo         = 0,
                    CheckedDESo           = 0,
                    TienDoDESO            = "Hình chưa nhập",
                    ReadImageDESO_Good    = 1,
                    ReadImageDESO_NotGood = 1
                };
                Global.db.tbl_Images.InsertOnSubmit(tempImage);
                Global.db.SubmitChanges();


                string des = temp + @"\" + Path.GetFileName(fi.ToString());
                fi.CopyTo(des);
                progressBarControl1.PerformStep();
                progressBarControl1.Update();
            }
            MessageBox.Show("Tạo batch mới thành công!");
            progressBarControl1.EditValue = 0;
            txt_BatchName.Text            = "";
            txt_ImagePath.Text            = "";
            lb_SoLuongHinh.Text           = "";
        }
예제 #13
0
        private void UpLoadMulti()
        {
            List <string> lStrBath = new List <string>();

            lStrBath.AddRange(Directory.GetDirectories(txt_PathFolder.Text));
            progressBarControl1.EditValue              = 0;
            progressBarControl1.Properties.Step        = 1;
            progressBarControl1.Properties.PercentView = true;
            progressBarControl1.Properties.Maximum     = lStrBath.Count;
            progressBarControl1.Properties.Minimum     = 0;

            foreach (string item in lStrBath)
            {
                var fBatch = new tbl_Batch
                {
                    fBatchName   = new DirectoryInfo(item).Name,
                    fUserCreate  = txt_UserCreate.Text,
                    fDateCreated = DateTime.Now,
                    fPathPicture = item,
                    fLocation    = txt_Location.Text,
                    fSoLuongAnh  = Directory.GetFiles(item).Length.ToString()
                };
                Global.db.tbl_Batches.InsertOnSubmit(fBatch);
                Global.db.SubmitChanges();


                //DateTime timeStart = new DateTime(dateEdit_ngaybatdau.DateTime.Year,
                //                                 dateEdit_ngaybatdau.DateTime.Month,
                //                                 dateEdit_ngaybatdau.DateTime.Day,
                //                                 timeEdit_ngaybatdau.Time.Hour,
                //                                 timeEdit_ngaybatdau.Time.Minute,
                //                                 timeEdit_ngaybatdau.Time.Second);
                //DateTime timeEnd = new DateTime(dateEdit_ngayketthuc.DateTime.Year,
                //                                    dateEdit_ngayketthuc.DateTime.Month,
                //                                    dateEdit_ngayketthuc.DateTime.Day,
                //                                    timeEdit_ngayketthuc.Time.Hour,
                //                                    timeEdit_ngayketthuc.Time.Minute,
                //                                    timeEdit_ngayketthuc.Time.Second);
                //int timeNotificationdeadline = 0;
                //if (cbb_loaithoigian.Text == "Ngày")
                //{
                //    timeNotificationdeadline = Convert.ToInt32(nud_thoigiandeadline.Value * 24 * 60);
                //}
                //else if (cbb_loaithoigian.Text == "Giờ")
                //{
                //    timeNotificationdeadline = Convert.ToInt32(nud_thoigiandeadline.Value * 60);
                //}
                //else if (cbb_loaithoigian.Text == "Phút")
                //{
                //    timeNotificationdeadline = Convert.ToInt32(nud_thoigiandeadline.Value);
                //}
                //var fBatchEntry = new tbl_Batch_Entry()
                //{
                //    fIDProject = Global.StrIdProject,
                //    fBatchName = txt_BatchName.Text,
                //    fUserCreate = txt_UserCreate.Text,
                //    fDateCreated = DateTime.Now,
                //    fPathPicture = txt_ImagePath.Text,
                //    fLocation = txt_Location.Text,
                //    fSoLuongAnh = soluonghinh.ToString(),
                //    fLoaiPhieu = txt_LoaiPhieu.Text,
                //    fTimeStart = timeStart,
                //    fTimeEnd = timeEnd,
                //    fDeadlineNotificationTime = timeNotificationdeadline
                //};
                //Global.db_BPO.tbl_Batch_Entries.InsertOnSubmit(fBatchEntry);
                //Global.db.SubmitChanges();


                string   searchFolder = txt_PathFolder.Text + "\\" + new DirectoryInfo(item).Name;
                var      filters      = new String[] { "jpg", "jpeg", "png", "gif", "tiff", "bmp" };
                string[] tmp          = GetFilesFrom(searchFolder, filters, false);
                string   temp         = Global.StrPath + "\\" + new DirectoryInfo(item).Name;
                Directory.CreateDirectory(temp);
                string imageJPG = "";
                foreach (string i in tmp)
                {
                    FileInfo  fi        = new FileInfo(i);
                    tbl_Image tempImage = new tbl_Image
                    {
                        fbatchname    = new DirectoryInfo(item).Name,
                        idimage       = Path.GetFileName(fi.ToString()),
                        ReadImageDESo = 0,
                        CheckedDESo   = 0,
                        Checked_QC    = 0,
                        TienDoDESO    = "Hình chưa nhập",
                        CheckQC       = false
                    };
                    Global.db.tbl_Images.InsertOnSubmit(tempImage);
                    Global.db.SubmitChanges();

                    tbl_TienDo tempTblTienDo = new tbl_TienDo
                    {
                        IDProject     = "JEMS",
                        fBatchName    = txt_BatchName.Text,
                        Idimage       = Path.GetFileName(fi.ToString()),
                        TienDoDeSo    = "Hình chưa nhập",
                        UserCheckDeSo = "",
                        DateCreate    = DateTime.Now
                    };
                    Global.db_BPO.tbl_TienDos.InsertOnSubmit(tempTblTienDo);
                    Global.db_BPO.SubmitChanges();

                    string des = temp + @"\" + Path.GetFileName(fi.ToString());
                    fi.CopyTo(des);
                    progressBarControl1.PerformStep();
                    progressBarControl1.Update();
                }
                progressBarControl1.PerformStep();
                progressBarControl1.Update();
            }
            MessageBox.Show("Tạo batch mới thành công!");
            progressBarControl1.EditValue = 0;
            txt_BatchName.Text            = "";
            txt_ImagePath.Text            = "";
            lb_SoLuongHinh.Text           = "";
            txt_LoaiPhieu.SelectedIndex   = 0;
        }