/// <summary>
        /// 预订单
        /// </summary>
        /// <returns></returns>
        public ActionResult PreOrder()
        {
            long _preordercode = QueryString.LongIntSafeQ("code");
            int  _jishi        = QueryString.IntSafeQ("js");

            if (_jishi == (int)JiShiSongEnum.JiShi)
            {
                XuQiuPreOrderMethod(_preordercode);
            }
            else
            {
                ///可正常销售的产品
                IList <OrderDetailPreTempEntity> _listproduct = OrderDetailPreTempBLL.Instance.GetOrderPreTempByCode(_preordercode, 1);

                //不能正常销售的产品
                IList <OrderDetailPreTempEntity> _listproductless = OrderDetailPreTempBLL.Instance.GetOrderPreTempByCode(_preordercode, 0);
                ViewBag.ProductList     = _listproduct;
                ViewBag.ProductListLess = _listproductless;
                ViewBag.MemId           = member.MemId;
                ViewBag.PreOrderCode    = _preordercode;
                VWOrderEntity _order = OrderCommonBLL.Instance.GetTransFeeDisCount(_listproduct);
                ViewBag.Order = _order;

                IntegralEntity _entity = IntegralBLL.Instance.GetIntegralByMemId(memid);
                ViewBag.Integral = _entity;
            }
            ViewBag.JiShiSong = _jishi;
            return(View());
        }
Beispiel #2
0
        public IntegralEntity GetIntegralByMemId(int memid)
        {
            string    sql = @"SELECT  [Id],[MemId],[AvailableIntegral],[FreezingIntegral],[Status],TimeStrampCode
							FROM
							dbo.[Integral] WITH(NOLOCK)	
							WHERE [MemId]=@MemId"                            ;
            DbCommand cmd = db.GetSqlStringCommand(sql);

            db.AddInParameter(cmd, "@MemId", DbType.Int32, memid);
            IntegralEntity entity = new IntegralEntity();

            using (IDataReader reader = db.ExecuteReader(cmd))
            {
                if (reader.Read())
                {
                    entity.Id                = StringUtils.GetDbInt(reader["Id"]);
                    entity.MemId             = StringUtils.GetDbInt(reader["MemId"]);
                    entity.AvailableIntegral = StringUtils.GetDbInt(reader["AvailableIntegral"]);
                    entity.FreezingIntegral  = StringUtils.GetDbInt(reader["FreezingIntegral"]);
                    entity.Status            = StringUtils.GetDbInt(reader["Status"]);
                    entity.TimeStrampCode    = ByteUtils.GetStringFromByte(reader["TimeStrampCode"]);
                }
            }

            return(entity);
        }
Beispiel #3
0
        /// <summary>
        /// 插入一条记录到表Integral,如果表中存在自增字段,则返回值为新记录的自增字段值,否则返回0
        /// </summary>
        /// <param name="db">数据库操作对象</param>
        /// <param name="integral">待插入的实体对象</param>
        public int AddIntegral(IntegralEntity entity)
        {
            string    sql = @"insert into Integral( [Id],[MemId],[AvailableIntegral],[FreezingIntegral],[Status])VALUES
			            ( @Id,@MemId,@AvailableIntegral,@FreezingIntegral,@Status)"            ;
            DbCommand cmd = db.GetSqlStringCommand(sql);

            db.AddInParameter(cmd, "@MemId", DbType.Int32, entity.MemId);
            db.AddInParameter(cmd, "@AvailableIntegral", DbType.Int32, entity.AvailableIntegral);
            db.AddInParameter(cmd, "@FreezingIntegral", DbType.Int32, entity.FreezingIntegral);
            db.AddInParameter(cmd, "@Status", DbType.Int32, entity.Status);
            return(db.ExecuteNonQuery(cmd));
        }
Beispiel #4
0
    public void SetUI(TransferData data)
    {
        EventTriggerListener.Get(m_button.gameObject).onClick = OnBtnSpendGiftClick;

        IntegralEntity IntegralEntity = data.GetValue <IntegralEntity>("integralEntity");

        index = IntegralEntity.id;

        TextureManager.Instance.LoadHead(IntegralEntity.img_url, (Texture2D texture2d) =>
        {
            m_image.texture = texture2d;
            m_priceText.SafeSetText(IntegralEntity.need_score.ToString());
            m_nameText.SafeSetText(IntegralEntity.name.ToString());
        });
    }
