Esempio n. 1
0
        public ActionResult EditCustomerActivity(int activityId, int customerId)
        {
            ActivityManagement    activityMgr = new ActivityManagement(User.Identity.GetUserId <int>());
            List <BActivity>      activities  = activityMgr.FindActivities(activityId, User.Identity.GetUserId <int>(), customerId, out total, true, 1, 1);
            CustomerActivityModel model       = new CustomerActivityModel();

            if (activities.Count == 1)
            {
                BActivity activity = activities[0];
                model.Id          = activity.Activity.Id;
                model.CustomerId  = customerId;
                model.Description = activity.Activity.Description;
                model.Enable      = activity.Activity.Enabled;
                model.ExpiredTime = activity.Activity.ExpiredTime > 0 ? DateTimeUtil.ConvertToDateTime(activity.Activity.ExpiredTime).ToString("yyyy-M-dd") : "";
                model.Name        = activity.Activity.Name;
                model.ScanType    = activity.Activity.ScanType;
                model.StartTime   = activity.Activity.ExpiredTime > 0 ? DateTimeUtil.ConvertToDateTime(activity.Activity.StartedTime).ToString("yyyy-M-dd") : "";
            }
            else
            {
                ViewBag.Message = "不能修改不属于自己客户的活动";
                return(View("Error"));
            }

            List <DictionaryTemplate> scanTypes = StaticDictionary.GetScanTypeList();

            ViewBag.ScanTypes = new SelectList(from st in scanTypes select new { Id = st.Id, Name = st.Value }, "Id", "Name");
            return(View("CreateCustomerActivity", model));
        }
Esempio n. 2
0
        public ActionResult CustomerAcivities(int customerId)
        {
            CustomerManagement customerMgr = new CustomerManagement(User.Identity.GetUserId <int>());
            List <BCustomer>   customers   = customerMgr.FindCustomers(User.Identity.GetUserId <int>(), customerId, out total);

            if (customers.Count == 0)
            {
                ViewBag.Message = string.Format("编号为:{0}的客户不是你的客户", customerId);
                return(View("Error"));
            }
            BCustomer          customer    = customers[0];
            ActivityManagement activityMgr = new ActivityManagement(customerMgr.CurrentLoginUser);
            int page     = 1;
            int pageSize = 20;

            int.TryParse(Request["page"], out page);
            page = page > 0 ? page : 1;
            List <BActivity>            activities = activityMgr.FindActivities(0, User.Identity.GetUserId <int>(), customerId, out total, true, page, pageSize);
            PageItemsResult <BActivity> result     = new PageItemsResult <BActivity>()
            {
                CurrentPage = page, EnablePaging = true, Items = activities, PageSize = pageSize, TotalRecords = total
            };

            KMBit.Grids.KMGrid <BActivity> grid = new Grids.KMGrid <BActivity>(result);
            ViewBag.Customer = customer;
            return(View("CustomerAcivities", grid));
        }
Esempio n. 3
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));
        }