Пример #1
0
        public POCRules(NBA nba)
        {
            _nba = nba;

            Bundle1 = new HashSet <Func <bool> >
            {
                Rule1,
                Rule2,
                Rule3,
                Rule4,
            };

            Bundle2 = new HashSet <Func <bool> >
            {
                Rule1,
                Rule4,
            };

            Bundle3 = new HashSet <Func <bool> >
            {
                Rule2,
                Rule3,
            };

            Bundle4 = new HashSet <Func <bool> >
            {
                Rule5,
            };

            GeneralRules = new HashSet <Func <bool> >
            {
                CantInstallmentWithPercentDiscount,
            };
        }
Пример #2
0
        /**
         * Constructor
         * @param nba the interface to the NBA
         */
        public NBABuilder(NBA nba)
        {
            _nba = nba;
            _all_states_are_final = false;

            name2state = new Dictionary <string, int>();
        }
Пример #3
0
        /**
           * Constructor
           * @param nba the interface to the NBA
           */
        public NBABuilder(NBA nba)
        {
            _nba = nba;
            _all_states_are_final = false;

            name2state = new Dictionary<string, int>();
        }
        public ActionResult DeleteConfirmed(int id)
        {
            NBA nBA = db.NBAs.Find(id);

            db.NBAs.Remove(nBA);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
        //Recebe a NBA no contrutor
        public POCManager(NBA nba)
        {
            _nba      = nba;
            _rules    = new HashSet <Func <bool> >();
            _mapRules = new POCMapRules(new POCRules(nba));

            CreateRules();
        }
Пример #6
0
        public SafraAlgorithm(NBA nba, Options_Safra options)
        {
            _options      = options;
            _nba_analysis = new NBAAnalysis(nba);
            _nba          = nba;
            _NODES        = 2 * nba.getStateCount();////////////ensure the number of nodes is enough

            stv_reorder = null;
            //{
            //    _next.resize(nba.getStateCount());
            //}
        }
        // GET: NBAs/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            NBA nBA = db.NBAs.Find(id);

            if (nBA == null)
            {
                return(HttpNotFound());
            }
            return(View(nBA));
        }
Пример #8
0
        static void Main(string[] args)
        {
            BossNotify eBossNotify = new BossNotify();

            Stock tongshi1 = new Stock("张三", eBossNotify);
            NBA   tongshi2 = new NBA("李四", eBossNotify);

            eBossNotify.Update += tongshi1.DoSomeThing;
            eBossNotify.Update += tongshi2.DoSomeThing;

            eBossNotify.SubjectStatus = "你们在干嘛";
            eBossNotify.Notify();
            Console.Read();
        }
Пример #9
0
        public static async Task <NBA> getPlayerCareerData(string playerPagePath)
        {
            string    url      = BASE_API + playerPagePath;
            WebClient wc       = new WebClient();
            string    htmldocs = wc.DownloadString(url);
            var       config   = Configuration.Default;
            var       context  = BrowsingContext.New(config);
            var       document = await context.OpenAsync(req => req.Content(htmldocs));

            NBA nba  = new NBA();
            var meta = document.QuerySelector("div[id='meta']");

            if (meta != null)
            {
                var divPerson  = meta.FirstElementChild.FirstElementChild;
                var playerName = divPerson.TextContent;

                if (playerName != null)
                {
                    nba.player = playerName;
                }
                else
                {
                    // not found name?
                    nba.player = playerPagePath;
                }
            }

            foreach (var divTag in document.QuerySelectorAll("div[class='stats_pullout'] div[class^='p']"))
            {
                foreach (var subDivTag in divTag.Children)
                {
                    var key   = subDivTag.FirstElementChild.TextContent.Replace("%", "").ToLower();
                    var value = subDivTag.LastElementChild.TextContent;

                    if (value != null)
                    {
                        typeof(NBA).GetProperty(key).SetValue(nba, value);
                    }
                    else
                    {
                        typeof(NBA).GetProperty(key).SetValue(nba, "");
                    }
                }
            }

            return(nba);
        }
        public ActionResult Edit([Bind(Include = "PhotoID,Image,Title,Description,Type,Price")] NBA nBA, HttpPostedFileBase file)
        {
            if (ModelState.IsValid)
            {
                if (file != null)
                {
                    nBA.Image = new byte[file.ContentLength];
                    file.InputStream.Read(nBA.Image, 0, file.ContentLength);

                    db.Entry(nBA).State = EntityState.Modified;
                    db.SaveChanges();
                    return(RedirectToAction("Index"));
                }
            }

            return(View("nBA"));
        }
        public ActionResult Create([Bind(Include = "PhotoID,Image,Title,Description,Type,Price")] NBA nBA, HttpPostedFileBase file)
        {
            if (ModelState.IsValid)
            {
                if (file != null)
                {
                    SportsMemoribiliaStoreEntities db = new SportsMemoribiliaStoreEntities();
                    nBA.Image = new byte[file.ContentLength];
                    file.InputStream.Read(nBA.Image, 0, file.ContentLength);

                    db.NBAs.Add(nBA);
                    db.SaveChanges();
                }
            }

            return(RedirectToAction("../NBAs"));
        }
Пример #12
0
        static async Task getPlayerCareerData(char alphabet, List <string> links)
        {
            List <Task> tasks   = new List <Task>();
            List <NBA>  careers = new List <NBA>();

            foreach (string link in links)
            {
                Task t = Task.Run(() =>
                {
                    NBA playerCareer = Crawler.getPlayerCareerData(link).Result;
                    careers.Add(playerCareer);
                    Log.debug("Got player's career => " + playerCareer.player);
                });
                tasks.Add(t);
            }

            Task.WaitAll(tasks.ToArray());

            using (CsvWriter cw = new CsvWriter(alphabet + ".csv"))
            {
                cw.savePlayerCareerData(careers);
            }
        }