Пример #1
0
        private void txtCariDiagnosa_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                DataGridViewRow row = (DataGridViewRow)dgvDiagnosa.Rows[0].Clone();
                var             dh  = new dataset.yakkumdbTableAdapters.ICD10_2019_CodesTableAdapter();
                var             dh2 = new fa_rx_diagnosaTableAdapter();
                dh.Fill(yakkumdb.ICD10_2019_Codes, txtCariDiagnosa.Text);
                DataTable dt = dh.GetData(txtCariDiagnosa.Text);

                if (dt.Rows.Count > 0)
                {
                    foreach (DataRow r in dt.Rows)
                    {
                        dh2.InsertQuery(_noreg, r["vc_codes"].ToString(), r["vc_desc_title"].ToString(), null, null, DateTime.Now);
                        //row.Cells[1].Value = r["vc_codes"].ToString();
                        //row.Cells[2].Value = r["vc_desc_title"].ToString();
                    }
                }
                else
                {
                    dh2.InsertQuery(_noreg, "-", txtCariDiagnosa.Text.ToString(), null, null, DateTime.Now);
                    //row.Cells[1].Value = "-";
                    //row.Cells[2].Value = txtCariDiagnosa.Text.ToString();
                }
                //dgvDiagnosa.Rows.Add(row);
                this.view_diagnosaTableAdapter.FillbyNoReg(yakkumdb.view_diagnosa, _noreg);
                this.dgvDiagnosa.Update();
                this.dgvDiagnosa.Refresh();

                txtCariDiagnosa.Clear();
            }
        }
Пример #2
0
        private void dgvDiagnosa_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            var dh = new fa_rx_diagnosaTableAdapter();

            if (e.RowIndex < 0)
            {
                return;
            }
            //if (e.ColumnIndex == this.dgvDiagnosa.Columns["btnPrimary"].Index)
            //{
            //    //this.dgvDiagnosa.Rows.Insert(0, dgvDiagnosa.Rows[e.RowIndex]);
            //    //this.dgvDiagnosa.Rows.Remove(dgvDiagnosa.Rows[e.RowIndex]);
            //}
            //Check to ensure that the row CheckBox is clicked.
            if (e.ColumnIndex == 3 && !string.IsNullOrEmpty(dgvDiagnosa.Rows[e.RowIndex].Cells[2].Value as string))
            {
                //Loop and uncheck all other CheckBoxes.
                foreach (DataGridViewRow row in dgvDiagnosa.Rows)
                {
                    if (row.Index == e.RowIndex)
                    {
                        row.Cells["btdiagnosautamaDataGridViewCheckBoxColumn"].Value = !Convert.ToBoolean(row.Cells["btdiagnosautamaDataGridViewCheckBoxColumn"].EditedFormattedValue);
                        dh.UpdateQueryDiaglist2nd(_noreg);
                        dh.UpdateQueryPrimaryDiag((int)row.Cells["idDataGridViewTextBoxColumn1"].Value);

                        this.view_diagnosaTableAdapter.FillbyNoReg(yakkumdb.view_diagnosa, _noreg);
                        dgvDiagnosa.Update();
                        //dgvDiagnosa.Refresh();
                    }
                    else
                    {
                        row.Cells["btdiagnosautamaDataGridViewCheckBoxColumn"].Value = false;
                    }
                }
            }

            if (e.ColumnIndex == this.dgvDiagnosa.Columns["btnDelete"].Index && !string.IsNullOrEmpty(dgvDiagnosa.Rows[e.RowIndex].Cells[2].Value as string))
            {
                dh.DeleteQuerybyId(Int32.Parse(dgvDiagnosa.Rows[e.RowIndex].Cells["idDataGridViewTextBoxColumn1"].Value.ToString()));
                this.dgvDiagnosa.Rows.Remove(dgvDiagnosa.Rows[e.RowIndex]);
            }
        }