Beispiel #5
0
        /// <summary>
        /// 根据主键值更新记录的全部字段(注意:该方法不会对自增字段、timestamp类型字段以及主键字段更新!如果要更新主键字段,请使用Update方法)。
        /// 如果数据库有数据被更新了则返回True,否则返回False
        /// </summary>
        /// <param name="db">数据库操作对象</param>
        /// <param name="integral">待更新的实体对象</param>
        public int UpdateIntegral(IntegralEntity entity)
        {
            string sql = @" UPDATE dbo.[Integral] SET
                       [Id]=@Id,[MemId]=@MemId,[AvailableIntegral]=@AvailableIntegral,[FreezingIntegral]=@FreezingIntegral,[Status]=@Status
                       WHERE [Id]=@id and  TimeStrampCode=@TimeStrampCode";

            DbCommand cmd = db.GetSqlStringCommand(sql);

            db.AddInParameter(cmd, "@Id", DbType.Int32, entity.Id);
            db.AddInParameter(cmd, "@MemId", DbType.Int32, entity.MemId);
            db.AddInParameter(cmd, "@AvailableIntegral", DbType.Int32, entity.AvailableIntegral);
            db.AddInParameter(cmd, "@FreezingIntegral", DbType.Int32, entity.FreezingIntegral);
            db.AddInParameter(cmd, "@Status", DbType.Int32, entity.Status);
            db.AddInParameter(cmd, "@TimeStrampCode", DbType.Binary, ByteUtils.GetByteFromString(entity.TimeStrampCode));
            return(db.ExecuteNonQuery(cmd));
        }
Beispiel #6
0
        /// <summary>
        /// 插入一条记录到表Integral,如果表中存在自增字段,则返回值为新记录的自增字段值,否则返回0。
        /// 该方法提供给界面等UI层调用
        /// </summary>
        /// <param name="integral">要添加的Integral数据实体对象</param>
        public int AddIntegral(IntegralEntity integral)
        {
            if (integral.Id > 0)
            {
                return(UpdateIntegral(integral));
            }

            else if (IntegralBLL.Instance.IsExist(integral))
            {
                return((int)CommonStatus.ADD_Fail_Exist);
            }
            else
            {
                return(IntegralDA.Instance.AddIntegral(integral));
            }
        }
Beispiel #7
0
        /// <summary>
        /// 读取记录列表。
        /// </summary>
        /// <param name="db">数据库操作对象</param>
        /// <param name="columns">需要返回的列,不提供任何列名时默认将返回所有列</param>
        public IList <IntegralEntity> GetIntegralList(int pagesize, int pageindex, ref int recordCount)
        {
            string sql = @"SELECT   [Id],[MemId],[AvailableIntegral],[FreezingIntegral],[Status]
						FROM
						(SELECT ROW_NUMBER() OVER (ORDER BY Id desc) AS ROWNUMBER,
						 [Id],[MemId],[AvailableIntegral],[FreezingIntegral],[Status] from dbo.[Integral] WITH(NOLOCK)	
						WHERE  1=1 ) as temp 
						where rownumber BETWEEN ((@PageIndex - 1) * @PageSize + 1) AND @PageIndex * @PageSize"                        ;

            string sql2 = @"Select count(1) from dbo.[Integral] with (nolock) ";
            IList <IntegralEntity> entityList = new List <IntegralEntity>();
            DbCommand cmd = db.GetSqlStringCommand(sql);

            db.AddInParameter(cmd, "@PageIndex", DbType.Int32, pageindex);
            db.AddInParameter(cmd, "@PageSize", DbType.Int32, pagesize);

            using (IDataReader reader = db.ExecuteReader(cmd))
            {
                while (reader.Read())
                {
                    IntegralEntity entity = new IntegralEntity();
                    entity.Id                = StringUtils.GetDbInt(reader["Id"]);
                    entity.MemId             = StringUtils.GetDbInt(reader["MemId"]);
                    entity.AvailableIntegral = StringUtils.GetDbInt(reader["AvailableIntegral"]);
                    entity.FreezingIntegral  = StringUtils.GetDbInt(reader["FreezingIntegral"]);
                    entity.Status            = StringUtils.GetDbInt(reader["Status"]);
                    entityList.Add(entity);
                }
            }
            cmd = db.GetSqlStringCommand(sql2);
            using (IDataReader reader = db.ExecuteReader(cmd))
            {
                if (reader.Read())
                {
                    recordCount = StringUtils.GetDbInt(reader[0]);
                }
                else
                {
                    recordCount = 0;
                }
            }
            return(entityList);
        }
