コード例 #1
0
        public static AreaCollection GetAllItem()
        {
            //AreaCollection ItemCollection = new AreaCollection();
            //Database db = SqlHelper.CreateConnection(SqlHelper.MyConnection);
            //DbCommand dbCommand = db.GetStoredProcCommand("tblArea_GetAll");
            //using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            //{
            //    Area item;
            //    while (dataReader.Read())
            //    {
            //        item = GetItemFromReader(dataReader);
            //        ItemCollection.Add(item);
            //    }
            //}


            //return ItemCollection;


            AreaCollection collection = new AreaCollection();

            try
            {
                using (var reader = SqlHelper.ExecuteReader("tblArea_GetList", null))
                {
                    while (reader.Read())
                    {
                        Area obj = new Area();
                        obj = GetItemFromReader(reader);
                        collection.Add(obj);
                    }
                }
            }
            catch (Exception objEx)
            {
                collection.Add(new Area()
                {
                    AreaID      = 0,
                    AreaName    = objEx.Message,
                    Description = objEx.StackTrace
                });
            }
            return(collection);
        }
コード例 #2
0
        public void Add()
        {
            var addView = new AddAreaView();

            if (addView.ShowDialog() == true)
            {
                _lookup.Add(addView.NewItem);
                _viewModel.Collection.Add(addView.NewItem);
            }
        }
コード例 #3
0
ファイル: LocalApiMockModule.cs プロジェクト: zesus19/c5.v1
        public Models.Api.SchoolListClassifiedRS GetSchoolListClassified(ApiRequest apiRQ)
        {
            var schoolCollection1 = new SchoolCollection();
            schoolCollection1.Add(new School { ID = 1, Name = "上海海富幼儿园龙阳校区" });
            schoolCollection1.Add(new School { ID = 2, Name = "上海私立蒙特梭利幼儿园" });
            schoolCollection1.Add(new School { ID = 3, Name = "上海市建青实验学校幼儿部" });
            schoolCollection1.Add(new School { ID = 4, Name = "上海中国福利会幼儿园" });
            schoolCollection1.Add(new School { ID = 5, Name = "上海市浦东新区冰厂田幼儿园(云山路寄宿部)" });
            var area1 = new Area { ID = 1, Name = "黄浦区", Schools = schoolCollection1 };
            var schoolCollection2 = new SchoolCollection();
            schoolCollection2.Add(new School { ID = 6, Name = "上海市实验幼儿园(杏山园)" });
            schoolCollection2.Add(new School { ID = 7, Name = "孔祥东音乐幼儿园(巨野路园区)" });
            schoolCollection2.Add(new School { ID = 8, Name = "上海市徐汇区科技幼儿园" });
            var area2 = new Area { ID = 2, Name = "徐汇区", Schools = schoolCollection2 };
            var schoolCollection3 = new SchoolCollection();
            schoolCollection3.Add(new School { ID = 9, Name = "上海乌南幼儿园" });
            schoolCollection3.Add(new School { ID = 10, Name = "上海市本溪路幼儿园" });
            schoolCollection3.Add(new School { ID = 11, Name = "上海市宝山区行知实验幼儿园" });
            var area3 = new Area { ID = 3, Name = "长宁区", Schools = schoolCollection3 };
            var areaCollection1 = new AreaCollection();
            areaCollection1.Add(area1);
            areaCollection1.Add(area2);
            areaCollection1.Add(area3);
            var schoolCollection4 = new SchoolCollection();
            schoolCollection4.Add(new School { ID = 12, Name = "宁波市第一幼儿园" });
            schoolCollection4.Add(new School { ID = 13, Name = "宁波市宝韵音乐幼儿园" });
            schoolCollection4.Add(new School { ID = 14, Name = "宁波市华光幼儿园" });
            var schoolCollection5 = new SchoolCollection();
            schoolCollection5.Add(new School { ID = 15, Name = "杭州市行知幼儿园" });
            schoolCollection5.Add(new School { ID = 16, Name = "杭州市清波幼儿园" });
            schoolCollection5.Add(new School { ID = 17, Name = "杭州市娃哈哈幼儿园" });
            var area4 = new Area { ID = 4, Name = "杭州市", Schools = schoolCollection5 };
            var area5 = new Area { ID = 5, Name = "宁波市", Schools = schoolCollection4 };
            var areaCollection2 = new AreaCollection();
            areaCollection2.Add(area4);
            areaCollection2.Add(area5);
            var sh = new Province { ID = 1, Areas = areaCollection1, Name = "上海市" };
            var zj = new Province { ID = 2, Areas = areaCollection2, Name = "浙江省" };

            return new SchoolListClassifiedRS { Ok = true, Provinces = new List<Province> { sh, zj } };
        }
