Exemplo n.º 1
0
 public static int update(clsPartTypes x)
 {
     using (SqlConnection conn = new SqlConnection(clsMain.sqlconnstring))
     {
         conn.Open();
         SqlCommand cmd = new SqlCommand("shop.spUpdatePartTypes", conn);
         cmd.CommandType = CommandType.StoredProcedure;
         cmd.Parameters.AddWithValue("@id", x.ID);
         cmd.Parameters.AddWithValue("@tag", x.Tag);
         int r = cmd.ExecuteNonQuery();
         return(r);
     }
 }
Exemplo n.º 2
0
        public static List <clsPartTypes> GetAllPartTypes()
        {
            List <clsPartTypes> x = new List <clsPartTypes>();

            using (SqlConnection conn = new SqlConnection(clsMain.sqlconnstring))
            {
                conn.Open();
                SqlCommand cmd = new SqlCommand("shop.spSelectAllPartTypes", conn);
                cmd.CommandType = CommandType.StoredProcedure;
                SqlDataReader rdr = cmd.ExecuteReader();
                while (rdr.Read())
                {
                    clsPartTypes y = new clsPartTypes();
                    y.ID  = Convert.ToInt32(rdr["ID"]);
                    y.Tag = Convert.ToString(rdr["Tag"]);

                    x.Add(y);
                }
            }
            return(x);
        }