public void CanRetrieveAllSamuraiValuePairs() { var context = new SamuraiContext(_options); var repo = new DisconnectedData(context); Assert.AreEqual(2, repo.GetSamuraiReferenceList().Count); }
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); } }
public void Check_Existing_Companies() { var context = new Ex1DataContext(_options); var repo = new DisconnectedData(context); Assert.IsTrue(repo.GetCompanyReferenceList().Count > 0); }
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 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); } }
public void CanRetrieveListOfSamuraisValues() { using (var context = new SamuraiContext(_options)) { var repo = new DisconnectedData(context); Assert.IsType <List <KeyValuePair <int, string> > >(repo.GetSamuraiReferenceList()); } }
public PrivateChatForm(List <string> users, string userName, DisconnectedData Db) { InitializeComponent(); this.Db = Db; Name = userName; listBox1.DataSource = users; dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; }
public void CanRetrieveListOfSamuraiValues() { var context = new SamuraiContext(_options); var repo = new DisconnectedData(context); var list = repo.GetSamuraiReferenceList(); Assert.IsInstanceOfType(list, typeof(List <KeyValuePair <int, string> >)); }
public void CanLoadQuotesAndIdentityForASamurai() { var context = new SamuraiContext(_options); var repo = new DisconnectedData(context); var graph = repo.LoadSamuraiGraph(1); Assert.AreEqual(2, graph.Quotes.Count); Assert.IsNotNull(graph.SecretIdentity); }
public void CanLoadQuotesAndIdentifyForASamurai() { using (var context = new SamuraiContext(_options)) { var repo = new DisconnectedData(context); var samuraiGraph = repo.LoadSamuraiGraph(1); Assert.Equal(2, samuraiGraph.Quotes.Count); Assert.NotNull(samuraiGraph.SecretIdentity); } }
void InitializeForm(IPEndPoint ip, int maxusers, string connectionString) { InitializeComponent(); MaxUsersAmount.Text = maxusers.ToString(); currentUsersInChat = 0; data = new DisconnectedData(connectionString); GetUsersByComboBox.SelectedItem = GetUsersByComboBox.Items[0]; Shown += (o, arg) => OnFormShown(ip); }
public AuthController( UserManager <IdentityUser> userManager, IConfiguration configuration, DisconnectedData context, IJwtGenerator jwtGenerator ) { _userManager = userManager; _configuration = configuration; _context = context; _jwtGenerator = jwtGenerator; }
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); } }
public AdminController(DisconnectedData repo) { _repo = repo; }
public SamuraiController(DisconnectedData repo) { _repo = repo; }
//private IJwtGenerator _jwtGenerator; public UserCaseController(DisconnectedData repo, IJwtGenerator jwtGenerator) { _repo = repo; //_jwtGenerator = jwtGenerator; }
public void StorehouseFPrint(SortTypes sort, string name = "") { StorehouseFListView.Items.Clear(); if (name != "") { query = Commands.SelectStorehouseF(sort, name); } else { query = Commands.SelectStorehouseF(sort); } ListViewItem item; if (connectionType == ConnectionTypes.Connected) { ConnectedData.SetCommand(query); int[] size = new int[2]; size = ConnectedData.GetRowAndColumnCount(); int row = size[0]; int column = size[1]; string[,] data = new string[row, column]; data = ConnectedData.GetTableData(); for (int i = 0; i < row; i++) { item = new ListViewItem(data[i, 0]); for (int j = 1; j < column; j++) { if (j == 5 || j == 6) { DateTime value = Convert.ToDateTime(data[i, j]); item.SubItems.Add(value.ToShortDateString()); } else { item.SubItems.Add(data[i, j]); } } StorehouseFListView.Items.Add(item); } } else { dataSet = DisconnectedData.GetTableData(query); DataTable dataTable = dataSet.Tables[0]; for (int i = 0; i < dataTable.Rows.Count; i++) { DataRow dataRow = dataTable.Rows[i]; item = new ListViewItem(dataRow[0].ToString()); for (int j = 1; j < dataTable.Columns.Count; j++) { if (j == 5 || j == 6) { DateTime value = Convert.ToDateTime(dataRow[j]); item.SubItems.Add(value.ToShortDateString()); } else { item.SubItems.Add(dataRow[j].ToString()); } } StorehouseFListView.Items.Add(item); } } }
public SamuraiController(DisconnectedData repository) { _repository = repository; }
public UserMessageController(DisconnectedData repo) { _repo = repo; }
public void PrescriptionsPrint(SortTypes sort, string name = "") { PrescriptionsListView.Items.Clear(); if (name != "") { query = Commands.SelectPrescriptions(sort, name); } else { query = Commands.SelectPrescriptions(sort); } ListViewItem item; if (connectionType == ConnectionTypes.Connected) { ConnectedData.SetCommand(query); int[] size = new int[2]; size = ConnectedData.GetRowAndColumnCount(); int row = size[0]; int column = size[1]; string[,] data = new string[row, column]; data = ConnectedData.GetTableData(); Dictionary <int, string> list = GetPrescriptionsDiagnoses(); Dictionary <int, string> list2 = GetPrescriptionsMedications(); for (int i = 0; i < row; i++) { item = new ListViewItem(data[i, 0]); for (int j = 1; j < column; j++) { if (j == 4 || j == 5) { bool value = Convert.ToBoolean(data[i, j]); if (value == true) { item.SubItems.Add("+"); } else { item.SubItems.Add("-"); } } else { item.SubItems.Add(data[i, j]); } } if (list.ContainsKey(Convert.ToInt32(data[i, 0]))) { item.SubItems.Add(list[Convert.ToInt32(data[i, 0])]); } else { item.SubItems.Add("-"); } if (list2.ContainsKey(Convert.ToInt32(data[i, 0]))) { item.SubItems.Add(list2[Convert.ToInt32(data[i, 0])]); } else { item.SubItems.Add("-"); } PrescriptionsListView.Items.Add(item); } } else { dataSet = DisconnectedData.GetTableData(query); DataTable dataTable = dataSet.Tables[0]; for (int i = 0; i < dataTable.Rows.Count; i++) { DataRow dataRow = dataTable.Rows[i]; item = new ListViewItem(dataRow[0].ToString()); for (int j = 1; j < dataTable.Columns.Count; j++) { if (j == 4 || j == 5) { bool value = Convert.ToBoolean(dataRow[j]); if (value == true) { item.SubItems.Add("+"); } else { item.SubItems.Add("-"); } } else { item.SubItems.Add(dataRow[j].ToString()); } } Dictionary <int, string> list = GetPrescriptionsDiagnoses(); Dictionary <int, string> list2 = GetPrescriptionsMedications(); if (list.ContainsKey(Convert.ToInt32(dataRow[0]))) { item.SubItems.Add(list[Convert.ToInt32(dataRow[0])]); } else { item.SubItems.Add("-"); } if (list2.ContainsKey(Convert.ToInt32(dataRow[0]))) { item.SubItems.Add(list2[Convert.ToInt32(dataRow[0])]); } else { item.SubItems.Add("-"); } PrescriptionsListView.Items.Add(item); } } }
public void MedicationsPrint(SortTypes sort, string name = "") { double sum = 0; int countPills = 0; int countSolutes = 0; MedicationsListView.Items.Clear(); if (name != "") { query = Commands.SelectMedications(sort, name); } else { query = Commands.SelectMedications(sort); } ListViewItem item; if (connectionType == ConnectionTypes.Connected) { ConnectedData.SetCommand(query); int[] size = new int[2]; size = ConnectedData.GetRowAndColumnCount(); int row = size[0]; int column = size[1]; string[,] data = new string[row, column]; data = ConnectedData.GetTableData(); for (int i = 0; i < row; i++) { item = new ListViewItem(data[i, 0]); for (int j = 1; j < column; j++) { if (j == 2) { double value = Convert.ToDouble(data[i, j]); item.SubItems.Add(Math.Round(value, 2).ToString() + " грн"); sum += value; } else { item.SubItems.Add(data[i, j]); } if (j == 5 && data[i, j] == "Таблетки") { countPills++; } else if (j == 5 && data[i, j] == "Раствор") { countSolutes++; } } MedicationsListView.Items.Add(item); } } else { dataSet = DisconnectedData.GetTableData(query); DataTable dataTable = dataSet.Tables[0]; for (int i = 0; i < dataTable.Rows.Count; i++) { DataRow dataRow = dataTable.Rows[i]; item = new ListViewItem(dataRow[0].ToString()); for (int j = 1; j < dataTable.Columns.Count; j++) { if (j == 2) { double value = Convert.ToDouble(dataRow[j]); item.SubItems.Add(Math.Round(value, 2).ToString() + " грн"); sum += value; } else { item.SubItems.Add(dataRow[j].ToString()); } if (j == 5 && dataRow[j].ToString() == "Таблетки") { countPills++; } else if (j == 5 && dataRow[j].ToString() == "Раствор") { countSolutes++; } } MedicationsListView.Items.Add(item); } } LabelMedicationsSumPriceValue.Text = Math.Round(sum, 2).ToString() + " грн"; LabelMedicationsSumPillsValue.Text = countPills.ToString(); LabelMedicationsSumSolutesValue.Text = countSolutes.ToString(); }
public void CanRetrieveListOfSamuraiValues() { var context = new SamuraiContext(_options); var repo = new DisconnectedData(context); var list = repo.GetSamuraiReferenceList(); }
public Dictionary <int, string> GetPrescriptionsMedications() { query = Commands.SelectPrescriptionsMedications(); ConnectedData.SetCommand(query); Dictionary <int, string> list = new Dictionary <int, string>(); if (connectionType == ConnectionTypes.Connected) { int[] size = new int[2]; size = ConnectedData.GetRowAndColumnCount(); int row = size[0]; int column = size[1]; string[,] data = new string[row, column]; data = ConnectedData.GetTableData(); int key = Convert.ToInt32(data[0, 0]); string str = ""; for (int i = 0; i < row; i++) { if (Convert.ToInt32(data[i, 0]) == key) { str += data[i, 1] + " " + data[i, 2] + "шт, "; } else { str = str.Remove(str.Length - 2); list.Add(key, str); str = ""; key = Convert.ToInt32(data[i, 0]); str += data[i, 1] + " " + data[i, 2] + "шт, "; } } str = str.Remove(str.Length - 2); list.Add(key, str); } else { dataSet = DisconnectedData.GetTableData(query); DataTable dataTable = dataSet.Tables[0]; DataRow dataRow = dataTable.Rows[0]; int key = Convert.ToInt32(dataRow[0]); string str = ""; for (int i = 0; i < dataTable.Rows.Count; i++) { dataRow = dataTable.Rows[i]; if (Convert.ToInt32(dataRow[0]) == key) { str += dataRow[1] + " " + dataRow[2] + "шт, "; } else { str = str.Remove(str.Length - 2); list.Add(key, str); str = ""; key = Convert.ToInt32(dataRow[0]); str += dataRow[1] + " " + dataRow[2] + "шт, "; } } str = str.Remove(str.Length - 2); list.Add(key, str); } return(list); }
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); } }
public CompanyController(DisconnectedData repo) { _repo = repo; }
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); } }