public static TinhTrangDichVu SelectById(Guid TTDV_ID)
        {
            var Item = new TinhTrangDichVu();
            var obj  = new SqlParameter[1];

            obj[0] = new SqlParameter("TTDV_ID", TTDV_ID);
            using (IDataReader rd = SqlHelper.ExecuteReader(DAL.con(), CommandType.StoredProcedure, "sp_tblSpaMgr_TinhTrangDichVu_Select_SelectById_linhnx", obj))
            {
                while (rd.Read())
                {
                    Item = getFromReader(rd);
                }
            }
            return(Item);
        }
        public static TinhTrangDichVu Insert(TinhTrangDichVu item)
        {
            var Item = new TinhTrangDichVu();
            var obj  = new SqlParameter[12];

            obj[0] = new SqlParameter("TTDV_ID", item.ID);
            obj[1] = new SqlParameter("TTDV_DM_ID", item.DM_ID);
            obj[2] = new SqlParameter("TTDV_DM_Ten", item.DM_Ten);
            obj[3] = new SqlParameter("TTDV_DV_ID", item.DV_ID);
            obj[4] = new SqlParameter("TTDV_DV_Ten", item.DV_Ten);
            obj[5] = new SqlParameter("TTDV_SoLuong", item.SoLuong);
            obj[6] = new SqlParameter("TTDV_ThuTu", item.ThuTu);
            obj[7] = new SqlParameter("TTDV_MoTa", item.MoTa);
            if (item.NgayTao > DateTime.MinValue)
            {
                obj[8] = new SqlParameter("TTDV_NgayTao", item.NgayTao);
            }
            else
            {
                obj[8] = new SqlParameter("TTDV_NgayTao", DBNull.Value);
            }
            obj[9] = new SqlParameter("TTDV_NguoiTao", item.NguoiTao);
            if (item.NgayCapNhat > DateTime.MinValue)
            {
                obj[10] = new SqlParameter("TTDV_NgayCapNhat", item.NgayCapNhat);
            }
            else
            {
                obj[10] = new SqlParameter("TTDV_NgayCapNhat", DBNull.Value);
            }
            obj[11] = new SqlParameter("TTDV_NguoiCapNhat", item.NguoiCapNhat);

            using (IDataReader rd = SqlHelper.ExecuteReader(DAL.con(), CommandType.StoredProcedure, "sp_tblSpaMgr_TinhTrangDichVu_Insert_InsertNormal_linhnx", obj))
            {
                while (rd.Read())
                {
                    Item = getFromReader(rd);
                }
            }
            return(Item);
        }
        public static TinhTrangDichVu getFromReader(IDataReader rd)
        {
            var Item = new TinhTrangDichVu();

            if (rd.FieldExists("TTDV_ID"))
            {
                Item.ID = (Guid)(rd["TTDV_ID"]);
            }
            if (rd.FieldExists("TTDV_DM_ID"))
            {
                Item.DM_ID = (Guid)(rd["TTDV_DM_ID"]);
            }
            if (rd.FieldExists("TTDV_DM_Ten"))
            {
                Item.DM_Ten = (String)(rd["TTDV_DM_Ten"]);
            }
            if (rd.FieldExists("TTDV_DV_ID"))
            {
                Item.DV_ID = (Guid)(rd["TTDV_DV_ID"]);
            }
            if (rd.FieldExists("TTDV_DV_Ten"))
            {
                Item.DV_Ten = (String)(rd["TTDV_DV_Ten"]);
            }
            if (rd.FieldExists("TTDV_SoLuong"))
            {
                Item.SoLuong = (Int32)(rd["TTDV_SoLuong"]);
            }
            if (rd.FieldExists("TTDV_ThuTu"))
            {
                Item.ThuTu = (Int32)(rd["TTDV_ThuTu"]);
            }
            if (rd.FieldExists("TTDV_MoTa"))
            {
                Item.MoTa = (String)(rd["TTDV_MoTa"]);
            }
            if (rd.FieldExists("TTDV_NgayTao"))
            {
                Item.NgayTao = (DateTime)(rd["TTDV_NgayTao"]);
            }
            if (rd.FieldExists("TTDV_NguoiTao"))
            {
                Item.NguoiTao = (String)(rd["TTDV_NguoiTao"]);
            }
            if (rd.FieldExists("TTDV_NgayCapNhat"))
            {
                Item.NgayCapNhat = (DateTime)(rd["TTDV_NgayCapNhat"]);
            }
            if (rd.FieldExists("TTDV_NguoiCapNhat"))
            {
                Item.NguoiCapNhat = (String)(rd["TTDV_NguoiCapNhat"]);
            }
            if (rd.FieldExists("DV_ThoiGian"))
            {
                Item.ThoiGian = (Int32)(rd["DV_ThoiGian"]);
            }
            if (rd.FieldExists("DV_Gia"))
            {
                Item.Gia = (Int32)(rd["DV_Gia"]);
            }
            Item.dvu = DichVuDal.getFromReader(rd);
            return(Item);
        }