示例#1
0
 /// <summary>
 /// 拷贝对象内容
 /// </summary>
 /// <param name="Oject"></param>
 protected void DeepCopy(EtCarrierType Oject)
 {
     try
     {
         if (Oject != null)
         {
             this._CarrierID    = Oject.CarrierID;
             this._CarrierValue = Oject.CarrierValue;
             this._EDSID        = Oject.EDSID;
             this._Name         = Oject.Name;
         }
     }
     catch (Exception ex)
     {
         JLog.Instance.MethodName = MethodBase.GetCurrentMethod().Name;
         JLog.Instance.Error(ex.Message);
     }
 }
示例#2
0
        /****1个主键***/
        /// <summary>
        /// 根据主键获取对象
        /// </summary>
        /// <param name="id"></param>
        internal EtCarrierType(int id)
        {
            using (SqlConnection conn = new SqlConnection(SQLDBHelper.ConnectionString))
            {
                EtCarrierType Relse = null;
                /****1个主键***/
                string sql = "SELECT * FROM [CarrierType] WHERE CarrierID = '" + id.ToString() + "'";

                using (var cnn = new SqlConnection(SQLDBHelper.ConnectionString))
                {
                    cnn.Open();
                    Relse = cnn.Query <EtCarrierType>(sql, null).Single();
                    cnn.Close();
                    if (Relse != null)
                    {
                        DeepCopy(Relse);
                    }
                }
            }
        }