Esempio n. 1
0
 public int capnhatHang(phieunhap pn)
 {
     using (SqlConnection con = new SqlConnection(ketnoi.chuoikn))
     {
         SqlCommand cmd = new SqlCommand("capnhatphieutam", con);
         cmd.CommandType = CommandType.StoredProcedure;
         cmd.Parameters.AddWithValue("@mahang", pn.mahang);
         cmd.Parameters.AddWithValue("@soluong", pn.soluong);
         cmd.Parameters.AddWithValue("@gianhap", pn.gianhap);
         cmd.Parameters.AddWithValue("@thanhtien", pn.thanhtien);
         con.Open();
         cmd.ExecuteNonQuery();
     }
     return(1);
 }
Esempio n. 2
0
 public int addHang(phieunhap pn)
 {
     using (SqlConnection con = new SqlConnection(ketnoi.chuoikn))
     {
         SqlCommand cmd = new SqlCommand("luusanphamtam", con);
         cmd.CommandType = CommandType.StoredProcedure;
         cmd.Parameters.AddWithValue("@mahang", pn.mahang);
         cmd.Parameters.AddWithValue("@soluong", pn.soluong);
         cmd.Parameters.AddWithValue("@gianhap", pn.gianhap);
         cmd.Parameters.AddWithValue("@thanhtien", pn.thanhtien);
         //cmd.Parameters.AddWithValue("@phieu", "tam");
         con.Open();
         try
         {
             cmd.ExecuteNonQuery();
         }
         catch (System.Exception)
         {
             return(-1);
         }
     }
     return(1);
 }