/// <summary> /// 拷贝对象内容 /// </summary> /// <param name="Oject"></param> protected void DeepCopy(EtTransType Oject) { try { if (Oject != null) { this._TransModelID = Oject.TransModelID; 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 EtTransType(int id) { using (SqlConnection conn = new SqlConnection(SQLDBHelper.ConnectionString)) { EtTransType Relse = null; /****1个主键***/ string sql = "SELECT * FROM [TransType] WHERE TransModelID = '" + id.ToString() + "'"; using (var cnn = new SqlConnection(SQLDBHelper.ConnectionString)) { cnn.Open(); Relse = cnn.Query <EtTransType>(sql, null).Single(); cnn.Close(); if (Relse != null) { DeepCopy(Relse); } } } }