Exemplo n.º 1
0
        public Snapshot_RecsCopyright SaveSnapshotWorksRecording(Snapshot_RecsCopyright snapshotRecsCopyright)
        {
            using (var context = new DataContext())
            {
                context.Snapshot_RecsCopyrights.Add(snapshotRecsCopyright);
                try
                {
                    context.SaveChanges();
                }
                catch (Exception e)
                {
                    Logger.Debug(e.ToString());
                    throw new Exception(e.ToString());
                }

                return(snapshotRecsCopyright);
            }
        }
        private List <Snapshot_RecsCopyright> CastToSnapshotRecsCopyrights(List <RecsCopyrights> recsCopyrights,
                                                                           int workTrackId)
        {
            var snapshotList = new List <Snapshot_RecsCopyright>();

            foreach (var rec in recsCopyrights)
            {
                var snapshot = new Snapshot_RecsCopyright();
                snapshot.CloneWorksTrackId = workTrackId;
                snapshot.WorkCode          = rec.WorkCode;
                snapshot.Title             = rec.Title;
                snapshot.PrincipalArtist   = rec.PrincipalArtist;
                snapshot.Writers           = rec.Writers;
                snapshot.WriteString       = rec.WriteString;
                snapshot.MechanicalCollectablePercentage = (int)rec.MechanicalCollectablePercentage;
                snapshot.MechanicalOwnershipPercentage   = (int)rec.MechanicalOwnershipPercentage;
                if (rec.Composers != null)
                {
                    snapshot.Composers = CastToSnapshotComposers(rec.Composers, workTrackId);
                }
                if (rec.Samples != null)
                {
                    snapshot.Samples = CastToSnapshotSamples(rec.Samples, workTrackId);
                }
                if (rec.LocalClients != null)
                {
                    snapshot.LocalClients = CastToSnapshotLocalClientCopyrights(rec.LocalClients, workTrackId);
                }
                if (rec.AquisitionLocationCode != null)
                {
                    snapshot.AquisitionLocationCodes = CastToSnapshotAquisitionLocationCode(rec.AquisitionLocationCode,
                                                                                            workTrackId);
                }
                snapshotList.Add(snapshot);
            }

            return(snapshotList);
        }