示例#1
0
 public bool SaveGenre(lwg_Genre p)
 {
     if (p != null)
     {
         if (p.GerneId > 0)
         {
             lwg_Genre c = dbContext.lwg_Genre.SingleOrDefault(ht => ht.GerneId == p.GerneId);
             if (c != null)
             {
                 c.Name = p.Name;
             }
             else
             {
                 return(false);
             }
         }
         else
         {
             if (dbContext.lwg_Genre.Count() > 0)
             {
                 p.GerneId = dbContext.lwg_Genre.OrderByDescending(pe => pe.GerneId).First().GerneId + 1;
             }
             else
             {
                 p.GerneId = 1;
             }
             dbContext.lwg_Genre.Add(p);
         }
         dbContext.SaveChanges();
         return(true);
     }
     return(false);
 }
示例#2
0
 public bool SavePublisher(lwg_Publisher p)
 {
     if (p != null)
     {
         if (p.PublisherId > 0)
         {
             lwg_Publisher c = dbContext.lwg_Publisher.SingleOrDefault(ht => ht.PublisherId == p.PublisherId);
             if (c != null)
             {
                 c.Name = p.Name;
             }
             else
             {
                 return(false);
             }
         }
         else
         {
             if (dbContext.lwg_Publisher.Count() > 0)
             {
                 p.PublisherId = dbContext.lwg_Publisher.OrderByDescending(pe => pe.PublisherId).First().PublisherId + 1;
             }
             else
             {
                 p.PublisherId = 1;
             }
             dbContext.lwg_Publisher.Add(p);
         }
         dbContext.SaveChanges();
         return(true);
     }
     return(false);
 }
示例#3
0
 public bool SaveInstrumental(lwg_Instrumental i)
 {
     if (i != null)
     {
         if (i.InstrumentalId > 0)
         {
             lwg_Instrumental c = dbContext.lwg_Instrumental.SingleOrDefault(it => it.InstrumentalId == i.InstrumentalId);
             if (c != null)
             {
                 c.LongName  = i.LongName;
                 c.ShortName = i.ShortName;
             }
             else
             {
                 return(false);
             }
         }
         else
         {
             if (dbContext.lwg_Instrumental.Count() > 0)
             {
                 i.InstrumentalId = dbContext.lwg_Instrumental.OrderByDescending(pe => pe.InstrumentalId).First().InstrumentalId + 1;
             }
             else
             {
                 i.InstrumentalId = 1;
             }
             dbContext.lwg_Instrumental.Add(i);
         }
         dbContext.SaveChanges();
         return(true);
     }
     return(false);
 }
 public bool DeleteEmail(int emailid)
 {
     if (emailid != 0)
     {
         var item = dbContent.Nop_EmailDirectory.Where(t => t.EmailID == emailid);
         dbContent.Nop_EmailDirectory.Remove(item.First());
         dbContent.SaveChanges();
         return(true);
     }
     return(false);
 }
示例#5
0
 public bool CheckAndInsertInstrTitle(string titleName, int catalogID, int titleTypeID)
 {
     try
     {
         lwg_InstrTitle lwg = context.lwg_InstrTitle.SingleOrDefault(o => o.Name.ToLower().Equals(titleName.ToLower()) && o.TitleTypeId == titleTypeID);
         if (lwg == null)
         {
             lwg             = new lwg_InstrTitle();
             lwg.TitleTypeId = titleTypeID;
             lwg.Name        = titleName;
             CatalogTitleTypeBiz cBiz = new CatalogTitleTypeBiz();
             cBiz.SaveInstrTitle(lwg);
         }
         if (!context.lwg_CatalogTitle.Any(o => o.CatalogId == catalogID && o.InstrTitleId == lwg.Id))
         {
             lwg_CatalogTitle catalogTitle = new lwg_CatalogTitle();
             catalogTitle.CatalogId    = catalogID;
             catalogTitle.InstrTitleId = lwg.Id;
             context.lwg_CatalogTitle.Add(catalogTitle);
             context.SaveChanges();
         }
         return(true);
     }
     catch (Exception ex)
     {
         return(false);
     }
 }
示例#6
0
        public bool InsertLicense(lwg_LicenseForm license)
        {
            if (license == null)
            {
                return(false);
            }

            try
            {
                license.CreatedDate = DateTime.Now;
                context.lwg_LicenseForm.Add(license);
                context.SaveChanges();
                return(true);
            }
            catch
            {
                throw;
            }
        }
