Beispiel #1
0
        /// <summary>
        /// 用户修改认证信息
        /// </summary>
        /// <param name="model">认证信息</param>
        /// <returns></returns>
        public int UpdateLaudator(CustLaudator model)
        {
            var sqlStr = new StringBuilder("update cust_laudator set ");
            sqlStr.Append(Helper.CreateField(model).Trim().TrimEnd(','));
            sqlStr.Append(" where openid=@openid;");

            using (var conn = Helper.GetConnection())
            {
                var tran = conn.BeginTransaction();
                try
                {
                    conn.Execute(sqlStr.ToString(), model, tran);
                    tran.Commit();
                    return 1;
                }
                catch (Exception ex)
                {
                    tran.Rollback();
                    return 0;
                }
            }
        }
Beispiel #2
0
 /// <summary>
 /// 保存点赞人信息
 /// </summary>
 /// <param name="model">点赞人信息</param>
 /// <returns></returns>
 public int AddLaudator(CustLaudator model)
 {
     const string sql = @"INSERT INTO cust_laudator
                         (innerid, accountid, nickname, photo, openid, remarkname, area, sex, subscribe_time, subscribe, country, province, city, createdtime)
                         VALUES (@innerid, @accountid, @nickname, @photo, @openid, @remarkname, @area, @sex, @subscribe_time, @subscribe, @country, @province, @city, @createdtime);";
     using (var conn = Helper.GetConnection())
     {
         var tran = conn.BeginTransaction();
         try
         {
             conn.Execute(sql, model, tran);
             tran.Commit();
             return 1;
         }
         catch (Exception ex)
         {
             tran.Rollback();
             return 0;
         }
     }
 }