public void tiaoban_application(string user_name, DateTimePicker dateTimePicker2, DateTimePicker dateTimePicker4, ComboBox comboBox3, TextBox textBox1) { int arrangementId_self, arrangementId_others; Barrangement ba = new Barrangement(); Bchangerecord bc = new Bchangerecord(); DTO4Arrangement dto4a_self = new DTO4Arrangement(); dto4a_self = ba.QueryArrangementIdByDoctorNameAndBeginTime(user_name, dateTimePicker2.Value.Date); arrangementId_self = int.Parse(dto4a_self.Id); DTO4Arrangement dto4a_others = new DTO4Arrangement(); dto4a_others = ba.QueryArrangementIdByDoctorNameAndBeginTime(comboBox3.SelectedValue.ToString(), dateTimePicker4.Value.Date); arrangementId_others = int.Parse(dto4a_others.Id); if (bc.InsertChangeRecord(arrangementId_self, arrangementId_others, textBox1.Text, "untreated")) { MessageBox.Show("申请成功!"); } else { MessageBox.Show("申请失败,请确认是否正确选择班次!"); } }
public string[] ShowChangeRecord(DataGridView dataGridView1, ComboBox comboBox1, int z) //显示申请记录 { string[] ChangeRecordIds = new string[20]; dataGridView1.Rows.Clear(); string status; if (comboBox1.Text.ToString() == "已处理的申请") { status = "processed"; } else { status = "untreated"; } Barrangement ba = new Barrangement(); Bchangerecord bc = new Bchangerecord(); DTO4ChangeRecord[] dto4c = new DTO4ChangeRecord[20]; DTO4Arrangement dto4a = new DTO4Arrangement(); dto4c = bc.QueryChangerecordByStatus(status); int j = 0; for (int i = 0; i < dto4c.Count(); i++) { if (dto4c[i].ArrangementId_others == "0" && z == 1) { int index = dataGridView1.Rows.Add(1); dto4a = ba.QueryArrangementById(dto4c[i].ArrangementId_self); dataGridView1.Rows[j].Cells[0].Value = dto4a.DoctorName; dataGridView1.Rows[j].Cells[1].Value = dto4a.BeginTime; dataGridView1.Rows[j].Cells[2].Value = dto4c[i].Remark; ChangeRecordIds[j] = dto4c[i].Id; j++; } if (dto4c[i].ArrangementId_others != "0" && z == 0) { int index = dataGridView1.Rows.Add(1); DTO4Arrangement dto4a_others = new DTO4Arrangement(); dto4a = ba.QueryArrangementById(dto4c[i].ArrangementId_self); dto4a_others = ba.QueryArrangementById(dto4c[i].ArrangementId_others); dataGridView1.Rows[j].Cells[0].Value = dto4a.DoctorName; dataGridView1.Rows[j].Cells[1].Value = dto4a_others.DoctorName; dataGridView1.Rows[j].Cells[2].Value = dto4a.BeginTime; dataGridView1.Rows[j].Cells[3].Value = dto4a_others.BeginTime; dataGridView1.Rows[j].Cells[4].Value = dto4c[i].Remark; ChangeRecordIds[j] = dto4c[i].Id; j++; } } return(ChangeRecordIds); }
public void qingjia_application(string user_name, DateTimePicker dateTimePicker3, TextBox textBox2) { int arrangementId_self; Barrangement ba = new Barrangement(); Bchangerecord bc = new Bchangerecord(); DTO4Arrangement dto4a_self = new DTO4Arrangement(); dto4a_self = ba.QueryArrangementIdByDoctorNameAndBeginTime(user_name, dateTimePicker3.Value.Date); arrangementId_self = int.Parse(dto4a_self.Id); if (bc.InsertChangeRecord(arrangementId_self, 0, textBox2.Text, "untreated")) { MessageBox.Show("申请成功!"); } else { MessageBox.Show("申请失败,请确认是否正确选择班次!"); } }
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("请先选择处理结果:批准/不批准"); } }