void Awake() { var viewPrefab = Instantiate(_viewPrefab); var input = viewPrefab.ShopController; var view = viewPrefab.ShopView; var database = new Database(); var dataAccess = new ShopDataAccess(database); var viewModel = new ShopViewModel(); // var itemCreator = new StandardLazyItemCreator( new List<ItemBluePrint>{new ItemBluePrint{Id = 1, UsageAction =() => { } }} ); var itemCreator = new InternetDependantItemCreator(); var inventory = new InventoryEntity(itemCreator); var prices = dataAccess.ItemPrices(); var resources = new ResourceEntity(); var shop = new ShopEntity(inventory, resources, new ItemPriceData { Prices = prices }); var useCaseInteractor = new BuyItemUseCase(dataAccess, viewModel, shop, inventory); view.Initialize(viewModel); input.Initialize(useCaseInteractor); }
/// <summary> /// 过期日期预警 3分之二 黄色 过期了红色 /// </summary> /// <param name="entity"></param> /// <returns></returns> private static string colorStyle(InventoryEntity entity) { DateTime startTime = Convert.ToDateTime(entity.ProductDate); DateTime endTime = Convert.ToDateTime(entity.ExpDate); TimeSpan ts = endTime - startTime; //过期了红色 if (DateTime.Now > entity.ExpDate) { return("style=background-color:red"); } DateTime startNowTime = DateTime.Now; TimeSpan tsNow = endTime - startNowTime; int days = ts.Days - tsNow.Days; if (entity.goods != null) { int totalDays = Datehelper.getDays(entity.goods.exDate.ToInt(0), entity.goods.exUnits); if (days / totalDays > 3) { return("style=background-color:yellow"); } } return(""); }
public static bool ModifyInventory(InventoryEntity entity) { long result = 0; if (entity != null) { InventoryRepository mr = new InventoryRepository(); InventoryInfo InventoryInfo = TranslateInventoryInfo(entity); if (entity.InventoryID > 0) { InventoryInfo.InventoryID = entity.InventoryID; InventoryInfo.ChangeDate = DateTime.Now; result = mr.ModifyInventory(InventoryInfo); } else { InventoryInfo.ChangeDate = DateTime.Now; InventoryInfo.CreateDate = DateTime.Now; result = mr.CreateNew(InventoryInfo); } } return(result > 0); }
public ReactorEntity(CubeGridEntity parent, MyObjectBuilder_Reactor definition) : base(parent, definition) { m_Inventory = new InventoryEntity(definition.Inventory); m_lastInventoryRefresh = DateTime.Now; }
public BuyItemUseCase(IShopDataAccess shopDataAccess, IShopBuyItemOutput shopBuyItemOutput, ShopEntity shop, InventoryEntity inventory) { _shopDataAccess = shopDataAccess; _shopBuyItemOutput = shopBuyItemOutput; _shop = shop; _inventory = inventory; }
private static InventoryInfo TranslateInventoryInfo(InventoryEntity entity) { InventoryInfo info = new InventoryInfo(); if (entity != null) { info.InventoryID = entity.InventoryID; info.GoodsID = entity.GoodsID; info.StorageID = entity.StorageID; info.Quantity = entity.Quantity; info.CustomerID = entity.CustomerID; info.InventoryType = entity.InventoryType; info.BatchNumber = entity.BatchNumber; info.ProductDate = entity.ProductDate; info.InventoryDate = entity.InventoryDate; info.UnitPrice = entity.UnitPrice; info.Remark = entity.Remark; info.IsLock = entity.IsLock; info.InventoryStatus = entity.InventoryStatus; info.OperatorID = entity.OperatorID; info.CreateDate = entity.CreateDate; info.ChangeDate = entity.ChangeDate; info.InventoryID = entity.InventoryID; } return(info); }
public ReactorEntity( CubeGridEntity parent, MyObjectBuilder_Reactor definition ) : base(parent, definition) { m_Inventory = new InventoryEntity( definition.Inventory ); m_lastInventoryRefresh = DateTime.Now; }
public ReactorEntity( CubeGridEntity parent, MyObjectBuilder_Reactor definition, Object backingObject ) : base(parent, definition, backingObject) { m_Inventory = new InventoryEntity( definition.Inventory, InternalGetReactorInventory( ) ); m_lastInventoryRefresh = DateTime.Now; }
public ReactorEntity(CubeGridEntity parent, MyObjectBuilder_Reactor definition, Object backingObject) : base(parent, definition, backingObject) { m_Inventory = new InventoryEntity(definition.Inventory, InternalGetReactorInventory( )); m_lastInventoryRefresh = DateTime.Now; }
/// <summary> /// 设置商品 /// </summary> /// <param name="count"></param> public virtual void SetInventory(int count) { InvokeItemLoader("Inventory"); if (Inventory == null || Inventory.Id == 0) { if (Purchase == null || Purchase.Storehouse == null || Product == null || Product.Id == 0) { return; } Inventory = new InventoryEntity { SaveType = SaveType.Add, Product = Product, Storehouse = Purchase.Storehouse, LockCount = 0, TransitCount = count, Recycle = 0, WarningCount = 0 }; return; } Inventory.TransitCount += count; if (Product.SaveType == SaveType.None) { Inventory.SetProperty(it => it.TransitCount); Inventory.SaveType = SaveType.Modify; } else if (Inventory.Properties != null) { Inventory.SetProperty(it => it.TransitCount); } }
private InventoryEntity GetItems(uint address, Inventory.Container type) { var offset = (uint)((int)type * 24); var containerAddress = MemoryHandler.Instance.GetUInt32(address, offset); var container = new InventoryEntity { Amount = MemoryHandler.Instance.GetByte(address, offset + 0x8), Items = new List <ItemInfo>(), Type = type }; for (var ci = 0; ci < 1600; ci += 64) { var itemOffset = (uint)(containerAddress + ci); var id = MemoryHandler.Instance.GetUInt32(itemOffset, 0x8); if (id > 0) { container.Items.Add(new ItemInfo { ID = id, Slot = MemoryHandler.Instance.GetByte(itemOffset, 0x4), Amount = MemoryHandler.Instance.GetByte(itemOffset, 0xC), SB = MemoryHandler.Instance.GetUInt16(itemOffset, 0x10), Durability = MemoryHandler.Instance.GetUInt16(itemOffset, 0x12), GlamourID = MemoryHandler.Instance.GetUInt32(itemOffset, 0x30) }); } } return(container); }
public Inventory(InventoryEntity InventoryEntity) : base(InventoryEntity) { if (InventoryEntity.InputEntities != null) { this.Inputs = new HashSet <Input>(); foreach (InputEntity InputEntity in InventoryEntity.InputEntities) { InputEntity.InventoryId = InventoryEntity.Id; this.Inputs.Add(new Input(InputEntity)); } } if (InventoryEntity.InventoryCheckpointEntities != null) { this.InventoryCheckpoints = new HashSet <InventoryCheckpoint>(); foreach (InventoryCheckpointEntity InventoryCheckpointEntity in InventoryEntity.InventoryCheckpointEntities) { InventoryCheckpointEntity.InventoryId = InventoryEntity.Id; this.InventoryCheckpoints.Add(new InventoryCheckpoint(InventoryCheckpointEntity)); } } if (InventoryEntity.OutputEntities != null) { this.Outputs = new HashSet <Output>(); foreach (OutputEntity OutputEntity in InventoryEntity.OutputEntities) { OutputEntity.InventoryId = InventoryEntity.Id; this.Outputs.Add(new Output(OutputEntity)); } } }
public static void GetInventoryInfoToWrite(int ProductSysNo, string CurrentStatus) { int AffectedVirtualQty = 0; InventoryEntity inventory = SecKillDA.GetInventoryByProductSysNo(ProductSysNo); if (inventory != null) { AffectedVirtualQty = inventory.VirtualQty; } //获取当前的分仓的虚库数量 List <InventoryStockEntity> Invstocklist = SecKillDA.GetInventoryStock(ProductSysNo); StringBuilder stockvirtualqty = new StringBuilder(); foreach (InventoryStockEntity itemStock in Invstocklist) { stockvirtualqty.Append(string.Format("{0}:{1};", itemStock.StockSysNo, itemStock.VirtualQty)); } string msg = DateTime.Now.ToString() + " 商品:" + ProductSysNo.ToString() + " " + CurrentStatus + " \r\n\t Inventory--VirtualQty: " + AffectedVirtualQty + "\r\n InventoryStock--VirtualQty: " + stockvirtualqty; WriteLog(msg); bool sendmailflag = Convert.ToBoolean(ConfigurationManager.AppSettings["SendMailFlag"]); if (sendmailflag == true) { SecKillDA.SendMailAboutInventoryInfo(msg, ProductSysNo, CurrentStatus); } }
public List <InventoryEntity> ReadData() { List <InventoryEntity> list = new List <InventoryEntity>(); // Read the Excel file as byte array byte[] bin = File.ReadAllBytes(path); // Create a new Excel package in a memorystream using (MemoryStream stream = new MemoryStream(bin)) using (ExcelPackage excelPackage = new ExcelPackage(stream)) { ExcelWorksheet workSheet = excelPackage.Workbook.Worksheets[3]; int startRow = 2; for (int i = startRow; i <= workSheet.Dimension.End.Row; i++) { string product = workSheet.Cells[i, 1].Value.ToString(); string category = workSheet.Cells[i, 2].Value.ToString(); string warehouse = workSheet.Cells[i, 3].Value.ToString(); string quantity = workSheet.Cells[i, 4].Value.ToString(); InventoryEntity inventoryEntity = new InventoryEntity { Id = Guid.NewGuid(), CategoryPath = category, ProductCode = product, WarehouseCode = warehouse, Quantity = Int32.Parse(quantity) }; list.Add(inventoryEntity); } } return(list); }
public ReactorEntity(CubeGridEntity parent, MyObjectBuilder_Reactor definition, Object backingObject) : base(parent, definition, backingObject) { m_Inventory = new InventoryEntity(definition.Inventory, InternalGetReactorInventory()); m_powerProducer = new PowerProducer(Parent.PowerManager, ActualObject); m_lastInventoryRefresh = DateTime.Now; }
public ActionResult GetData() { using (InventoryEntity db = new InventoryEntity()) { List <Request> rqlist = db.Requests.ToList <Request>(); return(Json(new { data = rqlist }, JsonRequestBehavior.AllowGet)); } }
public ReactorEntity(CubeGridEntity parent, MyObjectBuilder_Reactor definition) : base(parent, definition) { m_Inventory = new InventoryEntity(definition.Inventory); m_powerProducer = new PowerProducer(Parent.PowerManager, null); m_lastInventoryRefresh = DateTime.Now; }
public ReactorEntity(CubeGridEntity parent, MyObjectBuilder_Reactor definition, Object backingObject) : base(parent, definition, backingObject) { m_Inventory = new InventoryEntity(definition.Inventory, InternalGetReactorInventory( )); m_powerProducer = new PowerProducer(Parent.PowerManager, ActualObject); m_lastInventoryRefresh = DateTime.Now; }
public CharacterEntity(FileInfo characterFile) : base(null) { MyObjectBuilder_Character character = BaseObjectManager.LoadContentFile<MyObjectBuilder_Character, MyObjectBuilder_CharacterSerializer>(characterFile); ObjectBuilder = character; m_inventory = new InventoryEntity(character.Inventory); }
public static InventoryEntity GetInventoryByProductSysNo(int ProductSysNo) { DataCommand command = DataCommandManager.GetDataCommand("GetInventoryByProductSysNo"); command.SetParameterValue("@ProductSysNo", ProductSysNo); InventoryEntity result = command.ExecuteEntity<InventoryEntity>(); return result; }
public static InventoryEntity GetInventoryById(long gid) { InventoryEntity result = new InventoryEntity(); InventoryRepository mr = new InventoryRepository(); InventoryInfo info = mr.GetInventoryByKey(gid); result = TranslateInventoryEntity(info); return(result); }
public CharacterEntity(FileInfo characterFile) : base(null) { MyObjectBuilder_Character character = BaseObjectManager.LoadContentFile <MyObjectBuilder_Character>(characterFile); ObjectBuilder = character; m_inventory = new InventoryEntity(character.Inventory); }
public async Task <TData <string> > SaveForm(InventoryEntity entity) { TData <string> obj = new TData <string>(); await inventoryService.SaveForm(entity); obj.Data = entity.Id.ParseToString(); obj.Tag = 1; return(obj); }
public ActionResult Delete(int id) { using (InventoryEntity db = new InventoryEntity()) { Request req = db.Requests.Where(x => x.requestID == id).FirstOrDefault <Request>(); db.Requests.Remove(req); db.SaveChanges(); return(Json(new { success = true, message = "Request deleted successfully" }, JsonRequestBehavior.AllowGet)); } }
public void Create(Inventory inventory) { var Entity = new InventoryEntity { LocationId = inventory.LocationId, ProductId = inventory.ProductId, Amount = inventory.Amount }; _context.InventoryEntity.Add(Entity); _context.SaveChanges(); }
public TurretBaseEntity(CubeGridEntity parent, MyObjectBuilder_TurretBase definition) : base(parent, definition) { m_inventory = new InventoryEntity(definition.Inventory); m_shootingRange = definition.Range; m_searchingRange = m_shootingRange + 100; m_targetMeteors = definition.TargetMeteors; m_targetMissiles = definition.TargetMissiles; }
public void Update(Inventory inventory) { InventoryEntity currentEntity = _context.InventoryEntity.Find(inventory.LocationId, inventory.ProductId); int newAmount = currentEntity.Amount - inventory.Amount; var newEntity = new InventoryEntity { Amount = newAmount, LocationId = currentEntity.LocationId, ProductId = currentEntity.ProductId }; _context.Entry(currentEntity).CurrentValues.SetValues(newEntity); _context.SaveChanges(); }
public static void ModifyQuantity(InventoryEntity inventory) { //库存更新 InventoryRepository mr = new InventoryRepository(); InventoryInfo inventinfo = new InventoryInfo(); inventinfo.Quantity = inventory.Quantity;//仓库库存减去订单明细中出库库存 inventinfo.InventoryID = inventory.InventoryID; inventinfo.ChangeDate = DateTime.Now; mr.ModifyInventoryQuantity(inventinfo); }
public CharacterEntity(MyObjectBuilder_Character definition, Object backingObject) : base(definition, backingObject) { m_inventory = new InventoryEntity(definition.Inventory, InternalGetCharacterInventory()); EntityEventManager.EntityEvent newEvent = new EntityEventManager.EntityEvent(); newEvent.type = EntityEventManager.EntityEventType.OnCharacterCreated; newEvent.timestamp = DateTime.Now; newEvent.entity = this; newEvent.priority = 1; EntityEventManager.Instance.AddEvent(newEvent); }
public TurretBaseEntity(CubeGridEntity parent, MyObjectBuilder_TurretBase definition) : base(parent, definition) { m_inventory = new InventoryEntity(definition.Inventory); m_shootingRange = definition.Range; m_searchingRange = m_shootingRange + 100; m_targetMeteors = definition.TargetMeteors; m_targetMissiles = definition.TargetMissiles; m_targetMoving = definition.TargetMoving; }
public static InventoryEntity InitInventory(int productSysNo) { InventoryEntity entity = new InventoryEntity(); entity.ProductSysNo = productSysNo; DataCommand command = DataCommandManager.GetDataCommand("InsertInventory"); command.SetParameterValue("@ProductSysNo", productSysNo); command.ExecuteEntity<InventoryEntity>(); entity.InventorySysNo = Convert.ToInt32(command.GetParameterValue("@SysNo")); return entity; }
public TurretBaseEntity(CubeGridEntity parent, MyObjectBuilder_TurretBase definition, Object backingObject) : base(parent, definition, backingObject) { m_turretNetworkManager = new TurretNetworkManager(this, GetNetworkManager( )); m_inventory = new InventoryEntity(definition.Inventory, GetTurretInventory( )); m_shootingRange = definition.Range; m_searchingRange = m_shootingRange + 100; m_targetMeteors = definition.TargetMeteors; m_targetMissiles = definition.TargetMissiles; }
public InventoryEntity Create(EmployeeEntity EmployeeEntity, InventoryEntity InventoryEntity) { if (InventoryEntity == null) { throw new NotFoundException(); } Inventory Inventory = new Inventory(InventoryEntity); UnitOfWork.InventoryRepository.AddOrUpdate(Inventory); UnitOfWork.Complete(); return(Get(EmployeeEntity, Inventory.Id)); }
private static InventoryEntity GetItems(Inventory.Container type) { var InventoryPointerMap = new IntPtr(MemoryHandler.Instance.GetPlatformUInt(Scanner.Instance.Locations[Signatures.InventoryKey])); var offset = (uint)((int)type * 24); var containerAddress = MemoryHandler.Instance.GetPlatformUInt(InventoryPointerMap, offset); var container = new InventoryEntity { Amount = MemoryHandler.Instance.GetByte(InventoryPointerMap, offset + MemoryHandler.Instance.Structures.InventoryEntity.Amount), Items = new List <ItemInfo>(), TypeID = (byte)type, Type = type }; // The number of item is 50 in COMPANY's locker int limit; switch (type) { case Inventory.Container.COMPANY_1: case Inventory.Container.COMPANY_2: case Inventory.Container.COMPANY_3: limit = 3200; break; default: limit = 1600; break; } for (var i = 0; i < limit; i += 64) { var itemOffset = new IntPtr(containerAddress + i); var id = MemoryHandler.Instance.GetPlatformUInt(itemOffset, MemoryHandler.Instance.Structures.ItemInfo.ID); if (id > 0) { container.Items.Add(new ItemInfo { ID = (uint)id, Slot = MemoryHandler.Instance.GetByte(itemOffset, MemoryHandler.Instance.Structures.ItemInfo.Slot), Amount = MemoryHandler.Instance.GetByte(itemOffset, MemoryHandler.Instance.Structures.ItemInfo.Amount), SB = MemoryHandler.Instance.GetUInt16(itemOffset, MemoryHandler.Instance.Structures.ItemInfo.SB), Durability = MemoryHandler.Instance.GetUInt16(itemOffset, MemoryHandler.Instance.Structures.ItemInfo.ID), GlamourID = (uint)MemoryHandler.Instance.GetPlatformUInt(itemOffset, MemoryHandler.Instance.Structures.ItemInfo.GlamourID), //get the flag that show if the item is hq or not IsHQ = MemoryHandler.Instance.GetByte(itemOffset, MemoryHandler.Instance.Structures.ItemInfo.IsHQ) == 0x01 }); } } return(container); }
public TurretBaseEntity(CubeGridEntity parent, MyObjectBuilder_TurretBase definition, Object backingObject) : base(parent, definition, backingObject) { m_turretNetworkManager = new TurretNetworkManager(this, GetNetworkManager()); m_inventory = new InventoryEntity(definition.Inventory, GetTurretInventory()); m_shootingRange = definition.Range; m_searchingRange = m_shootingRange + 100; m_targetMeteors = definition.TargetMeteors; m_targetMissiles = definition.TargetMissiles; m_targetMoving = definition.TargetMoving; }
public ActionResult AddOrEdit(int id = 0) { if (id == 0) { return(View(new Request())); } else { using (InventoryEntity db = new InventoryEntity()) { return(View(db.Requests.Where(x => x.requestID == id).FirstOrDefault <Request>())); } } }
public SmallGatlingGunEntity( CubeGridEntity parent, MyObjectBuilder_SmallGatlingGun definition, Object backingObject ) : base( parent, definition, backingObject ) { m_inventory = new InventoryEntity( definition.Inventory, GetInventory( ) ); }
public ProductionBlockEntity(CubeGridEntity parent, MyObjectBuilder_ProductionBlock definition) : base(parent, definition) { m_inputInventory = new InventoryEntity(definition.InputInventory); m_outputInventory = new InventoryEntity(definition.OutputInventory); }
public ShipToolBaseEntity(CubeGridEntity parent, MyObjectBuilder_ShipToolBase definition, Object backingObject) : base(parent, definition, backingObject) { m_inventory = new InventoryEntity(definition.Inventory, InternalGetContainerInventory()); }
public ShipToolBaseEntity(CubeGridEntity parent, MyObjectBuilder_ShipToolBase definition) : base(parent, definition) { m_inventory = new InventoryEntity(definition.Inventory); }
public ProductionBlockEntity(CubeGridEntity parent, MyObjectBuilder_ProductionBlock definition, Object backingObject) : base(parent, definition, backingObject) { m_inputInventory = new InventoryEntity(definition.InputInventory, InternalGetInputInventory()); m_outputInventory = new InventoryEntity(definition.OutputInventory, InternalGetOutputInventory()); }
public CargoContainerEntity(CubeGridEntity parent, MyObjectBuilder_CargoContainer definition, Object backingObject) : base(parent, definition, backingObject) { m_Inventory = new InventoryEntity(definition.Inventory, InternalGetContainerInventory()); }
public CargoContainerEntity(CubeGridEntity parent, MyObjectBuilder_CargoContainer definition) : base(parent, definition) { m_Inventory = new InventoryEntity(definition.Inventory); }
public SmallGatlingGunEntity( CubeGridEntity parent, MyObjectBuilder_SmallGatlingGun definition ) : base( parent, definition ) { m_inventory = new InventoryEntity( definition.Inventory ); }
public CharacterEntity(MyObjectBuilder_Character definition) : base(definition) { m_inventory = new InventoryEntity(definition.Inventory); }
public ShipDrillEntity( CubeGridEntity parent, MyObjectBuilder_Drill definition ) : base( parent, definition ) { Inventory = new InventoryEntity( definition.Inventory ); }