Esempio n. 1
0
 private static void AddNewRecord(inventory car)
 {
     using (var repo = new InventoryRepo(new AutoLotContext()))
     {
         repo.Add(car);
     }
 }
Esempio n. 2
0
 //esther-adding POitem to cart
 protected void Submit_Click(object sender, EventArgs e)
 {
     if (validationOnTextBoxOrderQuantity() > 0)
     {
         List <POStaging> alist = new List <POStaging>();
         if (Session["StagingList"] != null)
         {
             alist = (List <POStaging>)Session["StagingList"];
         }
         inventory item         = BusinessLogic.GetInventory(itemid);
         string    suppliername = DropDownListSupplier.SelectedItem.Text;
         string    supplierid   = BusinessLogic.GetSupplierID(suppliername);
         int       orderqty     = Int32.Parse(TextBoxOrderQuantity.Text);
         double    unitprice    = Double.Parse(unitCost.Text);
         string    requiredDate = DateTime.Now.AddDays(28).ToString("yyyy-MM-dd");
         try
         {
             POStaging poItem = new POStaging(item, supplierid, orderqty, unitprice, DateTime.ParseExact(requiredDate, "yyyy-MM-dd", null), user);
             Session["StagingList"] = BusinessLogic.AddToStaging(alist, poItem);
         }
         catch (Exception ex)
         {
             Label1.Text = ex.Message;
         }
         Response.Redirect("POStagingSummary.aspx");
     }
 }
    public void addToItemInventory(int itemId, int amount)
    {
        for(int i = 0; i < iManager.items.Count; i++)
        {
            if(iManager.items[i].itemTransform.GetComponent<Item>().id == itemId)
            {
                bool isItemInList = false;
                int index = 0;
                for(int j = 0; j < items.Count; j++)
                {
                    if(items[j].item.id == itemId)
                    {
                        isItemInList = true;
                        index = j;
                    }
                }

                if(isItemInList)
                {
                    items[index].amountOfItem += amount;
                }
                else
                {
                    inventory inv = new inventory(iManager.items[i].itemTransform.GetComponent<Item>(), amount);
                    items.Add (inv);
                }
            }
        }
    }
Esempio n. 4
0
        public void DeleteTest()
        {
            inventory v = new inventory();

            using (var context = new DataContext(_seed, DBTypeEnum.Memory))
            {
                v.LocationID = AddLocation();
                v.OrderPopID = AddOrderPop();
                v.Stock      = 32;
                context.Set <inventory>().Add(v);
                context.SaveChanges();
            }

            PartialViewResult rv = (PartialViewResult)_controller.Delete(v.ID.ToString());

            Assert.IsInstanceOfType(rv.Model, typeof(inventoryVM));

            inventoryVM vm = rv.Model as inventoryVM;

            v         = new inventory();
            v.ID      = vm.Entity.ID;
            vm.Entity = v;
            _controller.Delete(v.ID.ToString(), null);

            using (var context = new DataContext(_seed, DBTypeEnum.Memory))
            {
                Assert.AreEqual(context.Set <inventory>().Count(), 0);
            }
        }
Esempio n. 5
0
        public void BatchDeleteTest()
        {
            inventory v1 = new inventory();
            inventory v2 = new inventory();

            using (var context = new DataContext(_seed, DBTypeEnum.Memory))
            {
                v1.LocationID = AddLocation();
                v1.OrderPopID = AddOrderPop();
                v1.Stock      = 32;
                v2.LocationID = v1.LocationID;
                v2.OrderPopID = v1.OrderPopID;
                v2.Stock      = 0;
                context.Set <inventory>().Add(v1);
                context.Set <inventory>().Add(v2);
                context.SaveChanges();
            }

            PartialViewResult rv = (PartialViewResult)_controller.BatchDelete(new string[] { v1.ID.ToString(), v2.ID.ToString() });

            Assert.IsInstanceOfType(rv.Model, typeof(inventoryBatchVM));

            inventoryBatchVM vm = rv.Model as inventoryBatchVM;

            vm.Ids = new string[] { v1.ID.ToString(), v2.ID.ToString() };
            _controller.DoBatchDelete(vm, null);

            using (var context = new DataContext(_seed, DBTypeEnum.Memory))
            {
                Assert.AreEqual(context.Set <inventory>().Count(), 0);
            }
        }
