예제 #1
0
        public ActionResult EmployeeAdd(Employees models)
        {
            销售_店铺员工档案 Emodel = new 销售_店铺员工档案
            {
                ID   = models.ID,
                姓名   = models.姓名,
                性别   = models.性别,
                编号   = models.编号,
                联系方式 = models.联系方式,
                停用标志 = models.停用标志,
                制单人  = models.制单人,
                制单日期 = models.制单日期,
                密码   = models.密码,
                店铺ID = storeBLL.GetModel(p => p.称 == models.店铺).ID,
                职务ID = positionBLL.GetModel(p => p.职务 == models.职务).ID
            };


            if (ModelState.IsValid)
            {
                storeEmployeesBLL.Add(Emodel);

                return(RedirectToAction("ManagerAction"));
            }
            return(View());
        }
        public ActionResult TrackLogAdd(CustomerTrackingModel customerTrackingModel)
        {
            if (Session["method"].ToString() == "Y")
            {
                string str = string.Format("<script>alert('重复操作!');parent.location.href='TrackLogIndex';</script>");
                return(Content(str));
            }
            try
            {
                销售_意向追踪日志 trackLog = new 销售_意向追踪日志();


                trackLog.店铺ID    = storeBLL.GetModel(P => P.称 == customerTrackingModel.店铺).ID;
                trackLog.备注      = customerTrackingModel.备注;
                trackLog.店长审核    = customerTrackingModel.店长审核;
                trackLog.接待记录ID  = customerInfoBLL.GetModel(p => p.接待序号 == customerTrackingModel.接待序号).ID;
                trackLog.是否申请设计师 = customerTrackingModel.是否申请设计师;
                trackLog.跟进人     = storeEmployeesBLL.GetModel(p => p.姓名 == customerTrackingModel.跟进人).ID;
                trackLog.跟进内容    = customerTrackingModel.跟进内容;
                trackLog.跟进方式    = customerTrackingModel.跟进方式;
                trackLog.跟进时间    = customerTrackingModel.跟进时间;



                trackLog.跟进结果 = Enum.GetName(typeof(CustomerTrackResult), customerTrackingModel.跟进结果).ToString();
                if (ModelState.IsValid)
                {
                    customerTrackingBLL.Add(trackLog);
                    Session["method"] = "Y";
                }

                else
                {
                    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 = "添加日志出错:";
                    foreach (var item in sb)
                    {
                        s += item.ToString() + "<br/>";
                    }
                    return(Content("<script>alert('" + s + "');window.history.go(-1);</script>"));
                }
            }
            catch (Exception ex)
            {
                return(Content("添加跟进日志时错误:" + ex.ToString()));
            }
            return(RedirectToAction("TrackLogIndex", new { id = customerTrackingModel.接待ID }));
        }
        /// <summary>
        /// 设置当前操作人员及店铺信息
        /// </summary>
        private void SetEmployee()
        {
            string userName = HttpContext.User.Identity.Name;

            if (userName != null)
            {
                var employees = HttpContext.Session["Employee"] as Employees;
                employeeID   = employees.ID;
                employeeName = employees.姓名;
                store        = employees.店铺;
                storeID      = storeBLL.GetModel(p => p.称 == store).ID;
                positionID   = storeEmployeesBLL.GetModel(p => p.ID == employeeID).职务ID;
            }
        }
