コード例 #1
0
        private void ButtonAcceptPId_Click(object sender, EventArgs e)
        {
            //if (connectionType == ConnectionTypes.Connected)
            //{

            //}
            int    id    = Convert.ToInt32(NumericPId.Value);
            string query = Commands.SelectPatientWhereId(id);

            string[] data = new string[5];
            ConnectedData.SetCommand(query);
            bool status = ConnectedData.CheckExist();

            if (status == true)
            {
                TextBoxStatusPId.Text      = "Выбрано";
                TextBoxStatusPId.ForeColor = Color.Green;
                data = ConnectedData.GetRowFromTable();
                TextBoxPName.Text = data[1];
            }
            else
            {
                TextBoxStatusPId.Text      = "Не выбрано";
                TextBoxStatusPId.ForeColor = Color.Red;
                TextBoxPName.ResetText();
                MessageBox.Show("Пациента с таким id не существует!");
            }
        }
コード例 #2
0
        private void ButtonAcceptRId_Click(object sender, EventArgs e)
        {
            //if (connectionType == ConnectionTypes.Connected)
            //{

            //}
            int    RId   = Convert.ToInt32(NumericRId.Value);
            string query = Commands.SelectStorehouseRWhereId(RId);

            ConnectedData.SetCommand(query);
            bool status = ConnectedData.CheckExist();

            if (status == true)
            {
                data = ConnectedData.GetRowFromTable();
                if (Convert.ToInt32(data[2]) == Convert.ToInt32(NumericMId.Value))
                {
                    TextBoxStatusRId.ForeColor = Color.Green;
                    TextBoxStatusRId.Text      = "Выбрано";
                }
                else
                {
                    TextBoxStatusRId.ForeColor = Color.Red;
                    TextBoxStatusRId.Text      = "Не выбрано";
                    MessageBox.Show("Записи с таким id для такого лекарства не существует!");
                }
            }
            else
            {
                TextBoxStatusRId.ForeColor = Color.Red;
                TextBoxStatusRId.Text      = "Не выбрано";
                MessageBox.Show("Записи с таким id не существует!");
            }
        }
