/// <summary> /// Function to update the db data upon successful parsing of the package /// </summary> private void UpdateItvData() { try { using (ITVConversionContext upDb = new ITVConversionContext()) { ItvConversionData entity = upDb.ItvConversionData.FirstOrDefault(i => i.Id == ItvData_RowId); string adi = Path.Combine(WorkingDirectory, "ADI.xml"); AdiMapping.LoadXDocument(adi); entity.IsTvod = AdiMapping.IsTVOD; entity.IsAdult = iTVConversion.IsAdult.ToLower() == "y" ? true : false; entity.PublicationDate = Publication_Date; if (!IsUpdate) { entity.OriginalAdi = AdiMapping.ADI_XDOC.ToString(); entity.MediaFileLocation = MediaLocation; entity.MediaChecksum = MediaChecksum; } else { entity.VersionMajor = Version_Major; entity.UpdateAdi = AdiMapping.ADI_XDOC.ToString(); entity.UpdatedDateTime = DateTime.Now; //entity.UpdatedFileLocation = MediaLocation; //entity.UpdatedFileName = MediaFileName; entity.UpdatedItv = ITVParser.ITV_Data.ToString(); //entity.UpdatedMediaChecksum = MediaChecksum; } int count = upDb.SaveChanges(); ItvConversionData rowId = upDb.ItvConversionData.Local.FirstOrDefault(); log.Info($"{count} record(s) updated in the database with Row ID: {ItvData_RowId}"); } } catch (Exception UID_EX) { throw new Exception($"Error encountered Updating DB Data: {UID_EX.Message}"); } }
private bool CheckTvodUpdate() { string adi = Path.Combine(WorkingDirectory, "ADI.xml"); if (AdiMapping.IsTVOD && IsUpdate) { if (ProcessTvodUpdate()) { log.Info("Successfully processed TVOD Update."); //var test = AdiMapping.des AdiMapping.SaveAdi(adi); AdiMapping.LoadXDocument(adi); return(true); } else { log.Error("Enountered an error during the processing of a tvod update, check logs."); return(false); } } return(true); }