Ejemplo n.º 1
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     try
     {
         //save Marrie pnlMarried
         PatientbindingSource1.EndEdit();
         dbc.SubmitChanges();
         lbErrormsg.Text = "Save data completed.";
     }
     catch (Exception ex)
     {
         lbErrormsg.Text = ex.Message;
     }
 }
Ejemplo n.º 2
0
        private void PatientbindingSource1_CurrentChanged(object sender, EventArgs e)
        {
            try
            {
                if (dbc.GetChangeSet().Updates.Count > 0)
                {
                    if (MessageBox.Show("คุณต้องการบันทึกการเปลี่ยนแปลงข้อมูลหรือไม่", "Confirm Message", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        dbc.SubmitChanges();
                    }
                    else
                    {
                        PatientbindingSource1.CancelEdit();
                    }
                }
            }
            catch (Exception ex)
            {
                Program.MessageError(ex.Message);
            }
            // Gender
            trn_patient currentpt = (trn_patient)PatientbindingSource1.Current;

            if (currentpt != null)
            {
                Program.SetValueRadioGroup(GBGender, currentpt.tpt_gender);
                Program.SetValueRadioGroup(pnlMarried, currentpt.tpt_married);
            }

            //Patient Type
            trn_patient_regi currentRegis = (trn_patient_regi)trnpatientregisBindingSource.Current;

            if (currentRegis != null)
            {
                Program.SetValueRadioGroup(GBPatientType, currentRegis.tpr_patient_type);
            }
        }