Esempio n. 6
0
    void Start()
    {
        selected_color = new Vector4(0f, 1f, 0f, 1f);          //Green
        crafting_color = new Vector4(0f, 1f, 1f, 1f);          //Cyan

        Inventory = inventory.instance;

        Inventory.on_item_changed_call_back += update_ui;

        melee_slot_ui  = GameObject.Find("melee_slot").GetComponent <inventory_slot_weapon_ui> ();
        ranged_slot_ui = GameObject.Find("ranged_slot").GetComponent <inventory_slot_weapon_ui> ();
        slots          = items_parrent.GetComponentsInChildren <inventory_slot_ui>();

        default_color = slots [selected_slot].GetComponent <Image> ().color;
        slots [selected_slot].GetComponent <Image> ().color = selected_color;

        inventory_canvas = gameObject.GetComponent <Canvas> ();

        settings = GameObject.Find("Settings").GetComponent <Settings> ();
        inventory_canvas.enabled = settings.inventory_opened;

        animator_melee = GameObject.Find("player_melee_slot").GetComponent <Animator> ();
        renderer_melee = animator_melee.gameObject.GetComponent <SpriteRenderer> ();

        animator_ranged = GameObject.Find("player_ranged_slot").GetComponent <Animator> ();
        renderer_ranged = animator_ranged.gameObject.GetComponent <SpriteRenderer> ();

        if (Inventory.on_item_changed_call_back != null)
        {
            Inventory.on_item_changed_call_back.Invoke();
        }
    }
 //esther-adding POitem to cart
 protected void Submit_Click(object sender, EventArgs e)
 {
     if (validationOnTextBoxOrderQuantity() > 0)
     {
         List <POStaging> alist = new List <POStaging>();
         if (Session["StagingList"] != null)
         {
             alist = (List <POStaging>)Session["StagingList"];
         }
         inventory item         = BusinessLogic.GetInventory(itemid);
         string    suppliername = DropDownListSupplier.SelectedItem.Text;
         string    supplierid   = BusinessLogic.GetSupplierID(suppliername);
         int       orderqty     = Int32.Parse(TextBoxOrderQuantity.Text);
         double    unitprice    = Double.Parse(unitCost.Text);
         string    requiredDate = DateTime.Now.AddDays(28).ToString("yyyy-MM-dd");
         try
         {
             POStaging poItem = new POStaging(item, supplierid, orderqty, unitprice, DateTime.ParseExact(requiredDate, "yyyy-MM-dd", null), user);
             Session["StagingList"] = BusinessLogic.AddToStaging(alist, poItem);
             String url = "ClerkInventory.aspx";
             Response.Write(BusinessLogic.MsgBox("Success: Item added to Purchase Order Staging"));
             Response.Write("<script language=JavaScript>  opener.location.replace('" + url + "'); </script>");
             Response.Write("<script language='javascript'> { window.close();}</script>");
         }
         catch (Exception ex)
         {
             Label1.Text = ex.Message;
         }
         //Response.Redirect("POStagingSummary.aspx");
     }
 }
