Example #1
0
        public bool HoaDonBanHang_Insert(HoaDonBanHangObj data)
        {
            bool check = false;

            try
            {
                using (SqlCommand dbCmd = new SqlCommand("sp_HoaDonBanHang_Insert", openConnection()))
                {
                    dbCmd.CommandType = CommandType.StoredProcedure;
                    dbCmd.Parameters.Add(new SqlParameter("@NgayLap", data.NgayLap));
                    dbCmd.Parameters.Add(new SqlParameter("@TongTien", data.TongTien));
                    dbCmd.Parameters.Add(new SqlParameter("@MaNV", data.MaNV));
                    dbCmd.Parameters.Add(new SqlParameter("@MaKH", data.MaKH));
                    int r = dbCmd.ExecuteNonQuery();
                    if (r > 0)
                    {
                        check = true;
                    }
                }
            }
            catch
            {
            }
            return(check);
        }
Example #2
0
        public List <HoaDonBanHangObj> HoaDonBanHang_GetByTop(string Top, string Where, string Order)
        {
            List <HoaDonBanHangObj> list = new List <HoaDonBanHangObj>();

            using (SqlCommand dbCmd = new SqlCommand("sp_HoaDonBanHang_getByTop", openConnection()))
            {
                dbCmd.CommandType = CommandType.StoredProcedure;
                dbCmd.Parameters.Add(new SqlParameter("@Top", Top));
                dbCmd.Parameters.Add(new SqlParameter("@Where", Where));
                dbCmd.Parameters.Add(new SqlParameter("@Order", Order));
                SqlDataReader dr = dbCmd.ExecuteReader();
                dr.Close();
                dr = dbCmd.ExecuteReader();
                if (dr.HasRows)
                {
                    while (dr.Read())
                    {
                        HoaDonBanHangObj obj = new HoaDonBanHangObj();
                        obj.HoaDonBanHangIDataReader(dr);
                        list.Add(obj);
                    }
                }
                dr.Close();
            }
            return(list);
        }