Beispiel #1
0
        private List <SelectListItem> BindDrop(bool Edit)
        {
            List <SelectListItem> bonusList = new List <SelectListItem> {
                new SelectListItem
                {
                    Selected = true,
                    Text     = "请选择红包...",
                    Value    = "0"
                }
            };
            var bonus = WeiActivityApplication.GetBonusByType(Himall.Entities.BonusInfo.BonusType.Prize);

            if (Edit)//是否是修改
            {
                foreach (var item in bonus)
                {
                    bonusList.Add(new SelectListItem
                    {
                        Selected = false,
                        Text     = item.Name,
                        Value    = item.Id.ToString()
                    });
                }
            }
            else
            {
                foreach (var item in bonus)
                {
                    var count = int.Parse(GetBonusSurplus(item.Id));
                    if (count > 0)
                    {
                        bonusList.Add(new SelectListItem
                        {
                            Selected = false,
                            Text     = item.Name + " 剩余:" + count + " 个",
                            Value    = item.Id.ToString()
                        });
                    }
                }
            }
            return(bonusList);
        }