public ActionResult CustomerTrackCustomerEdit(int id, string 跟进人)
        {
            SetEmployee();
            if (positionID != 3)
            {
                return(Content("违规操作!"));
            }
            string[] property = new string[1];
            property[0] = "跟进人ID";
            var model = customerInfoBLL.GetModel(p => p.ID == id);

            try
            {
                int eid = int.Parse(跟进人);
                model.跟进人ID = eid;
            }
            catch (Exception e)
            {
                return(Content("" + e.Message));
            }

            Session["method"] = "Y";
            customerInfoBLL.Modify(model, property);
            return(RedirectToAction("CustomerExamineView"));
        }
Exemple #2
0
        /// <summary>
        /// 申请设计
        /// </summary>
        /// <returns></returns>
        public ActionResult ApplyDesignView(int?recepitonID)
        {
            Session["method"] = "N";
            SetEmployee();
            ViewBag.Store      = store;
            ViewBag.Employee   = employeeName;
            ViewBag.IsManager  = storeEmployeesBLL.GetModel(p => p.ID == employeeID).是否店长;
            ViewBag.IsDesigner = storeEmployeesBLL.GetModel(p => p.ID == employeeID).是否设计师;
            ViewBag.IsEmployee = storeEmployeesBLL.GetModel(p => p.ID == employeeID).是否销售;
            List <销售_接待记录>    customerInfos     = new List <销售_接待记录>();
            DesignSubmitModel designSubmitModel = new DesignSubmitModel();

            if (recepitonID != null && recepitonID != 0)
            {
                var model = customerInfoBLL.GetModel(p => p.ID == recepitonID);
                designSubmitModel.客户姓名         = model.客户姓名;
                designSubmitModel.家庭成员         = model.家庭成员;
                designSubmitModel.职业           = model.家庭成员;
                designSubmitModel.楼盘具体位置       = model.安装地址;
                designSubmitModel.职业           = model.客户职业;
                designSubmitModel.联系方式         = model.客户电话;
                designSubmitModel.客户喜好         = model.主导者喜好风格;
                designSubmitModel.客户在意品牌或已购买品牌 = model.比较品牌;
                designSubmitModel.装修风格         = model.装修风格;
                designSubmitModel.装修进度         = model.装修进度;
                designSubmitModel.预算           = model.预算金额;
                designSubmitModel.接待记录ID       = model.ID;
                designSubmitModel.销售人员         = employeeName;
            }
            else if (employeeID != 0)
            {
                customerInfos = customerInfoBLL.GetModels(p => p.接待人ID == employeeID || p.跟进人ID == employeeID).ToList();
                SelectList customerInfosSelectListItem = new SelectList(customerInfos, "客户电话", "客户电话");
                ViewBag.CustomerPhoneNumber = customerInfosSelectListItem;
            }
            ViewBag.EmployeeName = employeeName;
            return(View(designSubmitModel));
        }
        private int storeID;         //当前店铺id
        // private IQueryable<Employees> workers;//所有员工信息



        // GET: CustomerTrackLog
        /// <summary>
        /// 跟进日志
        /// </summary>
        /// <param name="id">接待id</param>
        /// <param name="sortOrder">排序关键字</param>
        /// <param name="searchString">搜索词</param>
        /// <param name="currentFilter"></param>
        /// <param name="page">页码</param>
        /// <returns></returns>
        public ActionResult TrackLogIndex(int?id, string sortOrder, string searchString, string currentFilter, int?page)
        {
            List <CustomerTrackingModel> customerTrackingModels = new List <CustomerTrackingModel>();

            Session["method"] = "N";
            SetEmployee();//获取当前人员信息
            ViewBag.Store               = store;
            ViewBag.Employee            = employeeName;
            ViewBag.IsManager           = storeEmployeesBLL.GetModel(p => p.ID == employeeID).是否店长;
            ViewBag.IsDesigner          = storeEmployeesBLL.GetModel(p => p.ID == employeeID).是否设计师;
            ViewBag.IsEmployee          = storeEmployeesBLL.GetModel(p => p.ID == employeeID).是否销售;
            ViewBag.TrackingCurrentSort = sortOrder;
            ViewBag.TrackingDate        = String.IsNullOrEmpty(sortOrder) ? "first_desc" : "";
            ViewBag.TrackingResult      = sortOrder == "last" ? "last_desc" : "last";
            if (id != null && id != 0)
            {
                customerTrackingModels = BuildTrackingInfo(id);                          //获取当前客户的跟进信息
                ViewBag.Reception      = customerInfoBLL.GetModel(p => p.ID == id).接待序号; //将接待序号传到前端
            }
            else
            {
                customerTrackingModels = BuildTrackingInfo(0);//获取当前人员可查看的跟进信息
            }
            if (customerTrackingModels == null)
            {
                return(Content("当前操作人并无关联的跟进信息或无进入权限!"));
            }

            ViewBag.storeName = store;//将当前店铺名字传到前端
            if (searchString != null)
            {
                page = 1;
            }
            else
            {
                searchString = currentFilter;
            }
            ViewBag.TrackingCurrentFilter = searchString;//获得前端传回来的搜索关键词

            if (!string.IsNullOrEmpty(searchString))
            {
                customerTrackingModels = customerTrackingModels.Where(w => w.客户电话 == searchString).ToList();//通过客户电话查找
            }
            //Session["Name"] = customerInfoModels.FirstOrDefault();
            #region 排序,默认按ID升序
            switch (sortOrder)
            {
            case "first_desc":
                customerTrackingModels = customerTrackingModels.OrderByDescending(w => w.跟进时间).ToList();
                break;

            case "last_desc":
                customerTrackingModels = customerTrackingModels.OrderByDescending(w => w.跟进结果).ToList();
                break;

            case "last":
                customerTrackingModels = customerTrackingModels.OrderBy(w => w.跟进结果).ToList();
                break;

            default:
                customerTrackingModels = customerTrackingModels.OrderBy(w => w.跟进时间).ToList();
                break;
            }

            #endregion
            int pageSize   = 10;
            int pageNumber = (page ?? 1);

            return(View(customerTrackingModels.ToPagedList(pageNumber, pageSize)));
        }