示例#7
0
 public bool SavePerson(lwg_Person h)
 {
     if (h != null)
     {
         if (h.PersonId > 0)
         {
             lwg_Person c = dbContext.lwg_Person.SingleOrDefault(ht => ht.PersonId == h.PersonId);
             if (c != null)
             {
                 c.Biography   = h.Biography;
                 c.DOB         = h.DOB;
                 c.DOD         = h.DOD;
                 c.FirstLetter = h.FirstLetter;
                 c.FirstName   = h.FirstName;
                 c.LastName    = h.LastName;
                 c.NameDisplay = h.NameDisplay;
                 c.NameList    = h.NameList;
                 c.NameSort    = h.NameSort;
                 c.PictureID   = h.PictureID;
             }
             else
             {
                 return(false);
             }
         }
         else
         {
             if (dbContext.lwg_Person.Count() > 0)
             {
                 h.PersonId = dbContext.lwg_Person.Max(ct => ct.PersonId) + 1;
             }
             else
             {
                 h.PersonId = 1;
             }
             dbContext.lwg_Person.Add(h);
         }
         dbContext.SaveChanges();
         return(true);
     }
     return(false);
 }
示例#8
0
 public bool SaveSeries(lwg_Series p)
 {
     if (p != null)
     {
         if (p.SeriesId > 0)
         {
             lwg_Series c = dbContext.lwg_Series.SingleOrDefault(ht => ht.SeriesId == p.SeriesId);
             if (c != null)
             {
                 c.Name = p.Name;
             }
             else
             {
                 return(false);
             }
         }
         else
         {
             if (dbContext.lwg_Series.Count() > 0)
             {
                 p.SeriesId = dbContext.lwg_Series.OrderByDescending(pe => pe.SeriesId).First().SeriesId + 1;
             }
             else
             {
                 p.SeriesId = 1;
             }
             dbContext.lwg_Series.Add(p);
         }
         dbContext.SaveChanges();
         return(true);
     }
     return(false);
 }
示例#9
0
 public bool SaveReprintSource(lwg_ReprintSource i)
 {
     if (i != null)
     {
         if (i.ReprintSourceId > 0)
         {
             lwg_ReprintSource c = dbContext.lwg_ReprintSource.SingleOrDefault(it => it.ReprintSourceId == i.ReprintSourceId);
             if (c != null)
             {
                 c.Name = i.Name;
             }
             else
             {
                 return(false);
             }
         }
         else
         {
             if (dbContext.lwg_ReprintSource.Count() > 0)
             {
                 i.ReprintSourceId = dbContext.lwg_ReprintSource.OrderByDescending(pe => pe.ReprintSourceId).First().ReprintSourceId + 1;
             }
             else
             {
                 i.ReprintSourceId = 1;
             }
             dbContext.lwg_ReprintSource.Add(i);
         }
         dbContext.SaveChanges();
         return(true);
     }
     return(false);
 }
示例#10
0
 // add audios into lwg_Audio
 public void AddCatalogAudio(List <lwg_Audio> audioList)
 {
     dbContext.lwg_Audio.AddRange(audioList);
     dbContext.SaveChanges();
 }
