コード例 #1
0
        internal void SyncAttachments(Attachements item)
        {
            AttachmentsEntity ent = new AttachmentsEntity()
            {
                AttachementId = Convert.ToInt32(item.AttachementId),
                Bezeichnung   = item.Bezeichnung,
                Filename      = item.Filename,
                HauspaketId   = Convert.ToInt32(item.HauspaketId),
                Mimetype      = item.Mimetype,
                Size          = Convert.ToInt32(item.Size)
            };

            switch (item.SyncOperation)
            {
            case "INSERT":
            {
                dataHandler.InsertAttachements(ent);
            }
            break;

            case "UPDATE":
            {
                dataHandler.UpdateAttachements(ent);
            }
            break;

            case "DELETE":
            {
                dataHandler.DeleteAttachements(ent);
            }
            break;
            }
        }
コード例 #2
0
        public void DeleteAttachements(AttachmentsEntity attachementsEntity)
        {
            attachements result = (from x in db.attachements
                                   where x.attachement_id == attachementsEntity.AttachementId
                                   select x).SingleOrDefault();

            db.attachements.Remove(result);
            db.SaveChanges();
        }
コード例 #3
0
        public void UpdateAttachements(AttachmentsEntity attachementsEntity)
        {
            attachements result = (from x in db.attachements
                                   where x.attachement_id == attachementsEntity.AttachementId
                                   select x).SingleOrDefault();

            result.attachement_id = attachementsEntity.AttachementId;
            result.bezeichnung    = attachementsEntity.Bezeichnung;
            result.filename       = attachementsEntity.Filename;
            result.hauspaket_id   = attachementsEntity.HauspaketId;
            result.mimetype       = attachementsEntity.Mimetype;
            result.size           = attachementsEntity.Size;

            db.SaveChanges();
        }
コード例 #4
0
        public void InsertAttachements(AttachmentsEntity attachementsEntity)
        {
            attachements h = new attachements()
            {
                attachement_id = attachementsEntity.AttachementId,
                bezeichnung    = attachementsEntity.Bezeichnung,
                filename       = attachementsEntity.Filename,
                hauspaket_id   = attachementsEntity.HauspaketId,
                mimetype       = attachementsEntity.Mimetype,
                size           = attachementsEntity.Size
            };

            db.attachements.Add(h);
            db.SaveChanges();
        }