public void AddDepartmentAgainstMedicine(DepartmentMedicineView medicine) { try { _connection.Open(); SqlCommand cmd = new SqlCommand("dbo.AssignMedicinetoDepartment", _connection); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@medicineName", medicine.Name); cmd.Parameters.AddWithValue("@departmentName", medicine.DepartmentName); cmd.Parameters.AddWithValue("@qantityAssigned", medicine.QuantityAssigned); cmd.Parameters.AddWithValue("@allotmentDate", DateTime.Today); cmd.Parameters.AddWithValue("@batchNumber", medicine.batchNumber); cmd.Parameters.AddWithValue("@expiryDate", medicine.ExpiryDate); cmd.ExecuteNonQuery(); } catch (Exception exception) { Console.WriteLine("Failed to get Medicine names because " + exception.Message); } }
public void AddDepartmentAgainstMedicine(DepartmentMedicineView medicine) { _sqlHelper.AddDepartmentAgainstMedicine(medicine); }