示例#1
0
        // GET: ITEMs/Delete/5
        public ActionResult Delete(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ITEM iTEM = null;

            using (var client = new HttpClient())
            {
                client.BaseAddress = new Uri(apiUrl);
                //HTTP GET
                var responseTask = client.GetAsync("items/" + id);
                responseTask.Wait();

                var result = responseTask.Result;
                if (result.IsSuccessStatusCode)
                {
                    var readTask = result.Content.ReadAsAsync <ITEM>();
                    readTask.Wait();

                    iTEM = readTask.Result;
                }
                else //web api sent error response
                {
                    //log response status here..
                    ModelState.AddModelError(string.Empty, "Server error. Please contact administrator.");
                }
            }
            if (iTEM == null)
            {
                return(HttpNotFound());
            }
            return(View(iTEM));
        }
示例#2
0
        public async Task <ActionResult> CreateItem(ITEM i)
        {
            try
            {
                ITEM Value = new ITEM();
                if (ModelState.IsValid)
                {
                    TryUpdateModel(Value);
                    using (var client = new HttpClient())
                    {
                        client.BaseAddress = new Uri(Baseurl);
                        client.DefaultRequestHeaders.Clear();
                        client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
                        var myContent = JsonConvert.SerializeObject(Value);
                        var buffer    = System.Text.Encoding.UTF8.GetBytes(myContent);
                        ByteArrayContent    byteContent = new ByteArrayContent(buffer);
                        HttpResponseMessage Res         = await client.PostAsJsonAsync <ITEM>("api/ITEMS/", Value);

                        ITEM ItemInfo = new ITEM();
                        if (Res.IsSuccessStatusCode)
                        {
                            var ItemResponse = Res.Content.ReadAsStringAsync().Result;
                            ItemInfo = JsonConvert.DeserializeObject <ITEM>(ItemResponse);
                            return(RedirectToAction("Index"));
                        }
                    }
                }
            }
            catch (Exception e)
            {
                throw e;
            }

            return(View());
        }
示例#3
0
    private void ClickSell(IUIObject obj)
    {
        GS_POINT_BUY_REQ gS_POINT_BUY_REQ = new GS_POINT_BUY_REQ();

        if (this.m_eType == ExchangePointDlg.TYPE.TYPE_TICKET)
        {
            gS_POINT_BUY_REQ.nType       = 0;
            gS_POINT_BUY_REQ.nItemUnique = this.m_nSelectItemUnique;
            gS_POINT_BUY_REQ.nItemNum    = (long)this.m_nSelectItemNum;
        }
        else if (this.m_eType == ExchangePointDlg.TYPE.TYPE_EQUIPITEM)
        {
            bool flag = false;
            gS_POINT_BUY_REQ.nType = 1;
            for (int i = 0; i < 10; i++)
            {
                if (0L < this.m_nRemoveItemID[i])
                {
                    gS_POINT_BUY_REQ.nItemID[i] = this.m_nRemoveItemID[i];
                    ITEM itemFromItemID = NkUserInventory.instance.GetItemFromItemID(this.m_nRemoveItemID[i]);
                    if (itemFromItemID != null)
                    {
                        if (itemFromItemID.IsLock())
                        {
                            Main_UI_SystemMessage.ADDMessage(NrTSingleton <NrTextMgr> .Instance.GetTextFromNotify("726"), SYSTEM_MESSAGE_TYPE.NORMAL_MESSAGE_GREEN);
                        }
                        else
                        {
                            int num = itemFromItemID.m_nOption[2];
                            if (num >= 4)
                            {
                                flag = true;
                            }
                        }
                    }
                }
                else
                {
                    gS_POINT_BUY_REQ.nItemID[i] = 0L;
                }
            }
            if (flag)
            {
                string textFromInterface = NrTSingleton <NrTextMgr> .Instance.GetTextFromInterface("2251");

                string textFromMessageBox = NrTSingleton <NrTextMgr> .Instance.GetTextFromMessageBox("198");

                MsgBoxUI msgBoxUI = NrTSingleton <FormsManager> .Instance.LoadForm(G_ID.MSGBOX_DLG) as MsgBoxUI;

                if (msgBoxUI != null)
                {
                    msgBoxUI.SetMsg(new YesDelegate(this.MsgBoxOKEvent), gS_POINT_BUY_REQ, null, null, textFromInterface, textFromMessageBox, eMsgType.MB_OK_CANCEL);
                    return;
                }
            }
        }
        SendPacket.GetInstance().SendObject(eGAME_PACKET_ID.GS_POINT_BUY_REQ, gS_POINT_BUY_REQ);
        TsAudioManager.Instance.AudioContainer.RequestAudioClip("UI_SFX", "ETC", "COMMON-SUCCESS", new PostProcPerItem(NrAudioClipDownloaded.OnEventAudioClipDownloadedImmedatePlay));
    }
