Exemple #1
0
        public ActionResult CreateActivityTaocan(ActivityTaocanModel model)
        {
            ActivityManagement activityMgr = null;
            if (ModelState.IsValid)
            {
               
                try
                {
                    activityMgr = new ActivityManagement(User.Identity.GetUserId<int>());
                    Marketing_Activity_Taocan taocan = new Marketing_Activity_Taocan() { ActivityId=model.ActivityId, Price=model.Price, Quantity=model.Quantity, RouteId=model.RouteId};
                    activityMgr.CreateActivityTaocan(taocan);
                    return Redirect("/Agent/CustomerAcivities?customerId="+model.CustomerId);
                }
                catch (KMBitException ex)
                {
                    ViewBag.Message = ex.Message;
                }

                finally { }
            }

            List<BAgentRoute> routes = activityMgr.FindAvailableAgentRoutes(User.Identity.GetUserId<int>(), model.CustomerId, model.ActivityId);
            ViewBag.Routes = new SelectList((from r in routes select new { Id = r.Route.Id, Name = r.Taocan.Taocan2.Name + " - 代理价格" + (r.Taocan.Taocan.Sale_price*r.Route.Discount).ToString("0.00") + "元" }), "Id", "Name");
            return View(model);
        }
Exemple #2
0
        public ActionResult CreateActivityTaocan(int activityId,int customerId)
        {
            ActivityManagement activityMgr = new ActivityManagement(User.Identity.GetUserId<int>());
            List<BActivity> activities = activityMgr.FindActivities(activityId, User.Identity.GetUserId<int>(), 0, out total);
            if(activities==null || activities.Count==0)
            {
                ViewBag.Message = string.Format("编号为{0}的活动不是你的客户的活动",activityId);
                return View("Error");
            }

            List<BAgentRoute> routes = activityMgr.FindAvailableAgentRoutes(User.Identity.GetUserId<int>(),customerId, activityId);
            ViewBag.Routes = new SelectList((from r in routes select new { Id = r.Route.Id, Name = r.Taocan.Taocan2.Name + " - 代理价格" + (r.Taocan.Taocan.Sale_price*r.Route.Discount).ToString("0.00") + "元" }), "Id", "Name");
            ActivityTaocanModel model = new ActivityTaocanModel() { ActivityId= activityId,CustomerId= customerId };
            return View(model);
        }