public int Update(DONHANG emp) { int i; using (SqlConnection con = new SqlConnection(cs)) { con.Open(); SqlCommand com = new SqlCommand("UpdateDonHang", con); com.CommandType = CommandType.StoredProcedure; //com.Parameters.AddWithValue("@Id", emp.Id); com.Parameters.AddWithValue("@mavandon", emp.mavandon); com.Parameters.AddWithValue("@madonhang", emp.madonhang); com.Parameters.AddWithValue("@tennguoigui", emp.tennguoigui); com.Parameters.AddWithValue("@tennguoinhan", emp.tennguoinhan); com.Parameters.AddWithValue("@sdtnguoinhan", emp.sdtnguoinhan); com.Parameters.AddWithValue("@diachinguoinhan", emp.diachinguoinhan); com.Parameters.AddWithValue("@soluong", emp.soluong); com.Parameters.AddWithValue("@giatri", emp.giatri); com.Parameters.AddWithValue("@dichvu", emp.dichvu); com.Parameters.AddWithValue("@loaihang", emp.loaihang); com.Parameters.AddWithValue("@ghichu", emp.ghichu); com.Parameters.AddWithValue("@trangthai", emp.trangthai); com.Parameters.AddWithValue("@phiship", emp.phiship); com.Parameters.AddWithValue("@cod", emp.cod); com.Parameters.AddWithValue("@ngaytaodon", emp.ngaytaodon); com.Parameters.AddWithValue("@Action", "Update"); i = com.ExecuteNonQuery(); } return(i); }
//Method for Adding an Employee public int AddShipper(DONHANG emp) { int i; using (SqlConnection con = new SqlConnection(cs)) { con.Open(); SqlCommand com = new SqlCommand("AddShipper", con); com.CommandType = CommandType.StoredProcedure; com.Parameters.AddWithValue("@Id", emp.Id); com.Parameters.AddWithValue("@Shipper", emp.Shipper); com.Parameters.AddWithValue("@Action", "Update"); i = com.ExecuteNonQuery(); } return(i); }