public static TuVanDichVu SelectById(SqlConnection con, Guid TVDV_ID)
        {
            var Item = new TuVanDichVu();
            var obj  = new SqlParameter[1];

            obj[0] = new SqlParameter("TVDV_ID", TVDV_ID);
            using (IDataReader rd = SqlHelper.ExecuteReader(con, CommandType.StoredProcedure, "sp_tblSpaMgr_TuVanDichVu_Select_SelectById_linhnx", obj))
            {
                while (rd.Read())
                {
                    Item = getFromReader(rd);
                }
            }
            return(Item);
        }
        public static TuVanDichVu Update(TuVanDichVu item)
        {
            var Item = new TuVanDichVu();
            var obj  = new SqlParameter[17];

            obj[0] = new SqlParameter("TVDV_ID", item.ID);
            obj[1] = new SqlParameter("TVDV_KH_ID", item.KH_ID);
            obj[2] = new SqlParameter("TVDV_TV_ID", item.TV_ID);
            obj[3] = new SqlParameter("TVDV_DV_ID", item.DV_ID);
            if (item.NgayTao > DateTime.MinValue)
            {
                obj[4] = new SqlParameter("TVDV_NgayTao", item.NgayTao);
            }
            else
            {
                obj[4] = new SqlParameter("TVDV_NgayTao", DBNull.Value);
            }
            obj[5]  = new SqlParameter("TVDV_NguoiTao", item.NguoiTao);
            obj[6]  = new SqlParameter("TVDV_Gia", item.Gia);
            obj[7]  = new SqlParameter("TVDV_GhiChu", item.GhiChu);
            obj[8]  = new SqlParameter("TVDV_SoLan", item.SoLan);
            obj[9]  = new SqlParameter("TVDV_ThanhToan", item.ThanhToan);
            obj[10] = new SqlParameter("TVDV_ConNo", item.ConNo);
            if (item.NgayLap > DateTime.MinValue)
            {
                obj[11] = new SqlParameter("TVDV_NgayLap", item.NgayLap);
            }
            else
            {
                obj[11] = new SqlParameter("TVDV_NgayLap", DBNull.Value);
            }
            obj[12] = new SqlParameter("TVDV_BaoHanh_ID", item.BaoHanh_ID);
            obj[13] = new SqlParameter("TVDV_KHO_ID", item.KHO_ID);
            obj[14] = new SqlParameter("TVDV_CK", item.CK);
            obj[15] = new SqlParameter("TVDV_NhanVien", item.NhanVien);
            obj[16] = new SqlParameter("TVDV_Ma", item.Ma);
            using (IDataReader rd = SqlHelper.ExecuteReader(DAL.con(), CommandType.StoredProcedure, "sp_tblSpaMgr_TuVanDichVu_Update_UpdateNormal_linhnx", obj))
            {
                while (rd.Read())
                {
                    Item = getFromReader(rd);
                }
            }
            return(Item);
        }
        public static TuVanDichVu getFromReader(IDataReader rd)
        {
            var Item = new TuVanDichVu();

            if (rd.FieldExists("TVDV_ID"))
            {
                Item.ID = (Guid)(rd["TVDV_ID"]);
            }
            if (rd.FieldExists("TVDV_KH_ID"))
            {
                Item.KH_ID = (Guid)(rd["TVDV_KH_ID"]);
            }
            if (rd.FieldExists("TVDV_TV_ID"))
            {
                Item.TV_ID = (Guid)(rd["TVDV_TV_ID"]);
            }
            if (rd.FieldExists("TVDV_DV_ID"))
            {
                Item.DV_ID = (Guid)(rd["TVDV_DV_ID"]);
            }
            if (rd.FieldExists("TVDV_NgayTao"))
            {
                Item.NgayTao = (DateTime)(rd["TVDV_NgayTao"]);
            }
            if (rd.FieldExists("TVDV_NguoiTao"))
            {
                Item.NguoiTao = (String)(rd["TVDV_NguoiTao"]);
            }
            if (rd.FieldExists("TVDV_Ma"))
            {
                Item.Ma = (String)(rd["TVDV_Ma"]);
            }
            if (rd.FieldExists("TVDV_Gia"))
            {
                Item.Gia = (Double)(rd["TVDV_Gia"]);
            }
            if (rd.FieldExists("TVDV_GhiChu"))
            {
                Item.GhiChu = (String)(rd["TVDV_GhiChu"]);
            }
            if (rd.FieldExists("TVDV_SoLan"))
            {
                Item.SoLan = (Int32)(rd["TVDV_SoLan"]);
            }
            if (rd.FieldExists("TVDV_ThanhToan"))
            {
                Item.ThanhToan = (Double)(rd["TVDV_ThanhToan"]);
            }
            if (rd.FieldExists("TVDV_ConNo"))
            {
                Item.ConNo = (Double)(rd["TVDV_ConNo"]);
            }
            if (rd.FieldExists("TVDV_NgayLap"))
            {
                Item.NgayLap = (DateTime)(rd["TVDV_NgayLap"]);
            }
            if (rd.FieldExists("TVDV_BaoHanh_ID"))
            {
                Item.BaoHanh_ID = (Guid)(rd["TVDV_BaoHanh_ID"]);
            }
            if (rd.FieldExists("BaoHanh_Ten"))
            {
                Item.BaoHanh_Ten = (String)(rd["BaoHanh_Ten"]);
            }
            if (rd.FieldExists("KHO_Ten"))
            {
                Item.KHO_Ten = (String)(rd["KHO_Ten"]);
            }
            if (rd.FieldExists("TVDV_KHO_ID"))
            {
                Item.KHO_ID = (Guid)(rd["TVDV_KHO_ID"]);
            }
            if (rd.FieldExists("TVDV_CK"))
            {
                Item.CK = (Double)(rd["TVDV_CK"]);
            }
            if (rd.FieldExists("TVDV_NhanVien"))
            {
                Item.NhanVien = (String)(rd["TVDV_NhanVien"]);
            }
            if (rd.FieldExists("TVDV_NhanVien_Ten"))
            {
                Item.NhanVien_Ten = (String)(rd["TVDV_NhanVien_Ten"]);
            }
            if (rd.FieldExists("TVDV_Loai"))
            {
                Item.Loai = (Int32)(rd["TVDV_Loai"]);
            }
            if (rd.FieldExists("TVDV_LoaiQuy"))
            {
                Item.LoaiQuy = (Int32)(rd["TVDV_LoaiQuy"]);
            }
            Item._KhachHang = KhachHangDal.getFromReader(rd);
            Item._DichVu    = DichVuDal.getFromReader(rd);
            Item._TuVan     = TuVanDal.getFromReader(rd);
            return(Item);
        }