コード例 #1
0
ファイル: FrmMain.TZLY.Local.cs プロジェクト: wj60387/ESkin2
        void btnTZLY_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(this.cbBoxTZLY.Text))
            {
                MessageBox.Show("请选择一个听诊器..");
                return;
            }
            var stetInfo       = Setting.GetStetInfoByStetName(this.cbBoxTZLY.Text);
            var frmAudioRecord = new FrmAudioRecord()
            {
                PatientType = stetInfo.StetType,
                StetName    = this.cbBoxTZLY.Text
            };

            frmAudioRecord.ShowDialog();
            LoadLocalPatientInfo();
        }
コード例 #2
0
ファイル: FrmMain.TZLY.Local.cs プロジェクト: wj60387/ESkin2
        void dgvTZLY_Local_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex >= 0 && e.ColumnIndex >= 0)
            {
                var PatientInfo = new
                {
                    PatientGUID = dgvTZLY_Local.Rows[e.RowIndex].Cells[0].Value + ""
                    ,
                    PatientType = dgvTZLY_Local.Rows[e.RowIndex].Cells[1].Value + ""
                    ,
                    PatientName = dgvTZLY_Local.Rows[e.RowIndex].Cells[2].Value + ""
                    ,
                    DocName = dgvTZLY_Local.Rows[e.RowIndex].Cells[3].Value + ""
                    ,
                    DocDiagnose = dgvTZLY_Local.Rows[e.RowIndex].Cells[4].Value + ""
                    ,
                    DocRemark = dgvTZLY_Local.Rows[e.RowIndex].Cells[5].Value + ""
                };

                switch (dgvTZLY_Local.Columns[e.ColumnIndex].Name)
                {
                case "dgvTZLYLoaclDetail":
                {
                    var formAudioRecord = new FrmAudioRecord()
                    {
                        PatientType = Setting.GetPatientTypeByName(PatientInfo.PatientType.ToString())
                        ,
                        StetName    = this.cbBoxTZLY.Text,
                        PatientGUID = PatientInfo.PatientGUID,
                        PatientName = PatientInfo.PatientName,
                        DocName     = PatientInfo.DocName,
                        DocDiagnose = PatientInfo.DocDiagnose,
                        DocRemark   = PatientInfo.DocRemark,
                        CanEdit     = false
                    };
                    formAudioRecord.ShowDialog();
                    LoadLocalPatientInfo();
                }
                break;

                case "dgvTZLYLoaclDelete":
                {
                    if (DialogResult.OK == MessageBox.Show("你确定要删除该记录及其文件吗", "删除录音提示", MessageBoxButtons.OKCancel))
                    {
                        string sqlDelP = "delete from PatientInfo where PatientGUID={0}";
                        var    k       = Mediator.sqliteHelper.ExecuteNonQuery(sqlDelP, PatientInfo.PatientGUID);
                        if (k > 0)
                        {
                            Mediator.ShowMsg(string.Format("删除患者{0}信息成功...", Path.GetFileName(PatientInfo.PatientName)));
                            string sqlQueryAudio = "select GUID ,RecordTime from AudioInfo where PGUID={0}";
                            var    dt            = Mediator.sqliteHelper.ExecuteDatatable(sqlQueryAudio, PatientInfo.PatientGUID);
                            string sqlDelAudio   = "delete from AudioInfo where PGUID={0}";
                            var    n             = Mediator.sqliteHelper.ExecuteNonQuery(sqlDelAudio, PatientInfo.PatientGUID);
                            if (n > 0)
                            {
                                foreach (DataRow row in dt.Rows)
                                {
                                    string   guid       = row["GUID"] + "";
                                    DateTime recordTime = (DateTime)row["RecordTime"];
                                    string   filePath   = Path.Combine(Setting.localData, @"DevicesData\AudioFiles\" + recordTime.Year
                                                                       + "\\" + recordTime.Month + "\\" + recordTime.Day + "\\" + guid + ".MP3");
                                    if (File.Exists(filePath))
                                    {
                                        File.Delete(filePath);
                                        Mediator.ShowMsg(string.Format("删除文件{0}成功...", Path.GetFileName(filePath)));
                                    }
                                }
                            }
                        }
                    }
                    LoadLocalPatientInfo();
                }
                break;
                }
            }
        }