private static void RunDataSchedulerSirAccount(string profiletype) { while (true) { Api.ScheduledMessage.ScheduledMessage ApiobjScheduledMessage = new Api.ScheduledMessage.ScheduledMessage(); List <Domain.Myfashion.Domain.ScheduledMessage> lstScheduledMessage = (List <Domain.Myfashion.Domain.ScheduledMessage>)(new JavaScriptSerializer().Deserialize(ApiobjScheduledMessage.getScheduledMessageByProfileType(profiletype.ToString()), typeof(List <Domain.Myfashion.Domain.ScheduledMessage>))); ThreadPool.SetMaxThreads(10, 4); if (lstScheduledMessage != null) { if (lstScheduledMessage.Count != 0) { foreach (var item in lstScheduledMessage) { try { string testUserId = "2350e2cf-c790-4253-b17f-1f284fa244d5"; //if (item.UserId.ToString() != "e855ee26-da94-452f-ba74-5ef7e252083e") //if (item.UserId.ToString() != testUserId) //{ // continue; //} clsSocialSiteScheduler objclsSocialSiteScheduler = new clsSocialSiteScheduler(item.ProfileType); IScheduler objSocialSiteDataScheduler = objclsSocialSiteScheduler.CreateSocialSiteSchedulerInstance(); if (objSocialSiteDataScheduler != null) { Console.WriteLine(objSocialSiteDataScheduler.PostScheduleMessage(item.Id.ToString(), item.UserId.ToString(), item.ProfileId.ToString())); } } catch (Exception ex) { Console.WriteLine(ex.Message); } } } else { Console.WriteLine("No active record in Database"); } } else { Console.WriteLine("No active record in Database"); } Thread.Sleep(5 * 1000); } }
private static void RunDataScheduler(string profiletype) { while (true) { Api.ScheduledMessage.ScheduledMessage ApiobjScheduledMessage = new Api.ScheduledMessage.ScheduledMessage(); List <Domain.Socioboard.Domain.ScheduledMessage> lstScheduledMessage = (List <Domain.Socioboard.Domain.ScheduledMessage>)(new JavaScriptSerializer().Deserialize(ApiobjScheduledMessage.getScheduledMessageByProfileType(profiletype.ToString()), typeof(List <Domain.Socioboard.Domain.ScheduledMessage>))); ThreadPool.SetMaxThreads(10, 4); if (lstScheduledMessage != null) { if (lstScheduledMessage.Count != 0) { foreach (var item in lstScheduledMessage) { try { clsSocialSiteScheduler objclsSocialSiteScheduler = new clsSocialSiteScheduler(item.ProfileType); IScheduler objSocialSiteDataScheduler = objclsSocialSiteScheduler.CreateSocialSiteSchedulerInstance(); if (objSocialSiteDataScheduler != null) { Console.WriteLine(objSocialSiteDataScheduler.PostScheduleMessage(item.Id.ToString(), item.UserId.ToString(), item.ProfileId.ToString())); } } catch (Exception ex) { Console.WriteLine(ex.Message); } } } else { Console.WriteLine("No active record in Database"); } } else { Console.WriteLine("No active record in Database"); } Thread.Sleep(5 * 1000); } }
private static void RunDataScheduler(string profiletype) { string LogPath = ConfigurationManager.AppSettings["LogPath"].ToString(); DirectoryInfo di = Directory.CreateDirectory(LogPath); string filename = LogPath+"\\" + "Log_" + DateTime.Now.ToString("dd-MM-yyyy") + ".txt"; while (true) { if (profiletype.Equals("NewsLetter")) { Api.ScheduledMessage.ScheduledMessage ApiobjScheduledMessage = new Api.ScheduledMessage.ScheduledMessage(); Api.NewsLetter.NewsLetter ApiObjNewsLetter = new Api.NewsLetter.NewsLetter(); List<Domain.Socioboard.Domain.NewsLetter> lstNewsLetter = (List<Domain.Socioboard.Domain.NewsLetter>)(new JavaScriptSerializer().Deserialize(ApiObjNewsLetter.GetAllNewsLetters(), typeof(List<Domain.Socioboard.Domain.NewsLetter>))); ThreadPool.SetMaxThreads(10, 4); if (lstNewsLetter != null) { if (lstNewsLetter.Count != 0) { foreach (var item in lstNewsLetter) { try { //clsSocialSiteScheduler objclsSocialSiteScheduler = new clsSocialSiteScheduler(item.ProfileType); //IScheduler objSocialSiteDataScheduler = objclsSocialSiteScheduler.CreateSocialSiteSchedulerInstance(); Api.NewsLetter.NewsLetter ApiObjNewsLetterLocal = new Api.NewsLetter.NewsLetter(); if (ApiObjNewsLetterLocal != null) { Console.WriteLine(ApiObjNewsLetterLocal.SendNewsLetter(item.NewsLetterBody.ToString(), item.Subject.ToString(), item.UserId.ToString(),item.Id.ToString())); } } catch (Exception ex) { Console.WriteLine(ex.Message); ErrorLog(filename, ex.Message); } } } else { Console.WriteLine("No active record in Database"); } } else { Console.WriteLine("No active record in Database"); } Thread.Sleep(5 * 1000); } else { Api.ScheduledMessage.ScheduledMessage ApiobjScheduledMessage = new Api.ScheduledMessage.ScheduledMessage(); List<Domain.Socioboard.Domain.ScheduledMessage> lstScheduledMessage = (List<Domain.Socioboard.Domain.ScheduledMessage>)(new JavaScriptSerializer().Deserialize(ApiobjScheduledMessage.getScheduledMessageByProfileType(profiletype.ToString()), typeof(List<Domain.Socioboard.Domain.ScheduledMessage>))); ThreadPool.SetMaxThreads(10, 4); if (lstScheduledMessage != null) { if (lstScheduledMessage.Count != 0) { foreach (var item in lstScheduledMessage) { try { clsSocialSiteScheduler objclsSocialSiteScheduler = new clsSocialSiteScheduler(item.ProfileType); IScheduler objSocialSiteDataScheduler = objclsSocialSiteScheduler.CreateSocialSiteSchedulerInstance(); if (objSocialSiteDataScheduler != null) { Console.WriteLine(objSocialSiteDataScheduler.PostScheduleMessage(item.Id.ToString(), item.UserId.ToString(), item.ProfileId.ToString())); } } catch (Exception ex) { Console.WriteLine(ex.Message); ErrorLog(filename, ex.Message); } } } else { Console.WriteLine("No active record in Database"); } } else { Console.WriteLine("No active record in Database"); } Thread.Sleep(5 * 1000); } } }
private static void RunDataScheduler(string profiletype) { while (true) { try { Api.ScheduledMessage.ScheduledMessage ApiobjScheduledMessage = new Api.ScheduledMessage.ScheduledMessage(); List<Domain.Myfashion.Domain.ScheduledMessage> lstScheduledMessage = (List<Domain.Myfashion.Domain.ScheduledMessage>)(new JavaScriptSerializer().Deserialize(ApiobjScheduledMessage.getScheduledMessageByProfileType(profiletype.ToString()), typeof(List<Domain.Myfashion.Domain.ScheduledMessage>))); ThreadPool.SetMaxThreads(10, 4); if (lstScheduledMessage != null) { if (lstScheduledMessage.Count != 0) { foreach (var item in lstScheduledMessage) { try { clsSocialSiteScheduler objclsSocialSiteScheduler = new clsSocialSiteScheduler(item.ProfileType); IScheduler objSocialSiteDataScheduler = objclsSocialSiteScheduler.CreateSocialSiteSchedulerInstance(); if (objSocialSiteDataScheduler != null) { Console.WriteLine(objSocialSiteDataScheduler.PostScheduleMessage(item.Id.ToString(), item.UserId.ToString(), item.ProfileId.ToString())); } } catch (Exception ex) { Console.WriteLine(ex.Message); } } } else { Console.WriteLine("No active record in Database"); } } else { Console.WriteLine("No active record in Database"); } } catch (Exception ex) { Console.Write(ex.Message); } Thread.Sleep(5 * 1000); } }
private static void RunDataSchedulerSirAccount(string profiletype) { while (true) { Api.ScheduledMessage.ScheduledMessage ApiobjScheduledMessage = new Api.ScheduledMessage.ScheduledMessage(); List<Domain.Myfashion.Domain.ScheduledMessage> lstScheduledMessage = (List<Domain.Myfashion.Domain.ScheduledMessage>)(new JavaScriptSerializer().Deserialize(ApiobjScheduledMessage.getScheduledMessageByProfileType(profiletype.ToString()), typeof(List<Domain.Myfashion.Domain.ScheduledMessage>))); ThreadPool.SetMaxThreads(10, 4); if (lstScheduledMessage != null) { if (lstScheduledMessage.Count != 0) { foreach (var item in lstScheduledMessage) { try { string testUserId = "2350e2cf-c790-4253-b17f-1f284fa244d5"; //if (item.UserId.ToString() != "e855ee26-da94-452f-ba74-5ef7e252083e") //if (item.UserId.ToString() != testUserId) //{ // continue; //} clsSocialSiteScheduler objclsSocialSiteScheduler = new clsSocialSiteScheduler(item.ProfileType); IScheduler objSocialSiteDataScheduler = objclsSocialSiteScheduler.CreateSocialSiteSchedulerInstance(); if (objSocialSiteDataScheduler != null) { Console.WriteLine(objSocialSiteDataScheduler.PostScheduleMessage(item.Id.ToString(), item.UserId.ToString(), item.ProfileId.ToString())); } } catch (Exception ex) { Console.WriteLine(ex.Message); } } } else { Console.WriteLine("No active record in Database"); } } else { Console.WriteLine("No active record in Database"); } Thread.Sleep(5 * 1000); } }