Exemplo n.º 1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (taskHeader == null)
                taskHeader = new TaskHeader();

            taskHeader.TaskName = txtTaskName.Text.Trim();
            taskHeader.ScheduleFrom = dtScheduleDate.Value;
            taskHeader.Site = Constants.SiteName.ADIGLOBAL;
            taskHeader.TaskRepeat = chkRepeat.Checked;
            taskHeader.TaskRepeatInterval = Convert.ToInt32(numRepeatCount.Value);
            taskHeader.TaskRepeatUnit = cmbRepeatType.Text;
            taskHeader.Enabled = chkEnabled.Checked;
            taskHeader.TaskDescription = txtDescription.Text.Trim();

            try
            {
                TaskHeaderManager mgr = new TaskHeaderManager(Constants.ConnectionString);
                var x = mgr.Save(taskHeader);
            }
            catch (Exception ex) { }
        }
Exemplo n.º 2
0
 public int Save(TaskHeader taskHeader)
 {
     return Save(taskHeader.ScheduleID, taskHeader.TaskName, taskHeader.TaskDescription, taskHeader.Site, taskHeader.ScheduleFrom
         , taskHeader.TaskRepeat, taskHeader.TaskRepeatInterval, taskHeader.TaskRepeatUnit, taskHeader.Enabled);
 }
Exemplo n.º 3
0
 public void DeleteTaskHeader(TaskHeader th)
 {
     detailManager.DeleteByHeaderId(th.ScheduleID);
     thManager.DeleteById(th.ScheduleID);
 }
Exemplo n.º 4
0
        private TaskHeader GetTaskSchedulerHeader(ListViewItem lvItem)
        {
            TaskHeader h = new TaskHeader();
            h.ScheduleID = Convert.ToInt64(lvItem.SubItems[0].Text);
            h.TaskName = lvItem.SubItems[1].Text;
            h.TaskDescription = lvItem.SubItems[2].Text;
            h.Site = lvItem.SubItems[3].Text;
            h.ScheduleFrom = DateTime.Parse(lvItem.SubItems[4].Text);
            h.TaskRepeat = (lvItem.SubItems[5].Text == "YES");
            String itemText = lvItem.SubItems[6].Text;
            h.TaskRepeatInterval = Convert.ToInt32(itemText.Substring(0, itemText.LastIndexOf(' ')));
            h.TaskRepeatUnit = itemText.Substring(itemText.LastIndexOf(' '));
            h.Enabled = (lvItem.SubItems[7].Text == "YES");
            h.LastRun = lvItem.SubItems[8].Text == "" ? (DateTime?) null : Convert.ToDateTime(lvItem.SubItems[8].Text);
            h.NextRun = lvItem.SubItems[9].Text == "" ? (DateTime?) null : Convert.ToDateTime(lvItem.SubItems[9].Text);

            return h;
        }
Exemplo n.º 5
0
 private void SetTaskScheduleHeader(TaskHeader h)
 {
     String[] text = {
                         h.ScheduleID.ToString(),
                         h.TaskName,
                         h.TaskDescription,
                         h.Site,
                         h.ScheduleFrom.ToShortDateString(),
                         h.TaskRepeat ? "YES" : "NO",
                         String.Format("{0} {1}", h.TaskRepeatInterval, h.TaskRepeatUnit),
                         h.Enabled ? "YES" : "NO",
                         h.LastRun.ToString(),
                         h.NextRun.ToString(),
                     };
     ListViewItem lvItem = listViewScheduleTasks.FindItemWithText(h.ScheduleID.ToString());
     if (lvItem == null)
     {
         lvItem = new ListViewItem(text);
         listViewScheduleTasks.Items.Add(lvItem);
     }
     else
     {
         for (int i = 0; i < text.Length; i++)
             lvItem.SubItems[i].Text = text[i];
     }
 }
Exemplo n.º 6
0
 public ScheduleDetail(Int64 ScheduleID)
 {
     InitializeComponent();
     taskHeader = new TaskHeader();
     taskHeader.ScheduleID = ScheduleID;
 }