public static void AddSheduleToProfile(long profileId, SheduleJobModel shedule)
        {
            var date = shedule.Date.ToString("yyyy/MM/dd HH:mm:ss", CultureInfo.InvariantCulture);
            string selectedDaysString = string.Empty;
            if (shedule.SelectedDays != null) selectedDaysString = String.Join(",", shedule.SelectedDays);

            var sql = "INSERT IGNORE INTO " + TblSheduleJobs
                    + " (`ProfileID`, `Name`, `Date`, `Daily`,`SelectedDays`)"
                    + "VALUES('" + profileId
                    + "', '" + shedule.Name
                    + "', '" + date
                    + "', " + shedule.IsDaily
                    + ", '" + selectedDaysString + "');COMMIT;";

            DoSql(sql);
        }
Пример #2
0
 private void AddSchedule(SheduleJobModel schdueModel)
 {
     _schedulas.Add(schdueModel);
     elementContainerControl1.AddElement(schdueModel.Name);
 }
        private static IEnumerable<SheduleJobModel> GetShedulesForProfile(int profileId)
        {
            var sheduleList = new List<SheduleJobModel>();

            var sql = "SELECT * FROM " + TblSheduleJobs + " WHERE ProfileID = '" + profileId + "';";

            var reader = GetReader(sql);
            if (reader != null)
            {
                try
                {
                    while (reader.Read())
                    {
                        var shedule = new SheduleJobModel
                            {
                                Id = reader.GetInt32(0),
                                ProfileId = reader.GetInt32(1),
                                Name = reader.GetString(2),
                                Date = reader.GetDateTime(3),
                                IsDaily = reader.GetBoolean(4),
                                SelectedDays = new List<int>()
                            };

                        var selectedDays = reader.GetString(5).Split(',');
                        if (selectedDays.Count() != 1 || selectedDays[0] != String.Empty)
                            foreach (var day in selectedDays)
                            {
                                shedule.SelectedDays.Add(Convert.ToInt32(day));
                            }

                        sheduleList.Add(shedule);
                    }
                }
                finally
                {
                    reader.Close();
                }
            }
            return sheduleList;
        }
Пример #4
0
 private void AddSchedule(string fname)
 {
     var item = new SheduleJobModel
     {
         Name = fname,
         IsDaily = false,
         ProfileId = ProfilesManager.CurrentProfile.Parameters.ProfileId,
         Date = DateTime.Now,
         SelectedDays = new List<int>()
     };
     AddSchedule(item);
 }