private void button1_Click(object sender, EventArgs e) { ShopWayEntities shopWayEntities = new ShopWayEntities(); //List<Alias> aliases = new List<Alias>(); //aliases = shopWayEntities.Aliases.ToList(); //treeView1.CreateObjRef(aliases[0]); //dataGridView1.DataSource = dtoShop.GetDtoShops(); //stopwatch.Start(); //int y = rec(1); //MessageBox.Show(y.ToString() + " is " + stopwatch.Elapsed.Minutes.ToString()); int[] arr = { 1, 2, 3, 4, 5, 6 }; arr.OrderBy(g => randomNum(1, 5)); string str = ""; arr.ToList().ForEach(a => str = str + ' ' + a); //MessageBox.Show(str); Bll.Logic.TravelComputer l = new TravelComputer(); List <Goal> listans = l.DOmain(shopWayEntities.Products.ToList(), new Point(), shopWayEntities.Walls.ToList().Last(), shopWayEntities.Shops.First().Code, shopWayEntities.GetawayProcI(1).ToList(), shopWayEntities.Connections.ToList()); string s = ":" + "המסלול שלך" + "\n"; string p = ""; for (int i = 0; i < listans.Count(); i++) { s += " kind: " + listans[i].kind + " code: " + listans[i].num + " point: (" + listans[i].midPoint.X + "," + listans[i].midPoint.Y + ")" + "\n"; if (listans[i].kind == 's' && listans[i].products != null) { MessageBox.Show("i am stand number " + listans[i].num + "and i have product " + listans[i].products[0].Alias.TextAlias); } } MessageBox.Show(s); //ShopWayEntities s = new ShopWayEntities(); //dataGridView1.DataSource = s.Products.ToList(); }
public RequestResponse PostWay(RequestResponse r) { RequestResponse r2 = new RequestResponse(); try { dynamic data = r.Data; List <object> objectsData = data.ToObject <List <object> >(); dynamic d0 = objectsData[0]; dynamic d1 = objectsData[1]; dynamic d2 = objectsData[2]; dynamic d3 = objectsData[3]; int[] CodeProducts = (int[])d0.ToObject <int[]>(); bool endCash = (Boolean)d3; int numShop = Convert.ToInt32(d2); object d4 = d1; //TODO: לטפל שישתמש בנקודת התחלה Point pStart = d1.ToObject <Point>(); if (pStart.X == 0 && pStart.Y == 0) { //MessageBox.Show("no p"); pStart = null; } List <Goal> answers = TravelComputer.MainComputeTravel(CodeProducts, pStart, numShop, endCash, ShopWay.Properties.Resources.path); r2.Data = answers; r2.Result = true; r2.Message = "this is your way"; } catch { r2.Data = null; r2.Message = "problem in compute travel"; r2.Result = false; } return(r2); }