/// <summary> /// 加载引用对象 /// </summary> public override void LoadRefrenceObject() { try { _StationObj = Method.GetEtBaseStationByID(_StationID); } catch (Exception ex) { JLog.Instance.Error(ex.Message, MethodBase.GetCurrentMethod().Name, MethodBase.GetCurrentMethod().Module.Name); } }
/****1个主键***/ /// <summary> /// 根据主键获取对象 /// </summary> /// <param name="id"></param> internal EtBaseStation(int id) { using (SqlConnection conn = new SqlConnection(SQLDBHelper.ConnectionString)) { EtBaseStation Relse = null; /****1个主键***/ string sql = "SELECT * FROM [BaseStation] WHERE StationID = '" + id.ToString() + "'"; using (var cnn = new SqlConnection(SQLDBHelper.ConnectionString)) { cnn.Open(); Relse = cnn.Query <EtBaseStation>(sql, null).Single(); cnn.Close(); if (Relse != null) { DeepCopy(Relse); } } } }
/// <summary> /// 拷贝对象内容 /// </summary> /// <param name="Oject"></param> protected void DeepCopy(EtBaseStation Oject) { try { if (Oject != null) { this._StationID = Oject.StationID; this._StationGUID = Oject.StationGUID; this._TaskID = Oject.TaskID; this._StationAlias = Oject.StationAlias; this._Lng = Oject.Lng; this._Lat = Oject.Lat; this._StationType = Oject.StationType; this._MastSave = Oject.MastSave; this._CoverType = Oject.CoverType; this._PlanLevel = Oject.PlanLevel; } } catch (Exception ex) { JLog.Instance.MethodName = MethodBase.GetCurrentMethod().Name; JLog.Instance.Error(ex.Message); } }