예제 #1
0
        /// <summary>
        /// 更新产量
        /// </summary>
        /// <param name="key"></param>
        /// <param name="value"></param>
        /// <returns></returns>
        public static bool Set(YieldKey key, int value)
        {
            string msg       = string.Empty;
            bool   isSuccess = Database.NonQuery(string.Format("UPDATE [dbo].[{0}] SET [Value] = {1} WHERE [Key] = '{2}'", TableName, value, key), out msg);

            if (!string.IsNullOrEmpty(msg))
            {
                Error.Alert(msg);
                return(false);
            }
            return(isSuccess);
        }
예제 #2
0
        /// <summary>
        /// 读取产量
        /// </summary>
        /// <param name="key"></param>
        /// <returns></returns>
        public static int Get(YieldKey key)
        {
            string    msg = string.Empty;
            DataTable dt  = Database.Query(string.Format("SELECT [Value] FROM [dbo].[{0}] WHERE [Key] = '{1}'", TableName, key), out msg);

            if (!string.IsNullOrEmpty(msg))
            {
                Error.Alert(msg);
                return(-1);
            }

            if (dt.Rows.Count > 0)
            {
                return(TengDa._Convert.StrToInt(dt.Rows[0][0].ToString(), -1));
            }
            return(-1);
        }