public ActionResult Detail(int?id)
        {
            //初始化客户
            var entity = new Domain.SYS_BUSSINESSCUSTOMER()
            {
                ChargePersionSex = 1
            };

            if (id != null && id > 0)
            {
                //客户实体
                entity = BussinessCustomerManage.Get(p => p.ID == id);
                //公司介绍
                ViewData["CompanyInstroduce"] = ContentManage.Get(p => p.FK_RELATIONID == entity.FK_RELATIONID && p.FK_TABLE == "SYS_BUSSINESSCUSTOMER") ?? new Domain.COM_CONTENT();
            }

            //客户类型
            ViewBag.KHLX = this.CodeManage.LoadAll(p => p.CODETYPE == "LXRLX").OrderBy(p => p.SHOWORDER).ToList();

            return(View(entity));
        }
        public ActionResult Save(Domain.SYS_BUSSINESSCUSTOMER entity)
        {
            bool isEdit        = false;
            var  FK_RELATIONID = "";
            var  json          = new JsonHelper()
            {
                Msg = "保存成功", Status = "n"
            };

            try
            {
                if (entity != null)
                {
                    //公司简介数据ID
                    var contentId = Request["ContentId"] == null ? 0 : Int32.Parse(Request["ContentId"].ToString());

                    if (entity.ID <= 0) //添加
                    {
                        FK_RELATIONID        = Guid.NewGuid().ToString();
                        entity.FK_RELATIONID = FK_RELATIONID;
                        entity.Fk_DepartId   = this.CurrentUser.DptInfo == null ? "" : this.CurrentUser.DptInfo.ID;
                        entity.CreateUser    = CurrentUser.Name;
                        entity.CreateDate    = DateTime.Now;
                        entity.UpdateUser    = CurrentUser.Name;
                        entity.UpdateDate    = DateTime.Now;
                    }
                    else //修改
                    {
                        FK_RELATIONID     = entity.FK_RELATIONID;
                        entity.UpdateUser = CurrentUser.Name;
                        entity.UpdateDate = DateTime.Now;
                        isEdit            = true;
                    }
                    //同部门下 客户名称不能重复
                    if (!this.BussinessCustomerManage.IsExist(p => p.CompanyName.Equals(entity.CompanyName) && p.ID != entity.ID && p.Fk_DepartId == entity.Fk_DepartId))
                    {
                        using (TransactionScope ts = new TransactionScope())
                        {
                            try
                            {
                                if (this.BussinessCustomerManage.SaveOrUpdate(entity, isEdit))
                                {
                                    if (contentId <= 0)
                                    {
                                        this.ContentManage.Save(new Domain.COM_CONTENT()
                                        {
                                            CONTENT       = Request["Content"],
                                            FK_RELATIONID = FK_RELATIONID,
                                            FK_TABLE      = "SYS_BUSSINESSCUSTOMER",
                                            CREATEDATE    = DateTime.Now
                                        });
                                    }
                                    else
                                    {
                                        this.ContentManage.Update(new Domain.COM_CONTENT()
                                        {
                                            ID            = contentId,
                                            CONTENT       = Request["Content"],
                                            FK_RELATIONID = FK_RELATIONID,
                                            FK_TABLE      = "SYS_BUSSINESSCUSTOMER",
                                            CREATEDATE    = DateTime.Now
                                        });
                                    }
                                    json.Status = "y";
                                }

                                ts.Complete();
                            }
                            catch (Exception e)
                            {
                                json.Msg = "保存客户信息发生内部错误!";
                                WriteLog(Common.Enums.enumOperator.None, "保存客户错误:", e);
                            }
                        }
                    }
                    else
                    {
                        json.Msg = "客户已经存在,请不要重复添加!";
                    }
                }
                else
                {
                    json.Msg = "未找到要操作的客户记录";
                }
                if (isEdit)
                {
                    WriteLog(Common.Enums.enumOperator.Edit, "修改客户[" + entity.CompanyName + "],结果:" + json.Msg, Common.Enums.enumLog4net.INFO);
                }
                else
                {
                    WriteLog(Common.Enums.enumOperator.Add, "添加客户[" + entity.CompanyName + "],结果:" + json.Msg, Common.Enums.enumLog4net.INFO);
                }
            }
            catch (Exception e)
            {
                json.Msg = "保存客户信息发生内部错误!";
                WriteLog(Common.Enums.enumOperator.None, "保存客户错误:", e);
            }
            return(Json(json));
        }