public void UpdateArrangement(DataGridView dataGridView1, ComboBox comboBox1, ComboBox comboBox2) { string begin, end; if (dataGridView1.CurrentCell.RowIndex < 10) { begin = " 00:00:00"; end = " 12:00:00"; } else { begin = " 12:00:00"; end = " 23:59:59"; } DateTime bT = DateTime.Parse(dataGridView1.Rows[0].Cells[dataGridView1.CurrentCell.ColumnIndex].Value.ToString() + begin); DateTime fT = DateTime.Parse(dataGridView1.Rows[0].Cells[dataGridView1.CurrentCell.ColumnIndex].Value.ToString() + end); Barrangement Ba = new Barrangement(); string arrangementId = Ba.QueryArrangementIdByDoctorNameAndBeginTime(dataGridView1.CurrentCell.Value.ToString(), bT).Id; Bdoctorinfo Bd = new Bdoctorinfo(); DTO4DoctorInfo updatedoctorinfo = new DTO4DoctorInfo(); updatedoctorinfo = Bd.QuaryDoctorinfoByNameAndOffice(comboBox2.SelectedValue.ToString(), comboBox1.SelectedValue.ToString()); try { Ba.UpdateById(arrangementId, bT, fT, updatedoctorinfo.Id, updatedoctorinfo.Office, updatedoctorinfo.Name, updatedoctorinfo.JobTitle); dataGridView1.CurrentCell.Value = comboBox2.SelectedValue.ToString();//立即显示修改 } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public void Execution(CheckBox checkBox4, CheckBox checkBox3, DataGridView dataGridView1, TextBox textBox1, string[] Ids, int z)//执行申请管理操作 { string operate; Bchangerecord bc = new Bchangerecord(); if (checkBox4.Checked) { if (z == 0) //自动执行调班处理; { Barrangement ba = new Barrangement(); DTO4Arrangement self_arrangement = new DTO4Arrangement(); DTO4Arrangement others_arrangement = new DTO4Arrangement(); DateTime begin_time, finish_time; self_arrangement = ba.QueryArrangementIdByDoctorNameAndBeginTime(dataGridView1.CurrentRow.Cells[0].Value.ToString(), DateTime.Parse(dataGridView1.CurrentRow.Cells[2].Value.ToString())); others_arrangement = ba.QueryArrangementIdByDoctorNameAndBeginTime(dataGridView1.CurrentRow.Cells[1].Value.ToString(), DateTime.Parse(dataGridView1.CurrentRow.Cells[3].Value.ToString())); begin_time = self_arrangement.BeginTime; finish_time = self_arrangement.FinishTime; ba.UpdateById(self_arrangement.Id, others_arrangement.BeginTime, others_arrangement.FinishTime, self_arrangement.DoctorId, self_arrangement.Office, self_arrangement.DoctorName, self_arrangement.DoctorJobTitle); ba.UpdateById(others_arrangement.Id, begin_time, finish_time, others_arrangement.DoctorId, others_arrangement.Office, others_arrangement.DoctorName, others_arrangement.DoctorJobTitle); MessageBox.Show("已成功将" + self_arrangement.DoctorName + "与" + others_arrangement.DoctorName + "的班次对调!"); } operate = "approve"; bc.UpdateChangeRecordById(Ids[dataGridView1.CurrentCell.RowIndex], "processed", textBox1.Text, operate); MessageBox.Show("处理成功!"); } else if (checkBox3.Checked) { operate = "disapprove"; bc.UpdateChangeRecordById(Ids[dataGridView1.CurrentCell.RowIndex], "processed", textBox1.Text, operate); MessageBox.Show("处理成功!"); } else { MessageBox.Show("请先选择处理结果:批准/不批准"); } }