示例#11
0
        public bool SaveCatalog(lwg_Catalog c)
        {
            try
            {
                if (c != null)
                {
                    if (dbContext.lwg_Catalog.Any(ct => ct.CatalogId == c.CatalogId))
                    {
                        lwg_Catalog h = dbContext.lwg_Catalog.SingleOrDefault(ht => ht.CatalogId == c.CatalogId);
                        if (h != null)
                        {
                            //TODO: all file catalog
                            c.ArrangerGroupId = h.ArrangerGroupId;  // allow null
                            c.Blurb           = h.Blurb;
                            //p.CatalogId // increase by code
                            c.CatalogNumber  = h.CatalogNumber;
                            c.Duration       = h.Duration;
                            c.Format1        = h.Format1;
                            c.Format10       = h.Format10;
                            c.Format2        = h.Format2;
                            c.Format3        = h.Format3;
                            c.Format4        = h.Format4;
                            c.Format5        = h.Format5;
                            c.Format6        = h.Format6;
                            c.Format7        = h.Format7;
                            c.Format8        = h.Format8;
                            c.Format9        = h.Format9;
                            c.FSCprodcode    = h.FSCprodcode;
                            c.Grade          = h.Grade; // type : byte ?
                            c.InstrumentalId = h.InstrumentalId;

                            c.KaldbNumber = h.KaldbNumber;
                            c.pages       = h.pages;
                            c.PDF         = h.PDF;
                            c.PeriodId    = h.PeriodId;
                            c.Price1      = h.Price1;  // allow null
                            c.Price2      = h.Price2;  // allow null
                            c.Price3      = h.Price3;  // allow null
                            c.Price4      = h.Price4;  // allow null
                            c.Price5      = h.Price5;  // allow null
                            c.Price6      = h.Price6;  // allow null
                            c.Price7      = h.Price7;  // allow null
                            c.Price8      = h.Price8;  // allow null
                            c.Price9      = h.Price9;  // allow null
                            c.Price10     = h.Price10; // allow null

                            c.PTSprodcode     = h.PTSprodcode;
                            c.QTFile1         = h.QTFile1;
                            c.QTFile2         = h.QTFile2;
                            c.QTFile3         = h.QTFile3;
                            c.QTFile4         = h.QTFile4;
                            c.QTFile5         = h.QTFile5;
                            c.QTFile6         = h.QTFile6;
                            c.QTFile7         = h.QTFile7;
                            c.QTFile8         = h.QTFile8;
                            c.QTFile9         = h.QTFile9;
                            c.QTFile10        = h.QTFile10;
                            c.QTFile11        = h.QTFile11;
                            c.recid           = h.recid; // what's recid ?
                            c.ReprintSourceId = h.ReprintSourceId;

                            c.S4MasterSeries     = h.S4MasterSeries;
                            c.S5MasterCategories = h.S5MasterCategories;
                            c.SeriesId           = h.SeriesId;

                            c.SoundFile1   = h.SoundFile1;
                            c.SoundFile2   = h.SoundFile2;
                            c.SoundFile3   = h.SoundFile3;
                            c.SoundFile4   = h.SoundFile4;
                            c.SoundFile5   = h.SoundFile5;
                            c.SoundFile6   = h.SoundFile6;
                            c.SoundFile7   = h.SoundFile7;
                            c.SoundFile8   = h.SoundFile8;
                            c.SoundFile9   = h.SoundFile9;
                            c.SoundFile10  = h.SoundFile10;
                            c.SoundFile11  = h.SoundFile11;
                            c.SoundFile12  = h.SoundFile12;
                            c.SoundFile13  = h.SoundFile13;
                            c.SoundFile14  = h.SoundFile14;
                            c.SoundFile15  = h.SoundFile15;
                            c.SoundIcon    = h.SoundIcon;
                            c.Subtitle     = h.Subtitle;
                            c.TextLang     = h.TextLang;
                            c.TitleDisplay = h.TitleDisplay;
                            c.TitleList    = h.TitleList;
                            c.TitleSort    = h.TitleSort;
                            c.Track01      = h.Track01;
                            c.Track02      = h.Track02;
                            c.Track03      = h.Track03;
                            c.Track04      = h.Track04;
                            c.Track05      = h.Track05;
                            c.Track06      = h.Track06;
                            c.Track07      = h.Track07;
                            c.Track08      = h.Track08;
                            c.Track09      = h.Track09;
                            c.Track10      = h.Track10;
                            c.Xform1       = h.Xform1;
                            c.Xform2       = h.Xform2;
                            c.Xform3       = h.Xform3;
                            c.Xform4       = h.Xform4;
                            c.Xform5       = h.Xform5;

                            c.InstrDetail = h.InstrDetail;
                            c.VocAccomp   = h.VocAccomp;

                            c.Year            = h.Year;
                            c.CopyrightYear   = h.CopyrightYear;
                            c.TableofContents = h.TableofContents;
                        }
                        else
                        {
                            return(false);
                        }
                    }
                    else
                    {
                        dbContext.lwg_Catalog.Add(c);
                    }
                    dbContext.SaveChanges();
                    return(true);
                }
                return(false);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
示例#12
0
 // add videos into lwg_Video
 public void AddCatalogVideo(List <lwg_Video> videoList)
 {
     dbContext.lwg_Video.AddRange(videoList);
     dbContext.SaveChanges();
 }