public static int Insert(Database db, DefaultCardOut defaultCardOut)
        {
            StringBuilder sbField = new StringBuilder();
            StringBuilder sbValue = new StringBuilder();
            sbField.Append("INSERT INTO DefaultCardOut(");
            sbValue.Append("values(");
            sbField.Append("CameraId,");
            sbValue.AppendFormat("{0},", defaultCardOut.CameraId);
            sbField.Append("DisplayChannelId,");
            sbValue.AppendFormat("{0},", defaultCardOut.DisplayChannelId);
            sbField.Append("DispalySplitScreenNo)");
            sbValue.AppendFormat("{0})", defaultCardOut.DisplaySplitScreenNo);

            string cmdText = sbField.ToString() + " " + sbValue.ToString() + "";
            try
            {
                return db.ExecuteNonQuery(CommandType.Text, cmdText);

            }
            catch (Exception ex)
            {

                throw ex;
            }
        }
        public Dictionary<int, DefaultCardOut> GetAllDefaultCardOuts(ref string errMessage)
        {
            Database db = DatabaseFactory.CreateDatabase();
            errMessage = "";
            Dictionary<int, DefaultCardOut> list = new Dictionary<int, DefaultCardOut>();
            try
            {

                DataSet ds = DefaultCardOutDataAccess.GetAllDefaultCardOuts(db);

                DefaultCardOut defaultCardOut;
                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    defaultCardOut = new DefaultCardOut(ds.Tables[0].Rows[i]);
                    list.Add(defaultCardOut.Id, defaultCardOut);

                }
                return list;

            }
            catch (Exception ex)
            {
                errMessage = ex.Message + ex.StackTrace;
                logger.Error("Error Message:" + ex.Message + " Trace:" + ex.StackTrace);
                return null;
            }
        }
        public static int Update(Database db, DefaultCardOut defaultCardOut)
        {
            StringBuilder sb = new StringBuilder();
            sb.Append("update DefaultCardOut set");
            sb.AppendFormat(" cameraid={0},", defaultCardOut.CameraId);
            sb.AppendFormat(" DisplayChannelId={0},", defaultCardOut.DisplayChannelId);
            sb.AppendFormat(" DisplaySplitScreenNo={0},", defaultCardOut.DisplaySplitScreenNo);
            sb.AppendFormat(" where Id={0})", defaultCardOut.Id);
            string cmdText = sb.ToString();
            try
            {
                return db.ExecuteNonQuery(CommandType.Text, cmdText);

            }
            catch (Exception ex)
            {

                throw ex;
            }
        }
        public int Update(ref string errMessage, DefaultCardOut defaultCardOut)
        {
            Database db = DatabaseFactory.CreateDatabase();
            errMessage = "";
            try
            {
                return DefaultCardOutDataAccess.Update(db, defaultCardOut);

            }
            catch (Exception ex)
            {
                errMessage = ex.Message + ex.StackTrace;
                logger.Error("Error Message:" + ex.Message + " Trace:" + ex.StackTrace);
                return -1;
            }
        }