public Medicine( string name, Dictionary <string, Color> tags, MedicineGroup medicineInfos, MedicineScheduleInfo medicineScheduleInfo) { this.name = name; this.tags = tags; this.medicineOverAllInfo = medicineInfos; this.medicineScheduleInfo = medicineScheduleInfo; }
public static List <MedicineGroup> SeparatedBatchInfo(string name) { List <MedicineGroup> medicineLongInfos = new List <MedicineGroup>(10); //Get the Full Batch Info. MySqlCommand cmd = new MySqlCommand("select * from medicinetable where medname=@mdn ", globalCon); cmd.Parameters.AddWithValue("@mdn", name); MySqlDataReader reader2 = cmd.ExecuteReader(); while (reader2.Read()) { DateTime entryDate = reader2.GetDateTime(1); DateTime expDate = reader2.GetDateTime(2); int BatchNumber = reader2.GetInt16(3); int BatchStock = reader2.GetInt16(4); string status = reader2.GetString(5); int price = reader2.GetInt16(6); var tempInfo = new MedicineGroup(BatchNumber, BatchStock, status, entryDate, expDate, price); medicineLongInfos.Add(tempInfo); } reader2.Close(); return(medicineLongInfos); }
public Medicine MedicineLongInfo() { string companyName = ""; string query = "select manfName,username from mednametable where medName=@mname"; MySqlCommand getDetailsCommand = new MySqlCommand(query, globalCon); getDetailsCommand.Parameters.AddWithValue("@mname", name); MySqlDataReader reader = getDetailsCommand.ExecuteReader(); while (reader.Read()) { registeredBy = reader.GetString(1); companyName = reader.GetString(0); } reader.Close(); //Get List of Manufacturer Infos. manufacturerInfo = ManufacturerInfo.GetShortInfoOf(companyName); //Get List of Batch Infos. perBatchInfoList = MedicineGroup.SeparatedBatchInfo(name); //Get Full Schedule Info. medicineScheduleInfo = new MedicineScheduleInfo(name).GetScheduleInfo(); //Return the Medicine. return(new Medicine(name, registeredBy, perBatchInfoList, medicineScheduleInfo, manufacturerInfo)); }