Ejemplo n.º 1
0
 /// <summary>
 /// Inserts the image.
 /// </summary>
 /// <param name="imageData">The image data.</param>
 /// <returns></returns>
 public ImageData InsertImage(ImageData imageData)
 {
     using (ChannelFactory<ISPDBL> cf = new ChannelFactory<ISPDBL>(binding,endpointAddress)) {
         ISPDBL spdBL = cf.CreateChannel();
         return spdBL.InsertImage(imageData);
     }
 }
 /// <summary>
 /// Adds the image.
 /// </summary>
 /// <param name="img">The img.</param>
 public void addImage(ImageData img)
 {
     if (images == null) {
         images = new List<ImageData>();
     }
     images.Add(img);
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Inserts the image.
 /// </summary>
 /// <param name="imageData">The image data.</param>
 /// <returns></returns>
 public override ImageData InsertImage(ImageData imageData)
 {
     ImageData image = base.InsertImage(imageData);
     if (image != null) {
         if (imageBuffer != null) {
             imageBuffer.Add(imageData); // Add new Image also to buffer
         }
         return image;
     } else {
         return null;
     }
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Deletes the image.
 /// </summary>
 /// <param name="imageData">The image data.</param>
 /// <returns></returns>
 public override bool DeleteImage(ImageData imageData)
 {
     bool ok = base.DeleteImage(imageData);
     if (ok && imageBuffer != null) { // delete in buffer as well
         imageBuffer.Remove(imageData);
     }
     return ok;
 }
 /// <summary>
 /// Inserts the image.
 /// </summary>
 /// <param name="imageData">The image data.</param>
 /// <returns></returns>
 public virtual ImageData InsertImage(ImageData imageData)
 {
     IPhoto photoDB = Database.CreatePhoto();
     long id = photoDB.Insert(imageData);
     if (id != 0) {
         imageData.PhotoID = id;
         return imageData;
     } else {
         return null;
     }
 }
        public void PhotoInsertTest()
        {
            IPhoto photoDB = Database.CreatePhoto();
            ImageData photo = new ImageData(0, pID, "c:\\image.jpg", "Gutes Foto");
            long iID = photoDB.Insert(photo);
            ImageData photoWithID = new ImageData(iID, photo.PatientID, photo.Link, photo.Kommentar);

            photo = photoDB.FindByPhotoId(iID);

            Assert.AreEqual(photo.Link, photoWithID.Link);
            Assert.AreEqual(photo.Kommentar, photoWithID.Kommentar);
            Assert.AreEqual(photo.PhotoID, photoWithID.PhotoID);
            Assert.AreEqual(photo.Link, photoWithID.Link);

            Assert.IsTrue(photoDB.Delete(iID));

            Assert.IsNull(photoDB.FindByPhotoId(iID));
        }
 /// <summary>
 /// Deletes the image.
 /// </summary>
 /// <param name="imageData">The image data.</param>
 /// <returns></returns>
 public virtual bool DeleteImage(ImageData imageData)
 {
     IPhoto photoDB = Database.CreatePhoto();
     return photoDB.Delete(imageData.PhotoID);
 }
Ejemplo n.º 8
0
        private ImageData fillPhoto(IDataReader rdr)
        {
            ImageData photo = new ImageData();

            photo.PhotoID = Convert.ToInt64(rdr["PhotoID"]);
            photo.PatientID = Convert.ToInt64(rdr["PatientID"]);
            photo.Link = Convert.ToString(rdr["Link"]);
            photo.Kommentar = Convert.ToString(rdr["Kommentar"]);

            return photo;
        }
Ejemplo n.º 9
0
 public bool Update(ImageData photo)
 {
     log.Error("Update Foto not implemented");
     throw new Exception("The method or operation is not implemented.");
 }
Ejemplo n.º 10
0
        public long Insert(ImageData idata)
        {
            try {

                long tstart = DateTime.Now.Ticks;

                DbUtil.OpenConnection();

                if (insertByIdCmd == null) {
                    insertByIdCmd = DbUtil.CreateCommand(SQL_INSERT_BY_ID + DbUtil.GetAppendix("PhotoID"), DbUtil.CurrentConnection);
                    insertByIdCmd.Parameters.Add(DbUtil.CreateParameter("@PatientID", DbType.Int64));
                    insertByIdCmd.Parameters.Add(DbUtil.CreateParameter("@Link", DbType.String));
                    insertByIdCmd.Parameters.Add(DbUtil.CreateParameter("@Kommentar", DbType.String));
                }

                ((IDataParameter)insertByIdCmd.Parameters["@PatientID"]).Value = idata.PatientID;
                ((IDataParameter)insertByIdCmd.Parameters["@Link"]).Value = idata.Link;
                ((IDataParameter)insertByIdCmd.Parameters["@Kommentar"]).Value = idata.Kommentar;

                //bool ok = insertByIdCmd.ExecuteNonQuery() == 1;
                Object insertRet = insertByIdCmd.ExecuteScalar();

                long tend = DateTime.Now.Ticks;
                log.Info("Insert Foto: " + insertRet + " " + ((tend - tstart) / 10000) + "ms");

                return DbUtil.getGeneratedId((IDbCommand)insertByIdCmd, lastInsertedRowCmd, insertRet);
            } catch (Exception e) {
                log.Error(e.Message);
                throw e;
            } finally {
                DbUtil.CloseConnection();
            }
        }
        /// <summary>
        /// Parses the Photos.
        /// </summary>
        /// <param name="jsonFotos">The json Photos.</param>
        /// <returns></returns>
        private static IList<ImageData> parsePhotos(ArrayList jsonFotos)
        {
            IList<ImageData> photoList = new List<ImageData>();

            foreach (Hashtable htnexAct in jsonFotos) {
                ImageData photo = new ImageData();

                if (htnexAct.ContainsKey(photo_PatientID)) {
                    photo.PatientID = Convert.ToInt64(htnexAct[photo_PatientID]);
                }

                if (htnexAct.ContainsKey(nextAction_PatientID)) {
                    photo.PatientID = Convert.ToInt64(htnexAct[nextAction_PatientID]);
                }

                if (htnexAct.ContainsKey(photo_Link)) {
                    photo.Link = Convert.ToString(htnexAct[photo_Link]);
                }

                if (htnexAct.ContainsKey(photo_Kommentar)) {
                    photo.Kommentar = Convert.ToString(htnexAct[photo_Kommentar]);
                }

                photoList.Add(photo);
            }

            return photoList;
        }