public void setTime(DateTime dateTime) { if (TimeUtils.DataTime2Stamp(dateTime) != 1) { string day = dateTime.Day.ToString(); string month = dateTime.Month.ToString(); string week = dateTime.DayOfWeek.ToString(); this.timeLabel.Text = String.Format("{0}月{1}日, {2} 到期", month, day, week); if (dateTime < DateTime.Now) { this.timeLabel.ForeColor = Color.FromArgb(227, 87, 89); this.timeImage.BackgroundImage = Properties.Resources.canlender_out; } else { this.timeLabel.ForeColor = Color.FromArgb(55, 97, 241); this.timeImage.BackgroundImage = Properties.Resources.canlender_fixed; } this.timeDelete.Enabled = true; this.timeDelete.Visible = true; } else { this.timeDelete.Enabled = false; this.timeDelete.Visible = false; this.timeLabel.ForeColor = SystemColors.GrayText; this.timeLabel.Text = "添加截止时间"; this.timeImage.BackgroundImage = Properties.Resources.canlender_defalut; } }
private void monthCalendar1_DateSelected(object sender, DateRangeEventArgs e) { DateTime start = e.Start; DateTime end = e.End; this.task.StartTime = TimeUtils.DataTime2Stamp(start); this.task.EndTime = TimeUtils.DataTime2Stamp(end); setTime(end); this.monthCalendar1.Visible = false; this.monthCalendar1.Enabled = false; SaveTask(); }
public void AddNewTask(string taskName) { Random random = new Random(); Task task = new Task(); task.Id = TimeUtils.DataTime2Stamp(DateTime.Now); task.StartTime = TimeUtils.DataTime2Stamp(DateTime.Now); task.EndTime = task.StartTime + 60 * 60 * 24; task.TagId = 1; task.Progress = 0; task.Describe = taskName; task.Detail = " "; task.Finish = false; TaskDAO taskDAO = new TaskDAO(); taskDAO.insert(task); }