Exemple #1
0
        public void TestStationBLL()
        {
            StationBLL bll = new StationBLL(new StationsDAL());

            Station station1 = new Station("stationA1", new SensorAddress("aa.bb1"), "description", 3);

            bll.Add(station1);

            bll.Delete(station1);

            Station station2 = new Station("stationB3", new SensorAddress("aa.bb7"), "description", 3);
            Station station3 = new Station("stationB3", new SensorAddress("aa.bb8"), "description", 3);

            bll.Add(station2);
            bll.Modify(station2, station3);

            bll.Delete(station3);
            Station station4 = (Station)bll.GetObjById(station3.Name);

            bll.ExcuteSqlStr("select * from station");

            List <object> list1 = bll.GetAllObjs();

            List <object> list2 = bll.GetObjsBySQL("select * from station", null);

            List <Station> list3 = bll.GetStationsByUser(new User("aa"));
        }
Exemple #2
0
        private void StationConfig_Load(object sender, EventArgs e)
        {
            StationBLL stationBll = new StationBLL(new StationsDAL());

            oldStations = stationBll.GetStationsByUser(mainFrm.User);

            oldNode = treeView1.Nodes[this.mainFrm.User.Name];

            DisplayStation(oldStations);
        }
Exemple #3
0
        public void InitMainFrm()
        {
            this.title.Location = new System.Drawing.Point(this.Width / 2 - this.title.Width / 2, this.menuStrip1.Height);

            if (user != null)
            {
                if (user.Role == 1)
                {
                    this.menuStrip1.Items.Add("用户管理", null, delegate(object sender, EventArgs e)
                    {
                        UserManageFrm usFrm = new UserManageFrm();
                        usFrm.Show();
                    });
                    this.menuStrip1.Items.Add("站点配置", null, (object sender, EventArgs e) => {
                        StationConfigFrm scFrm = new StationConfigFrm(this);
                        scFrm.Show();
                    });
                }

                UiInformationBLL uiBll = new UiInformationBLL(new UiInformationDAL());

                List <UIInfomation> uiInfos = uiBll.GetUiInformationsByUser(user);
                if (uiInfos.Count > 0)
                {
                    this.Text       = uiInfos[0].Caption;
                    this.title.Text = uiInfos[0].Title;
                }

                List <Station> stations = new List <Station>();

                StationBLL stationBLl = new StationBLL(new StationsDAL());

                stations = stationBLl.GetStationsByUser(this.User);

                ShowStation(stations);
            }
        }