//写日程 private void schedule_pictureBox_Click(object sender, EventArgs e) { if (write_schedule == null || write_schedule.IsDisposed) { writeSchedule.ParentFormChange formChangeDelegate = new writeSchedule.ParentFormChange(init_rc_Panel); write_schedule = new writeSchedule(formChangeDelegate); write_schedule.User = this.user; write_schedule.Role = this.role; write_schedule.ScheduleDate = DateTime.Now; } if (!write_schedule.Created) { write_schedule.Show(); } else { write_schedule.WindowState = FormWindowState.Normal; write_schedule.Focus(); } }
public void init_rc_Panel() { if (this.InvokeRequired) { writeSchedule.ParentFormChange formChangeDelegate = new writeSchedule.ParentFormChange(init_rc_Panel); this.Invoke(formChangeDelegate); } else { bool rcVisible = panelOfSuibi.Visible; panelOfSuibi.Visible = false; long thisDay = DateTime.Now.Date.Ticks; long nextDay = DateTime.Now.Date.Ticks + new DateTime(1, 1, 2).Date.Ticks; IList staffScheduleList = baseService.loadEntityList("from StaffSchedule where STATE=" + (int)IEntity.stateEnum.Normal + " and Staff=" + user.Id + " and ScheduleTime>=" + thisDay + " order by ScheduleTime asc"); if (staffScheduleList.Count > rc_flowLayoutPanel.Controls.Count) { while (rc_flowLayoutPanel.Controls.Count > 0) { rc_flowLayoutPanel.Controls.RemoveAt(0); // 删除所有日程消息 } if (scheduleList != null) { scheduleList.Clear(); } scheduleList = staffScheduleList; //把查询出来的日程列表付给全局变量 creat_ri_cheng_Panel(staffScheduleList); } if (this.rc_flowLayoutPanel.Controls.Count == 0) { this.rc_flowLayoutPanel.BackgroundImage = WorkLogForm.Properties.Resources.NoCntentBg; } else { this.rc_flowLayoutPanel.BackgroundImage = null; } panelOfSuibi.Visible = rcVisible; } }