private void Form_Update_Load(object sender, EventArgs e) { userId = UserItem.GetCurID(); DataTable dt = Utils.dbs.GetCon(userId); string[] datetime = dt.Rows[0]["DateItem"].ToString().Split(' '); set_date.Value = DateTime.Parse(datetime[0]); set_time.Value = DateTime.Parse(datetime[1]); textContent.Text = dt.Rows[0]["ContentItem"].ToString(); timer_clock.Start(); }
public void SetItemBG() { for (int i = 0; i < userList.Count; i++) { if (userList[i].UserID != UserItem.GetCurID()) { userList[i].SetBackColor(1);//设置背景为SystemColor.Control } else { userList[i].SetBackColor(0);//设置背景为选中色 } } }
//删除某条deadline private void btn_delete_Click(object sender, EventArgs e) { curID = UserItem.GetCurID(); if (curID < 0) { MessageBox.Show("请选择需要删除的Deadline"); return; } if (DialogResult.OK == MessageBox.Show("确定删除选中的DeadLine吗?", "系统提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Information)) { for (int i = 0; i < userList.Count; i++) { if (userList[i].UserID == curID) { userList.RemoveAt(i); pannelList.Controls.RemoveAt(i); pannelList.RowCount--; if (pannelList.RowCount == 0) { EmptyItem ei = new EmptyItem(); pannelList.Controls.Clear(); pannelList.Controls.Add(ei); } try { if (!Utils.dbs.DeleteOneItem(TABLENAME, curID)) { MessageBox.Show("删除失败"); } } catch (System.Exception ex) { MessageBox.Show(ex.ToString()); } break; } } } }