/// <summary> /// 拷贝对象内容 /// </summary> /// <param name="Oject"></param> protected void DeepCopy(EtAtennalType Oject) { try { if (Oject != null) { this._ID = Oject.ID; this._EDSID = Oject.EDSID; this._Name = Oject.Name; } } catch (Exception ex) { JLog.Instance.MethodName = MethodBase.GetCurrentMethod().Name; JLog.Instance.Error(ex.Message); } }
/****1个主键***/ /// <summary> /// 根据主键获取对象 /// </summary> /// <param name="id"></param> internal EtAtennalType(int id) { using (SqlConnection conn = new SqlConnection(SQLDBHelper.ConnectionString)) { EtAtennalType Relse = null; /****1个主键***/ string sql = "SELECT * FROM [AtennalType] WHERE ID = '" + id.ToString() + "'"; using (var cnn = new SqlConnection(SQLDBHelper.ConnectionString)) { cnn.Open(); Relse = cnn.Query <EtAtennalType>(sql, null).Single(); cnn.Close(); if (Relse != null) { DeepCopy(Relse); } } } }