public ActionResult ChangeBuyConfirm([Bind(Include = "SaleBookId,SalesmanId,WXCode,WXNickname,Name,Phone,Comments,ViewConfirm,BuyConfirm,BuyUnit,Column1,Column2,Column3,CompanyId")] SaleBook model)
        {
            if (model != null)
            {
                SaleBook saleBook = db.SaleBooks.Find(model.SaleBookId);

                SetBindConfirmBinding(saleBook);

                if (saleBook != null && saleBook.BuyConfirm == BuyConfirmStateEnum.BuyConfirmed)
                {
                    ModelState.AddModelError("BuyConfirm", "已经现场确认的记录,不能够再次确认!");
                    return View("BuyConfirm", saleBook);
                    //return View(saleBook);
                }
                if (saleBook != null && saleBook.BuyConfirm == 0)
                {
                    saleBook.SalesmanId = model.SalesmanId;
                    saleBook.BuyUnit = model.BuyUnit;
                    saleBook.BuyConfirm = model.BuyConfirm;
                }
                var defConfig1 = new WXStudio.EFModel.Entities.Core.CoreConfig();

                defConfig1.Key = "BuyHouseScore";//买楼积分
                var result2 = db.CoreConfigs.Where(item => item.Key == "BuyHouseScore");
                if (result2 != null && result2.Count() > 0)
                {
                    var defConfig2 = result2.First();
                    if (defConfig2 == null)
                        return RedirectToAction("Index");

                    double d = 500;
                    if (defConfig2 != null && !string.IsNullOrEmpty(defConfig2.Value)
                        && double.TryParse(defConfig2.Value, out d))
                    {
                        var salesmanScore = db.SalesmanScores.Create();
                        salesmanScore.CompanyID = saleBook.CompanyId != null ? saleBook.CompanyId.Value : 0;
                        salesmanScore.CreateDateTimeStamp = TimeStampUtility.ToTimeStamp(DateTime.Now);
                        salesmanScore.SaleBookId = saleBook.SaleBookId;
                        salesmanScore.SalesmanId = saleBook.SalesmanId;
                        salesmanScore.ScoreValue = (float)d;
                        salesmanScore.Comments = saleBook.Comments;

                        db.SalesmanScores.Add(salesmanScore);
                    }
                }

                db.SaveChanges();
            }

            return RedirectToAction("Index");
        }
        //[AllowAnonymous]
        //[ValidateAntiForgeryToken]
        public ActionResult ChangeViewConfirm([Bind(Include = "SaleBookId,SalesmanId,WXCode,WXNickname,Name,Phone,Comments,ViewConfirm,BuyConfirm,BuyUnit,Column1,Column2,Column3,CompanyId")] SaleBook model)
        {
            if (model != null)
            {
                SaleBook saleBook = db.SaleBooks.Find(model.SaleBookId);

                this.SetViewConfirmBinding(saleBook);
                //BindingHelper1 h1 = new BindingHelper1() { Id = ViewConfirmStateEnum.Default, Name = "未确认" };
                //BindingHelper1 h2 = new BindingHelper1() { Id = ViewConfirmStateEnum.ViewConfirmed, Name = "现场确认" };

                ////var selectList = new SelectList(new SelectListItem[] { enumListitem1, enumListitem2 });
                //this.ViewData["ViewConfirmEnum"] = new SelectList(new BindingHelper1[] { h1, h2 }, "Id", "Name"); // selectList;

                //var salemans = from one in db.Salesmans
                //               select new BindingHelper1() { Id = one.SalesmanId, Name = one.Name };

                //this.ViewData["SalesmanIdEnum"] = new SelectList(salemans);

                if (saleBook != null && saleBook.ViewConfirm == ViewConfirmStateEnum.ViewConfirmed)
                {
                    ModelState.AddModelError("ViewConfirm", "已经现场确认的记录,不能够再次确认!");
                    return View("ViewConfirm", saleBook);
                    //return View(saleBook);
                }
                if (saleBook != null && saleBook.ViewConfirm == 0)
                {
                    saleBook.BuyUnit = model.BuyUnit;
                    saleBook.SalesmanId = model.SalesmanId;
                    saleBook.ViewConfirm = model.ViewConfirm;
                }

                var defConfig1 = new WXStudio.EFModel.Entities.Core.CoreConfig();

                defConfig1.Key = "ViewHouseScore";//看楼积分
                var result2 = db.CoreConfigs.Where(item => item.Key == "ViewHouseScore");
                if (result2 != null && result2.Count() > 0)
                {
                    var defConfig2 = result2.First();
                    if (defConfig2 == null)
                        return RedirectToAction("Index");

                    double d = 500;
                    if (defConfig2 != null && !string.IsNullOrEmpty(defConfig2.Value)
                        && double.TryParse(defConfig2.Value, out d))
                    {
                        var salesmanScore = db.SalesmanScores.Create();
                        salesmanScore.CompanyID = model.CompanyId != null ? model.CompanyId.Value : 0;
                        salesmanScore.CreateDateTimeStamp = TimeStampUtility.ToTimeStamp(DateTime.Now);
                        salesmanScore.SaleBookId = model.SaleBookId;
                        salesmanScore.SalesmanId = model.SalesmanId;
                        salesmanScore.ScoreValue = (float)d;
                        salesmanScore.Comments = model.Comments;

                        db.SalesmanScores.Add(salesmanScore);
                    }
                }

                db.SaveChanges();
            }

            return RedirectToAction("Index");
        }