public DataTable GetTerminalID_Configed(TerType terType) { string SQL = "SELECT DISTINCT TerminalID FROM UniversalTerWayConfig WHERE TerminalType='" + ((int)terType).ToString() + "' ORDER BY TerminalID"; DataTable dt = SQLHelper.ExecuteDataTable(SQL, null); return(dt); }
public int GetCofingSequence(string Terid, string pointid, TerType terType) { string SQL = "SELECT Sequence FROM UniversalTerWayConfig WHERE PointID ='" + pointid + "' AND TerminalID='" + Terid + "' AND TerminalType='" + ((int)terType).ToString() + "'"; object obj_sequence = SQLHelper.ExecuteScalar(SQL, null); if (obj_sequence != null) { return(Convert.ToInt32(obj_sequence)); } return(-1); }
public DataTable GetUniversalDataConfig(TerType terType) { try { return(dal.GetUniversalDataConfig(terType)); } catch (Exception ex) { logger.ErrorException("GetUniversalDataConfig()", ex); return(null); } }
public string GetTerminalName(string TerminalID, TerType tertype) { try { return(dal.GetTerminalName(TerminalID, tertype)); } catch (Exception ex) { logger.ErrorException("GetTerminalName", ex); return(""); } }
public DataTable GetTerminalID_Configed(TerType terType) { try { return(dal.GetTerminalID_Configed(terType)); } catch (Exception ex) { logger.ErrorException("GetTerminalID_Configed", ex); return(null); } }
public int Insert(UniversalWayTypeEntity entity, TerType terType) { try { return(dal.Insert(entity, terType)); } catch (Exception ex) { logger.ErrorException("Insert", ex); return(-1); } }
public DataTable GetTerInfo(TerType type) { try { return(dal.GetTerInfo(type)); } catch (Exception ex) { logger.ErrorException("GetTerInfo", ex); return(null); } }
public int TypeExist(UniversalCollectType type, string name, TerType terType) { try { return(dal.TypeExist(type, name, terType)); } catch (Exception ex) { logger.ErrorException("TypeExist", ex); return(-1); } }
//获取最大Sequence public int GetMaxSequence(int parentId, TerType terType) { try { return(dal.GetMaxSequence(parentId, terType)); } catch (Exception ex) { logger.ErrorException("GetMaxSequence", ex); return(-1); } }
/// <summary> /// 获得从UniversalTerWayConfig表中的第?路数据,-1为无效数据 /// </summary> public int GetCofingSequence(string Terid, string pointid, TerType terType) { try { return(dal.GetCofingSequence(Terid, pointid, terType)); } catch (Exception ex) { logger.ErrorException("GetCofingSequence", ex); return(-1); } }
/// <summary> /// 获得配置的全部PointID(不区分ID) /// </summary> /// <returns></returns> public List <UniversalWayTypeEntity> GetConfigPointID(string id, TerType terType) { try { return(dal.GetConfigPointID(id, terType)); } catch (Exception ex) { logger.ErrorException("GetAllConfigPointID", ex); return(null); } }
public int DeleteTer(TerType type, string TerminalID) { try { dal.DeleteTer(type, TerminalID); return(1); } catch (Exception ex) { logger.ErrorException("DeleteTer", ex); return(-1); } }
public int DeleteUniversalWayTypeConfig_TerID(int TerminalID, TerType terType) { try { dal.DeleteUniversalWayTypeConfig_TerID(TerminalID, terType); return(1); } catch (Exception ex) { logger.ErrorException("DeleteUniversalWayTypeConfig_TerID", ex); return(-1); } }
public int TypeExist(UniversalCollectType type, string name, TerType terType) { string SQL = "SELECT COUNT(1) FROM UniversalTerWayType WHERE WayType='" + (int)type + "' AND Name='" + name + "' AND TerminalType='" + ((int)terType).ToString() + "'"; object obj = SQLHelper.ExecuteScalar(SQL, null); if (obj != null && obj != DBNull.Value) { return((Convert.ToInt32(obj) > 0) ? 1 : 0); } else { return(0); } }
public int GetMaxSequence(int parentId, TerType terType) { string SQL = "SELECT MAX(Sequence) FROM UniversalTerWayType WHERE ParentId='" + parentId + "' AND TerminalType='" + ((int)terType).ToString() + "'"; object obj = SQLHelper.ExecuteScalar(SQL, null); if (obj != null && obj != DBNull.Value) { return(Convert.ToInt32(obj)); } else { return(0); } }
public int Insert(UniversalWayTypeEntity entity, TerType terType) { if (entity == null) { return(0); } string SQL = @"INSERT INTO UniversalTerWayType(ID,Level,ParentID,WayType,Name,FrameWidth,Sequence,MaxMeasureRange,MaxMeasureRangeFlag,Precision,Unit,ModifyTime,TerminalType) VALUES( @ID,@Level,@ParentID,@WayType,@Name,@FrameWidth,@Sequence,@MaxMeasureRange,@MaxMeasureRangeFlag,@Precision,@Unit,@ModifyTime,@terType)"; SqlParameter[] parms = new SqlParameter[] { new SqlParameter("@ID", DbType.Int32), new SqlParameter("@Level", DbType.Int32), new SqlParameter("@ParentID", DbType.Int32), new SqlParameter("@WayType", DbType.Int32), new SqlParameter("@Name", DbType.String), new SqlParameter("@FrameWidth", DbType.Int32), new SqlParameter("@Sequence", DbType.Int32), new SqlParameter("@MaxMeasureRange", DbType.Single), new SqlParameter("@MaxMeasureRangeFlag", DbType.Single), new SqlParameter("@Precision", DbType.Int32), new SqlParameter("@Unit", DbType.String), new SqlParameter("@ModifyTime", DbType.DateTime), new SqlParameter("@terType", DbType.Int32) }; parms[0].Value = entity.ID; parms[1].Value = entity.Level; parms[2].Value = entity.ParentID; parms[3].Value = (int)entity.WayType; parms[4].Value = entity.Name; parms[5].Value = entity.FrameWidth; parms[6].Value = entity.Sequence; parms[7].Value = entity.MaxMeasureRange; parms[8].Value = entity.ManMeasureRangeFlag; parms[9].Value = entity.Precision; parms[10].Value = entity.Unit; parms[11].Value = entity.ModifyTime; parms[12].Value = (int)terType; SQLHelper.ExecuteNonQuery(SQL, parms); return(1); }
/// <summary> /// 获得配置的PointID(不区分ID),id为空时,获取全部 /// </summary> /// <returns></returns> public List <UniversalWayTypeEntity> GetConfigPointID(string id, TerType terType) { string SQL_Point = string.Format(@"SELECT ID,Level,ParentID,WayType,Name,FrameWidth,Sequence,MaxMeasureRange,MaxMeasureRangeFlag,Precision,Unit,ModifyTime FROM UniversalTerWayType WHERE ID IN (SELECT DISTINCT PointID FROM UniversalTerWayConfig WHERE TerminalType='{0}' {1}) AND TerminalType='{2}' ORDER BY WayType,Sequence", (int)terType, (string.IsNullOrEmpty(id) ? "" : "AND TerminalID='" + id.Trim() + "'"), (int)terType); List <UniversalWayTypeEntity> lst = new List <UniversalWayTypeEntity>(); using (SqlDataReader reader = SQLHelper.ExecuteReader(SQL_Point, null)) { while (reader.Read()) { UniversalWayTypeEntity entity = new UniversalWayTypeEntity(); entity.ID = reader["ID"] != DBNull.Value ? Convert.ToInt32(reader["ID"]) : -1; entity.Level = reader["Level"] != DBNull.Value ? Convert.ToInt32(reader["Level"]) : 0; entity.ParentID = reader["ParentID"] != DBNull.Value ? Convert.ToInt32(reader["ParentID"]) : 0; entity.WayType = reader["WayType"] != DBNull.Value ? (UniversalCollectType)(Convert.ToInt32(reader["WayType"])) : UniversalCollectType.Simulate; entity.Name = reader["Name"] != DBNull.Value ? reader["Name"].ToString() : ""; entity.FrameWidth = reader["FrameWidth"] != DBNull.Value ? Convert.ToInt32(reader["FrameWidth"]) : 2; entity.Sequence = reader["Sequence"] != DBNull.Value ? Convert.ToInt32(reader["Sequence"]) : 1; entity.MaxMeasureRange = reader["MaxMeasureRange"] != DBNull.Value ? Convert.ToSingle(reader["MaxMeasureRange"]) : 0f; entity.ManMeasureRangeFlag = reader["MaxMeasureRangeFlag"] != DBNull.Value ? Convert.ToSingle(reader["MaxMeasureRangeFlag"]) : 0f; entity.Precision = reader["Precision"] != DBNull.Value ? Convert.ToInt32(reader["Precision"]) : 2; entity.Unit = reader["Unit"] != DBNull.Value ? reader["Unit"].ToString() : ""; //entity.SyncState = reader["SyncState"] != DBNull.Value ? Convert.ToInt32(reader["SyncState"]) : 0; entity.ModifyTime = reader["ModifyTime"] != DBNull.Value ? Convert.ToDateTime(reader["ModifyTime"]) : ConstValue.MinDateTime; lst.Add(entity); } } foreach (UniversalWayTypeEntity entity in lst) { entity.HaveChild = IDHaveChild(entity.ID.ToString()); } return(lst.Count > 0 ? lst:null); }
/// <summary> /// 获取对应终端的采集配置 /// </summary> /// <param name="TerminalID"></param> /// <returns></returns> public List <UniversalWayTypeConfigEntity> GetUniversalWayTypeConfig(int TerminalID, TerType terType) { try { return(dal.GetUniversalWayTypeConfig(TerminalID, terType)); } catch (Exception ex) { logger.ErrorException("GetUniversalWayTypeConfig", ex); return(null); } }
/// <summary> /// 保存通用终端配置 -1:保存异常,1:保存成功 /// </summary> public int SaveTerInfo(int terminalid, string name, string addr, string remark, TerType terType, List <UniversalWayTypeConfigEntity> lstPointID) { try { return(dal.SaveTerInfo(terminalid, name, addr, remark, terType, lstPointID)); } catch (Exception ex) { logger.ErrorException("SaveTerInfo", ex); return(-1); } }