Example #1
0
        /// <summary>
        /// 通过主键得到实体对象
        /// </summary>
        /// <param name="MainID">主键</param>
        /// <param name="SetSnapShot">是否设置测点实时值</param>
        /// <returns></returns>
        public static bool Delete(string TagID)
        {
            KPI_RaceTagEntity entity = new KPI_RaceTagEntity();
            string            sql    = "select * from Race_Tag where TagID='{0}'";

            sql = string.Format(sql, TagID);

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

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

            return(KPI_RaceTagDal.Delete(entity));
        }
Example #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="UnitID"></param>
        /// <returns></returns>
        public static DataTable GetSearchListC(string UnitID)
        {
            DataTable dt = null;

            string WorkID = KPI_UnitDal.GetWorkIDByCode(UnitID);

            DataTable dtItems = KPI_RaceTagDal.GetTags(UnitID);

            if (dtItems == null && dtItems.Rows.Count <= 0)
            {
                return(dt);
            }

            string condition = "";

            for (int i = 0; i < dtItems.Rows.Count; i++)
            {
                string ItemID      = dtItems.Rows[i]["TagID"].ToString();
                string ItemDesc    = dtItems.Rows[i]["TagDesc"].ToString();
                string ItemEngunit = dtItems.Rows[i]["TagEngunit"].ToString();

                condition += "cast(avg(case TagID when '" + ItemID + "' then TagValue else null  end) as numeric(18,4)) as '" + ItemDesc + "[" + ItemEngunit + "]', ";
            }

            condition = condition.Remove(condition.LastIndexOf(','));

            string sql = @"select ShiftName As '运行值', {0}
                                from Race_Snapshot
                                a left outer join Race_Shift b on  a.TagShift = b.ShiftID
                                 group by ShiftName, ShiftID
                                order by b.ShiftID";

            sql = string.Format(sql, condition);

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

            return(dt);
        }