예제 #1
0
        ///// <summary>
        ///// 通过主键得到实体对象
        ///// </summary>
        ///// <param name="MainID">主键</param>
        ///// <param name="SetSnapShot">是否设置测点实时值</param>
        ///// <returns></returns>
        //public static string GetTagID(string TagName, string UnitID)
        //{
        //    KPI_InputTagEntity entity = new KPI_InputTagEntity();
        //    string sql = "select * from KPI_InputTag where TagName='{0}'";
        //    sql = string.Format(sql, TagName);

        //    if (UnitID != "")
        //    {
        //        sql += " and UnitID='" + UnitID + "' ";
        //    }

        //    DataTable dt = DBAccess.GetRelation().ExecuteDataset(sql).Tables[0];
        //    if (dt.Rows.Count > 0)
        //        entity.DrToMember(dt.Rows[0]);

        //    return entity.TagID;

        //}

        /// <summary>
        /// 通过主键得到实体对象
        /// </summary>
        /// <param name="MainID">主键</param>
        /// <param name="SetSnapShot">是否设置测点实时值</param>
        /// <returns></returns>
        public static InputTagEntity GetEntity(string InputID)
        {
            InputTagEntity entity = new InputTagEntity();
            string         sql    = "select * from KPI_InputTag where InputID='{0}'";

            sql = string.Format(sql, InputID);

            DataTable dt = DBAccess.GetRelation().ExecuteDataset(sql).Tables[0];

            if (dt.Rows.Count > 0)
            {
                entity.DrToMember(dt.Rows[0]);
            }

            return(entity);
        }
예제 #2
0
        /////////////////////////////////////////////////////////////////////////////////////////////////////////
        /// <summary>
        /// 获得与主键对应的实体对象
        /// </summary>
        /// <returns></returns>
        public static List <InputTagEntity> GetAllEntity()
        {
            List <InputTagEntity> ltInputs = new List <InputTagEntity>();

            string sql = "select * from KPI_InputTag";

            DataTable dt = DBAccess.GetRelation().ExecuteDataset(sql).Tables[0];

            foreach (DataRow dr in dt.Rows)
            {
                InputTagEntity entity = new InputTagEntity();
                entity.DrToMember(dr);

                ltInputs.Add(entity);
            }

            return(ltInputs);
        }