コード例 #3
0
        private void ButtonAcceptId_Click(object sender, EventArgs e)
        {
            //if (connectionType == ConnectionTypes.Connected)
            //{

            //}
            int    id    = Convert.ToInt32(NumericId.Value);
            string query = Commands.SelectMedicationsWhereId(id);

            string[] data = new string[11];
            ConnectedData.SetCommand(query);
            bool status = ConnectedData.CheckExist();

            if (status == true)
            {
                TextBoxStatusId.Text       = "Выбрано";
                TextBoxStatusId.ForeColor  = Color.Green;
                ButtonUpdate.Enabled       = true;
                TextBoxName.Enabled        = true;
                TextBoxPrice.Enabled       = true;
                TextBoxQuantity.Enabled    = true;
                TextBoxVolume.Enabled      = true;
                ComboBoxMedType.Enabled    = true;
                ComboBoxUsesType.Enabled   = true;
                ComboBoxManufType.Enabled  = true;
                CheckBoxPrepTime.Enabled   = true;
                CheckBoxFilterTime.Enabled = true;
                ConnectedData.SetCommand(query);
                data             = ConnectedData.GetRowFromTable();
                TextBoxName.Text = data[1];

                double price = Convert.ToDouble(data[2]);
                TextBoxPrice.Text    = Math.Round(price, 2).ToString();
                TextBoxQuantity.Text = data[3];
                TextBoxVolume.Text   = data[4];

                if (data[5] == "1")
                {
                    ComboBoxUsesType.SelectedIndex = 0;
                }
                else if (data[5] == "2")
                {
                    ComboBoxUsesType.SelectedIndex = 1;
                }

                if (data[6] == "1")
                {
                    ComboBoxManufType.SelectedIndex = 0;
                }
                else if (data[6] == "2")
                {
                    ComboBoxManufType.SelectedIndex = 1;
                }
                else if (data[6] == "4")
                {
                    ComboBoxManufType.SelectedIndex = 2;
                }

                if (data[7] == "1")
                {
                    ComboBoxMedType.SelectedIndex = 0;
                }
                else if (data[7] == "2")
                {
                    ComboBoxMedType.SelectedIndex = 1;
                }
                else if (data[7] == "3")
                {
                    ComboBoxMedType.SelectedIndex = 2;
                }
                else if (data[7] == "4")
                {
                    ComboBoxMedType.SelectedIndex = 3;
                }
                else if (data[7] == "5")
                {
                    ComboBoxMedType.SelectedIndex = 4;
                }
                else if (data[7] == "1002")
                {
                    ComboBoxMedType.SelectedIndex = 5;
                }
                else if (data[7] == "1003")
                {
                    ComboBoxMedType.SelectedIndex = 6;
                }

                TextBoxMixableList.Text    = data[8];
                TextBoxPrepTime.Text       = data[9];
                TextBoxFiltrationTime.Text = data[10];

                if (ComboBoxManufType.SelectedIndex == 2)
                {
                    TextBoxMixableList.Enabled = true;
                }
                else
                {
                    TextBoxMixableList.ResetText();
                    TextBoxMixableList.Enabled = false;
                }

                if (TextBoxPrepTime.Text == "-")
                {
                    CheckBoxPrepTime.Checked = false;
                    TextBoxPrepTime.ResetText();
                    TextBoxPrepTime.Enabled = false;
                }
                else
                {
                    CheckBoxPrepTime.Checked = true;
                    TextBoxPrepTime.Enabled  = true;
                }

                if (TextBoxFiltrationTime.Text == "-")
                {
                    CheckBoxFilterTime.Checked = false;
                    TextBoxFiltrationTime.ResetText();
                    TextBoxFiltrationTime.Enabled = false;
                }
                else
                {
                    CheckBoxFilterTime.Checked    = true;
                    TextBoxFiltrationTime.Enabled = true;
                }

                this.Refresh();
            }
            else
            {
                TextBoxStatusId.Text      = "Не выбрано";
                TextBoxStatusId.ForeColor = Color.Red;
                TextBoxName.ResetText();
                TextBoxPrice.ResetText();
                TextBoxQuantity.ResetText();
                TextBoxVolume.ResetText();
                ComboBoxMedType.SelectedIndex   = -1;
                ComboBoxUsesType.SelectedIndex  = -1;
                ComboBoxManufType.SelectedIndex = -1;
                CheckBoxFilterTime.Checked      = false;
                CheckBoxPrepTime.Checked        = false;
                TextBoxPrepTime.ResetText();
                TextBoxFiltrationTime.ResetText();
                TextBoxMixableList.ResetText();
                ButtonUpdate.Enabled          = false;
                TextBoxName.Enabled           = false;
                TextBoxPrice.Enabled          = false;
                TextBoxQuantity.Enabled       = false;
                TextBoxVolume.Enabled         = false;
                ComboBoxMedType.Enabled       = false;
                ComboBoxUsesType.Enabled      = false;
                ComboBoxManufType.Enabled     = false;
                CheckBoxPrepTime.Enabled      = false;
                CheckBoxFilterTime.Enabled    = false;
                TextBoxPrepTime.Enabled       = false;
                TextBoxFiltrationTime.Enabled = false;
                TextBoxMixableList.Enabled    = false;
                this.Refresh();
                MessageBox.Show("Лекарства с таким id не существует!");
            }
        }