예제 #4
0
        /// <summary>
        /// 将员工数据优化
        /// </summary>
        public void BuildEmploess()
        {
            List <Employees> employeesList = new List <Employees>();

            if (workers == null)
            {
                var worker = storeEmployeesBLL.GetModels(p => true);//查询初始员工信息
                #region 对员工信息进行数据优化


                foreach (var item in worker)
                {
                    Employees employees = new Employees
                    {
                        ID    = item.ID,
                        停用标志  = item.停用标志,
                        姓名    = item.姓名,
                        性别    = item.性别,
                        编号    = item.编号,
                        密码    = item.密码,
                        职务    = positionBLL.GetModel(p => p.ID == item.职务ID).职务,
                        店铺    = storeBLL.GetModel(p => p.ID == item.店铺ID).称,
                        联系方式  = item.联系方式,
                        跟进目标数 = item.跟进目标计划数,
                        是否销售  = item.是否销售,
                        是否店长  = item.是否店长,
                        是否设计师 = item.是否设计师
                    };
                    employeesList.Add(employees);
                }
                #endregion
                workers = employeesList.AsEnumerable().AsQueryable();
            }
        }
        /// <summary>
        /// 上传文件的具体方法
        /// </summary>
        /// <returns>成功则为true,失败异常则为False</returns>
        public JsonResult UploadFile(FileViewModel fileModel)
        {
            string msg = "true";

            if (fileModel.DesignId == 0)
            {
                msg = "设计案ID获取出错!";
                return(Json(msg));
            }
            //if (Session["method"].ToString() == "Y")
            //{
            //    string str = string.Format("<script>alert('重复操作!');parent.location.href='TrackLogIndex';</script>");
            //    return Json(str);
            //}
            SetEmployee();



            fileModel.FileName  = fileModel.UploadStream.FileName;
            fileModel.UserName  = employeeName;
            fileModel.StoreName = storeBLL.GetModel(p => p.ID == storeID).称;

            var m = fileModel.UploadStream.InputStream;

            msg = IsAllowedExtension(fileModel.UploadStream, fileModel.Filetype);
            if (msg != "true")
            {
                return(Json(msg));                                                                                                                                            //如果上传文件不匹配,则返回出错信息!
            }
            var path = UploadManager.SaveFile(fileModel.UploadStream, fileModel.FileName, fileModel.StoreName, fileModel.DesignId.ToString(), fileModel.Filetype.ToString()); //获得上传路径

            fileModel.Path = path;
            if (path == null) /*|| design_ProjectDrawingsBLL.GetModel(p => p.存储路径 == path) != null)*/
            {
                return(Json("false"));
            }
            销售_设计案提交表_项目相关图纸 model = new 销售_设计案提交表_项目相关图纸
            {
                提交人      = fileModel.UserName,
                提交时间     = DateTime.Now,
                更新人      = fileModel.UserName,
                更新日期     = DateTime.Now,
                设计案提交表ID = fileModel.DesignId,
                文件名      = fileModel.FileName
            };

            model.设计案提交表ID = fileModel.DesignId;
            var s = "";

            switch (fileModel.Filetype)
            {
            case FileType.CAD图:
                s          = fileModel.Filetype.ToString();
                model.存储路径 = fileModel.Path;
                model.文件类型 = fileTypeBLL.GetModel(p => p.文件类型 == s).ID;
                break;

            case FileType.效果3D图:
                model.存储路径 = fileModel.Path;
                s          = fileModel.Filetype.ToString();
                model.文件类型 = fileTypeBLL.GetModel(p => p.文件类型 == s).ID;
                break;

            case FileType.对比图:
                model.存储路径 = fileModel.Path;
                s          = fileModel.Filetype.ToString();
                model.文件类型 = fileTypeBLL.GetModel(p => p.文件类型 == s).ID;
                break;

            case FileType.PDF文件:
                model.存储路径 = fileModel.Path;
                s          = fileModel.Filetype.ToString();
                model.文件类型 = fileTypeBLL.GetModel(p => p.文件类型 == s).ID;
                break;

            case FileType.PPT文件:
                model.存储路径 = fileModel.Path;
                s          = fileModel.Filetype.ToString();
                model.文件类型 = fileTypeBLL.GetModel(p => p.文件类型 == s).ID;

                break;

            case FileType.Excel文件:
                model.存储路径 = fileModel.Path;
                s          = fileModel.Filetype.ToString();
                model.文件类型 = fileTypeBLL.GetModel(p => p.文件类型 == s).ID;
                break;

            case FileType.其它:
                model.存储路径 = fileModel.Path;
                s          = fileModel.Filetype.ToString();
                model.文件类型 = fileTypeBLL.GetModel(p => p.文件类型 == s).ID;
                break;

            case FileType.完成效果文件:
                model.存储路径 = fileModel.Path;
                s          = fileModel.Filetype.ToString();
                model.文件类型 = fileTypeBLL.GetModel(p => p.文件类型 == s).ID;
                break;

            default:
                break;
            }

            if (ModelState.IsValid)
            {
                design_ProjectDrawingsBLL.Add(model);
                Session["method"] = "Y";
                ModelState.Clear();
            }
            else
            {
                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);
                    }
                }
                msg = "上传文件出错:";
                foreach (var item in sb)
                {
                    msg += item.ToString() + "<br/>";
                }
                return(Json(msg));
            }
            msg = "上传成功!";
            return(Json(msg));
        }
예제 #6
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"));
        }