コード例 #4
0
ファイル: Area.cs プロジェクト: mudasar/scco
        internal static AreaCollection CollectAll()
        {
            var dataTable  = DatabaseController.ExecuteSelectQuery("SELECT * FROM " + TABLE_NAME);
            var collection = new AreaCollection();

            foreach (DataRow dataRow in dataTable.Rows)
            {
                var item = new Area();
                item.SetPropertiesFromDataRow(dataRow);
                collection.Add(item);
            }
            return(collection);
        }
コード例 #5
0
        public static AreaCollection GetAllItembyCountryID(int CountryID)
        {
            AreaCollection ItemCollection = new AreaCollection();
            Database       db             = SqlHelper.CreateConnection(SqlHelper.MyConnection);
            DbCommand      dbCommand      = db.GetStoredProcCommand("tblArea_GetByCountryID");

            db.AddInParameter(dbCommand, "CountryID", DbType.String, CountryID);
            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                Area item;
                while (dataReader.Read())
                {
                    item = GetItemFromReader(dataReader);
                    ItemCollection.Add(item);
                }
            }


            return(ItemCollection);
        }
コード例 #6
0
        private void frmMain_Load(object sender, EventArgs e)
        {
            Cursor.Current = Cursors.WaitCursor;

            status.Text = string.Empty;

            this.Show();
            System.Windows.Forms.Application.DoEvents();

            string mapPointFile = string.Empty;

            openFileDialog1.Filter           = "Mappoint Files (*.ptm)|*.ptm";
            openFileDialog1.RestoreDirectory = true;

            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                mappointAreas = new AreaCollection();

                MapPoint.Application mApp = new MapPoint.Application();
                mApp.Visible     = false;
                mApp.UserControl = false;

                MapPoint.Map map = mApp.OpenMap(openFileDialog1.FileName, false);

                int i = 0;
                foreach (MapPoint.Shape shape in map.Shapes)
                {
                    //try
                    //{
                    if (shape.Type == GeoShapeType.geoFreeform)
                    {
                        i++;

                        status.Text = "Importing Shape " + i.ToString();
                        System.Windows.Forms.Application.DoEvents();

                        AreaCoordinateCollection coordinates = new AreaCoordinateCollection();

                        System.Object[] objects = (System.Object[])shape.Vertices;

                        foreach (System.Object obj in objects)
                        {
                            if (obj is MapPoint.Location)
                            {
                                MapPoint.Location location = (MapPoint.Location)obj;

                                AreaCoordinate coordinate = new AreaCoordinate();
                                coordinate.Latitude  = location.Latitude;
                                coordinate.Longitude = location.Longitude;
                                coordinates.Add(coordinate);

                                System.Windows.Forms.Application.DoEvents();
                            }
                        }

                        Area area = new Area(coordinates.MinLatitude(), coordinates.MinLongitude());
                        if (area == null || area.AreaID == -1)
                        {
                            area.AreaID         = int.MinValue;
                            area.OrganizationID = OrganizationId;
                            area.Name           = "Area: " + i.ToString();
                            area.MapHeight      = 400;
                            area.MapWidth       = 600;
                        }

                        area.Coordinates = coordinates;

                        for (int j = 0; j < area.Coordinates.Count; j++)
                        {
                            AreaCoordinate aCoordinate = area.Coordinates[j];
                            aCoordinate.AreaID = area.AreaID;
                            aCoordinate.Order  = j;
                        }

                        if (area.Blob != null)
                        {
                            area.Blob.DateModified = DateTime.Now;
                        }

                        mappointAreas.Add(area);
                    }
                    //}
                    //catch (System.Exception ex)
                    //{
                    //    MessageBox.Show("Area " + i.ToString() + ": " + ex.Message, "Error Reading Area");
                    //}
                }

                LoadExistingAreas();
                LoadMappointAreas(0);
            }
            else
            {
                btnLink.Enabled      = false;
                btnCreateNew.Enabled = false;
                btnRemove.Enabled    = false;
                btnImport.Enabled    = false;
            }

            status.Text    = string.Empty;
            Cursor.Current = Cursors.Default;
        }
