public List<Medicine> GetAllMedicineByRepeater()
        {
            SqlConnection connection = new SqlConnection(databaseConString);
            string query = "SELECT * FROM view_medicineList";
            SqlCommand command = new SqlCommand(query, connection);
            connection.Open();

            SqlDataReader reader = command.ExecuteReader();

            List<Medicine> medicineList = new List<Medicine>();

            int serialNo = 1;
            while (reader.Read())
            {
                Medicine medicine = new Medicine();
                medicine.SerialNo = serialNo++;
                medicine.MedicineCode = reader["medicine_code"].ToString();
                medicine.MedicineName = reader["medicine_name"].ToString();
                medicine.Description = reader["description"].ToString();
                medicine.CategoryName = reader["category_name"].ToString();
                medicine.CompanyName = reader["company_name"].ToString();
                medicine.Price = double.Parse(reader["price"].ToString());

                medicineList.Add(medicine);
            }
            reader.Close();
            connection.Close();

            return medicineList;
        }
 public string Save(Medicine medicine)
 {
     if (medicineGateway.Save(medicine) > 0)
     {
         return "Added Successfully!";
     }
     else
     {
         return "Could Not Added!";
     }
 }
        protected void addMedicineButton_Click(object sender, EventArgs e)
        {
            Medicine medicine = new Medicine();
            medicine.MedicineCode = medicineCodeTextBox.Text;
            medicine.MedicineName = medicineNameTextBox.Text;
            medicine.Description = descriptionTextBox.Text;
            medicine.CategoryId = int.Parse(categoryNameDropDownList.SelectedValue);
            medicine.CompanyId = int.Parse(companyNameDropDownList.SelectedValue);
            medicine.Price = int.Parse(priceTextBox.Text);

            message.InnerHtml = medicineManager.Save(medicine);
        }
        public int Save(Medicine medicine)
        {
            SqlConnection connection = new SqlConnection(databaseConString);
            string query = "INSERT INTO tbl_medicine VALUES ('" + medicine.MedicineCode + "','" + medicine.MedicineName +
                           "','" + medicine.Description + "','" + medicine.CategoryId + "','" + medicine.CompanyId +
                           "','" + medicine.Price + "')";
            SqlCommand command = new SqlCommand(query, connection);

            connection.Open();
            int rowAffected = command.ExecuteNonQuery();
            connection.Close();
            return rowAffected;
        }