Esempio n. 8
0
    // Start is called before the first frame update
    //private void Awake()
    //{
    //    if (instance == null)

    //    {  instance = this; DontDestroyOnLoad(this); }
    //}
    void Start()
    {
        soul = 100;
        image6.fillAmount = 100 / 100f;
        isequip           = false;
        inv = GameObject.Find("itemdatabase").GetComponent <inventory>();
        shadoweffect.SetActive(false);
        flash.SetActive(false);
        effectanimator = transform.Find("rush/cyclone").GetComponent <Animator>();
        effectanimator.gameObject.SetActive(false);
        effectanimator1 = transform.Find("rush/airflow").GetComponent <Animator>();
        effectanimator1.gameObject.SetActive(false);
        effectanimator2 = transform.Find("shadowrush1/shadow1").GetComponent <Animator>();
        effectanimator2.gameObject.SetActive(false);
        loading        = GetComponent <GameObject>();
        playanimator   = GetComponent <Animator>();
        playrigibody2d = GetComponent <Rigidbody2D>();
        audioSource    = GetComponent <AudioSource>();
        dir            = -1;
        attack1.SetActive(false);
        attack2.SetActive(false);
        attack3.SetActive(false);
        cuhealth = maxhealth;
        isdefend = false;
        shuijin1.SetActive(false);
        shuijin2.SetActive(false);
        shuijin3.SetActive(false);
        shuijin4.SetActive(false);
        shuijin5.SetActive(false);
        atk = 2;
    }
    // Use this for initialization
    void Start()
    {
        Inventory = inventory.instance;
        Inventory.itemchangedcallback += UpdateUI;

        slot = slotparent.GetComponentsInChildren <InventorySlot>();
    }
        public static InventoryModel CreateInventory(InventoryModel invm, out string error)
        {
            error = "";
            LUSSISEntities entities = new LUSSISEntities();
            inventory      inv      = new inventory();

            try
            {
                inv.itemid       = invm.Itemid;
                inv.stock        = invm.Stock;
                inv.reorderlevel = invm.ReorderLevel;
                inv.reorderqty   = invm.ReorderQty;
                inv = entities.inventories.Add(inv);
                entities.SaveChanges();
                // retrieving the inserted inventory model by using the GetInventory method
                invm = GetInventoryByInventoryid(inv.invid, out error);
            }
            catch (NullReferenceException)
            {
                error = ConError.Status.NOTFOUND;
            }
            catch (Exception e)
            {
                error = e.Message;
            }
            return(invm);
        }
        public static Boolean RemoveInventory(InventoryModel invm, out string error)
        {
            error = "";
            LUSSISEntities entities = new LUSSISEntities();
            inventory      inv      = new inventory();

            try
            {
                if (entities.inventories.Where(p => p.itemid == invm.Itemid).Count() > 0)
                {
                    inv = entities.inventories.Where(p => p.invid == invm.Itemid).First <inventory>();
                    entities.inventories.Remove(inv);
                    entities.SaveChanges();
                }
            }
            catch (NullReferenceException)
            {
                error = ConError.Status.NOTFOUND;
                return(false);
            }
            catch (Exception e)
            {
                error = e.Message;
                return(false);
            }
            return(true);
        }
        public static InventoryDetailModel GetInventoryDetailByItemid(int itemid, out string error)
        {
            LUSSISEntities entities = new LUSSISEntities();

            error = "";
            inventory            inventory = new inventory();
            InventoryDetailModel invdm     = new InventoryDetailModel();

            try
            {
                staticpoms  = PurchaseOrderRepo.GetPurchaseOrderByStatus(ConPurchaseOrder.Status.PENDING, out error);
                staticcount = 1;

                inventory = entities.inventories.Where(p => p.itemid == itemid).FirstOrDefault <inventory>();
                invdm     = CovertDBInventorytoAPIInventoryDet(inventory);
            }
            catch (NullReferenceException)
            {
                error = ConError.Status.NOTFOUND;
            }
            catch (Exception e)
            {
                error = e.Message;
            }
            return(invdm);
        }
        public static InventoryModel UpdateInventory(InventoryModel invm, out string error)
        {
            error = "";
            // declare and initialize new LUSSISEntities to perform update
            LUSSISEntities entities = new LUSSISEntities();
            inventory      inv      = new inventory();

            try
            {
                // finding the inventory object using Inventory API model
                inv = entities.inventories.Where(p => p.invid == invm.Invid).First <inventory>();

                // transfering data from API model to DB Model
                inv.itemid       = invm.Itemid;
                inv.stock        = invm.Stock;
                inv.reorderlevel = invm.ReorderLevel;
                inv.reorderqty   = invm.ReorderQty;

                // saving the update
                entities.SaveChanges();

                // return the updated model
                invm = CovertDBInventorytoAPIInventory(inv);
            }
            catch (NullReferenceException)
            {
                error = ConError.Status.NOTFOUND;
            }
            catch (Exception e)
            {
                error = e.Message;
            }
            return(invm);
        }
