private void PrescriptionsButtonDelete_Click(object sender, EventArgs e) { DeletePrescriptions deletePrescriptions = new DeletePrescriptions(); DialogResult status = deletePrescriptions.ShowDialog(); if (status == DialogResult.OK) { query = Commands.DeletePrescriptions(Models.Prescriptions.id1, Models.Prescriptions.id2, Models.Prescriptions.patientName); MessageBox.Show(query); int count; if (connectionType == ConnectionTypes.Connected) { ConnectedData.SetCommand(query); count = ConnectedData.UpdateData(); } else { count = DisconnectedData.DeleteData(query); } MessageBox.Show("Удалено: " + count.ToString()); PrescriptionsPrint(SortTypes.IdAsc); } }
private void StorehouseFButtonEdit_Click(object sender, EventArgs e) { UpdateStorehouseFields updateStorehouseFields = new UpdateStorehouseFields(connectionType); DialogResult status = updateStorehouseFields.ShowDialog(); if (status == DialogResult.OK) { query = Commands.UpdateStorehouseF(Models.StorehouseField.id1, Models.StorehouseField.Quantity, Models.StorehouseField.Critical_quantity, Models.StorehouseField.StorehouseRequestsId, Models.StorehouseField.ManufactureDate, Models.StorehouseField.ShelfLife); MessageBox.Show(query); int count; if (connectionType == ConnectionTypes.Connected) { ConnectedData.SetCommand(query); count = ConnectedData.UpdateData(); } else { count = DisconnectedData.UpdateData(query); } MessageBox.Show("Обновлено: " + count.ToString()); StorehouseFPrint(SortTypes.IdAsc); } }
private void MedicationButtonEdit_Click(object sender, EventArgs e) { UpdateMedications updateMedications = new UpdateMedications(connectionType); DialogResult status = updateMedications.ShowDialog(); if (status == DialogResult.OK) { query = Commands.UpdateMedications(Models.Medications.id1, Models.Medications.Name, Models.Medications.Price, Models.Medications.Quantity, Models.Medications.Volume, Models.Medications.MedicationType, Models.Medications.UsesType, Models.Medications.ManufactureType, Models.Medications.MixableList, Models.Medications.PreparationTime, Models.Medications.FiltrationTime); MessageBox.Show(query); int count; if (connectionType == ConnectionTypes.Connected) { ConnectedData.SetCommand(query); count = ConnectedData.UpdateData(); } else { count = DisconnectedData.UpdateData(query); } MessageBox.Show("Обновлено: " + count.ToString()); MedicationsPrint(SortTypes.IdAsc); } }
private void StorehouseFButtonDelete_Click(object sender, EventArgs e) { DeleteStorehouseFields deleteStorehouseFields = new DeleteStorehouseFields(); DialogResult status = deleteStorehouseFields.ShowDialog(); if (status == DialogResult.OK) { query = Commands.DeleteStorehouseF(Models.StorehouseField.id1, Models.StorehouseField.id2, Models.StorehouseField.MedicationsName); MessageBox.Show(query); int count; if (connectionType == ConnectionTypes.Connected) { ConnectedData.SetCommand(query); count = ConnectedData.UpdateData(); } else { count = DisconnectedData.DeleteData(query); } MessageBox.Show("Удалено: " + count.ToString()); StorehouseFPrint(SortTypes.IdAsc); } }
private void PrescriptionsButtonEdit_Click(object sender, EventArgs e) { UpdatePrescriptions updatePrescriptions = new UpdatePrescriptions(connectionType); DialogResult status = updatePrescriptions.ShowDialog(); if (status == DialogResult.OK) { query = Commands.UpdatePrescriptions(Models.Prescriptions.id1, Models.Prescriptions.doctorName, Models.Prescriptions.doctorSignature, Models.Prescriptions.doctorStamp, Models.Prescriptions.patientId); int count; MessageBox.Show(query); if (connectionType == ConnectionTypes.Connected) { ConnectedData.SetCommand(query); count = ConnectedData.UpdateData(); MessageBox.Show("Обновлено основ: " + count.ToString()); PrescriptionsPrint(SortTypes.IdAsc); query = Commands.DeleteDiagnosesPrescriptions(Models.Prescriptions.id1); MessageBox.Show(query); ConnectedData.SetCommand(query); count = ConnectedData.UpdateData(); MessageBox.Show("Удалено диагнозов: " + count.ToString()); PrescriptionsPrint(SortTypes.IdAsc); query = Commands.DeletePrescriptionsMedications(Models.Prescriptions.id1); MessageBox.Show(query); ConnectedData.SetCommand(query); count = ConnectedData.UpdateData(); MessageBox.Show("Удалено лекарств: " + count.ToString()); PrescriptionsPrint(SortTypes.IdAsc); query = Commands.InsertDiagnosesPrescriptions(Models.Prescriptions.diagnosesId, Models.Prescriptions.id1); MessageBox.Show("3\n" + query); ConnectedData.SetCommand(query); count = ConnectedData.UpdateData(); MessageBox.Show("Добавлено диагнозов: " + count.ToString()); query = Commands.InsertPrescriptionsMedications(Models.Prescriptions.medicationsId, Models.Prescriptions.id1); MessageBox.Show("4\n" + query); ConnectedData.SetCommand(query); count = ConnectedData.UpdateData(); MessageBox.Show("Добавлено лекарств: " + count.ToString()); } else { count = DisconnectedData.UpdateData(query); MessageBox.Show("Обновлено основ: " + count.ToString()); PrescriptionsPrint(SortTypes.IdAsc); query = Commands.DeleteDiagnosesPrescriptions(Models.Prescriptions.id1); MessageBox.Show(query); count = DisconnectedData.DeleteData(query); MessageBox.Show("Удалено диагнозов: " + count.ToString()); PrescriptionsPrint(SortTypes.IdAsc); query = Commands.DeletePrescriptionsMedications(Models.Prescriptions.id1); MessageBox.Show(query); count = DisconnectedData.DeleteData(query); MessageBox.Show("Удалено лекарств: " + count.ToString()); PrescriptionsPrint(SortTypes.IdAsc); query = Commands.InsertDiagnosesPrescriptions(Models.Prescriptions.diagnosesId, Models.Prescriptions.id1); MessageBox.Show("3\n" + query); count = DisconnectedData.InsertData(query); MessageBox.Show("Добавлено диагнозов: " + count.ToString()); query = Commands.InsertPrescriptionsMedications(Models.Prescriptions.medicationsId, Models.Prescriptions.id1); MessageBox.Show("4\n" + query); count = DisconnectedData.InsertData(query); MessageBox.Show("Добавлено лекарств: " + count.ToString()); } PrescriptionsPrint(SortTypes.IdAsc); } }
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); } }