Ejemplo n.º 1
0
        public static int Insert(Database db, AlarmIconInfo alarmIconInfo)
        {
            StringBuilder sbField = new StringBuilder();
            StringBuilder sbValue = new StringBuilder();
            sbField.Append("INSERT INTO AlarmIconInfo(");
            sbValue.Append("values(");
            sbField.Append("AlarmId");
            sbValue.AppendFormat("{0}", alarmIconInfo.AlarmId);
            sbField.Append(",IconIndex");
            sbValue.AppendFormat(",{0}", alarmIconInfo.IconIndex);
            sbField.Append(",ToolTip");
            sbValue.AppendFormat(",'{0}'", alarmIconInfo.ToolTip);
            sbField.Append(",X");
            sbValue.AppendFormat(",{0}", alarmIconInfo.X);
            sbField.Append(",Y");
            sbValue.AppendFormat(",{0}", alarmIconInfo.Y);
            sbField.Append(",Map");
            sbValue.AppendFormat(",{0}", alarmIconInfo.Map);
            sbField.Append(",MatchCameraId)");
            sbValue.AppendFormat(",{0})", alarmIconInfo.MatchCameraId);
            string cmdText = sbField + " " + sbValue;
            try
            {
                return db.ExecuteNonQuery(CommandType.Text, cmdText);

            }
            catch (Exception ex)
            {

                throw ex;
            }
        }
Ejemplo n.º 2
0
        public static int Update(Database db, AlarmIconInfo alarmIconInfo)
        {
            StringBuilder sb = new StringBuilder();
            sb.Append("update AlarmIconInfo set");
            sb.AppendFormat(" IconIndex={0}", alarmIconInfo.IconIndex);
            sb.AppendFormat(",ToolTip='{0}'", alarmIconInfo.ToolTip);
            sb.AppendFormat(",X={0}", alarmIconInfo.X);
            sb.AppendFormat(",Y={0} ", alarmIconInfo.Y);
            sb.AppendFormat(",MatchCameraId={0} ", alarmIconInfo.MatchCameraId);
            sb.AppendFormat(",Map={0} ", alarmIconInfo.Map);
            sb.AppendFormat(" where AlarmId={0}", alarmIconInfo.AlarmId);
            string cmdText = sb.ToString();
            try
            {
                return db.ExecuteNonQuery(CommandType.Text, cmdText);

            }
            catch (Exception ex)
            {

                throw ex;
            }
        }