コード例 #1
0
        // GET: WeShop
        public ActionResult Index()
        {
            WeShop m = WeShopService.instance().GetEneityByCompanyID(UserDateTicket.Company.ID);

            if (m == null)
            {
                m = new WeShop();
            }
            return(View(m));
        }
コード例 #2
0
ファイル: DbContextFactory.cs プロジェクト: 903682959/WeShop
        public static WeShop CreateDbContext()
        {
            WeShop dBContext = CallContext.GetData("DbContext") as WeShop;

            if (dBContext == null)
            {
                dBContext = new WeShop();
                CallContext.SetData("DbContext", dBContext);
            }
            return(dBContext);
        }
コード例 #3
0
        public static WeShop GenInstance()
        {
            WeShop dbcontext = CallContext.GetData("DbContext") as WeShop;

            if (dbcontext == null)
            {
                dbcontext = new WeShop();
                CallContext.SetData("DbContext", dbcontext);
            }
            return(dbcontext);
        }
コード例 #4
0
        public static WeShop GenInstance()
        {
            WeShop wshop = CallContext.GetData("DbContext") as WeShop;

            if (wshop == null)
            {
                wshop = new WeShop();
                CallContext.SetData("DbContext", wshop);//如果通道中没有该参数,则向通道中添加该参数
                return(wshop);
            }
            return(wshop);
        }
コード例 #5
0
        public static WeShop GetIntance()
        {
            //CallContext是一个线程槽,一个请求就是一个线程,如果数据上下文存在,就直接从线程槽里拿出来用
            var _dbContext = CallContext.GetData("dbContext") as WeShop;

            //如果数据存在,就创建一个,放进线程槽,供线程的下次操作使用
            if (_dbContext == null)
            {
                _dbContext = new WeShop();
                CallContext.SetData("dbContext", _dbContext);
            }

            return(_dbContext);
        }
コード例 #6
0
        public JsonResult Index(FormCollection form)
        {
            ResultBase_form result = new ResultBase_form();
            WeShop          m      = new WeShop();

            TryUpdateModel <WeShop>(m, form);
            m.CompanyID = UserDateTicket.Company.ID;
            if (m.ID == Guid.Empty)
            {
                result.status = WeShopService.instance().Insert(m);
            }
            else
            {
                result.status = WeShopService.instance().Update(m);
            }
            result.msg       = result.status == 0 ? "操作失败" : "操作成功";
            result.ResultURL = "/WeShop/Index";
            return(Json(result, JsonRequestBehavior.AllowGet));
        }
コード例 #7
0
        private string GetToken()
        {
            WeShop m = WeShopService.instance().GetEneityByCompanyID(UserDateTicket.Company.ID);

            return(WSApi.GetToken(m.appkey, m.secret));
        }