Beispiel #8
0
    /// <summary>
    /// 测试积分兑换功能
    /// </summary>
    private void IntegralText()
    {
        IntegralEntityExternal integralEntityExternal;
        List <IntegralEntity>  lstIntegralEntityTest = new List <IntegralEntity>();
        IntegralEntity         integralEntity001     = new IntegralEntity();

        integralEntity001.id         = 0;
        integralEntity001.img_url    = "http://img.mp.itc.cn/upload/20161120/dcc2dd640a604aaea092e74f6855dd4b_th.jpeg";
        integralEntity001.name       = "钢之炼金术师";
        integralEntity001.need_score = 9099;
        IntegralEntity integralEntity002 = new IntegralEntity();

        integralEntity002.id         = 1;
        integralEntity002.img_url    = "http://a4.topitme.com/o/201012/17/12925697494423.jpg";
        integralEntity002.name       = "樱木和流川枫";
        integralEntity002.need_score = 9999;
        lstIntegralEntityTest.Add(integralEntity001);
        lstIntegralEntityTest.Add(integralEntity002);
        integralEntityExternal       = new IntegralEntityExternal();
        integralEntityExternal.score = 10086;
        integralEntityExternal.prize = lstIntegralEntityTest;

        IntegralEntityExternal integralEntityAndNum = integralEntityExternal;

        TransferData        data = new TransferData();
        List <TransferData> lstIntegralEntityData = new List <TransferData>();

        List <IntegralEntity> lstIntegralEntity = integralEntityAndNum.prize;

        for (int i = 0; i < lstIntegralEntity.Count; i++)
        {
            TransferData integralEntity = new TransferData();
            integralEntity.SetValue("integralEntity", lstIntegralEntity[i]);
            lstIntegralEntityData.Add(integralEntity);
        }
        data.SetValue("lstData", lstIntegralEntityData);
        data.SetValue("Count", integralEntityAndNum.score);

        if (m_UIIntegralWindow)
        {
            m_UIIntegralWindow.SetUI(data);
        }
    }
Beispiel #9
0
        /// <summary>
        /// 读取记录列表。
        /// </summary>
        /// <param name="db">数据库操作对象</param>
        /// <param name="columns">需要返回的列,不提供任何列名时默认将返回所有列</param>
        public IList <IntegralEntity> GetIntegralAll()
        {
            string sql = @"SELECT    [Id],[MemId],[AvailableIntegral],[FreezingIntegral],[Status] from dbo.[Integral] WITH(NOLOCK)	";
            IList <IntegralEntity> entityList = new List <IntegralEntity>();
            DbCommand cmd = db.GetSqlStringCommand(sql);

            using (IDataReader reader = db.ExecuteReader(cmd))
            {
                while (reader.Read())
                {
                    IntegralEntity entity = new IntegralEntity();
                    entity.Id                = StringUtils.GetDbInt(reader["Id"]);
                    entity.MemId             = StringUtils.GetDbInt(reader["MemId"]);
                    entity.AvailableIntegral = StringUtils.GetDbInt(reader["AvailableIntegral"]);
                    entity.FreezingIntegral  = StringUtils.GetDbInt(reader["FreezingIntegral"]);
                    entity.Status            = StringUtils.GetDbInt(reader["Status"]);
                    entityList.Add(entity);
                }
            }
            return(entityList);
        }
        public ActionResult Integral()
        {
            int _pagesize  = CommonKey.PageSizeIntegralChange;
            int _pageindex = QueryString.IntSafeQ("pageindex");

            if (_pageindex == 0)
            {
                _pageindex = 1;
            }
            int            recordCount = 0;
            IntegralEntity _integral   = IntegralBLL.Instance.GetIntegralByMemId(memid);
            IList <IntegralChangeEntity> _changelist = IntegralChangeBLL.Instance.GetIntegralChangeList(_pagesize, _pageindex, ref recordCount, memid);

            ViewBag.ChangeList = _changelist;
            ViewBag.Integral   = _integral;
            string _url     = "/Member/Integral?1=1";
            string _pageStr = HTMLPage.SetOrderListPage(recordCount, _pagesize, _pageindex, _url);

            ViewBag.PageStr = _pageStr;
            return(View());
        }
Beispiel #11
0
 /// <summary>
 /// 更新一条Integral记录。
 /// 该方法提供给界面等UI层调用
 /// </summary>
 /// <param name="integral">待更新的实体对象</param>
 /// <param name="columns">要更新的列名,不提供任何列名时默认将更新主键之外的所有列</param>
 public int UpdateIntegral(IntegralEntity integral)
 {
     return(IntegralDA.Instance.UpdateIntegral(integral));
 }
Beispiel #12
0
 /// <summary>
 /// 判断对象是否存在
 /// </summary>
 /// <param name="dicEnum"></param>
 /// <returns></returns>
 public bool IsExist(IntegralEntity integral)
 {
     return(IntegralDA.Instance.ExistNum(integral) > 0);
 }