Example #1
0
 private void btEditName_Click(object sender, EventArgs e)
 {
     if (id_ServiceRecords != -1 && dtScan != null && dtScan.DefaultView.Count > 0 && dgvScan.CurrentRow != null && id_ServiceRecords != -1)
     {
         int         indexRow = dgvScan.CurrentRow.Index;
         int         id       = int.Parse(dtScan.DefaultView[indexRow]["id"].ToString());
         string      oldName  = (string)dtScan.DefaultView[indexRow]["cName"];
         frmNameFile frmNF    = new frmNameFile();
         if (DialogResult.OK == frmNF.ShowDialog())
         {
             string fileName = frmNF.getComment;
             setLog(id_ServiceRecords, "", 0, 2, typeDoc, fileName, oldName);
             Config.hCntMain.updateScanName(id, fileName);
             getData();
         }
     }
     else
     if (id_ServiceRecords == -1 && Config.bufferDataTable != null && Config.bufferDataTable.Rows.Count > 0 && dgvScan.CurrentRow != null)
     {
         int         indexRow = dgvScan.CurrentRow.Index;
         int         id       = int.Parse(Config.bufferDataTable.DefaultView[indexRow]["id"].ToString());
         frmNameFile frmNF    = new frmNameFile();
         if (DialogResult.OK == frmNF.ShowDialog())
         {
             string fileName = frmNF.getComment;
             Config.bufferDataTable.DefaultView[indexRow]["cName"] = fileName;
             Config.bufferDataTable.AcceptChanges();
         }
     }
 }
Example #2
0
        private void Scan()
        {
            try
            {
                Nwuram.Framework.scan.scanImg fImg = new Nwuram.Framework.scan.scanImg();
                fImg.ShowDialog();
                this.TopMost = true;
                byte[] img_array = fImg.img_array;
                this.TopMost = false;
                if (img_array != null)
                {
                    frmNameFile frmNF = new frmNameFile();
                    if (DialogResult.OK == frmNF.ShowDialog())
                    {
                        string fileName   = frmNF.getComment;
                        byte[] byteFile   = img_array;
                        string @Extension = ".jpg";
                        saveFileToDataBase(byteFile, fileName, @Extension);


                        //MemoryStream ms = new MemoryStream(img_array);
                        //System.Drawing.Image img_end = System.Drawing.Image.FromStream(ms);
                        //dgvUL.CurrentRow.Cells["scan"].Value = ImageToByteArray(ScaleImage(img_end, 800, 1200));

                        //int current_id = Convert.ToInt32(dgvUL.CurrentRow.Cells["id"].Value);
                        //if (id_del_image.Contains(current_id))
                        //{
                        //    id_del_image.Remove(current_id);
                        //}
                        //if (!id_add_image.Contains(current_id))
                        //{
                        //    id_add_image.Add(current_id);
                        //}

                        //imagePanel1.Image = ScaleImage(img_end, 284, 275) as Bitmap;
                    }
                    //SetButtonsEnabled();
                }
            }
            catch
            {
                MessageBox.Show("Ошибка при работе со сканером!");
            }
        }