Example #1
0
        public static int AddItem(UserProfit item)
        {
            string spName = "cudo_createprofit";

            SqlParameter[] paramvalues = new SqlParameter[]
            {
                new SqlParameter("@userid", item.userid),
                new SqlParameter("@reguid", item.reguid),
                new SqlParameter("@xftime", item.xftime),
                new SqlParameter("@xfpoint", item.xfpoint),
                new SqlParameter("@sypoint", item.sypoint)
            };
            return(SqlHelper.ExecuteNonQuery(SqlHelper.ConnectionString, CommandType.StoredProcedure, spName, paramvalues));
        }
Example #2
0
        public static List <UserProfit> GetList(int pageindex, int pagesize, int reguid)
        {
            List <UserProfit> list   = new List <UserProfit>();
            string            spName = "cudo_getprofitlistbyreguid";

            SqlParameter[] paramvalues = new SqlParameter[]
            {
                new SqlParameter("@pageindex", pageindex),
                new SqlParameter("@pagesize", pagesize),
                new SqlParameter("@reguid", reguid)
            };
            SqlDataReader dataReader = SqlHelper.ExecuteReader(SqlHelper.ConnectionString, CommandType.StoredProcedure, spName, paramvalues);

            try
            {
                while (dataReader.Read())
                {
                    UserProfit item = new UserProfit();
                    item.id       = Convert.ToInt32(dataReader["id"]);
                    item.UserName = dataReader["username"].ToString();
                    item.xftime   = Convert.ToDateTime(dataReader["xftime"]);
                    item.xfpoint  = Convert.ToDecimal(dataReader["xfpoint"]);
                    item.sypoint  = Convert.ToDecimal(dataReader["sypoint"]);
                    list.Add(item);
                }
            }
            catch
            {
                dataReader.Close();
                dataReader.Dispose();
            }
            finally
            {
                dataReader.Close();
                dataReader.Dispose();
            }
            return(list);
        }
Example #3
0
        /// <summary>
        /// 更新推广会员的积分
        /// </summary>
        /// <param name="reguid">id</param>
        /// <param name="point">消费积分</param>
        /// <param name="xftime">消费时间</param>
        private void ModifyTGPoint(int reguid, decimal point, DateTime xftime)
        {
            int userid = new JoinPromotionBLL().GetUserIdByReguid(reguid);

            if (userid > 0)
            {
                UserInfo item = ubll.GetUserByID(userid);
                int      zk   = new UserGroupBLL().GetItemById(item.UserGroup).Zk; //会员折扣

                decimal upoint = zk * point / 100;                                 //折扣%*积分
                //ubll.UpdatePoint(upoint, userid);

                #region ===添加消费记录===
                UserProfit upitem = new UserProfit();
                upitem.reguid  = reguid;
                upitem.userid  = userid;
                upitem.xfpoint = point;
                upitem.sypoint = upoint;
                upitem.xftime  = xftime;
                new UserProfitBLL().AddItem(upitem);
                #endregion
            }
        }
Example #4
0
 public int AddItem(UserProfit item)
 {
     return(UserProfitDAL.AddItem(item));
 }