Example #1
0
        private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            Person index = this.PlList[e.RowIndex];

            if (e.ColumnIndex == 6)
            {
                var doctorform = new DoctorForm(index);
                doctorform.ShowDialog();
                renew();
            }
            else if (e.ColumnIndex == 7)
            {
                var ok = MessageBox.Show("是否删除人员" + PlList[e.RowIndex].b_name + "?", "是否删除", MessageBoxButtons.OKCancel,
                                         MessageBoxIcon.Question);
                if (ok == DialogResult.OK)
                {
                    try
                    {
                        AllValue.db.Execute("DELETE FROM person WHERE b_id=@b_id", PlList[e.RowIndex]);
                        MessageBox.Show("删除成功");
                    }
                    catch (Exception exception)
                    {
                        Console.WriteLine(exception);
                        MessageBox.Show("删除失败");
                    }
                }
            }
            else if (e.ColumnIndex == 8)
            {
                var doc = new Document();
                doc.LoadFromFile("sample.docx");
                var i = index;
                doc.Replace("$[b_college]$", tostring(i.b_college), false, false);
                doc.Replace("$[b_sex]$", tostring(i.b_sex), false, false);
                doc.Replace("$[b_idcard]$", tostring(i.b_idcard), false, false);
                doc.Replace("$[b_name]$", tostring(i.b_name), false, false);
                doc.Replace("$[b_birth]$", i.b_birth.ToShortDateString(), false, false);
                doc.Replace("$[b_marriage]$", i.b_marriage == 1 ? "是" : "否", false, false);
                doc.Replace("$[b_educated]$", tostring(i.b_educated), false, false);
                doc.Replace("$[b_nation]$", tostring(i.b_nation), false, false);
                doc.Replace("$[b_occupation]$", tostring(i.b_occupation), false, false);
                doc.Replace("$[b_birthplace]$", tostring(i.b_birthplace), false, false);
                doc.Replace("$[b_phone]$", tostring(i.b_phone), false, false);
                doc.Replace("$[b_email]$", tostring(i.b_email), false, false);
                doc.Replace("$[b_address]$", tostring(i.b_address), false, false);
                doc.Replace("$[b_anamnesis]$", tostring(i.b_anamnesis), false, false);
                doc.Replace("$[f_eyeL]$", tostring(i.f_eyeL), false, false);
                doc.Replace("$[f_eyeR]$", tostring(i.f_eyeR), false, false);
                doc.Replace("$[f_eyeL_correct]$", tostring(i.f_eyeL_correct), false, false);
                doc.Replace("$[f_eyeR_correct]$", tostring(i.f_eyeR_correct), false, false);
                doc.Replace("$[f_eye_otherill]$", tostring(i.f_eye_otherill), false, false);
                doc.Replace("$[f_eye_colorpic]$", tostring(i.f_eye_colorpic), false, false);
                doc.Replace("$[f_eye_color]$", tostring(i.f_eye_color), false, false);
                doc.Replace("$[f_earL]$", tostring(i.f_earL), false, false);
                doc.Replace("$[f_earR]$", tostring(i.f_earR), false, false);
                doc.Replace("$[f_earill]$", tostring(i.f_earill), false, false);
                doc.Replace("$[f_nosesmell]$", tostring(i.f_nosesmell), false, false);
                doc.Replace("$[f_face]$", tostring(i.f_face), false, false);
                doc.Replace("$[f_throat]$", tostring(i.f_throat), false, false);
                doc.Replace("$[f_orallip]$", tostring(i.f_orallip), false, false);
                doc.Replace("$[f_oraltooth]$", tostring(i.f_oraltooth), false, false);
                doc.Replace("$[f_other]$", tostring(i.f_other), false, false);
                doc.Replace("$[f_eye_op]$", tostring(i.f_eye_op), false, false);
                doc.Replace("$[f_oto_op]$", tostring(i.f_oto_op), false, false);
                doc.Replace("$[f_oral_op]$", tostring(i.f_oral_op), false, false);
                doc.Replace("$[w_height]$", tostring(i.w_height), false, false);
                doc.Replace("$[w_weight]$", tostring(i.w_weight), false, false);
                doc.Replace("$[w_skin]$", tostring(i.w_skin), false, false);
                doc.Replace("$[w_lymph]$", tostring(i.w_lymph), false, false);
                doc.Replace("$[w_thyroid]$", tostring(i.w_thyroid), false, false);
                doc.Replace("$[w_spine]$", tostring(i.w_spine), false, false);
                doc.Replace("$[w_arm_and_leg]$", tostring(i.w_arm_and_leg), false, false);
                doc.Replace("$[w_arthrosis]$", tostring(i.w_arthrosis), false, false);
                doc.Replace("$[w_flat_foot]$", tostring(i.w_flatfoot), false, false);
                doc.Replace("$[w_others]$", tostring(i.w_others), false, false);
                doc.Replace("$[w_advice]$", tostring(i.w_advice), false, false);
                doc.Replace("$[n_blood]$", tostring(i.n_blood), false, false);
                doc.Replace("$[n_heartrate]$", tostring(i.n_heartrate), false, false);
                doc.Replace("$[n_grow]$", tostring(i.n_grow), false, false);
                doc.Replace("$[n_nerve]$", tostring(i.n_nerve), false, false);
                doc.Replace("$[n_breath]$", tostring(i.n_breath), false, false);
                doc.Replace("$[n_heartvessel]$", tostring(i.n_heartvessel), false, false);
                doc.Replace("$[n_liver]$", tostring(i.n_liver), false, false);
                doc.Replace("$[n_spleen]$", tostring(i.n_spleen), false, false);
                doc.Replace("$[n_kidney]$", tostring(i.n_kidney), false, false);
                doc.Replace("$[n_others]$", tostring(i.n_others), false, false);
                doc.Replace("$[n_advice]$", tostring(i.n_advice), false, false);
                doc.Replace("$[o_blood]$", tostring(i.o_blood), false, false);
                doc.Replace("$[o_liver]$", tostring(i.o_liver), false, false);
                doc.Replace("$[o_piss]$", tostring(i.o_piss), false, false);
                doc.Replace("$[o_chest]$", tostring(i.o_chest), false, false);
                doc.Replace("$[o_othercheck]$", tostring(i.o_othercheck), false, false);
                doc.Replace("$[o_stutter]$", tostring(i.o_stutter), false, false);
                doc.Replace("$[o_outlook]$", tostring(i.o_outlook), false, false);
                doc.Replace("$[o_advice]$", tostring(i.o_advice), false, false);
                doc.Replace("$[s_conclusion]$", tostring(i.s_conclusion), false, false);
                doc.Replace("$[s_sign]$", tostring(i.s_sign), false, false);
                doc.Replace("$[s_hospital]$", tostring(i.s_hospital), false, false);
                doc.Replace("$[s_hosi_sign]$", tostring(i.s_hosi_sign), false, false);
                doc.Replace("$[s_time]$", i.s_time.ToShortDateString(), false, false);
                doc.Replace("$[c_advice]$", tostring(i.c_advice), false, false);
                doc.Replace("$[c_sign]$", tostring(i.c_sign), false, false);
                doc.Replace("$[c_note]$", tostring(i.c_note), false, false);
                var time = Guid.NewGuid().ToString();
                doc.SaveToFile(i.b_name + "体测表" + time + ".docx", FileFormat.Docx);
                doc.Close();
                MessageBox.Show("导出成功");
            }
            else
            {
                var info = new InfoShow(index);
                info.ShowDialog();
            }
        }
Example #2
0
 private void button1_Click(object sender, EventArgs e)
 {
     var doctorfrom = new DoctorForm(p);
     doctorfrom.ShowDialog();
 }