Exemplo n.º 1
0
        public Dictionary <int, CameraIconInfo> GetAllCameraIconInfo(ref string errMessage)
        {
            Database db = DatabaseFactory.CreateDatabase();

            errMessage = "";
            Dictionary <int, CameraIconInfo> list = new Dictionary <int, CameraIconInfo>();

            try
            {
                CameraIconInfo cameraIconInfo;
                DataSet        ds = CameraIconDataAccess.GetAllCameraIconInfo(db);
                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    cameraIconInfo = new CameraIconInfo(ds.Tables[0].Rows[i]);
                    list.Add(cameraIconInfo.CameraId, cameraIconInfo);
                }
                return(list);
            }
            catch (Exception ex)
            {
                errMessage = ex.Message + ex.StackTrace;
                logger.Error("Error Message:" + ex.Message + " Trace:" + ex.StackTrace);
                return(null);
            }
        }
Exemplo n.º 2
0
        public static int Insert(Database db, CameraIconInfo cameraIconInfo)
        {
            StringBuilder sbField = new StringBuilder();
            StringBuilder sbValue = new StringBuilder();

            sbField.Append("INSERT INTO CameraIconInfo(");
            sbValue.Append("values(");
            sbField.Append("CameraId");
            sbValue.AppendFormat("{0}", cameraIconInfo.CameraId);
            sbField.Append(",IconIndex");
            sbValue.AppendFormat(",{0}", cameraIconInfo.IconIndex);
            sbField.Append(",ToolTip");
            sbValue.AppendFormat(",'{0}'", cameraIconInfo.ToolTip);
            sbField.Append(",X");
            sbValue.AppendFormat(",{0}", cameraIconInfo.X);
            sbField.Append(",Y");
            sbValue.AppendFormat(",{0}", cameraIconInfo.Y);
            sbField.Append(",Map");
            sbValue.AppendFormat(",{0}", cameraIconInfo.Map);
            sbField.Append(",MatchAlarmId)");
            sbValue.AppendFormat(",{0})", cameraIconInfo.MatchAlarmId);
            string cmdText = sbField + " " + sbValue;

            try
            {
                return(db.ExecuteNonQuery(CommandType.Text, cmdText));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 3
0
        public int Update(ref string errMessage, CameraIconInfo cameraIconInfo)
        {
            Database db = DatabaseFactory.CreateDatabase();

            errMessage = "";
            try
            {
                return(CameraIconDataAccess.Update(db, cameraIconInfo));
            }
            catch (Exception ex)
            {
                errMessage = ex.Message + ex.StackTrace;
                logger.Error("Error Message:" + ex.Message + " Trace:" + ex.StackTrace);
                return(-1);
            }
        }
Exemplo n.º 4
0
        public static int Update(Database db, CameraIconInfo cameraIconInfo)
        {
            StringBuilder sb = new StringBuilder();

            sb.Append("update CameraIconInfo set");
            sb.AppendFormat(" IconIndex={0}", cameraIconInfo.IconIndex);
            sb.AppendFormat(",ToolTip='{0}'", cameraIconInfo.ToolTip);
            sb.AppendFormat(",X={0}", cameraIconInfo.X);
            sb.AppendFormat(",Y={0} ", cameraIconInfo.Y);
            sb.AppendFormat(",MatchAlarmId={0} ", cameraIconInfo.MatchAlarmId);
            sb.AppendFormat(" where CameraId={0}", cameraIconInfo.CameraId);
            string cmdText = sb.ToString();

            try
            {
                return(db.ExecuteNonQuery(CommandType.Text, cmdText));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }