/****1个主键***/ /// <summary> /// 根据主键获取对象 /// </summary> /// <param name="id"></param> internal EtAccount(int id) { using (SqlConnection conn = new SqlConnection(SQLDBHelper.ConnectionString)) { EtAccount Relse = null; /****1个主键***/ string sql = "SELECT * FROM [Account] WHERE Id = '" + id.ToString() + "'"; using (var cnn = new SqlConnection(SQLDBHelper.ConnectionString)) { cnn.Open(); Relse = cnn.Query <EtAccount>(sql, null).Single(); cnn.Close(); if (Relse != null) { DeepCopy(Relse); } } } }
/// <summary> /// 拷贝对象内容 /// </summary> /// <param name="Oject"></param> protected void DeepCopy(EtAccount Oject) { try { if (Oject != null) { this._Id = Oject.Id; this._AccountName = Oject.AccountName; this._Type = Oject.Type; this._Status = Oject.Status; this._ProfileId = Oject.ProfileId; this._ModifierId = Oject.ModifierId; this._ModifiedTime = Oject.ModifiedTime; } } catch (Exception ex) { JLog.Instance.MethodName = MethodBase.GetCurrentMethod().Name; JLog.Instance.Error(ex.Message); } }