protected void addCompanyButton_Click(object sender, EventArgs e)
        {
            Company company = new Company();
            company.CompanyCode = companyCodeTextBox.Text;
            company.CompanyName = companyNameTextBox.Text;

            message.InnerHtml = companyManager.Save(company);
        }
 public string Save(Company company)
 {
     if (companyGateway.Save(company) > 0)
     {
         return "Added Successfully";
     }
     else
     {
         return "Could Not Found";
     }
 }
 public int Save(Company company)
 {
     SqlConnection connection = new SqlConnection(databaseConString);
     string query = "INSERT INTO tbl_company VALUES ('" + company.CompanyCode + "','" + company.CompanyName +
                    "')";
     SqlCommand command = new SqlCommand(query,connection);
     connection.Open();
     int rowAffected = command.ExecuteNonQuery();
     connection.Close();
     return rowAffected;
 }
        public List<Company> GetAllCompanyByDropDownList()
        {
            SqlConnection connection = new SqlConnection(databaseConString);
            string query = "SELECT * FROM tbl_company";
            SqlCommand command = new SqlCommand(query, connection);
            connection.Open();

            SqlDataReader reader = command.ExecuteReader();

            List<Company> companyList = new List<Company>();

            while (reader.Read())
            {
                Company company = new Company();
                company.Id = int.Parse(reader["id"].ToString());
                company.CompanyName = reader["company_name"].ToString();

                companyList.Add(company);
            }
            reader.Close();
            connection.Close();

            return companyList;
        }