示例#1
0
        public ActionResult Edit([Bind(Include = "TranContainerID,Updated,Updator,TranID,ShippingTypeID,Count,LineShippingCharge,LineShippingChargeCurrencyID,LineShippingChargeSelling,LineShippingChargeSellingCurrencyID,LineShippingChargeTotal,LineShippingChargeSellingTotal")] TranContainer trancontainer)
        {
            if (ModelState.IsValid)
            {
                db.Entry(trancontainer).State = EntityState.Modified;
                db.SaveChanges();
                Calculations.CalcTran(trancontainer.TranID, 6);
                return(RedirectToAction("Details", "Tran", new { id = trancontainer.TranID }));
            }
            ViewBag.ShippingTypeID = new SelectList(db.ShippingType, "ShippingTypeID", "ShippingTypeName", trancontainer.ShippingTypeID);
            ViewBag.TranID         = new SelectList(db.Tran, "TranID", "TranID", trancontainer.TranID);
            ViewBag.LineShippingChargeCurrencyID        = new SelectList(db.Currency, "CurrencyID", "CurrencyCode", trancontainer.LineShippingChargeCurrencyID);
            ViewBag.LineShippingChargeSellingCurrencyID = new SelectList(db.Currency, "CurrencyID", "CurrencyCode", trancontainer.LineShippingChargeSellingCurrencyID);

            var tran = db.Tran.FirstOrDefault(t => t.TranID == trancontainer.TranID);

            if (tran == null)
            {
                ViewBag.ActiveTran = null;
            }
            else
            {
                ViewBag.ActiveTran = tran;
            }
            return(View(trancontainer));
        }
示例#2
0
        // GET: /TranContainer/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            TranContainer trancontainer = db.TranContainer.Find(id);

            if (trancontainer == null)
            {
                return(HttpNotFound());
            }
            ViewBag.ShippingTypeID = new SelectList(db.ShippingType, "ShippingTypeID", "ShippingTypeName", trancontainer.ShippingTypeID);
            //ViewBag.TranID = new SelectList(db.Tran, "TranID", "TranID", trancontainer.TranID);
            ViewBag.LineShippingChargeCurrencyID        = new SelectList(db.Currency, "CurrencyID", "CurrencyCode", trancontainer.LineShippingChargeCurrencyID);
            ViewBag.LineShippingChargeSellingCurrencyID = new SelectList(db.Currency, "CurrencyID", "CurrencyCode", trancontainer.LineShippingChargeSellingCurrencyID);

            var tran = db.Tran.FirstOrDefault(t => t.TranID == trancontainer.TranID);

            if (tran == null)
            {
                ViewBag.ActiveTran = null;
            }
            else
            {
                ViewBag.ActiveTran = tran;
            }

            return(View(trancontainer));
        }
示例#3
0
        public async Task <ActionResult> DeleteConfirmed(int id)
        {
            TranContainer trancontainer = await db.TranContainer.FindAsync(id);

            db.TranContainer.Remove(trancontainer);
            Calculations.CalcTran(trancontainer.TranID, 6);
            await db.SaveChangesAsync();

            Calculations.CalcTran(trancontainer.TranID, 6);
            return(RedirectToAction("Details", "Tran", new { id = trancontainer.TranID }));
        }
示例#4
0
        // GET: /TranContainer/Delete/5
        public async Task <ActionResult> Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            TranContainer trancontainer = await db.TranContainer.FindAsync(id);

            if (trancontainer == null)
            {
                return(HttpNotFound());
            }
            return(View(trancontainer));
        }
示例#5
0
        public async Task <ActionResult> CreateByTranID([Bind(Include = "TranContainerID,Updated,Updator,TranID,ShippingTypeID,Count,LineShippingCharge,LineShippingChargeCurrencyID,LineShippingChargeSelling,LineShippingChargeSellingCurrencyID,LineShippingChargeTotal,LineShippingChargeSellingTotal")] TranContainer trancontainer)
        {
            if (ModelState.IsValid)
            {
                db.TranContainer.Add(trancontainer);
                await db.SaveChangesAsync();

                //return RedirectToAction("Index");

                Calculations.CalcTran(trancontainer.TranID, 6);
                return(RedirectToAction("Details", "Tran", new { id = trancontainer.TranID }));
            }

            ViewBag.ShippingTypeID = new SelectList(db.ShippingType, "ShippingTypeID", "ShippingTypeName", trancontainer.ShippingTypeID);
            ViewBag.TranID         = new SelectList(db.Tran, "TranID", "TranID", trancontainer.TranID);
            ViewBag.LineShippingChargeCurrencyID        = new SelectList(db.Currency, "CurrencyID", "CurrencyCode", trancontainer.LineShippingChargeCurrencyID);
            ViewBag.LineShippingChargeSellingCurrencyID = new SelectList(db.Currency, "CurrencyID", "CurrencyCode", trancontainer.LineShippingChargeSellingCurrencyID);
            return(View());
        }
示例#6
0
 //This method gets called by the runtime. Use this method to add services to the container.
 public void ConfigureServices(IServiceCollection services)
 {
     TranContainer.Build();
     TranContainer.Start();
     //跨域设置
     services.AddCors(options =>
     {
         options.AddPolicy("hydra.admin", builder =>
         {
             builder
             .AllowAnyOrigin()
             .AllowAnyMethod()
             .AllowAnyHeader()
             .AllowCredentials();//指定处理cookie
         });
     });
     //(DI)注入使用的类
     services.AddScoped(typeof(IAdminService), typeof(AdminService));
     services.AddScoped(typeof(IMenuService), typeof(MenuService));
     services.AddScoped(typeof(IRoleService), typeof(RoleService));
     services.AddScoped(typeof(IConfigService), typeof(ConfigService));
     services.AddScoped(typeof(ILogsService), typeof(LogsService));
     services.AddScoped(typeof(IAnalysisDashBoardService), typeof(AnalysisDashBoardService));
     services.AddScoped(typeof(IAnalysisRemainService), typeof(AnalysisRemainService));
     services.AddScoped(typeof(IAnalysisGameProfitService), typeof(AnalysisGameProfitService));
     services.AddScoped(typeof(IplayerGoldService), typeof(playerGoldService));
     services.AddScoped(typeof(IplayerBetsService), typeof(playerBetsService));
     services.AddScoped(typeof(IplayerOnlineService), typeof(playerOnlineService));
     //AutoMapper 注册
     AutoMapperConfiguration.Register();
     DbConfig.MasterDB = Configuration["AppSettings:MasterDB"];
     DbConfig.GameAPI  = Configuration["AppSettings:GameAPI"];
     services.AddMvc(cfg =>
     {
         cfg.Filters.Add(new AuthorizationFilter());
     });
 }