コード例 #4
0
        private void ButtonAcceptId_Click(object sender, EventArgs e)
        {
            //if (connectionType == ConnectionTypes.Connected)
            //{

            //}

            int    id    = Convert.ToInt32(NumericId.Value);
            string query = Commands.SelectPrescriptionsWhereId(id);

            ConnectedData.SetCommand(query);
            bool status = ConnectedData.CheckExist();

            if (status == true)
            {
                TextBoxStatusId.Text       = "Выбрано";
                TextBoxStatusId.ForeColor  = Color.Green;
                TextBoxStatusPId.Text      = "Выбрано";
                TextBoxStatusPId.ForeColor = Color.Green;
                ButtonUpdate.Enabled       = true;
                LabelPId.Enabled           = true;
                LabelStatusPId.Enabled     = true;
                NumericPId.Enabled         = true;
                ButtonAcceptPId.Enabled    = true;
                TextBoxStatusPId.Enabled   = true;
                TextBoxDName.Enabled       = true;
                TextBoxPName.Enabled       = true;
                CheckBoxDSignature.Enabled = true;
                CheckBoxDStamp.Enabled     = true;
                DGVDiagnoses.Enabled       = true;
                DGVMedications.Enabled     = true;


                ConnectedData.SetCommand(query);
                dataPrescription = ConnectedData.GetRowFromTable();

                TextBoxDName.Text          = dataPrescription[1];
                CheckBoxDSignature.Checked = Convert.ToBoolean(dataPrescription[2]);
                CheckBoxDStamp.Checked     = Convert.ToBoolean(dataPrescription[3]);
                pId = Convert.ToInt32(dataPrescription[4]);
                NumericPId.Value = pId;
                string query2 = Commands.SelectPatientWhereId(pId);
                ConnectedData.SetCommand(query2);
                dataPatient       = ConnectedData.GetRowFromTable();
                TextBoxPName.Text = dataPatient[1];

                InitializeDGVs(id);
                this.Refresh();
            }
            else
            {
                TextBoxStatusId.Text       = "Не выбрано";
                TextBoxStatusId.ForeColor  = Color.Red;
                ButtonUpdate.Enabled       = false;
                LabelPId.Enabled           = false;
                LabelStatusPId.Enabled     = false;
                NumericPId.Enabled         = false;
                ButtonAcceptPId.Enabled    = false;
                TextBoxStatusPId.Enabled   = false;
                TextBoxDName.Enabled       = false;
                TextBoxPName.Enabled       = false;
                CheckBoxDSignature.Enabled = false;
                CheckBoxDStamp.Enabled     = false;
                DGVDiagnoses.Enabled       = false;
                DGVMedications.Enabled     = false;

                this.Refresh();
                MessageBox.Show("Записи с таким id не существует!");
            }
        }
コード例 #5
0
        private void PrescriptionsButtonAdd_Click(object sender, EventArgs e)
        {
            AddPrescriptions addPrescriptions = new AddPrescriptions(connectionType);
            DialogResult     status           = addPrescriptions.ShowDialog();

            if (status == DialogResult.OK)
            {
                query = Commands.InsertPrescriptions(Models.Prescriptions.doctorName,
                                                     Models.Prescriptions.doctorSignature, Models.Prescriptions.doctorStamp,
                                                     Models.Prescriptions.patientId);

                int count;

                if (connectionType == ConnectionTypes.Connected)
                {
                    MessageBox.Show("1\n" + query);
                    ConnectedData.SetCommand(query);
                    count = ConnectedData.UpdateData();
                    MessageBox.Show("Добавлено: " + count.ToString());

                    string[] data = new string[1];
                    query = Commands.SelectLastId("dbo.prescriptions");
                    MessageBox.Show("2\n" + query);
                    ConnectedData.SetCommand(query);
                    data = ConnectedData.GetRowFromTable();
                    int id = Convert.ToInt32(data[0]);

                    query = Commands.InsertDiagnosesPrescriptions(Models.Prescriptions.diagnosesId, id);
                    MessageBox.Show("3\n" + query);
                    ConnectedData.SetCommand(query);
                    count = ConnectedData.UpdateData();
                    MessageBox.Show("Добавлено: " + count.ToString());

                    query = Commands.InsertPrescriptionsMedications(Models.Prescriptions.medicationsId, id);
                    MessageBox.Show("4\n" + query);
                    ConnectedData.SetCommand(query);
                    count = ConnectedData.UpdateData();
                    MessageBox.Show("Добавлено: " + count.ToString());
                }

                else
                {
                    count = DisconnectedData.InsertData(query);
                    MessageBox.Show("Добавлено: " + count.ToString());

                    query = Commands.SelectLastId("dbo.prescriptions");
                    MessageBox.Show("2\n" + query);

                    dataSet = DisconnectedData.GetTableData(query);
                    DataTable dataTable = dataSet.Tables[0];
                    DataRow   dataRow   = dataTable.Rows[0];
                    int       id        = Convert.ToInt32(dataRow[0]);

                    query = Commands.InsertDiagnosesPrescriptions(Models.Prescriptions.diagnosesId, id);
                    MessageBox.Show("3\n" + query);
                    count = DisconnectedData.InsertData(query);
                    MessageBox.Show("Добавлено: " + count.ToString());

                    query = Commands.InsertPrescriptionsMedications(Models.Prescriptions.medicationsId, id);
                    MessageBox.Show("4\n" + query);
                    count = DisconnectedData.InsertData(query);
                    MessageBox.Show("Добавлено: " + count.ToString());
                }

                PrescriptionsPrint(SortTypes.IdAsc);
            }
        }