Exemple #4
0
        public ActionResult CustomerAdd(CustomerInfoModel customerInfoModel)
        {
            if (Session["method"].ToString() == "Y")
            {
                string str = string.Format("<script>alert('重复操作!');parent.location.href='CustomerIndex';</script>");
                return(Content(str));
            }

            SetEmployee();
            var     employee = storeEmployeesBLL.GetModel(p => p.姓名 == employeeName);
            销售_接待记录 model    = new 销售_接待记录();

            try
            {
                model.店铺ID    = storeBLL.GetModel(p => p.称 == store).ID;
                model.接待人ID   = storeEmployeesBLL.GetModel(p => p.姓名 == employeeName).ID;
                model.接待序号    = customerInfoModel.接待序号;
                model.接待日期    = DateTime.Now.Date;
                model.主导者     = customerInfoModel.主导者;
                model.主导者喜好风格 = customerInfoModel.主导者喜好风格;
                model.使用空间    = customerInfoModel.使用空间;
                model.出店时间    = customerInfoModel.出店时间;
                model.制单日期    = DateTime.Now;
                model.行人      = customerInfoModel.行人;
                model.如何得知品牌  = customerInfoModel.如何得知品牌;
                model.安装地址    = customerInfoModel.安装地址;
                model.客户姓名    = customerInfoModel.客户姓名;
                model.客户建议    = customerInfoModel.客户建议;
                model.客户来源    = customerInfoModel.客户来源;
                model.客户电话    = customerInfoModel.客户电话;
                model.客户着装    = customerInfoModel.客户着装;
                model.客户类别    = customerInfoModel.客户类别;
                model.客户类型    = customerInfoModel.客户类型;
                model.客户职业    = customerInfoModel.客户职业;
                model.家庭成员    = customerInfoModel.家庭成员;
                model.年龄段     = customerInfoModel.年龄段;
                model.性别      = customerInfoModel.性别;
                model.是否有意向   = customerInfoModel.是否有意向;
                if (employeeName != null)
                {
                    model.更新人 = storeEmployeesBLL.GetModel(p => p.姓名 == employeeName).ID;
                }

                model.更新日期 = DateTime.Now;
                model.来店次数 = 1;
                model.比较品牌 = customerInfoModel.比较品牌;
                model.特征   = customerInfoModel.特征;
                model.社交软件 = customerInfoModel.社交软件;
                model.装修情况 = customerInfoModel.装修情况;
                model.装修进度 = customerInfoModel.装修进度;
                model.装修风格 = customerInfoModel.装修风格;
                model.设计师  = customerInfoModel.设计师;
                var recPersonID = storeEmployeesBLL.GetModel(p => p.姓名 == customerInfoModel.接待人).ID;
                if (storeEmployeesBLL.GetModel(p => p.姓名 == customerInfoModel.接待人).跟进目标计划数 > customerInfoBLL.GetModels(p => p.跟进人ID == recPersonID).Count())
                {
                    model.跟进人ID = storeEmployeesBLL.GetModel(p => p.姓名 == customerInfoModel.接待人).ID;//初次添加且当前接待人员跟进指标未满,跟进人为当前接待人员。否则为空。
                }



                model.返点         = customerInfoModel.返点;
                model.进店时长       = int.Parse((customerInfoModel.出店时间 - customerInfoModel.进店时间).TotalMinutes.ToString());
                model.进店时间       = customerInfoModel.进店时间;
                model.预报价折扣      = customerInfoModel.预报价折扣;
                model.预算金额       = customerInfoModel.预算金额;
                model.预计使用时间     = customerInfoModel.预计使用时间;
                model.喜欢产品       = customerInfoModel.喜欢产品;
                model.喜欢元素       = customerInfoModel.喜欢元素;
                model.主卧预算备注     = customerInfoModel.主卧预算备注;
                model.主卧预算家具     = customerInfoModel.主卧预算家具;
                model.主卧预算金额     = customerInfoModel.主卧预算金额;
                model.书房预算备注     = customerInfoModel.书房预算备注;
                model.书房预算家具     = customerInfoModel.书房预算家具;
                model.书房预算金额     = customerInfoModel.书房预算金额;
                model.其它空间备注     = customerInfoModel.其它空间备注;
                model.其它空间家具     = customerInfoModel.其它空间家具;
                model.其它空间预算     = customerInfoModel.其它空间预算;
                model.喜欢产品       = customerInfoModel.喜欢产品;
                model.喜欢元素       = customerInfoModel.喜欢元素;
                model.婴儿或儿童房预算备注 = customerInfoModel.婴儿或儿童房预算备注;
                model.婴儿或儿童房预算家具 = customerInfoModel.婴儿或儿童房预算家具;
                model.婴儿或儿童房预算金额 = customerInfoModel.婴儿或儿童房预算金额;
                model.客厅预算备注     = customerInfoModel.客厅预算备注;
                model.客厅预算家具     = customerInfoModel.客厅预算家具;
                model.客厅预算金额     = customerInfoModel.客厅预算金额;
                model.户型大小       = customerInfoModel.户型大小;
                model.次卧预算备注     = customerInfoModel.次卧预算备注;
                model.次卧预算家具     = customerInfoModel.次卧预算家具;
                model.次卧预算金额     = customerInfoModel.次卧预算金额;
                model.比较品牌产品     = customerInfoModel.比较品牌产品;
                model.比较品牌产品备注   = customerInfoModel.比较品牌产品备注;
            }
            catch (Exception e)
            {
                return(Content(e.Message));
            }



            if (!ModelState.IsValid)
            {
                List <string> sb = new List <string>();
                //获取所有错误的Key
                List <string> Keys = ModelState.Keys.ToList();
                //获取每一个key对应的ModelStateDictionary
                foreach (var key in Keys)
                {
                    var errors = ModelState[key].Errors.ToList();
                    //将错误描述添加到sb中
                    foreach (var error in errors)
                    {
                        sb.Add(error.ErrorMessage);
                    }
                }
                string s = null;
                foreach (var item in sb)
                {
                    s += item.ToString() + ";";
                }
                return(Content("<script>alert('" + s + "');window.history.go(-1);</script>"));
            }
            var isHave = customerInfoBLL.GetModel(p => p.客户姓名 == model.客户姓名 && p.接待日期 == model.接待日期);

            if (isHave != null)
            {
                return(Content("<script>alert('数据已存在!,请勿重复提交');parent.location.href='CustomerIndex';</script>"));
            }
            #region 如果客户已在当前店铺登记过
            try
            {
                var lis1 = customerInfoBLL.GetModels(p => p.客户姓名 == model.客户姓名 || p.客户电话 == model.客户电话);
                int num1 = lis1.Count();
                if (num1 >= 0) //统计客户来店登记次数
                {
                    model.来店次数 += num1;
                }
            }
            catch (Exception e)
            {
                return(Content(e.Message));
            }

            customerInfoBLL.Add(model);;
            Session["method"] = "Y";
            #endregion



            var id = customerInfoBLL.GetModel(p => p.接待序号 == model.接待序号).接待人ID;
            return(RedirectToAction("CustomerIndex"));
        }