Exemplo n.º 1
0
        public string AddCompany(Company company)
        {
            string result = string.Empty;
            try
            {
                SqlCommand cmd = new SqlCommand("sp_AddCompany");
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.Add(new SqlParameter("@Company", company.CompanyName));
                cmd.Parameters.Add(new SqlParameter("@ContactNum", company.CompanyContactNumber));

                result = ExecuteNonQuery(cmd);
            }
            catch (Exception ex)
            {
                result = "Sorry, the system is unable to add a company right now. Please try again later.";
            }
            return result;
        }
Exemplo n.º 2
0
 public string UpdateCompany(Company company)
 {
     try
     {
         SqlCommand cmd = new SqlCommand("sp_UpdateCompany");
         cmd.CommandType = CommandType.StoredProcedure;
         cmd.Parameters.Add(new SqlParameter("@Company", company.CompanyName));
         cmd.Parameters.Add(new SqlParameter("@ContactNum", company.CompanyContactNumber));
         cmd.Parameters.Add(new SqlParameter("@CompanyID", company.CompanyID));
         return ExecuteNonQuery(cmd);
     }
     catch (Exception ex)
     {
         return "Sorry, the system is down right now. Please contact your system administrator.";
     }
 }