Example #1
0
        public void InsertArrangement(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();

            Bdoctorinfo    Bd            = new Bdoctorinfo();
            DTO4DoctorInfo adddoctorinfo = new DTO4DoctorInfo();

            adddoctorinfo = Bd.QuaryDoctorinfoByNameAndOffice(comboBox2.SelectedValue.ToString(), comboBox1.SelectedValue.ToString());
            try
            {
                Ba.AddArrangement(bT, fT, adddoctorinfo.Id, adddoctorinfo.Office, adddoctorinfo.Name, adddoctorinfo.JobTitle);
                dataGridView1.CurrentCell.Value = comboBox2.SelectedValue.ToString();//立即显示修改
            }
            catch (Exception ex) { MessageBox.Show(ex.Message); }
        }