private void button4_Click(object sender, EventArgs e) { foreach (ListViewItem item in listView4.CheckedItems) { WorkOverTime wkot = new WorkOverTime(); wkot = (WorkOverTime)item.Tag; wkot.State = (int)WorkOverTime.stateEnum.Deleted; baseService.SaveOrUpdateEntity(wkot); listView4.Items.Remove(item); } }
private void button1_Click(object sender, EventArgs e) { TimeSpan ts = dateTimePicker5.Value.AddSeconds(1).TimeOfDay - dateTimePicker2.Value.TimeOfDay; if (ts.Hours > 3 || (ts.Hours == 3 && ts.Minutes > 0)) { MessageBox.Show("超过加班时长限制"); return; } else { IList userlist = listView1.CheckedItems; ClassLibrary.WorkOverTime wkot = new WorkOverTime(); wkot.WorkManId = new List <WkTUser>(); if (userlist != null && userlist.Count != 0) { foreach (ListViewItem item in userlist) { wkot.WorkManId.Add((WkTUser)item.Tag); } wkot.Ku_Id = User; wkot.StartTime = dateTimePicker2.Value.Ticks; wkot.EndTime = dateTimePicker5.Value.Ticks; wkot.Date = dateTimePicker1.Value.Date.Ticks; wkot.Dept = this.Dept; wkot.DayTime = ts.Ticks; wkot.WorkContent = textBox7.Text; wkot.State = (int)WorkOverTime.stateEnum.Normal; baseService.SaveOrUpdateEntity(wkot); MessageBox.Show("提交成功"); } else { MessageBox.Show("请选择人员"); } upDateListView1(Dept); } }