示例#4
0
        //
        // GET: /ITEMAdmin/Create

        public ActionResult Create()
        {
            ITEM item = new ITEM();

            item.Status = false;

            return(View(item));
        }
示例#5
0
 public int getItemCapacity(ITEM item)
 {
     if (itemsCapacity.ContainsKey(item))
     {
         return(itemsCapacity[item]);
     }
     return(0);
 }
 public void Post([FromBody] ITEM item)
 {
     using (PODbEntities db = new PODbEntities())
     {
         db.ITEMs.Add(item);
         db.SaveChanges();
     }
 }
示例#7
0
 public static void Item_Tooltip(Form cThis, ITEM pkItem, G_ID eWidowID, bool bEquiped)
 {
     Tooltip_Dlg.Tooltip_Text_Info[] array = Tooltip_Dlg.Get_Item_Text_Info(pkItem, null, eWidowID, bEquiped);
     if (array != null)
     {
         Tooltip_Dlg.Tooltip_Base(cThis, array, pkItem.m_nRank, eWidowID, 0);
     }
 }
        public ActionResult DeleteConfirmed(int id)
        {
            ITEM iTEM = db.ITEMs.Find(id);

            db.ITEMs.Remove(iTEM);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 public void Put([FromBody] ITEM item)
 {
     using (PODbEntities db = new PODbEntities())
     {
         db.Entry(item).State = System.Data.Entity.EntityState.Modified;
         db.SaveChanges();
     }
 }
示例#10
0
 public void ConvertItemInfo(ITEM pItem)
 {
     if (pItem == null)
     {
         return;
     }
     pItem.Set(this.m_kBaseItem);
 }
示例#11
0
 public void addItem(ITEM item)
 {
     // if available and capacity is not reached
     if ((itemsCollected.ContainsKey(item)) && (itemsCollected[item] < itemsCapacity[item]))
     {
         itemsCollected[item]++;
     }
 }
示例#12
0
        public AddEditItemForm(ITEM item)
        {
            InitializeComponent();

            _mode = FormMode.EditForm;

            PopulateContols(item);
        }
 public void Set_Tooltip(G_ID a_eWidowID, ITEM a_cItem, bool bEquiped = false)
 {
     this.m_eParentWindowID = a_eWidowID;
     this.m_cItem           = a_cItem;
     this.Item_Tooltip(this, this.m_cItem, null, this.m_eParentWindowID, bEquiped);
     this.Show();
     ItemTooltipDlg_Second.Tooltip_Rect(this, Vector3.zero);
 }
 public void Set_Tooltip(G_ID eWidowID, ITEM pkItem, ITEM pkEquipedItem)
 {
     this.m_eParentWindowID = eWidowID;
     this.m_cItem           = pkItem;
     this.Item_Tooltip(this, this.m_cItem, pkEquipedItem, eWidowID, false);
     this.Show();
     ItemTooltipDlg_Second.Tooltip_Rect(this, Vector3.zero);
 }
示例#15
0
 public override void Init()
 {
     base.Init();
     this.srcSolID  = 0L;
     this.destSolID = 0L;
     this.srcItem   = null;
     this.destItem  = null;
 }
示例#16
0
        // Ajout d'un article au panier
        private void  addToCart(object sender, RoutedEventArgs e)
        {
            ITEM item = new ITEM();

            item     = ((Button)sender).Tag as ITEM;
            itemTest = item;
            var queryIngCat = (from cat in db.CATEGORY_INGREDIENT.Where(ci => ci.ITEM.Any())
                               from itm in db.ITEM.Where(i => i.CATEGORY_INGREDIENT.Contains(cat) && i.id_item == item.id_item)
                               select cat).ToList();

            if (queryIngCat.Count > 0)
            {
                DialogHost.Show(new ItemOption(item, queryIngCat), "RootDialog", onCLosingDialog);
            }
            else
            {
                var it = cvm.Cart.FirstOrDefault(i => i.ItemId == item.id_item);
                if (it != null)
                {
                    it.ItemQuantity = it.ItemQuantity + 1;
                    //  it.ItemPriceWithoutSupp = it.ItemPriceWithoutSupp + it.ItemPrice;
                    //  it.ItemPrice += it.ItemPrice;
                }
                else
                {
                    cvm.Cart.Add(new Cart
                    {
                        ItemQuantity         = 1,
                        ItemId               = item.id_item,
                        ItemTitle            = item.item_title,
                        ItemPriceWithoutSupp = (double)item.item_price,
                        Cooked               = item.cooked,
                        SuppPrice            = 0,
                    });
                }
                double totalCartLocal = 0.00;
                cartList = cvm.Cart;

                foreach (Cart itm in cartList)
                {
                    totalCartLocal = totalCartLocal + itm.ItemPrice;
                }
                cvm.TotalPrice           = totalCartLocal;
                cvm.TotalRestPrice       = cvm.TotalPrice - cvm.TotalPayed;
                tb_total.Text            = cvm.TotalPrice + "€";
                tb_totalRest.Text        = cvm.TotalRestPrice + "€";
                lv_cartItems.ItemsSource = cvm.Cart;

                //Detect menu
            }


            //foreach (CATEGORY_INGREDIENT list in queryIngCat)
            //{
            //    int id = list.id_category_ingredient;
            //    DialogHost.Show(new ItemOption(item, id), "RootDialog", onCLosingDialog);
            //}
        }
 public void Set_Tooltip(G_ID a_eWidowID, ITEM a_cItem, bool bEquiped, Vector3 showPosition, long SolID = 0L)
 {
     this.m_eParentWindowID = a_eWidowID;
     this.m_cItem           = a_cItem;
     this.m_SolID           = SolID;
     this.Item_Tooltip(this, this.m_cItem, null, this.m_eParentWindowID, bEquiped);
     this.Show();
     ItemTooltipDlg_Second.Tooltip_Rect(this, showPosition);
 }
示例#18
0
    public override void Set_Value(object obj)
    {
        ITEM iTEM = obj as ITEM;

        if (iTEM != null)
        {
            this.AddItemLinkText(iTEM);
        }
    }
示例#19
0
 public void Set_TooltipForEquip(G_ID eWidowID, ITEM pkEquipedItem, ITEM pkItem, bool bEquiped)
 {
     base.RemoveChildControl();
     Tooltip_Dlg.m_eParentWindowID = eWidowID;
     this.m_cItem = pkItem;
     Tooltip_Dlg.Item_Tooltip(this, pkEquipedItem, this.m_cItem, eWidowID, bEquiped);
     Tooltip_Dlg.Tooltip_Rect(this, Vector3.zero);
     this.Show();
 }
示例#20
0
    public void Item_Equipment(long solID, ITEM a_cItem)
    {
        NkSoldierInfo soldierInfoBySolID = this.GetSoldierInfoBySolID(solID);

        if (soldierInfoBySolID != null)
        {
            soldierInfoBySolID.EquipmentItem(a_cItem);
        }
    }
        public void PushText(string text, ITEM linkItem, string color)
        {
            string @string = NrTSingleton <UIDataManager> .Instance.GetString(MsgHandler.HandleReturn <string>("GetTextColor", new object[]
            {
                color
            }), text);

            this.PushText(@string, linkItem);
        }
 void RemoveItem(ITEM item)
 {
     if (inventory[item] <= 0)
     {
         Debug.LogError("ItemInventoryController : " + item.ToString() + " is 0.");
         return;
     }
     inventory[item] -= 1;
 }
示例#23
0
 public void Set_Tooltip(G_ID eWidowID, ITEM pkItem, bool showItemNum)
 {
     base.RemoveChildControl();
     Tooltip_Dlg.m_eParentWindowID = eWidowID;
     this.m_cItem = pkItem;
     Tooltip_Dlg.Item_Tooltip(this, this.m_cItem, eWidowID);
     Tooltip_Dlg.Tooltip_Rect(this, Vector3.zero);
     this.Show();
 }
示例#24
0
 private void PopulateContols(ITEM item)
 {
     //todo: try to move this into controller
     this.ItemId          = item.i_id;
     this.ItemName        = item.i_name;
     this.ItemQuantity    = item.i_quantity.GetValueOrDefault(0);
     this.ItemWeight      = item.i_weight;
     this.ItemDescription = item.i_description;
 }
示例#25
0
    public void Select_Equipment(int Equipment_id)
    {
        Select_Item = ItemManager.Instance.Get_ItemInfo(Equipment_id);
        Select_Item_Icon.spriteName = Select_Item.Icon_Name;
        Select_Description.text     = Select_Item.Description;

        Select_Item_Icon.gameObject.SetActive(true);
        Select_Description.gameObject.SetActive(true);
    }
示例#26
0
        private void setKnife(Game gm, int id, int dest, ITEM item)
        {
            var p = gm.shareData.players.getPlayer(id);

            GameTest.setItem(gm, p.name, item, ITEM.NONE, ITEM.NONE, ITEM.NONE);
            p.net_item = 0;
            p.net_opp  = dest;
            p.usedItem();
        }
示例#27
0
        public void UpdateInventory(ITEM item)
        {
            if (_controller == null)
            {
                return;
            }

            _controller.UpdateInventoryGrid(item);
        }
示例#28
0
 public void DeleteItem(int?id)
 {
     using (lostfoundDB db = new lostfoundDB())
     {
         ITEM item = db.ITEMs.Find((int)id);
         db.ITEMs.Remove(item);
         db.SaveChanges();
     }
 }
    protected int CalculateWeaponScore(ITEM i)
    {
        int stat       = (int)(i) / 2;
        int playerStat = StatValues[stat] + ((int)(i) % 2) * 2;
        int enemyStat  = EnemyStats[(int)(SelectedEnemy) * NumBaseStats + stat];

        Debug.LogFormat("[Adventure Game #{0}] Weapon {1}: player stat={2}, enemy stat={3}, score {4}", moduleId, ItemName(i), playerStat, enemyStat, playerStat - enemyStat);
        return(playerStat - enemyStat);
    }
示例#30
0
文件: PInvoke.cs 项目: Helen1987/edu
        static void Main(string[] args)
        {
            //Simple examples of interop with integers and strings:
            Array.ForEach(Enumerable.Range(2, 100).Where(IsPrime).ToArray(), Console.WriteLine);
            Console.WriteLine(IsValid(null));
            Console.WriteLine(IsValid("Hey!"));
            
            //Marshaling an array of items.  Note that the ITEM structure is duplicated
            //in the C and C# code.  The process of duplication can be streamlined by using
            //an automatic tool such as the P/Invoke Signature Assistant.
            ITEM[] items = { new ITEM(0), new ITEM(1), new ITEM(6), new ITEM(18) };
            ITEM lookup = new ITEM(6);
            int index;
            Find(items, items.Length, ref lookup, out index);
            Console.WriteLine(index);

            //Marshaling arrays and structures as pointers, using unsafe code and the
            //fixed statement to obtain a pointer.  In this example, a pointer to the middle
            //of the array (the 3rd element) is passed to the Find method.
            unsafe
            {
                fixed (ITEM* p = &items[2])
                {
                    Find(p, items.Length - 2, &lookup, &index);
                    Console.WriteLine(index);
                }
            }

            //Marshaling a mutable string using StringBuilder:
            StringBuilder text = new StringBuilder("Hello");
            FillString(text, 'a');
            Console.WriteLine(text);

            //Marshaling delegates with an anonymous method:
            IsMatch match = delegate(string s) { return s.StartsWith("Go"); };
            Console.WriteLine(FindMatch(match));

            //Marshaling delegates with a lambda expression:
            match = s => s.StartsWith("I");
            Console.WriteLine(FindMatch(match));

            //Callback on garbage-collected delegate:
            //StoreMatch(new PInvoke().Matcher);
            //GC.Collect();
            //UseMatch();

            //Marshaling delegates which are stored by native code and invoked later.
            //The lifetime of such delegates must be explicitly managed to ensure that
            //the delegate is not garbage collected while native code still has a
            //reference to it through a native function pointer.
            match = new PInvoke().Matcher;
            StoreMatch(match);
            GC.Collect();
            UseMatch();
            GC.KeepAlive(match);    //Keeps the delegate alive
        }
示例#31
0
    public void ClickUseFullElixir(IUIObject obj)
    {
        if (!NrTSingleton <ContentsLimitManager> .Instance.IsWillSpend())
        {
            return;
        }
        NrMyCharInfo kMyCharInfo = NrTSingleton <NkCharManager> .Instance.m_kMyCharInfo;

        if (kMyCharInfo != null)
        {
            long num = kMyCharInfo.m_nMaxActivityPoint - kMyCharInfo.m_nActivityPoint;
            if (num <= 0L)
            {
                string textFromNotify = NrTSingleton <NrTextMgr> .Instance.GetTextFromNotify("784");

                Main_UI_SystemMessage.ADDMessage(textFromNotify, SYSTEM_MESSAGE_TYPE.NAGATIVE_MESSAGE);
                return;
            }
            if (0 >= NkUserInventory.GetInstance().Get_First_ItemCnt(70005))
            {
                string empty = string.Empty;
                NrTSingleton <CTextParser> .Instance.ReplaceParam(ref empty, new object[]
                {
                    NrTSingleton <NrTextMgr> .Instance.GetTextFromNotify("168"),
                    "targetname",
                    NrTSingleton <ItemManager> .Instance.GetItemNameByItemUnique(70005)
                });

                Main_UI_SystemMessage.ADDMessage(empty, SYSTEM_MESSAGE_TYPE.NAGATIVE_MESSAGE);
                return;
            }
            ITEM item = NkUserInventory.GetInstance().GetItem(70005);
            if (item != null)
            {
                NrCharUser nrCharUser = NrTSingleton <NkCharManager> .Instance.GetChar(1) as NrCharUser;

                NkSoldierInfo          userSoldierInfo        = nrCharUser.GetUserSoldierInfo();
                long                   solID                  = userSoldierInfo.GetSolID();
                GS_ITEM_SUPPLY_USE_REQ gS_ITEM_SUPPLY_USE_REQ = new GS_ITEM_SUPPLY_USE_REQ();
                gS_ITEM_SUPPLY_USE_REQ.m_nItemUnique = item.m_nItemUnique;
                gS_ITEM_SUPPLY_USE_REQ.m_nDestSolID  = solID;
                if ((long)item.m_nItemNum < num)
                {
                    gS_ITEM_SUPPLY_USE_REQ.m_shItemNum = item.m_nItemNum;
                }
                else
                {
                    gS_ITEM_SUPPLY_USE_REQ.m_shItemNum = (int)num;
                }
                gS_ITEM_SUPPLY_USE_REQ.m_byPosType = item.m_nPosType;
                gS_ITEM_SUPPLY_USE_REQ.m_shPosItem = item.m_nItemPos;
                SendPacket.GetInstance().SendObject(eGAME_PACKET_ID.GS_ITEM_SUPPLY_USE_REQ, gS_ITEM_SUPPLY_USE_REQ);
            }
            NrTSingleton <FormsManager> .Instance.CloseForm(G_ID.WILLCHARGE_DLG);
        }
    }
示例#32
0
        public void setItem(Int32 tipo_item, String nombre_item, String descripcion)
        {
            LinqDBDataContext db = new LinqDBDataContext();
            ITEM iITEM = new ITEM
            {
                CODIGO_TIPO_ITEM = tipo_item,
                NOMBRE_ITEM = nombre_item,
                DESCRIPCION_ITEM = descripcion

            };
            db.ITEM.InsertOnSubmit(iITEM);
            db.SubmitChanges();
        }
示例#33
0
    public void LoadItemList()
    {
        if (this.ItemDictionary.Count > 0) return;

        string itemInfoFilePath = "itemList";

        XmlDocument xmlDoc = LoadXML(itemInfoFilePath);
        XmlElement eApp = xmlDoc.DocumentElement;
        XmlElement firstApp = (XmlElement)eApp.FirstChild;

        while ((firstApp != null) && (firstApp.IsEmpty == false))
        {
            XmlNodeList child = firstApp.ChildNodes;

            foreach (XmlElement eNode in child)
            {
                ITEM item;
                item = new ITEM();
                item.name = eNode.GetAttribute("name");
                item.uID = int.Parse(eNode.GetAttribute("uID"));
                item.shopDisplay = bool.Parse(eNode.GetAttribute("shopDisplay"));
                item.currencyType = int.Parse(eNode.GetAttribute("currencyType"));
                item.price = int.Parse(eNode.GetAttribute("price"));
                item.level = int.Parse(eNode.GetAttribute("level"));
                item.attack = float.Parse(eNode.GetAttribute("attack"));
                item.defense = float.Parse(eNode.GetAttribute("defense"));
                item.stat1 = float.Parse(eNode.GetAttribute("stat1"));
                item.stat2 = float.Parse(eNode.GetAttribute("stat2"));
                item.stat3 = float.Parse(eNode.GetAttribute("stat3"));
                item.description = eNode.GetAttribute("description");
                item.categoryType = int.Parse(eNode.GetAttribute("categoryType"));
                item.subCategory = int.Parse(eNode.GetAttribute("subCategory"));
                item.itemType = int.Parse(eNode.GetAttribute("itemType"));
                item.partsType = int.Parse(eNode.GetAttribute("partsType"));
                item.classID = int.Parse(eNode.GetAttribute("classID"));
                item.gender = int.Parse(eNode.GetAttribute("gender"));
                item.grade = int.Parse(eNode.GetAttribute("grade"));
                item.upgradeEnable = bool.Parse(eNode.GetAttribute("upgradeEnable"));
                item.prefabPath = eNode.GetAttribute("prefabPath");
                item.prefabPathFe = eNode.GetAttribute("prefabPathFe");

                item.iconTex = eNode.GetAttribute("iconTex");
                Debug.Log(item.name);

                ItemDictionary[item.uID] = item;

            }

            firstApp = (XmlElement)firstApp.NextSibling;
        }
    }
示例#34
0
文件: PInvoke.cs 项目: Helen1987/edu
 static extern void Find(ITEM[] items, int count, ref ITEM lookup, out int index);
示例#35
0
文件: PInvoke.cs 项目: Helen1987/edu
 static unsafe extern void Find(ITEM* items, int count, ITEM* lookup, int* index);