Esempio n. 14
0
 private static void RemoveRecordByCar(inventory carToDelete)
 {
     using (var repo = new inventoryRepo())
     {
         repo.Delete(carToDelete);
     }
 }
        public async Task <IHttpActionResult> PutUnicorn(Guid id, inventory unicorn)
        {
            if (!this.ModelState.IsValid)
            {
                return(this.BadRequest(this.ModelState));
            }

            if (id != unicorn.unicorn_id)
            {
                return(this.BadRequest());
            }

            this.unishopEntitiesContext.SetModified(unicorn);

            try
            {
                await this.unishopEntitiesContext.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!this.UnicornExists(id))
                {
                    return(this.NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(this.StatusCode(HttpStatusCode.NoContent));
        }
Esempio n. 16
0
 void Start()
 {
     inventory = GameObject.FindGameObjectWithTag("Inventory").GetComponent <inventory>();
     system    = gameObject.GetComponent <ParticleSystem>();
     gameObject.GetComponent <ParticleSystem>().Simulate(startTime);
     system.Play();
 }
Esempio n. 17
0
 private void Start()
 {
     spriteManager = GameObject.FindGameObjectWithTag("SpriteManager").GetComponent <spriteManager>();
     parentMachine = transform.parent.GetComponent <machine>();                        //machine of the holder
     place         = transform.GetChild(0).gameObject.GetComponent <SpriteRenderer>(); //holder
     inventory     = GameObject.FindGameObjectWithTag("Inventory").GetComponent <inventory>();
 }
Esempio n. 18
0
        public HttpResponseMessage PostSupplier([FromBody] inventory item)
        {
            using (ProcurementDBEntities1 dbContext = new ProcurementDBEntities1())
            {
                try
                {
                    HttpResponseMessage response = new HttpResponseMessage();
                    if (item.currentStock > item.maxStock)
                    {
                        response = Request.CreateResponse(HttpStatusCode.NotFound, new { statusCode = HttpStatusCode.NotFound, message = "Stock Exceeds and Item cannot be Saved" });
                    }
                    else
                    {
                        var result = dbContext.inventories.Add(item);
                        dbContext.SaveChanges();
                        response = Request.CreateResponse(HttpStatusCode.OK, new { statusCode = HttpStatusCode.OK, message = "Item Added into Inventory Succesfully" });
                    }

                    return(response);
                }
                catch (Exception e)
                {
                    return(Request.CreateResponse(HttpStatusCode.NotFound, new { statusCode = HttpStatusCode.NotFound, message = e.Message }));
                }
            }
        }
Esempio n. 19
0
    /*, list equip*/

    // Use this for initialization
    public void Beginn(int hp, int maxhp, int mana, int maxmana, int xp, int lvl, int gold, int pwr, int armor, int agility, string pname, int posx, int posy, int p_ID /*, list equip*/)
    {
        //Player = [] in python zum laden&speichern genutzte liste
        this.hp        = hp;
        this.maxhp     = maxhp;
        this.mana      = mana;
        this.maxmana   = maxmana;
        this.xp        = xp;
        this.lvl       = lvl;
        this.gold      = gold;
        this.pwr       = pwr;
        this.armor     = armor;
        this.agility   = agility;
        this.Player_ID = p_ID;
        //this.name = pname;
        this.pos = new Vector2(posx, posy);
        inv      = GameObject.Find("Main Camera").GetComponent <inventory> ();

        //Equip = equip ausrüstungsslots
        //GameObject.Find ("Unit").transform.Find ("UnitModel").GetComponent<SkinnedMeshRenderer> ().enabled = true;
        GameObject.Find("Unit").transform.Find("UnitModel").GetComponent <MeshRenderer> ().enabled = true;
        GameObject.Find("Unit").GetComponent <PlayerToPos> ().MovePlayer();
        GameObject.Find("Map").GetComponent <map> ().LoadMap();

        // Game ist fertig geladen!
        GameObject.Find("Main Camera").GetComponent <mainmenu> ().gameloaded = true;
    }
Esempio n. 20
0
    void Update()
    {
        dataHandler = GameObject.Find("DataHandler");
        inventory ino = dataHandler.GetComponent <inventory>();

        dicForCompare = ino.dic;
        /********************************************************/
        targetPlayer = GameObject.Find("_3rd Person Controller");
        pp           = targetPlayer.GetComponent <PickingAndPlacing>();
        /********************************************************/
        if (pp.gotMessage != null)
        {
            gotMessage  = pp.gotMessage;  //here we are getting
            destMessage = pp.destMessage;
        }

        if (counter == pp.objectWeWant)
        {
            indi.SetActive(false);
            playPaues.SetActive(false);
            life.SetActive(false);
            place.SetActive(false);
            game.SetActive(false);

            finalize.SetActive(true);    //////////////////////////////////////////////////////////// finalize
        }
    }
Esempio n. 21
0
    public void addToItemInventory(int itemId, int amount)
    {
        for (int i = 0; i < iManager.items.Count; i++)
        {
            if (iManager.items[i].itemTransform.GetComponent <Item>().id == itemId)
            {
                bool isItemInList = false;
                int  index        = 0;
                for (int j = 0; j < items.Count; j++)
                {
                    if (items[j].item.id == itemId)
                    {
                        isItemInList = true;
                        index        = j;
                    }
                }

                if (isItemInList)
                {
                    items[index].amountOfItem += amount;
                }
                else
                {
                    inventory inv = new inventory(iManager.items[i].itemTransform.GetComponent <Item>(), amount);
                    items.Add(inv);
                }
            }
        }
    }
Esempio n. 22
0
 public void transferAllSafe(inventory target)
 {
     foreach (ressources item in Enum.GetValues(typeof(ressources)))
     {
         transferSafe(target, item);
     }
 }
    void Start()
    {
        inventory = inventory.instance;
        int numslot = System.Enum.GetNames(typeof(Equipmentslot)).Length;

        currentEquipment = new Equipment[numslot];
    }
Esempio n. 24
0
 // Start is called before the first frame update
 void Start()
 {
     enemyfly1 = GetComponent <Rigidbody2D>();
     healthy   = 6;
     con       = GameObject.Find("player").GetComponent <controller>();
     inv       = GameObject.Find("itemdatabase").GetComponent <inventory>();
 }
Esempio n. 25
0
 private void Awake()
 {
     picOfItemHandler = transform.GetChild(0).gameObject;
     player           = GameObject.FindGameObjectWithTag("Player");
     inv = player.GetComponent <inventory>();
     GM  = GameObject.FindGameObjectWithTag("Global").GetComponent <GameManager>();
 }
Esempio n. 26
0
        //组装item在前台的显示信息
        private inventory scanItem_encodeItemInfo2front(ref LTS.Item stItem, ref LTS.Product stProduct)
        {
            Log.WriteLog(LogType.Trace, "come in scanItem_encodeItemInfo2front");

            //组装显示信息
            inventory stInv = new inventory();

            if (null == stInv)
            {
                Log.WriteLog(LogType.Error, "error to get inventory memery");
                return(null);
            }

            if (null == stItem)
            {
                Log.WriteLog(LogType.Error, "the item param is error");
                return(null);
            }

            stInv.EPC    = stItem.TagEPC;
            stInv.itemID = stItem.ItemID;
            if (stProduct != null)
            {
                stInv.ProductName        = stProduct.ProductName;
                stInv.ProductDescription = stProduct.ProductDescription;
            }
            Log.WriteLog(LogType.Trace, "success to encode item[" + stInv.itemID + "] info into front:epc[" + stInv.EPC + "], product name[" + stInv.ProductName + "], product description[" + stInv.ProductDescription + "]");

            return(stInv);
        }
Esempio n. 27
0
 private static void RemoveRecordByCar(inventory carToDelete)
 {
     using (var context = new AutoLotContext())
     {
         using var repo = new InventoryRepo(context);
         repo.Delete(carToDelete);
     }
 }
Esempio n. 28
0
 public void transferAll(inventory target)
 {
     foreach (ressources item in Enum.GetValues(typeof(ressources)))
     {
         target.newContent[item] += this.newContent[item];
         this.newContent[item]    = 0;
     }
 }
Esempio n. 29
0
 void Start()
 {
     enemyanimator = gameObject.GetComponent <Animator>();
     enemy3        = gameObject.GetComponent <Rigidbody2D>();
     lasttime      = 0;
     con           = GameObject.Find("player").GetComponent <controller>();
     inv           = GameObject.Find("itemdatabase").GetComponent <inventory>();
 }
Esempio n. 30
0
        public ActionResult DeleteConfirmed(string id)
        {
            inventory inventory = db.inventories.Find(id);

            db.inventories.Remove(inventory);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Esempio n. 31
0
 public void setSlot(inventory attachedInventory, int SlotID, container attachedContainer)
 {
     this.SlotID            = SlotID;
     this.attachedContainer = attachedContainer;
     myStack          = attachedInventory.getStackInSlot(SlotID);
     inventoryManager = inventoryManager.INSTANCE;
     updateSlot();
 }
Esempio n. 32
0
    //private static int j;
    void Awake()
    {
        i = 0;
        //j = 0;

        collectableName = gameObject.name;
        inv = GameObject.Find ("Char_Cat").GetComponent<inventory>();
        database = GameObject.Find ("Items_ItemDatabase").GetComponent<itemDatabase>();
        //trophy = GameObject.Find ("trophy");
    }
	public void addToItemInventory(int itemId, int amount)
	{
		for(int i = 0; i < iManager.items.Count; i++)
		{
			if(iManager.items[i].itemTransform.GetComponent<Item>().id == itemId)
			{
				inventory inv = new inventory(iManager.items[i].itemTransform.GetComponent<Item>(), amount);
				items.Add (inv);
			}
		}
	}
Esempio n. 34
0
	// Use this for initialization
	void Start () {
		inventory_instance = this;
	}
Esempio n. 35
0
 partial void Insertinventory(inventory instance);
Esempio n. 36
0
 partial void Deleteinventory(inventory instance);
Esempio n. 37
0
 partial void Updateinventory(inventory instance);