Esempio n. 1
0
        private void dgvDiagnosis_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            DataGridView gv = (DataGridView)sender;

            if (gv.Columns[e.ColumnIndex].Name == "Del")
            {
                clsSourceDiagnosis result = (clsSourceDiagnosis)gv.Rows[e.RowIndex].DataBoundItem;
                sourceDiag.Remove(result);
                fieldDestinationCls fieldDesti = mapField.Where(x => x.fieldDestination == result.fieldName).FirstOrDefault();
                if (fieldDesti != null)
                {
                    trn_eye_exam_hdr patient_eyes = bsPatientEyes.OfType <trn_eye_exam_hdr>().FirstOrDefault();
                    TypeDescriptor.GetProperties(patient_eyes)[fieldDesti.fieldCheck].SetValue(patient_eyes, null);
                }
            }
        }
Esempio n. 2
0
 private void btnAddDiagnosis_Click(object sender, EventArgs e)
 {
     try
     {
         clsSourceDiagnosis result = sourceDiag.Where(x => x.fieldName == cmbMainTopic.Text.ToString() + ":" + cmbSubTopic.Text.ToString()).FirstOrDefault();
         if (result == null)
         {
             sourceDiag.Add(new clsSourceDiagnosis
             {
                 fieldName = cmbMainTopic.Text.ToString() + ":" + cmbSubTopic.Text.ToString(),
                 side      = cmbMainTopic.Text.ToString(),
                 name      = cmbMainTopic.Text.ToString(),
                 name_desc = cmbMainTopic.Text.ToString(),
                 val       = cmbSubTopic.Text.ToString()
             });
         }
     }
     catch
     {
     }
 }
Esempio n. 3
0
        private void eye_hdr_PropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            fieldDestinationCls chkField = mapField.Where(x => x.fieldCheck == e.PropertyName).FirstOrDefault();

            if (chkField != null)
            {
                var val = TypeDescriptor.GetProperties(sender)[chkField.fieldCheck].GetValue(sender);
                if ((char?)val != null)
                {
                    if ((char?)val == 'N')
                    {
                        chkField.comboBox.SelectedIndex = -1;
                        chkField.comboBox.Enabled       = false;
                    }
                    else if ((char?)val == 'A')
                    {
                        chkField.comboBox.SelectedIndex = 1;
                        chkField.comboBox.Enabled       = true;
                    }
                }
                else
                {
                    chkField.comboBox.SelectedIndex = -1;
                    chkField.comboBox.Enabled       = false;
                }
            }
            else
            {
                fieldDestinationCls desField = mapField.Where(x => x.fieldDestination == e.PropertyName).FirstOrDefault();
                if (desField != null)
                {
                    var val     = TypeDescriptor.GetProperties(sender)[desField.fieldDestination].GetValue(sender);
                    var valflag = TypeDescriptor.GetProperties(sender)[desField.fieldCheck].GetValue(sender);
                    clsSourceDiagnosis result = sourceDiag.OfType <clsSourceDiagnosis>().Where(x => x.fieldName == desField.fieldDestination).FirstOrDefault();
                    if (valflag != null)
                    {
                        if (valflag.GetType() == typeof(string) || valflag.GetType() == typeof(char))
                        {
                            if (string.IsNullOrEmpty(valflag.ToString()) || valflag.ToString() == "N")
                            {
                                if (result != null)
                                {
                                    sourceDiag.Remove(result);
                                }
                            }
                            else
                            {
                                if (result != null)
                                {
                                    result.val = val.ToString();
                                }
                                else
                                {
                                    sourceDiag.Add(new clsSourceDiagnosis
                                    {
                                        fieldName = desField.fieldDestination,
                                        side      = desField.fieldSide,
                                        name      = desField.fieldDesciption1,
                                        name_desc = desField.fieldDesciption2,
                                        val       = val.ToString()
                                    });
                                }
                            }
                        }
                    }
                    else
                    {
                        if (result != null)
                        {
                            sourceDiag.Remove(result);
                        }
                    }
                    dgvDiagnosis.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells;
                    dgvDiagnosis.Refresh();
                }
            }
        }