예제 #1
0
        private void insertConsultation()
        {
            string cim  = new CimCodes(cims, textBoxDiagnostic.Text, "ID").ID;
            string date = (radioButtonToday.Checked) ? DateTime.Today.ToString("dd-MM-yyyy") : maskedTextBoxDate.Text;

            Consultation consultation = new Consultation(currentConsultation, selectedPatient.ID, cim, date);

            string        command   = "INSERT INTO consultations(IdPatient,CIM,ConsDate) VALUES(@IdPatient,@CIM,@ConsDate)";
            List <string> paramList = new List <string>();
            List <object> valueList = new List <object>();

            paramList.Add("@IdPatient");   valueList.Add(consultation.IdPatient);
            paramList.Add("@CIM");         valueList.Add(consultation.CIM);
            paramList.Add("@ConsDate");    valueList.Add(consultation.Date);

            if (connectionClass.sqlCommand(command, paramList, valueList, "Invalid operation!"))
            {
                currentConsultation += 1;
                MessageBox.Show("Successfully inserted!");
                emptyFields();
                visibleAdd();

                buttonModify.Enabled = true;
                buttonRemove.Enabled = true;
                buttonReport.Enabled = true;
            }
        }
예제 #2
0
        private void updateConsultation()
        {
            var confirmResult = MessageBox.Show("Are you sure you want to modify this consultation?", "Modify Consultation", MessageBoxButtons.YesNo);

            if (confirmResult == DialogResult.Yes)
            {
                string cim  = new CimCodes(cims, textBoxDiagnostic.Text, "ID").ID;
                string date = (radioButtonToday.Checked) ? DateTime.Today.ToString("dd-MM-yyyy") : maskedTextBoxDate.Text;

                string        command   = "UPDATE consultations SET CIM=@CIM, ConsDate=@ConsDate WHERE ID=@ID";
                List <string> paramList = new List <string>();
                List <object> valueList = new List <object>();
                paramList.Add("@CIM"); valueList.Add(cim);
                paramList.Add("@ConsDate"); valueList.Add(date);
                paramList.Add("@ID"); valueList.Add(selectedConsultation.ID);

                if (connectionClass.sqlCommand(command, paramList, valueList, "Consultation could not be modified!"))
                {
                    MessageBox.Show("Successfully updated!");
                    emptyFields();
                    labelIdC.Visible      = false;
                    buttonConfirm.Enabled = false;
                }
            }
        }
예제 #3
0
        public ArrayList getListCIM()
        {
            MySqlDataReader rowReader = null;

            try
            {
                ArrayList listCim = new ArrayList();

                string query = "select * from cim";
                rowReader = execReader(query);
                if (rowReader.HasRows)
                {
                    while (rowReader.Read())
                    {
                        CimCodes cim = new CimCodes(rowReader["ID"].ToString(), rowReader["name"].ToString());
                        listCim.Add(cim);
                    }
                }
                rowReader.Close();
                if (listCim.Count != 0)
                {
                    return(listCim);
                }
            }
            catch (Exception ex)
            {
                if (rowReader != null)
                {
                    rowReader.Close();
                }
                Console.Write(ex);
            }

            return(null);
        }
예제 #4
0
        private void updateDataGrid()
        {
            int    id   = (int)numericUpDownSearchID.Value;
            string cim  = new CimCodes(cims, textBoxDiagnostic.Text, "ID").ID;
            string date = (radioButtonToday.Checked) ? DateTime.Today.ToString("dd-MM-yyyy") : maskedTextBoxDate.Text;

            int count = 0;

            string query = "select * from consultations where ";

            if (checkBoxID.Checked)
            {
                query += "ID=" + id;
                count++;
            }
            if (checkBoxDiagnostic.Checked)
            {
                if (count > 0)
                {
                    query += " and ";
                }
                query += "CIM like \'%" + cim + "%\'";
                count++;
            }
            if (checkBoxDate.Checked)
            {
                if (count > 0)
                {
                    query += " and ";
                }
                query += "ConsDate like \'%" + date + "%\'";
                count++;
            }
            if (count > 0)
            {
                query += " and ";
            }
            query += "IdPatient=" + selectedPatient.ID;

            consultations = connectionClass.getConsultationsData(query);

            dataGridViewConsultations.Rows.Clear();
            if (consultations != null)
            {
                foreach (Consultation cons in consultations)
                {
                    DataGridViewRow newRow = new DataGridViewRow();

                    newRow.CreateCells(dataGridViewConsultations);
                    newRow.Cells[0].Value = cons.ID;
                    newRow.Cells[1].Value = cons.Date;
                    newRow.Cells[2].Value = new CimCodes(cims, cons.CIM, "Diagnostic").Diagnostic;
                    dataGridViewConsultations.Rows.Add(newRow);
                }
            }
        }