예제 #1
0
        /* -------------------------------------------------------------------------------------------
         * delete the selected picture from sql server
         * --------------------------------------------------------------------------------------------- */
        private void DeletePicture(string picName)
        {
            if (!File.Exists(picGalleryFile))
            {
                return;
            }
            XmlDocument doc = new XmlDocument();

            doc.Load(picGalleryFile);
            XmlNode picGallery = doc.SelectSingleNode(EmrConstant.ElementNames.PicGallery);
            XmlNode picture    = FindPictureNode(picName, picGallery);

            if (picture != null)
            {
                picGallery.RemoveChild(picture);
            }
            doc.Save(picGalleryFile);
            string departCode;

            departCode = Globals.OpDepartID;
            /* Delete an picture from PicGallery */
            using (gjtEmrService.emrServiceXml es = new gjtEmrService.emrServiceXml())
            {
                try
                {
                    es.DeletePicture(picName, departCode);
                }
                catch (Exception ex)
                {
                    Globals.logAdapter.Record("EX925511256767", ex.Message + ">>" + ex.ToString(), true);
                }
            }
            /* Get pictrues from PicGallery for a department */
            for (int i = this.plContain.Controls.Count - 1; i >= 0; i--)
            {
                //if(typeof(PictureBox).GetType()==Controls[i].GetType())
                this.plContain.Controls.RemoveAt(i);
            }
            LoadPicture(ThisAddIn.xmlPicGalleryWriter(Globals.OpDepartID));
        }