예제 #1
0
파일: MovieUtils.cs 프로젝트: jmn319/mmb
 //Updated October 18th
 public static string AddMovieToMyMovies(string Name, string ImdbCode, string Year)
 {
     string r = "";
     try
     {
         Movie m = new Movie() { ImdbTitle = Name, ImdbCode = ImdbCode, Year = Convert.ToInt16(Year) };
         MongoUtils.GetMongoCollection
             (
                 @"mongodb://" + ConfigurationManager.AppSettings["mongoHost"] + @"/",
                 ConfigurationManager.AppSettings["port"],
                 ConfigurationManager.AppSettings["db"],
                 ConfigurationManager.AppSettings["mymovies_collection"]
             ).Insert(m);
         Log.AppendToLog(Name + " was successfully added in 'My Shows'.",
             ConfigurationManager.AppSettings["log_file"]);
         r = Name + " was successfully added in 'My Shows'.";
     }
     catch (Exception e)
     {
         Log.AppendToLog("Error : FATAL " + e, ConfigurationManager.AppSettings["log_file"]);
         r = "Error : FATAL " + e;
     }
     return r;
 }
예제 #2
0
파일: MovieUtils.cs 프로젝트: jmn319/mmb
 //Updated July 24th
 public static bool IsInPending(Movie m)
 {
     try
     {
         List<Pending> pendingList = MongoUtils.GetMongoCollection
         (
             @"mongodb://" + ConfigurationManager.AppSettings["mongoHost"] + @"/",
             ConfigurationManager.AppSettings["port"],
             ConfigurationManager.AppSettings["db"],
             ConfigurationManager.AppSettings["pending_collection"]
         ).FindAs<Pending>(Query.EQ("Name", m.YtsMovieTitle)).ToList<Pending>();
         if (pendingList.Count != 0) return true;
         else return false;
     }
     catch (Exception e)
     { Log.AppendToLog("Error : Checking pending movies. " + e, ConfigurationManager.AppSettings["log_file"]); return false; }
 }