コード例 #6
0
        private void ButtonAcceptId_Click(object sender, EventArgs e)
        {
            //if (connectionType == ConnectionTypes.Connected)
            //{

            //}
            int    id    = Convert.ToInt32(NumericId.Value);
            string query = Commands.SelectStorehouseFWhereId(id);

            ConnectedData.SetCommand(query);
            bool status = ConnectedData.CheckExist();

            if (status == true)
            {
                TextBoxStatusId.Text            = "Выбрано";
                TextBoxStatusId.ForeColor       = Color.Green;
                ButtonUpdate.Enabled            = true;
                TextBoxQuantity.Enabled         = true;
                TextBoxCriticalQuantity.Enabled = true;
                TextBoxManufactureDate.Enabled  = true;
                TextBoxShelfLife.Enabled        = true;
                CheckBoxRId.Enabled             = true;

                ConnectedData.SetCommand(query);
                data = ConnectedData.GetRowFromTable();

                TextBoxQuantity.Text         = data[4];
                TextBoxCriticalQuantity.Text = data[2];

                DateTime manufactureDate = Convert.ToDateTime(data[5]);
                DateTime shelfLife       = Convert.ToDateTime(data[6]);
                TextBoxManufactureDate.Text = manufactureDate.ToShortDateString();
                TextBoxShelfLife.Text       = shelfLife.ToShortDateString();

                if (data[3] != "-")
                {
                    NumericRId.Value           = Convert.ToInt32(data[3]);
                    CheckBoxRId.Checked        = true;
                    NumericRId.Enabled         = true;
                    ButtonAcceptRId.Enabled    = true;
                    TextBoxStatusRId.ForeColor = Color.Green;
                    TextBoxStatusRId.Text      = "Выбрано";
                }
                else
                {
                    CheckBoxRId.Checked        = false;
                    TextBoxStatusRId.ForeColor = Color.Red;
                    TextBoxStatusRId.Text      = "Не выбрано";
                }

                this.Refresh();
            }
            else
            {
                TextBoxStatusId.Text            = "Не выбрано";
                TextBoxStatusId.ForeColor       = Color.Red;
                ButtonUpdate.Enabled            = false;
                TextBoxQuantity.Enabled         = false;
                TextBoxCriticalQuantity.Enabled = false;
                TextBoxManufactureDate.Enabled  = false;
                TextBoxShelfLife.Enabled        = false;
                CheckBoxRId.Checked             = false;
                CheckBoxRId.Enabled             = false;
                TextBoxStatusRId.ForeColor      = Color.Red;
                TextBoxStatusRId.Text           = "Не выбрано";

                this.Refresh();
                MessageBox.Show("Записи с таким id не существует!");
            }
        }