コード例 #1
0
ファイル: Program.cs プロジェクト: mrdotnet/NDatabase
        private static object PrepareNewItem(int i)
        {
            var holderA = new HolderA {
                Id = i, Name = "HolderA" + i
            };

            for (var j = 0; j < 100; j++)
            {
                var holderB = new HolderB {
                    Id = j, Name = "HolderB" + j
                };
                holderA.ListOfHolderBItems.Add(holderB);

                for (var k = 0; k < 100; k++)
                {
                    var holderC = new HolderC {
                        Id = k, Name = "HolderC" + k
                    };
                    holderB.ListOfHolderCItems.Add(holderC);

                    for (var l = 0; l < 100; l++)
                    {
                        var item = new FinalItem {
                            Id = l, Name = "FinalItem" + l
                        };
                        holderC.FinalItems.Add(item);
                    }
                }
            }

            return(holderA);
        }
コード例 #2
0
ファイル: State.cs プロジェクト: sebgod/hime
 /// <summary>
 /// Adds a new item making this state a final state
 /// </summary>
 /// <param name="item">The new item</param>
 public void AddItem(FinalItem item)
 {
     if (!items.ContainsValue(item))
     {
         items.Add(item.Priority, item);
     }
 }
コード例 #3
0
        public ActionResult Exchange(FinalItem TempItem)
        {
            MailAddress from = new MailAddress("*****@*****.**", "Eulu-Interchange");
            //MailAddress to = new MailAddress(TempItem.userinfo);
            MailAddress to = new MailAddress("*****@*****.**");
            MailMessage m  = new MailMessage(from, to);

            m.Subject    = "Новий обмін";
            m.Body       = "<h2>Вам запропонували обінятися</h2><br><p> Чи ви бажаєте обміняти " + TempItem.OldName + " на " + TempItem.NewName + " - " + TempItem.NewPrice + " грн" + "</p>"; // <a />
            m.IsBodyHtml = true;
            SmtpClient smtp = new SmtpClient("smtp.gmail.com", 587);

            smtp.Credentials = new NetworkCredential("*****@*****.**", "Strongpassword");
            smtp.EnableSsl   = true;
            smtp.Send(m);
            return(RedirectToAction("Main", "Market"));
        }
コード例 #4
0
ファイル: DFA.cs プロジェクト: sebgod/hime
        /// <summary>
        /// Extracts the sub-DFA that produces the specified final item
        /// </summary>
        /// <param name="final">A final item</param>
        /// <returns>The sub-DFA for the specified item</returns>
        public DFA ExtractSubFor(FinalItem final)
        {
            if (final == null)
            {
                throw new System.ArgumentException("The specified item must not be null");
            }
            List <DFAState> targets = new List <DFAState>();

            foreach (DFAState state in states)
            {
                if (state.IsFinal && state.Items[0] == final)
                {
                    targets.Add(state);
                }
            }
            if (targets.Count == 0)
            {
                throw new System.ArgumentException("The specified item is never produced by this DFA");
            }
            return(ExtractSubTo(targets));
        }
コード例 #5
0
        private static void callEbay(object textIn)
        {
            string text = textIn.ToString();

            text = System.Web.HttpUtility.HtmlEncode(text);

            string url = "http://svcs.ebay.com/services/search/FindingService/v1";

            url += "?OPERATION-NAME=findItemsByKeywords";
            url += "&SERVICE-VERSION=1.0.0";
            url += "&SECURITY-APPNAME=JODOS-TE-0e9b-4bbc-9101-1c79d952427c";
            url += "&GLOBAL-ID=EBAY-US";
            url += "&RESPONSE-DATA-FORMAT=JSON";
            url += "&keywords=" + text;
            url += "&paginationInput.entriesPerPage=10";
            url += "&SortOrder=PricePlusShippingLowest";
            url += "&itemFilter(0).name=ListingType";
            url += "&itemFilter(0).value=FixedPrice";
            url += "&itemFilter(1).name=Condition";
            url += "&itemFilter(1).value=New";
            url += "&itemFilter(2).name=TopRatedSellerOnly";
            url += "&itemFilter(2).value=true";
            url += "&itemFilter(3).name=AvailableTo";
            url += "&itemFilter(3).value=IL";



            System.Net.WebRequest req = System.Net.WebRequest.Create(url);
            req.Proxy = WebProxy.GetDefaultProxy();
            System.Net.WebResponse resp = req.GetResponse();
            System.IO.StreamReader sr   = new System.IO.StreamReader(resp.GetResponseStream());

            JsonSerializerSettings x = new JsonSerializerSettings();

            x.MissingMemberHandling = MissingMemberHandling.Ignore;

            EbayResponse retValue = JsonConvert.DeserializeObject <EbayResponse>(sr.ReadToEnd(), x);

            if (retValue.findItemsByKeywordsResponse[0].ack[0].ToString() != "Failure")
            {
                IList <Item> ebayItems = retValue.findItemsByKeywordsResponse[0].searchResult[0].item;

                foreach (Item item in ebayItems)
                {
                    FinalItem temp = new FinalItem();

                    temp.ItemUrl   = item.viewItemURL[0].ToString();
                    temp.ImageUrl  = item.galleryURL[0].ToString();
                    temp.ItemPrice = item.sellingStatus[0].currentPrice[0].__value__;
                    if (item.shippingInfo[0].shippingServiceCost == null)
                    {
                        temp.ShippingPrice = "0";
                    }
                    else
                    {
                        temp.ShippingPrice = item.shippingInfo[0].shippingServiceCost[0].__value__;
                    }
                    temp.Name   = item.title[0].ToString();
                    temp.Source = "eBay";
                    FinalList.Add(temp);
                }
            }
        }
コード例 #6
0
	// Use this for initialization
	void Start () {

        finalItem = new FinalItem(transform.position.x, transform.position.y); 
    }