public LuaScriptResourceBagViewModel(BagViewModel parentViewModel) : base(parentViewModel) { ExportFilter += "|Lua File|*.lua"; CurrentResourceView = new ScriptSourceTextView(); CurrentResourceView.DataContext = new LuaScriptResourceViewModel(); }
public ManifestBagViewModel(BagViewModel parentViewModel) : base(parentViewModel) { ExportFilter += "|Manifest Dump|*.txt"; CurrentResourceView = new CommonUI.Views.ResourceViews.ManifestResourceView(); CurrentResourceView.DataContext = new ManifestResourceViewModel(); }
public JsonResult Index(int Id, string Size) { BagViewModel objShoppingCartModel = new BagViewModel(); Cloth objItem = shoppingEntities.Clothes.Single(model => model.Id == Id); if (Session["CartCounter"] != null) { listOfShoppingCartModels = Session["CartItem"] as List <BagViewModel>; } if (listOfShoppingCartModels.Any(m => m.Id == Id && m.Size == Size)) { objShoppingCartModel = listOfShoppingCartModels.Single(m => m.Id == Id && m.Size == Size); objShoppingCartModel.Quantity = objShoppingCartModel.Quantity + 1; objShoppingCartModel.Total = objShoppingCartModel.Quantity * objShoppingCartModel.UnitPrice; } else { objShoppingCartModel.Id = Id; objShoppingCartModel.Image = objItem.Image; objShoppingCartModel.ItemName = objItem.Name; objShoppingCartModel.Size = Size; objShoppingCartModel.Quantity = 1; objShoppingCartModel.Total = objItem.Price; objShoppingCartModel.UnitPrice = objItem.Price; listOfShoppingCartModels.Add(objShoppingCartModel); } Session["CartCounter"] = listOfShoppingCartModels.Count; Session["CartItem"] = listOfShoppingCartModels; return(Json(new { Success = true, Counter = listOfShoppingCartModels.Count }, JsonRequestBehavior.AllowGet)); }
public AudioMaterialResourceBagViewModel(BagViewModel parentViewModel) : base(parentViewModel) { ExportFilter += "|JSON File|*.json"; CurrentResourceView = new AudioMaterialResourceView(); CurrentResourceView.DataContext = new AudioMaterialResourceViewModel(); }
public Bag() { InitializeComponent(); BindingContext = new BagViewModel(); this.BackgroundImage = "background.jpg"; }
public PickableModelResourceBagViewModel(BagViewModel parentViewModel) : base(parentViewModel) { ExportFilter += "|JSON File|*.json"; CurrentResourceView = new PickableModelResourceView(); CurrentResourceView.DataContext = new PickableModelResourceViewModel(); }
public async Task <IActionResult> Create(BagViewModel model) { if (ModelState.IsValid) { model.Bag.ImagePath = ""; if (model.ImageFile != null) { var file = model.ImageFile; var fileName = ContentDispositionHeaderValue.Parse(file.ContentDisposition).FileName.Trim('"'); // FileName returns "fileName.ext"(with double quotes) if (fileName.EndsWith(".jpg")) // Important for security { var filePath = Path.Combine(_hostingEnvironment.WebRootPath, "uploads", fileName); using (var fileStream = new FileStream(filePath, FileMode.Create)) { await file.CopyToAsync(fileStream); } model.Bag.ImagePath = fileName; } } _context.Add(model.Bag); await _context.SaveChangesAsync(); return(RedirectToAction("Index")); } ViewData["CategoryID"] = new SelectList(_context.Categories, "ID", "ID", model.Bag.CategoryID); ViewData["SupplierID"] = new SelectList(_context.Suppliers, "ID", "ID", model.Bag.SupplierID); return(View(model)); }
public WorldChunkSourceBagViewModel(BagViewModel parentViewModel) : base(parentViewModel) { ExportFilter += "|JSON File|*.json"; CurrentResourceView = new WorldChunkSourceView(); CurrentResourceView.DataContext = new WorldChunkSourceViewModel(); }
//Просмотр корзины public IActionResult Index() { var bag = _db.Orders.Where(x => x.OrderStatus == Order.Status.Bag) .Include(x => x.Items) .ThenInclude(x => x.Product).FirstOrDefault(); if (bag == null) { bag = new Order(); _db.Orders.Add(bag); _db.SaveChanges(); } BagViewModel bagViewModel = new BagViewModel { Items = bag.Items .Select(x => new BagItemViewModel { Id = x.Id, Name = x.Product.Name, Count = x.Count, Price = x.Product.Price }).ToList() }; return(View(bagViewModel)); }
public IHttpActionResult GetAllMachineBags() { PillarsaltDbContext db = new PillarsaltDbContext(); BagViewModel bagViewModel = new BagViewModel(); bagViewModel.TmsMachineBagses = db.TMS_MachineBags.ToList(); bagViewModel.TmsDepositeBags = db.TMS_DepositeBag.ToList().ToList(); bagViewModel.TmsMachineBrands = db.TMS_Machine_BrandandModels.ToList(); var qry = from d in _machineBagsBll.GetAll() join b in bagViewModel.TmsMachineBrands on d.MachineId equals b.Id join t in bagViewModel.TmsMachineDocumentses on d.MachineId equals t.Id join p in bagViewModel.TmsDepositeBags on d.BagId equals p.Id select new { t.MachineName, machineId = b.Id, mBagNo = p.BagNo, d.Id, d.Notes, d.MachineId, d.BagId, d.StaffId, d.Amount, d.CurrentStage, d.UserId, d.AttachDate, d.Active }; return(Ok(qry.ToList())); }
public ClusterDefinitionResourceBagViewModel(BagViewModel parentViewModel) : base(parentViewModel) { ExportFilter += "|JSON File|*.json"; CurrentResourceView = new ClusterDefinitionResourceView(); CurrentResourceView.DataContext = new ClusterDefinitionResourceViewModel(); }
public CreateBagView(BagViewModel viewModel) { InitializeComponent(); _viewModel = viewModel; DataContext = _viewModel; }
public ActionResult Buy(int id) { Items db = new Items(); Item item = db.ItemsUnites.Single(x => x.Id == id); BagViewModel bvm = new BagViewModel(); bvm.ItemsModel = item; return(View(bvm)); }
public async Task <IActionResult> Edit(int id, BagViewModel viewModel) { if (id != viewModel.Bag.ID) { return(NotFound()); } if (ModelState.IsValid) { viewModel.Bag.ImagePath = ""; if (viewModel.ImageFile != null) { var file = viewModel.ImageFile; var fileName = ContentDispositionHeaderValue.Parse(file.ContentDisposition).FileName.Trim('"'); // FileName returns "fileName.ext"(with double quotes) if (fileName.EndsWith(".jpg")) // Important for security { var filePath = Path.Combine(_hostingEnvironment.WebRootPath, "uploads", fileName); using (var fileStream = new FileStream(filePath, FileMode.Create)) { await file.CopyToAsync(fileStream); } viewModel.Bag.ImagePath = fileName; } } try { _context.Update(viewModel.Bag); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!BagExists(viewModel.Bag.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction("Index")); } ViewData["CategoryID"] = new SelectList(_context.Categories, "ID", "Name", viewModel.Bag.CategoryID); ViewData["SupplierID"] = new SelectList(_context.Suppliers, "ID", "Name", viewModel.Bag.SupplierID); return(View(viewModel.Bag)); }
public void OnClick() { BagViewModel bvm = viewModels.FindObject <BagViewModel>(); BagEntity bentity = utilsEntity.GetEntity <BagEntity>(bvm.gameObject); bentity.OpenClose = true; ConfigViewModel cvm = viewModels.FindObject <ConfigViewModel>(); ConfigEntity entity = utilsEntity.GetEntity <ConfigEntity>(cvm.gameObject); entity.OpenClose = false; }
public async Task <IActionResult> Edit(int?id, bool?copy) { Bagsmvc bag = new Bagsmvc(); BagViewModel bvm = new BagViewModel(); bvm.People = await _cache.GetFromTable(_context.People); bvm.People = bvm.People.OrderBy(x => x.FirstName).ToList(); ViewBag.Operation = "Edit This"; // First set up the bagtype dropdown // When id is not null, we are editing or copying. Otherwise, we're creating // EDIT a bag if (id != null) { var allbags = await _cache.GetFromTable(_context.Bags); bag = allbags.FirstOrDefault(x => x.Id == id); } else // CREATE a new blank bag { ViewBag.Operation = "Newly Created"; await _context.Bags.AddAsync(bag); await _context.SaveChangesAsync();; await _cache.GetFromTable(true, _context.Bags); } // COPY a bag // This is a real hack. Once the button is hit, the bag is copied and saved to the db. Setting Id = 0 somehow // indicates to the Entity Framework to add the record in with a newly generated ID. // Also, since we don't want an exact copy, bring user to edit screen to make the changes. if (copy != null) { ViewBag.Operation = "Recently Copied"; bag.Id = 0; bag.Links = null; bag.Person = null; // This is required because the instance of Person is being 'tracked' elsewhere await _context.Bags.AddAsync(bag); await _context.SaveChangesAsync(); // await _cache.AddItem(bag, _context.Bags); await _cache.GetFromTable(true, _context.Bags); } bvm.Bag = bag; bvm.TypeOfBag = await _cache.GetFromTable(_context.Types); return(View(bvm)); }
public ActionResult Buy(BagViewModel bag) { if (small_online_store.Models.CurrentUser.instance != null) { Order order = new Order(); order.Quantity = 1; order.Size = bag.OrderModel.Size; order.ItemId = bag.ItemsModel.Id; return(RedirectToAction("Create", "Orders", order)); } else { return(RedirectToAction("Create", "Users")); } }
public IHttpActionResult GetMachineBagsById(int id) { var contact = _machineBagsBll.GetById(id); if (contact.Any()) { PillarsaltDbContext db = new PillarsaltDbContext(); BagViewModel bagViewModel = new BagViewModel { TmsMachineBagses = db.TMS_MachineBags.ToList(), TmsDepositeBags = db.TMS_DepositeBag.ToList().ToList(), TmsMachineDocumentses = db.TMS_Machine_Documents.ToList() }; var qry = from d in _machineBagsBll.GetById(id) join b in bagViewModel.TmsMachineDocumentses on d.MachineId equals b.Id join p in bagViewModel.TmsDepositeBags on d.BagId equals p.Id select new { b.MachineName, machineId = b.Id, mBagNo = p.BagNo, d.Id, d.Notes, d.MachineId, d.BagId, d.StaffId, d.Amount, d.CurrentStage, d.UserId, d.AttachDate, d.Active }; return(Ok(qry.ToList())); } else { return(Json(new { Msg = "0", Reason = "Recordset is empty!" })); } }
// GET: Bags/Edit/5 public async Task <IActionResult> Edit(int?id) { if (id == null) { return(NotFound()); } var bag = await _context.Bags.SingleOrDefaultAsync(m => m.ID == id); if (bag == null) { return(NotFound()); } var viewModel = new BagViewModel { Bag = bag }; ViewData["CategoryID"] = new SelectList(_context.Categories, "ID", "Name", bag.CategoryID); ViewData["SupplierID"] = new SelectList(_context.Suppliers, "ID", "Name", bag.SupplierID); return(View(viewModel)); }
public IHttpActionResult GetMachineBagsByContext(string sValue) { if (sValue != null) { PillarsaltDbContext db = new PillarsaltDbContext(); BagViewModel bagViewModel = new BagViewModel { TmsMachineBagses = db.TMS_MachineBags.ToList(), TmsDepositeBags = db.TMS_DepositeBag.ToList().ToList(), TmsMachineDocumentses = db.TMS_Machine_Documents.ToList() }; var qry = from d in _machineBagsBll.GetAll().Where(m => m.MachineId != null && m.MachineId.Equals(sValue)) join b in bagViewModel.TmsMachineDocumentses on d.MachineId equals b.Id join p in bagViewModel.TmsDepositeBags on d.BagId equals p.Id select new { b.MachineName, machineId = b.Id, mBagNo = p.BagNo, d.Id, d.Notes, d.MachineId, d.BagId, d.StaffId, d.Amount, d.CurrentStage, d.UserId, d.AttachDate, d.Active }; return(Ok(qry.ToList())); } return(Json(new { Msg = "0" })); }
public SoundResourceBagViewModel(BagViewModel parentViewModel) : base(parentViewModel) { ExportFilter += "|Wav Sound|*.wav"; CurrentResourceView = new SoundResourceView(); CurrentResourceView.DataContext = new SoundResourceViewModel(); }
public async Task <ActionResult> Edit(BagViewModel bvm, IFormCollection collection, List <IFormFile> files) { if (ModelState.IsValid) { Boolean RefreshLinks = false; try { Linksmvccore Link = new Linksmvccore(); // Not only do we update the bag, automatically create a link // Only do this if a Person was selected AND if link doesn't already exist if (bvm.Bag.PersonID != 0 && bvm.Bag.PersonID != null) { List <Linksmvccore> alllinks = await _cache.GetFromTable(_context.Links); Linksmvccore link = alllinks.FirstOrDefault(x => x.BagId == bvm.Bag.Id && x.PersonId == (int)bvm.Bag.PersonID); // No, the current link doesn't already exist, so save a new one if (link == null) { Link.PersonId = (int)bvm.Bag.PersonID; Link.BagId = bvm.Bag.Id; await _context.Links.AddAsync(Link); RefreshLinks = true; } } foreach (var file in files) { if (file != null || file.Length != 0) { String path = Path.Combine( Directory.GetCurrentDirectory(), "wwwroot\\images", file.FileName); // This works with HostGator on mvc.fitpacking.com!! //path = "wwwroot\\images\\" + file.FileName; // return Content(path); using (var stream = new FileStream(path, FileMode.Create)) { await file.CopyToAsync(stream); } } } //TempData["debug"] = bvm.Bag.CopyFile(bvm.Bag.FrontFileName); ////bvm.Bag.CopyFile(bvm.Bag.BackFileName); ////bvm.Bag.CopyFile(bvm.Bag.BottomFileName); // But mainly, we're here to update the bag _context.Bags.Update(bvm.Bag); await _context.SaveChangesAsync(); // Refresh the cache. To update Navigation properties, an update of People is required as well await _cache.GetFromTable(true, _context.Bags); await _cache.GetFromTable(RefreshLinks, _context.Links); await _cache.GetFromTable(RefreshLinks, _context.People); return(RedirectToAction(nameof(Index))); } catch (Exception e) { return(View()); } } return(View(bvm.Bag)); }
public BagPage() { InitializeComponent(); BindingContext = new BagViewModel(new DiceService(), DiceDataBase, new Bag()); }
public GeometryResourceBagViewModel(BagViewModel parentViewModel) : base(parentViewModel) { //ExportFilter += "|Fbx File (Download)|*.fbx"; CurrentResourceView = new GeometryResourceView(); CurrentResourceView.DataContext = new GeometryResourceViewModel(); }
public BagView() { InitializeComponent(); BindingContext = new BagViewModel(); }
public ScriptCompiledBytecodeResourceViewModel(BagViewModel parentViewModel) : base(parentViewModel) { ExportFilter += "|.Net Assembly|*.dll"; }