예제 #1
0
        public int InsertRecommendedHistory(RecommendedHistory history)
        {
            int           ret    = 0;
            SQLiteHelper  sh     = new SQLiteHelper();
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into RecommendedHistory(");
            strSql.Append("Id,OpenId,DishesId,DishName,Score,CreateTime)");
            strSql.Append(" values (");
            strSql.Append("@Id,@OpenId,@DishesId,@DishName,@Score,@CreateTime)");
            SQLiteParameter[] parameters =
            {
                sh.MakeSQLiteParameter("@Id",         DbType.String,   history.Id),
                sh.MakeSQLiteParameter("@OpenId",     DbType.String,   history.OpenId),
                sh.MakeSQLiteParameter("@DishesId",   DbType.String,   history.DishesId),
                sh.MakeSQLiteParameter("@DishName",   DbType.String,   history.DishName),
                sh.MakeSQLiteParameter("@Score",      DbType.Double,   history.Score),
                sh.MakeSQLiteParameter("@CreateTime", DbType.DateTime, history.CreateTime)
            };

            if (sh.ExecuteSql(strSql.ToString(), parameters) >= 1)
            {
                ret = 1;
            }

            return(ret);
        }
예제 #2
0
        public void SaveRecommendHistory(string openId, string dishesId, double score, string dishName)
        {
            RecommendedHistory history = new RecommendedHistory()
            {
                Id         = Guid.NewGuid().ToString(),
                OpenId     = openId,
                DishesId   = dishesId,
                DishName   = dishName,
                Score      = score,
                CreateTime = DateTime.Now,
            };

            InsertRecommendedHistory(history);
        }