public string Save(Medicine aMedicine)
 {
     if (aMedicineDbGateway.Find(aMedicine.Name) == null)
     {
         aMedicineDbGateway.Save(aMedicine);
         return("Saved");
     }
     else
     {
         return("Already Exists");
     }
 }
Beispiel #2
0
        public string SaveMedicine(Medicine aMedicine)
        {
            Medicine medicineFound = aMedicineDBGateway.Find(aMedicine.Name);

            if (medicineFound == null)
            {
                aMedicineDBGateway.SaveMedicine(aMedicine);
                return("Medicine Successfully Saved...!!!");
            }
            else
            {
                return("This medicine already exist");
            }
        }
        public List <Stock> GetAll(int centerId)
        {
            string query = "SELECT *FROM tbl_stock where centerId=" + centerId;

            ASqlConnection.Open();
            ASqlCommand    = new SqlCommand(query, ASqlConnection);
            ASqlDataReader = ASqlCommand.ExecuteReader();

            List <Stock> stockList = new List <Stock>();

            while (ASqlDataReader.Read())
            {
                MedicineDBGateway aGateway  = new MedicineDBGateway();;
                Stock             aStock    = new Stock();
                Medicine          aMedicine = aGateway.Find(Convert.ToInt32(ASqlDataReader["id"]));
                aStock.MedicineName = aMedicine.Name + "_" + aMedicine.MgMl;
                aStock.Quantity     = (int)ASqlDataReader["quantity"];

                stockList.Add(aStock);
            }
            ASqlDataReader.Close();
            ASqlConnection.Close();

            return(stockList);
        }
Beispiel #4
0
 public Medicine Find(string name)
 {
     return(aMedicineDbGateway.Find(name));
 }
 internal Medicine Find(string medicineId)
 {
     return(aMedicineDbGateway.Find(medicineId));
 }