Beispiel #1
0
        public ActionResult Edit(FormCollection fc)
        {
            WeiActivityModel model = WeiActivityApplication.GetActivityModel(Convert.ToInt32(fc["activityId"]));

            if (!string.IsNullOrWhiteSpace(fc["activityTitle"]))
            {
                model.activityTitle = fc["activityTitle"].ToString();
            }
            if (!string.IsNullOrWhiteSpace(fc["activityDetails"]))
            {
                model.activityDetails = fc["activityDetails"].ToString();
            }

            if (!string.IsNullOrWhiteSpace(fc["endTime"]))
            {
                model.endTime = Convert.ToDateTime(fc["endTime"].ToString());
            }
            if (!string.IsNullOrWhiteSpace(fc["participationType"]))
            {
                model.participationType = (WeiParticipateType)Enum.Parse(typeof(WeiParticipateType), fc["participationType"].ToString());
            }
            if (!string.IsNullOrWhiteSpace(fc["participationCount"]))
            {
                model.participationCount = Convert.ToInt32(fc["participationCount"].ToString().Replace(",", " ").Trim());
            }
            if (!string.IsNullOrWhiteSpace(fc["isPoint"]))
            {
                if (Convert.ToInt32(fc["isPoint"]) > 0)
                {
                    model.consumePoint = Convert.ToInt32(fc["consumePoint"].ToString());
                }
                else
                {
                    model.consumePoint = 0;
                }
            }

            //临时图片地址
            model.activityUrl = fc["activityUrl"];
            string url = CurrentUrlHelper.CurrentUrlNoPort() + "/m-Mobile/ScratchCard/index/";

            model.codeUrl = url;

            model.activityType = WeiActivityType.ScratchCard;


            long id = WeiActivityApplication.AddActivitySubmit(model);

            return(RedirectToAction("Detail/" + id));
        }
Beispiel #2
0
        public ActionResult Add(FormCollection fc)
        {
            WeiActivityModel model = new WeiActivityModel();

            if (!string.IsNullOrWhiteSpace(fc["activityTitle"]))
            {
                model.activityTitle = fc["activityTitle"].ToString();
            }
            if (!string.IsNullOrWhiteSpace(fc["activityDetails"]))
            {
                model.activityDetails = fc["activityDetails"].ToString();
            }
            if (!string.IsNullOrWhiteSpace(fc["beginTime"]))
            {
                model.beginTime = Convert.ToDateTime(fc["beginTime"].ToString());
            }
            if (!string.IsNullOrWhiteSpace(fc["endTime"]))
            {
                model.endTime = Convert.ToDateTime(fc["endTime"].ToString());
            }
            if (!string.IsNullOrWhiteSpace(fc["participationType"]))
            {
                model.participationType = (WeiParticipateType)Enum.Parse(typeof(WeiParticipateType), fc["participationType"].ToString());
            }
            if (!string.IsNullOrWhiteSpace(fc["participationCount"]))
            {
                model.participationCount = Convert.ToInt32(fc["participationCount"].ToString().Replace(",", " ").Trim());
            }
            if (!string.IsNullOrWhiteSpace(fc["isPoint"]))
            {
                if (Convert.ToInt32(fc["isPoint"]) > 0)
                {
                    model.consumePoint = Convert.ToInt32(fc["consumePoint"].ToString());
                }
                else
                {
                    model.consumePoint = 0;
                }
            }



            //临时图片地址
            model.activityUrl = fc["activityUrl"];
            string url = CurrentUrlHelper.CurrentUrlNoPort() + "/m-Mobile/ScratchCard/index/";

            model.codeUrl = url;

            model.activityType = WeiActivityType.ScratchCard;
            model.addDate      = DateTime.Now;

            if (!string.IsNullOrWhiteSpace(fc["harward"]))
            {
                List <WeiActivityAwardModel> listAwardModel = new List <WeiActivityAwardModel>();
                for (int i = 1; i <= Convert.ToInt32(fc["harward"]); i++)
                {
                    WeiActivityAwardModel awardModel = new WeiActivityAwardModel();
                    awardModel.activityId = model.Id;
                    if (!string.IsNullOrWhiteSpace(fc["integral" + i]))
                    {
                        awardModel.integral = Convert.ToInt32(fc["integral" + i].ToString());
                    }
                    awardModel.awardType = (WeiActivityAwardType)Enum.Parse(typeof(WeiActivityAwardType), fc["ReceiveType" + i].ToString());
                    if (!string.IsNullOrWhiteSpace(fc["brand" + i]))
                    {
                        awardModel.bonusId = Convert.ToInt32(fc["brand" + i].ToString());
                    }
                    if (!string.IsNullOrWhiteSpace(fc["coupon" + i]))
                    {
                        awardModel.couponId = Convert.ToInt32(fc["coupon" + i].ToString());
                    }
                    if (!string.IsNullOrWhiteSpace(fc["awardCount" + i]))
                    {
                        awardModel.awardCount = Convert.ToInt32(fc["awardCount" + i].ToString());
                    }
                    if (!string.IsNullOrWhiteSpace(fc["proportion" + i]))
                    {
                        awardModel.proportion = Convert.ToInt32(fc["proportion" + i].ToString());
                    }
                    awardModel.awardLevel = i;
                    if (awardModel.awardCount > 0 && awardModel.proportion > 0)
                    {
                        listAwardModel.Add(awardModel);
                    }
                }
                model.awards = listAwardModel;
            }

            long id = WeiActivityApplication.AddActivitySubmit(model);

            return(RedirectToAction("Detail/" + id));
        }