public ActionResult DistributionOpen()
        {
            ViewDistributionOpen model = new ViewDistributionOpen();

            using (var db = new EFContext())
            {
                var shopdistribution = db.selshopdistribution.FirstOrDefault(x => x.ShopID == ShopId);

                //if (shopdistribution == null || shopdistribution.IsSignAgreement == false)
                //{
                //    return RedirectToAction("DistributionContract");
                //}

                model.IsOpen          = shopdistribution.IsOpen;
                model.IsSignAgreement = shopdistribution.IsSignAgreement;
            }
            return(View(model));
        }
        public ActionResult SaveDistributionOpen(ViewDistributionOpen model)
        {
            ViewBase b = new ViewBase();

            try
            {
                using (var db = new EFContext())
                {
                    var shopdistribution = db.selshopdistribution.FirstOrDefault(x => x.ShopID == ShopId);

                    if (shopdistribution == null || shopdistribution.IsSignAgreement == false)
                    {
                        b.Code    = 1;
                        b.Message = "签署合同后才能开启";
                        b.Url     = "/DistributionBank/DistributionContract";
                        return(Json(b, JsonRequestBehavior.AllowGet));
                    }
                    selshopdistributionopendetail log = new selshopdistributionopendetail()
                    {
                        ID         = WebTools.getGUID(),
                        ShopID     = ShopId,
                        CreateTime = DateTime.Now,
                        IsAuto     = false,
                        IsOpen     = model.IsOpen,
                        ManagerId  = ManagerId,
                        Remark     = string.Empty
                    };
                    db.selshopdistributionopendetail.Add(log);
                    shopdistribution.IsOpen = model.IsOpen;
                    db.SaveChanges();
                    b.Code    = 1;
                    b.Message = ConstantHelper.Success;
                    b.Url     = "/DistributionBank/DistributionOpen";
                }
            }
            catch (Exception Exc)
            {
                b.Code        = 0;
                b.Message     = ConstantHelper.Failure;
                b.Description = Exc.ToString();
            }

            return(Json(b, JsonRequestBehavior.AllowGet));
        }