/// <summary>
 /// Create a new HoloDiskFile object.
 /// </summary>
 /// <param name="progressivo">Initial value of the Progressivo property.</param>
 /// <param name="numeroFile">Initial value of the NumeroFile property.</param>
 public static HoloDiskFile CreateHoloDiskFile(global::System.Int64 progressivo, global::System.Int64 numeroFile)
 {
     HoloDiskFile holoDiskFile = new HoloDiskFile();
     holoDiskFile.Progressivo = progressivo;
     holoDiskFile.NumeroFile = numeroFile;
     return holoDiskFile;
 }
 /// <summary>
 /// Deprecated Method for adding a new object to the HoloDiskFiles EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToHoloDiskFiles(HoloDiskFile holoDiskFile)
 {
     base.AddObject("HoloDiskFiles", holoDiskFile);
 }
Beispiel #3
0
        public bool InsertNewFile(long progressivoDisco, string nomeFile, string contenuto, long crypt)
        {
            nomeFile = nomeFile.Trim();
            try
            {
                var verifyIfExists = (from files in context.HoloDiskFiles
                                      where files.Progressivo == progressivoDisco
                                      && files.NomeFile == nomeFile
                                      select files);
                if (verifyIfExists.Count() > 0)
                {
                    return false;
                }

                long NewNumber = (from files in context.HoloDiskFiles
                                    where files.Progressivo == progressivoDisco
                                    orderby files.NumeroFile descending
                                    select files.NumeroFile).FirstOrDefault() + 1;
                HoloDiskFile newfile = new HoloDiskFile();
                newfile.Progressivo = progressivoDisco;
                newfile.NumeroFile = NewNumber;
                newfile.NomeFile = nomeFile;
                newfile.Contenuto = contenuto;
                newfile.LivelloCrypt = crypt;
                context.HoloDiskFiles.AddObject(newfile);
                return true;
            }
            catch
            {
                return false;
            }
        }