コード例 #1
0
        public static int Insert(Database db, DisplayChannelInfo displayChannelInfo)
        {
            StringBuilder sbField = new StringBuilder();
            StringBuilder sbValue = new StringBuilder();
            sbField.Append("INSERT INTO DisplayChannelInfo(");
            sbValue.Append("values(");
            sbField.Append("DisplayChannelName,");
            sbValue.AppendFormat("'{0}',", displayChannelInfo.DisplayChannelName);
            sbField.Append("DecodeCardNo,");
            sbValue.AppendFormat("{0},", displayChannelInfo.DecodeCardNo);
            sbField.Append("DispalyChannelNoInCurrentCard,");
            sbValue.AppendFormat("{0},", displayChannelInfo.DispalyChannelNoInCurrentCard);
            sbField.Append("SplitScreenNo) ");
            sbValue.AppendFormat("{0})", displayChannelInfo.SplitScreenNo);

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

            }
            catch (Exception ex)
            {

                throw ex;
            }
        }
コード例 #2
0
        public Dictionary<int, DisplayChannelInfo> GetAllDisplayChannelInfo(ref string errMessage)
        {
            Database db = DatabaseFactory.CreateDatabase();
            errMessage = "";
            Dictionary<int, DisplayChannelInfo> list = new Dictionary<int, DisplayChannelInfo>();
            try
            {
                DisplayChannelInfo displayChannelInfo;
                DataSet ds = DisplayChannelDataAccess.GetAllDisplayChannelInfos(db);
                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    displayChannelInfo = new DisplayChannelInfo(ds.Tables[0].Rows[i]);
                    list.Add(displayChannelInfo.DisplayChannelId, displayChannelInfo);
                }
                return list;

            }
            catch (Exception ex)
            {
                errMessage = ex.Message + ex.StackTrace;
                logger.Error("Error Message:" + ex.Message + " Trace:" + ex.StackTrace);
                return null;
            }
        }
コード例 #3
0
        public int Update(ref string errMessage, DisplayChannelInfo displayChannelInfo)
        {
            Database db = DatabaseFactory.CreateDatabase();
            errMessage = "";
            try
            {
                return DisplayChannelDataAccess.Update(db, displayChannelInfo);

            }
            catch (Exception ex)
            {
                errMessage = ex.Message + ex.StackTrace;
                logger.Error("Error Message:" + ex.Message + " Trace:" + ex.StackTrace);
                return -1;
            }
        }
コード例 #4
0
        public static int Update(Database db, DisplayChannelInfo displayChannelInfo)
        {
            StringBuilder sb = new StringBuilder();
            sb.Append("update displayChannelInfo set");
            sb.AppendFormat(" DisplayChannelName='{0}'", displayChannelInfo.DisplayChannelName);
            sb.AppendFormat(" where DisplayChannelId={0})", displayChannelInfo.DisplayChannelId);
            string cmdText = sb.ToString();
            try
            {
                return db.ExecuteNonQuery(CommandType.Text, cmdText);

            }
            catch (Exception ex)
            {

                throw ex;
            }
        }