コード例 #7
0
        public Models.Api.SchoolListClassifiedRS GetSchoolListClassified(ApiRequest apiRQ)
        {
            var schoolCollection1 = new SchoolCollection();

            schoolCollection1.Add(new School {
                ID = 1, Name = "上海海富幼儿园龙阳校区"
            });
            schoolCollection1.Add(new School {
                ID = 2, Name = "上海私立蒙特梭利幼儿园"
            });
            schoolCollection1.Add(new School {
                ID = 3, Name = "上海市建青实验学校幼儿部"
            });
            schoolCollection1.Add(new School {
                ID = 4, Name = "上海中国福利会幼儿园"
            });
            schoolCollection1.Add(new School {
                ID = 5, Name = "上海市浦东新区冰厂田幼儿园(云山路寄宿部)"
            });
            var area1 = new Area {
                ID = 1, Name = "黄浦区", Schools = schoolCollection1
            };
            var schoolCollection2 = new SchoolCollection();

            schoolCollection2.Add(new School {
                ID = 6, Name = "上海市实验幼儿园(杏山园)"
            });
            schoolCollection2.Add(new School {
                ID = 7, Name = "孔祥东音乐幼儿园(巨野路园区)"
            });
            schoolCollection2.Add(new School {
                ID = 8, Name = "上海市徐汇区科技幼儿园"
            });
            var area2 = new Area {
                ID = 2, Name = "徐汇区", Schools = schoolCollection2
            };
            var schoolCollection3 = new SchoolCollection();

            schoolCollection3.Add(new School {
                ID = 9, Name = "上海乌南幼儿园"
            });
            schoolCollection3.Add(new School {
                ID = 10, Name = "上海市本溪路幼儿园"
            });
            schoolCollection3.Add(new School {
                ID = 11, Name = "上海市宝山区行知实验幼儿园"
            });
            var area3 = new Area {
                ID = 3, Name = "长宁区", Schools = schoolCollection3
            };
            var areaCollection1 = new AreaCollection();

            areaCollection1.Add(area1);
            areaCollection1.Add(area2);
            areaCollection1.Add(area3);
            var schoolCollection4 = new SchoolCollection();

            schoolCollection4.Add(new School {
                ID = 12, Name = "宁波市第一幼儿园"
            });
            schoolCollection4.Add(new School {
                ID = 13, Name = "宁波市宝韵音乐幼儿园"
            });
            schoolCollection4.Add(new School {
                ID = 14, Name = "宁波市华光幼儿园"
            });
            var schoolCollection5 = new SchoolCollection();

            schoolCollection5.Add(new School {
                ID = 15, Name = "杭州市行知幼儿园"
            });
            schoolCollection5.Add(new School {
                ID = 16, Name = "杭州市清波幼儿园"
            });
            schoolCollection5.Add(new School {
                ID = 17, Name = "杭州市娃哈哈幼儿园"
            });
            var area4 = new Area {
                ID = 4, Name = "杭州市", Schools = schoolCollection5
            };
            var area5 = new Area {
                ID = 5, Name = "宁波市", Schools = schoolCollection4
            };
            var areaCollection2 = new AreaCollection();

            areaCollection2.Add(area4);
            areaCollection2.Add(area5);
            var sh = new Province {
                ID = 1, Areas = areaCollection1, Name = "上海市"
            };
            var zj = new Province {
                ID = 2, Areas = areaCollection2, Name = "浙江省"
            };

            return(new SchoolListClassifiedRS {
                Ok = true, Provinces = new List <Province> {
                    sh, zj
                }
            });
        }