private void MedicinesComboBox_SelectedIndexChanged(object sender, EventArgs e) { var med = ReadExcel.GetDoze(MedicinesComboBox.Text); DozeTxtBox.Text = med.Dose; morningChkBx.Checked = med.Morning; eveningChkBx.Checked = med.Evening; nightChkbx.Checked = med.Night; }
public Form1() { try { InitializeComponent(); if (!System.IO.Directory.Exists(@".\Data")) { System.IO.Directory.CreateDirectory(@".\Data"); } if (!System.IO.Directory.Exists(@".\Data\AllPatientPrescription")) { System.IO.Directory.CreateDirectory(@".\Data\AllPatientPrescription"); } string jsonFilePath = string.Format( @".\Data\AllPatientPrescription\DaysPatient{0}.json", DateTime.Now.ToLongDateString().Replace(' ', '_')); if (!System.IO.File.Exists(jsonFilePath)) { System.IO.File.Create(jsonFilePath).Close(); } if (!System.IO.File.Exists(@".\Data\TotalPrescriptionCount.txt")) { System.IO.File.Create(@".\Data\TotalPrescriptionCount.txt").Close(); } var allComplains = ReadExcel.GetSymptoms(); foreach (var c in allComplains) { AllSymptoms.Items.Add(c); } var lst = ReadExcel.GetAllMedicines().OrderBy(x => x).ToList(); lst.Insert(0, "==Select=="); MedicinesComboBox.DataSource = lst; } catch (Exception ex) { Common.Log(ex); MessageBox.Show("If it is first time try to re strat your application. Other wise call your developer."); } }
private void AddNewMedicine_Click(object sender, EventArgs e) { try { if (addNewMedName.Text == string.Empty) { MessageBox.Show("Please enter new medicine name."); return; } if (MorningDozeTxtBx.Text == string.Empty) { MessageBox.Show("Please enter mornign doze."); return; } if (EveningDozeTxtBx.Text == string.Empty) { MessageBox.Show("Please enter evening doze."); return; } if (NightDozeTxtBx.Text == string.Empty) { MessageBox.Show("Please enter night doze."); return; } AddMedStatus.Text = "Status-" + ReadExcel.AddNewMedicine(addNewMedName.Text, MorningDozeTxtBx.Text, EveningDozeTxtBx.Text, NightDozeTxtBx.Text); addNewMedName.Text = string.Empty; NightDozeTxtBx.Text = string.Empty; EveningDozeTxtBx.Text = string.Empty; MorningDozeTxtBx.Text = string.Empty; } catch (Exception ex) { Common.Log(ex); MessageBox.Show("Contact developer and send the logs to the developer."); } }