Exemplo n.º 1
0
        /// <summary>
        /// 保存图片并记录入图片表(注意是否打勾)
        /// </summary>
        /// <param name="arrayImg"></param>
        public bool SaveImage(List <ImgObj> arrayImg, SIS_Model.MWorkList worklist)
        {
            bool isSuccess = true;
            int  j         = 0;

            for (int i = 0; i < arrayImg.Count; i++)
            {
                ImgObj obj   = (ImgObj)arrayImg[i];
                MImage model = (MImage)obj.MImage;
                if (model == null)
                {
                    model                    = new MImage();
                    model.IMAGE_PATH         = CreateServerPath(obj.ImagePath);
                    model.EXAM_ACCESSION_NUM = worklist.EXAM_ACCESSION_NUM;
                }
                else
                {
                    model.IMAGE_PATH = CreateServerPath(obj.ImagePath);
                }
                model.IS_PRINT   = (obj.IsCheck == true ? 1 : 0);
                model.IMAGE_DATE = System.DateTime.Now;
                if (obj.IsDeleted)
                {
                    imgCopy.DeleteImg(model);
                }
                else
                {
                    if (imgCopy.FileUpLoad(model, obj.ImagePath, false) != 1)
                    {
                        // MessageBox.Show("图片" + obj.ImagePath + "保存失败,请检查网络连接情况", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        isSuccess = false;
                    }
                    else
                    {
                        j++;
                    }
                }
            }
            worklist.IMAGE_COUNTS = j;
            return(isSuccess);
        }
Exemplo n.º 2
0
 private void DeleteImg(bool isAll)
 {
     if (this.p_PreferImages.Controls.Count > 0)
     {
         List <userCtrPictureEx> arrayDelCheckCtl = new List <userCtrPictureEx>();
         List <userCtrPictureEx> arrayDelCtl      = new List <userCtrPictureEx>();
         for (int i = 0; i < this.p_PreferImages.Controls.Count; i++)
         {
             userCtrPictureEx axf = (userCtrPictureEx)this.p_PreferImages.Controls[i];
             if (isAll)
             {
                 arrayDelCtl.Add(axf);
                 continue;
             }
             if (axf.Picture.IsSelecting)
             {
                 if (axf.Picture.GetCheck())
                 {
                     arrayDelCheckCtl.Add(axf);
                 }
                 else
                 {
                     arrayDelCtl.Add(axf);
                 }
             }
         }
         if (!isAll && arrayDelCtl.Count == 0 && arrayDelCheckCtl.Count == 0)
         {
             return;
         }
         DialogResult dr;
         if (arrayDelCheckCtl.Count > 0)
         {
             if (!isAll)
             {
                 dr = MessageBoxEx.Show("选择图像包含打印图像,打印图像不能删除,是否删除其它所选择图像?", "警告", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);
             }
             else
             {
                 dr = MessageBoxEx.Show("该检查包含打印图像,打印图像不能删除,是否删除所有没打印图像?", "警告", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);
             }
         }
         else
         {
             if (!isAll)
             {
                 dr = MessageBoxEx.Show("是否删除所选择图像?", "警告", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);
             }
             else
             {
                 dr = MessageBoxEx.Show("是否删除该检查所有图像?", "警告", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);
             }
         }
         if (dr == DialogResult.OK)
         {
             ImageCopy imgCopy = new ImageCopy();
             if (isAll)
             {
                 for (int i = 0; i < arrayDelCtl.Count; i++)
                 {
                     System.IO.File.Delete(arrayDelCtl[i].Picture.FilePath);
                     ImgObj obj = (ImgObj)arrayDelCtl[i].Picture.ImgObj;
                     imgCopy.DeleteImg((SIS_Model.MImage)obj.MImage);
                 }
                 this.p_PreferImages.Controls.Clear();
                 this.dbClick(null);
                 frmMainForm.examInf.ArrayImages.Clear();
             }
             else
             {
                 for (int i = 0; i < arrayDelCtl.Count; i++)
                 {
                     System.IO.File.Delete(arrayDelCtl[i].Picture.FilePath);
                     this.p_PreferImages.Controls.Remove(arrayDelCtl[i]);
                     ImgObj obj = (ImgObj)arrayDelCtl[i].Picture.ImgObj;
                     imgCopy.DeleteImg((SIS_Model.MImage)obj.MImage);
                     frmMainForm.examInf.ArrayImages.Remove(obj);
                     if (obj.ImagePath.Substring(obj.ImagePath.LastIndexOf("\\") + 1) == this.CurrentCtlName)
                     {
                         this.dbClick(null);
                     }
                 }
             }
         }
     }
     this.l_Count.Text = "共 " + this.p_PreferImages.Controls.Count.ToString() + " 张";
 }