static void Main()
        {
            Console.WriteLine("CDN Warmup Console Schedular App Started....");
            Console.WriteLine("--------------------------------------------");

            Schedular.Run().GetAwaiter().GetResult();

            Console.ReadKey();
        }
        private void ComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            var    image            = e.AddedItems[0] as ComboBoxItem;
            string currentOperation = image.Content.ToString();

            var       ttp       = sender as ComboBox;
            Playlists playlists = null;

            if (image != null && ttp.Tag is Playlists)
            {
                playlists = (Playlists)ttp.Tag;
            }

            if (playlists != null)
            {
                Create_Playlist create_Playlist = new Create_Playlist();
                Global_Log.pID          = playlists.PID;
                Global_Log.playlistName = playlists.Name;

                if (currentOperation == "Update")
                {
                    create_Playlist.SetProperty(playlists.Name.ToString());
                }
                else if (currentOperation == "Delete")
                {
                    create_Playlist.deletePlaylist(playlists.PID);
                }
                //else if (currentOperation == "View")
                //{
                //    currentPlaylist = playlists.PID;

                //    loadPlaylistSong(Global_Log.pID, playlists.SortId);
                //}
                else if (currentOperation == "Schedule")
                {
                    //currentPlaylist = playlists.PID;
                    Schedular schedular = new Schedular();
                    schedular.ShowDialog();
                    //loadPlaylistSong(Global_Log.pID, playlists.SortId);

                    if (Global_Log.fM_Custom == null)
                    {
                        Global_Log.fM_Custom = new FM.FM_Custom();
                    }
                    Global_Log.fM_Custom.AutoPlay_PreviewMouseLeftButtonDown();
                }
            }
            loadPlaylist();
        }
Example #3
0
        public void ExecuteServiceAction(object state)
        {
            DateTime now = DateTime.Now;
            DateTime sendTime = DateTime.Today.AddHours(1);

            // If it's already past send time execute action, 
            // extend time and wait until tomorrow.
            if (now > sendTime)
            {
                // Not shown.
                sendTime = sendTime.AddDays(1.0);
            }
            ScheduleService();
            long msUntilSendTime = (long)(sendTime - now).TotalMilliseconds;
            Schedular.Change(2000, Timeout.Infinite);
        }
Example #4
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            Schedular objScheduler = new Schedular();

            //Get All Registered Users
            DataTable dtUsers = objScheduler.GetAllRegisteredUsers();

            DataRowCollection drcUsers = dtUsers.Rows;

            foreach (DataRow drUser in drcUsers)
            {
                int userId = int.Parse(drUser["UserId"].ToString());

                string strUserEmailId = drUser["EmailId"].ToString();

                //Get All Birthday Event Details
                DataTable dtBirthdayDetails = objScheduler.GetBirthdayDetailsByUserId(userId);

                DataRowCollection drcBirthdayDetails = dtBirthdayDetails.Rows;

                string strBdayEventDetails = string.Empty;

                foreach (DataRow drBirthdayDetail in drcBirthdayDetails)
                {
                    int birthdayDetailsId = int.Parse(drBirthdayDetail["BirthdayDetailsId"].ToString());

                    string strDateOfBirth = drBirthdayDetail["DateOfBirth"].ToString();

                    //Get Birthday Event Reminder
                    DataTable dtBirthdatReminder = objScheduler.GetBirthdayReminder(userId, birthdayDetailsId);

                    if (dtBirthdatReminder.Rows.Count > 0)
                    {
                        DataRow drBirthdayReminder = dtBirthdatReminder.Rows[0];

                        bool DaysBefore30 = (bool)drBirthdayReminder["30DaysBefore"];

                        bool DaysBefore14 = (bool)drBirthdayReminder["14DaysBefore"];

                        bool DaysBefore7 = (bool)drBirthdayReminder["7DaysBefore"];

                        bool DaysBefore3 = (bool)drBirthdayReminder["3DaysBefore"];

                        bool DayofEvent = (bool)drBirthdayReminder["DayofEvent"];

                        //Get The Current Date
                        DateTime dtCurrentDate = DateTime.Now;

                        DateTime dtDateOfBirth = DateTime.Parse(strDateOfBirth);

                        string strBirthdayName = drBirthdayDetail["FirstName"].ToString();

                        if (DaysBefore30 == true)
                        {
                            DateTime dtNew = dtDateOfBirth.AddDays(-30);
                            if ((dtNew.Day == dtCurrentDate.Day) && (dtNew.Month == dtCurrentDate.Month))
                            {
                                strBdayEventDetails += "<tr style='background-color:#D2FFFF;'><td width='50%'>" + strBirthdayName + "</td><td width='50%'>" + dtDateOfBirth.ToString("dd-MMM-yyyy") + "</td></tr>";
                            }
                        }

                        if (DaysBefore14 == true)
                        {
                            DateTime dtNew = dtDateOfBirth.AddDays(-14);
                            if ((dtNew.Day == dtCurrentDate.Day) && (dtNew.Month == dtCurrentDate.Month))
                            {
                                strBdayEventDetails += "<tr style='background-color:#D2FFFF;'><td width='50%'>" + strBirthdayName + "</td><td width='50%'>" + dtDateOfBirth.ToString("dd-MMM-yyyy") + "</td></tr>";
                            }
                        }

                        if (DaysBefore7 == true)
                        {
                            DateTime dtNew = dtDateOfBirth.AddDays(-7);
                            if ((dtNew.Day == dtCurrentDate.Day) && (dtNew.Month == dtCurrentDate.Month))
                            {
                                strBdayEventDetails += "<tr style='background-color:#D2FFFF;'><td width='50%'>" + strBirthdayName + "</td><td width='50%'>" + dtDateOfBirth.ToString("dd-MMM-yyyy") + "</td></tr>";
                            }
                        }

                        if (DaysBefore3 == true)
                        {
                            DateTime dtNew = dtDateOfBirth.AddDays(-3);
                            if ((dtNew.Day == dtCurrentDate.Day) && (dtNew.Month == dtCurrentDate.Month))
                            {
                                strBdayEventDetails += "<tr style='background-color:#D2FFFF;'><td width='50%'>" + strBirthdayName + "</td><td width='50%'>" + dtDateOfBirth.ToString("dd-MMM-yyyy") + "</td></tr>";
                            }
                        }

                        if (DayofEvent == true)
                        {
                            if ((dtDateOfBirth.Day == dtCurrentDate.Day) &&
                                (dtDateOfBirth.Month == dtCurrentDate.Month))
                            {
                                strBdayEventDetails += "<tr style='background-color:#D2FFFF;'><td width='50%'>" + strBirthdayName + "</td><td width='50%'>" + dtDateOfBirth.ToString("dd-MMM-yyyy") + "</td></tr>";
                            }
                        }
                    }
                }
                if (strBdayEventDetails != String.Empty)
                {
                    objScheduler.SendMail(strUserEmailId, strBdayEventDetails);
                }
            }
        }