示例#1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void UCCompareAmount1_QueryEvent(object sender, EventArgs e)
        {
            StationCollection stations = this.UCCompareAmount1.SelectedStationCollection;

            if (stations.Count > 0)
            {
                DateTime  begin = this.UCCompareAmount1.Begin;
                DateTime  end   = this.UCCompareAmount1.End;
                DataTable tbl   = stations.GetSluiceDataTable(begin, end);

                //
                //
                string title  = string.Format("{0} ~ {1} {2}闸位曲线", begin, end, this.GetSelectedChannelName());
                string yTitle = "闸位(cm)";

                this.UCAMChart1.SetLineChartInfo(tbl,
                                                 "StationName",
                                                 "DT",
                                                 "Height",
                                                 title,
                                                 yTitle);

                //
                //
                H.DataSource = tbl;
                H.Bind();
            }
        }
示例#2
0
        /// <summary>
        /// 
        /// </summary>
        public static StationCollection CreateRainStationCollection()
        {
            StationCollection rainStations = new StationCollection();
            DataTable rainStationTable = StationDBI.GetRainStationDataTable();

            return CreateStationCollection(rainStationTable);
        }
示例#3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Query()
        {
            if (IsValid)
            {
                DateTime begin = UCConditionDTTwo1.Begin;
                DateTime end   = UCConditionDTTwo1.End;

                //int  UCConditionDTTwo1.GetQueryDeviceIDs();
                StationCollection sc           = this.UCConditionDTTwo1.Stations;
                string[]          stationNames = sc.GetStationNames();

                DataTable tbl = DitchDataDayDBI.GetDayDataTable(begin, end, stationNames, this.DataEnum);
                //this.GridView1.DataSource = tbl;
                //this.DataBind();
                this.GridView1.Columns.Clear();
                Xdgk.UI.GridViewHelper H = new Xdgk.UI.GridViewHelper(this.GridView1);
                H.GridViewConfig = GetGridViewConfig(tbl);
                H.DataSource     = tbl;
                H.Bind();


                this.UCZedChart1.DataSource      = tbl;
                this.UCZedChart1.GraphPaneConfig = GetGraphPaneConfig(tbl);
            }
        }
示例#4
0
        /// <summary>
        /// 
        /// </summary>
        private void Fill()
        {

            StationCollection stations = SoftManager.GetSoft().Hardware.Stations;
            foreach (IStation st in stations)
            {
                foreach (IDevice d in st.Devices)
                {
                    if (d is IOutside)
                    {
                        kvs.Add(new KeyValue(d.Station.Name, d));
                    }
                }
            }

            //
            //
            kvs.Insert(0, new KeyValue("<无>", null));

            this.cmbStandard.DisplayMember = "Key";
            this.cmbStandard.ValueMember = "Value";
            this.cmbStandard.DataSource = kvs;


            IOutsideTemperatureProvider p = OutsideTemperatureProviderManager.Provider;
            if (p is DeviceOTProvider)
            {
                this.cmbStandard.SelectedValue = ((DeviceOTProvider)p).Outside;
            }
        }
示例#5
0
        /// <summary>
        ///
        /// </summary>
        private void Fill()
        {
            int no = 1;

            StationCollection stations = SoftManager.GetSoft().Hardware.Stations;

            foreach (IStation st in stations)
            {
                foreach (IDevice d in st.Devices)
                {
                    if (d is IOutside)
                    {
                        string   keyName = string.Format("{0}: {1}({2})", no++, d.Station.Name, d.DeviceType.Text);
                        KeyValue kv      = new KeyValue(keyName, d);
                        kvs.Add(kv);
                    }
                }
            }

            //
            //
            kvs.Insert(0, new KeyValue("<无>", null));

            this.cmbStandard.DisplayMember = "Key";
            this.cmbStandard.ValueMember   = "Value";
            this.cmbStandard.DataSource    = kvs;


            IOutsideTemperatureProvider p = OutsideTemperatureProviderManager.Provider;

            if (p is DeviceOTProvider)
            {
                this.cmbStandard.SelectedValue = ((DeviceOTProvider)p).Outside;
            }
        }
示例#6
0
        /// <summary>
        ///
        /// </summary>
        private void Query()
        {
            string title  = string.Empty;
            string ytitle = string.Empty;

            StationCollection selected = this.UCCompareAmount1.SelectedStationCollection;
            DateTime          begin    = this.UCCompareAmount1.Begin;
            DateTime          end      = this.UCCompareAmount1.End;

            this.UCAMChart1.StationOrderList = GetStationOrderList(selected);
            this.UCAMChart1.StationColorList = GetStationColorList(selected);
            switch (this.DataEnum)
            {
            case DataEnum.WL:
                QueryWL(selected, begin, end);
                break;

            case DataEnum.Flux:
                QueryFlux(selected, begin, end);
                break;

            case DataEnum.Amount:
                QueryAmount(selected, begin, end);
                break;
            }
            this.ShowControls();
        }
示例#7
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="stationCollection"></param>
        /// <returns></returns>
        private List <IStation> Sort(StationCollection stations)
        {
            List <IStation> stationList = new List <IStation>(stations);

            stationList.Sort(new StationComparer());
            return(stationList);
        }
示例#8
0
文件: frmMain.cs 项目: wpmyj/c3
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void mnuStationAdd_Click(object sender, EventArgs e)
        {
            frmStationType f  = new frmStationType();
            DialogResult   dr = f.ShowDialog();

            if (dr == DialogResult.OK)
            {
                StationType stationType = f.SelectedStationType;
                ISPU        spu         = Soft.SPUs[stationType];
                IStationUI  stationUI   = spu.StationUI;

                StationCollection stations = this.Soft.Hardware.Stations;
                IStation          newStation;
                DialogResult      dr2 = stationUI.Add(stationType, stations, out newStation);
                if (dr2 == DialogResult.OK)
                {
                    Debug.Assert(newStation.StationType != null);
                    Debug.Assert(newStation.Spu != null);
                    Debug.Assert(newStation.Guid != null);

                    stations.Add(newStation);
                    spu.StationPersister.Add(newStation);

                    StationTreeNode stationNode = new StationTreeNode(newStation);
                    this.HardwareTreeView.Nodes.Add(stationNode);
                }
            }
        }
示例#9
0
        /// <summary>
        ///
        /// </summary>
        public StationCollection GetDeletedStationCollection()
        {
            StationCollection stations = this.GetStationList(this.ChannelID);

            stations.Remove(this.StationCollection);
            return(stations);
        }
示例#10
0
        //****************************************************
        // Method: private void button_Click(object sender, RoutedEventArgs e)
        //
        // Purpose: Handle button click event to open JSON file of StationCollection
        //          and add to items on listview for the station collection
        private void button_Click(object sender, RoutedEventArgs e)
        {
            OpenFileDialog dlg = new OpenFileDialog();

            dlg.Title            = "Open StationCollection From JSON";
            dlg.InitialDirectory = Directory.GetCurrentDirectory();
            dlg.Filter           = "JSON files (*.json)|*.json";

            if (dlg.ShowDialog() == true)
            {
                FileStream reader = new FileStream(dlg.FileName, FileMode.Open, FileAccess.Read);

                DataContractJsonSerializer inputSerializer;
                inputSerializer = new DataContractJsonSerializer(typeof(StationCollection));

                sc = (StationCollection)inputSerializer.ReadObject(reader);
                reader.Close();

                foreach (Station s in sc.stations)
                {
                    listViewStationCollection.Items.Add(s);
                }

                textBoxFilename.Text = dlg.FileName;
            }
        }
示例#11
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public StationCollection CreateRainStations(CommuniSoft soft)
        {
            string deviceType = "LXRainDevice";

            StationCollection stations = new StationCollection();
            DataTable         stTable  = LXDBDBI.LXDB.GetRainStationDataTable();

            foreach (DataRow row in stTable.Rows)
            {
                string    rainName    = row["Rain_Name"].ToString();
                int       rainAddress = Convert.ToInt32(row["Rain_addr"]);
                string    ipString    = row["Rain_IP"].ToString();
                IPAddress ip          = IPAddress.Parse(ipString);
                int       deviceid    = rainAddress;
                int       stationid   = rainAddress;

                SocketCommuniType ct = new SocketCommuniType(ip);
                Station           st = new Station(rainName, ct);
                st.ID = stationid;

                DeviceDefine dd = soft.DeviceDefineManager.
                                  DeviceDefineCollection.FindDeviceDefine(deviceType);
                LXRainDevice d = new LXRainDevice(dd, rainAddress);
                d.ID = deviceid;

                st.Devices.Add(d);

                stations.Add(st);
            }
            return(stations);
        }
示例#12
0
        /// <summary>
        ///
        /// </summary>
        private void Query()
        {
            StationCollection stations = this.UCCompareAmount1.SelectedStationCollection;
            RangeType         rt       = this.UCCompareAmount1.RangeType;

            switch (rt)
            {
            case RangeType.Year:
                QueryYear();
                break;

            case RangeType.During:
                QueryDuring();
                break;

            case RangeType.Range:
                QueryRange();
                break;

            case RangeType.Day:
                QueryDay();
                break;

            default:
                throw new NotSupportedException("cannot query with RangeType: " + rt);
            }
            ShowControls();
        }
示例#13
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="n1"></param>
 /// <param name="stationCollection"></param>
 private void CreateStation(TreeNode parent, StationCollection stationCollection)
 {
     foreach (StationClass s in stationCollection)
     {
         TreeNode stationTN = CreateStationTreeNode(s);
         parent.ChildNodes.Add(stationTN);
     }
 }
        private void InitControl()
        {
            cmb_EntryStation.DataSource    = StationCollection.AllStation();
            cmb_EntryStation.DisplayMember = "Name";

            cmb_GoOutStation.DataSource    = StationCollection.AllStation();
            cmb_GoOutStation.DisplayMember = "Name";
        }
示例#15
0
 /// <summary>
 /// 
 /// </summary>
 public frmStationItem(StationCollection stations)
     : this()
 {
     _stations = stations;
     // set init value
     //
     this.cmbDiscriminateMode.SelectedValue = DiscriminateMode.ByIPAddress;
     this._adeState = ADEStatus.Add;
 }
示例#16
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="selected"></param>
 /// <returns></returns>
 private System.Collections.Generic.List <string> GetStationOrderList(StationCollection selected)
 {
     System.Collections.Generic.List <string> result = new System.Collections.Generic.List <string>();
     foreach (StationClass st in selected)
     {
         result.Add(st.StationName);
     }
     return(result);
 }
示例#17
0
 /// <summary>
 ///
 /// </summary>
 public frmStationItem(StationCollection stations)
     : this()
 {
     _stations = stations;
     // set init value
     //
     this.cmbDiscriminateMode.SelectedValue = DiscriminateMode.ByIPAddress;
     this._adeState = ADEStatus.Add;
 }
示例#18
0
文件: frmMain.cs 项目: leadscloud/lx
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void mnuStationAdd_Click(object sender, EventArgs e)
        {
            StationCollection ss = YeHeCommuniServerApp.Default.CommuniSoft.HardwareManager.Stations;
            frmStationItem    f  = new frmStationItem(ss);
            DialogResult      dr = f.ShowDialog();

            if (dr == DialogResult.OK)
            {
                AddStationToTreeView(this.tvStation, f.Station);
            }
        }
示例#19
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="stations"></param>
 /// <param name="scp"></param>
 internal static bool Bind(StationCollection stations, SocketCommuniPort scp)
 {
     foreach (Station st in stations)
     {
         if (scp.Match(st.CommuniType))
         {
             ClearBind(st);
             return Bind(st, scp);
         }
     }
     return false;
 }
示例#20
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="selected"></param>
        /// <param name="begin"></param>
        /// <param name="end"></param>
        private void QueryWL(StationCollection selected, DateTime begin, DateTime end)
        {
            DataTable tbl = selected.GetWL1DataTable(begin, end);

            this.UCAMChart1.SetLineChartInfo(tbl,
                                             YongShuiGuanLiDBI.DBNames.vDitchData.StationName,
                                             YongShuiGuanLiDBI.DBNames.vDitchData.DT,
                                             YongShuiGuanLiDBI.DBNames.vDitchData.WL1);

            this.GridView1.DataSource = tbl;
            this.GridView1.DataBind();
        }
示例#21
0
        /// <summary>
        ///
        /// </summary>
        private void SaveStationColor()
        {
            StationCollection ss = SessionManager.ChannelSession.StationCollection;

            for (int i = 0; i < this.dlStation.Items.Count; i++)
            {
                DataListItem item     = this.dlStation.Items[i];
                TextBox      txtColor = item.Controls[3] as TextBox;
                StationClass station  = ss[i];
                station.Color = ConvertStringToColor(txtColor.Text);
            }
        }
示例#22
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void UCConditionDTTwo1_QueryEvent(object sender, EventArgs e)
        {
            if (IsValid)
            {
                DateTime begin = this.UCConditionDTTwo1.Begin;
                DateTime end   = this.UCConditionDTTwo1.End;

                StationCollection stations = this.UCConditionDTTwo1.Stations;
                DataTable         tbl      = DitchDataDayDBI.GetDayDataTable(begin, end, stations.GetStationNames(), DataEnum.Amount);
                this.GridView1.DataSource = tbl;
                this.GridView1.DataBind();
            }
        }
示例#23
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        private string GetSelectedStationName()
        {
            StationCollection stations = this.UCConditionDTTwo1.Stations;

            if (stations.Count > 0)
            {
                return(stations[0].StationName);
            }
            else
            {
                return(string.Empty);
            }
        }
示例#24
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="stations"></param>
        /// <returns></returns>
        static private ListItemCollection GetStationListItemCollection(StationCollection stations)
        {
            ListItemCollection r = new ListItemCollection();

            foreach (StationClass s in stations)
            {
                int      id   = s.StationID;
                string   name = s.StationName;
                ListItem item = new ListItem(name, id.ToString());
                //item.Selected = true;
                r.Add(item);
            }
            return(r);
        }
示例#25
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="stations"></param>
        /// <param name="cp"></param>
        internal static bool Bind(StationCollection stations, CommuniPort cp)
        {
            if (stations == null)
                throw new ArgumentNullException("stations");

            if (cp == null)
                throw new ArgumentNullException("cp");

            if (cp is SocketCommuniPort)
            {
                return Bind(stations, cp as SocketCommuniPort);
            }
            return false;
        }
示例#26
0
        /// <summary>
        /// Add a station to the collection of stations to be processed rejecting duplicates.
        /// </summary>
        /// <param name="newStation">The station to be added.</param>
        public static bool AddStation(TVStation newStation)
        {
            if (newStation == null)
            {
                throw (new ArgumentException("The new station cannot be null", "newStation"));
            }

            foreach (TVStation oldStation in StationCollection)
            {
                if (oldStation.OriginalNetworkID != -1)
                {
                    if (oldStation.OriginalNetworkID == newStation.OriginalNetworkID &&
                        oldStation.TransportStreamID == newStation.TransportStreamID &&
                        oldStation.ServiceID == newStation.ServiceID)
                    {
                        oldStation.Name = newStation.Name;
                        return(false);
                    }
                }
                else
                {
                    if (oldStation.Frequency != -1)
                    {
                        if (oldStation.Frequency == newStation.Frequency &&
                            oldStation.ServiceID == newStation.ServiceID)
                        {
                            oldStation.Name = newStation.Name;
                            oldStation.OriginalNetworkID = newStation.OriginalNetworkID;
                            oldStation.TransportStreamID = newStation.TransportStreamID;
                            return(false);
                        }
                    }
                    else
                    {
                        if (oldStation.ServiceID == newStation.ServiceID)
                        {
                            oldStation.Name = newStation.Name;
                            oldStation.OriginalNetworkID = newStation.OriginalNetworkID;
                            oldStation.TransportStreamID = newStation.TransportStreamID;
                            oldStation.Frequency         = newStation.Frequency;
                            return(false);
                        }
                    }
                }
            }

            StationCollection.Add(newStation);

            return(true);
        }
示例#27
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="channelID"></param>
        private StationCollection GetStationList(int channelID)
        {
            StationCollection list       = new StationCollection();
            DataTable         stationTbl = ChannelDBI.GetStationDataTable(channelID);

            foreach (DataRow row in stationTbl.Rows)
            {
                StationClass sc = new StationClass();
                sc.StationID   = Convert.ToInt32(row["StationID"]);
                sc.StationName = row["Name"].ToString();
                //this.StationCollection.Add(sc);
                list.Add(sc);
            }
            return(list);
        }
示例#28
0
        /// <summary>
        /// 
        /// </summary>
        public frmStationItem(StationCollection stations)
        {
            this.InitializeComponent();
            this.FillDiscriminateMode();

            BindGroup();
            ShowSocketSettingUI();

            _stations = stations;
            // set init value
            //
            this.cmbDiscriminateMode.SelectedValue = DiscriminateMode.ByIPAddress;
            this._adeState = ADEState.Add;
            this.rbSocket.Checked = true;
        }
示例#29
0
        /// <summary>
        ///
        /// </summary>
        private void Query()
        {
            StationCollection selected = this.UCChannelStationDT1.SelectedStationCollection;
            DateTime          begin    = this.UCChannelStationDT1.Begin;
            DateTime          end      = this.UCChannelStationDT1.End;

            if (this.UCChannelStationDT1.IsDateTimePoint)
            {
                DataTable t         = selected.GetDitchDataSection(end);
                string    valueName = string.Empty;
                switch (this.DataEnum)
                {
                case DataEnum.WL:
                    valueName = "WL1";
                    break;

                case DataEnum.Flux:
                    valueName = YongShuiGuanLiDBI.DBNames.vDitchData.InstantFlux;
                    break;

                case DataEnum.Amount:
                    valueName = YongShuiGuanLiDBI.DBNames.vDitchDataDay.DayAmount;
                    break;
                }
                this.UCAMChart1.SetColumnChartInfo(t, "StationName", valueName, "DT");
            }
            else
            {
                switch (this.DataEnum)
                {
                case DataEnum.WL:
                    QueryWL(selected, begin, end);
                    break;

                case DataEnum.Flux:
                    QueryFlux(selected, begin, end);
                    break;

                case DataEnum.Amount:
                    QueryAmount(selected, begin, end);
                    break;
                }
            }

            this.UCAMChart1.Visible = true;
        }
示例#30
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="?"></param>
        public void SetChannalInfo(int channelID)
        {
            this.ChannelID = channelID;
            DataTable tbl = ChannelDBI.GetChannelDataTable(channelID);

            if (tbl.Rows.Count > 0)
            {
                DataRow r = tbl.Rows[0];
                this.ChannelName   = r["ChannelName"].ToString();
                this.ChannelRemark = r["Remark"].ToString();
                //this.StationCollection =

                this.StationCollection.Clear();
                StationCollection stationsOfChannel = GetStationList(channelID);
                //this.StationCollection.Add(stationsOfChannel
                this.StationCollection = stationsOfChannel;
            }
        }
示例#31
0
        /// <summary>
        /// 获取候选站点列表
        /// </summary>
        /// <returns></returns>
        public StationCollection GetCandidateStationList()
        {
            StationCollection list = new StationCollection();
            DataTable         tbl  = StationDBI.GetNotAssociateStationDataTable();

            foreach (DataRow row in tbl.Rows)
            {
                int          stationID = Convert.ToInt32(row["StationID"]);
                string       name      = row["Name"].ToString();
                StationClass n         = new StationClass();
                n.StationID   = stationID;
                n.StationName = name;
                list.Add(n);
            }
            list.Remove(this.StationCollection);
            list.Add(GetDeletedStationCollection());
            return(list);
        }
示例#32
0
        public static StationBody Create(String flowID, String name)
        {
            StationCollection stations;

            if (!flows.TryGetValue(flowID, out stations))
            {
                flows.TryAdd(flowID, stations = new StationCollection());
            }

            var body = createStationBody(flowID, name);

            if (!stations.TryAdd(name, body))
            {
                stations.TryGetValue(name, out body);
            }

            return(body);
        }
示例#33
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="selected"></param>
        /// <param name="begin"></param>
        /// <param name="end"></param>
        private void QueryFlux(StationCollection selected, DateTime begin, DateTime end)
        {
            string    title  = string.Format("{0} ~ {1} {2}流量曲线", begin, end, this.GetSelectedChannelName());
            string    yTitle = "流量(m3/s)";
            DataTable tbl    = selected.GetFluxDataTable(begin, end);

            this.UCAMChart1.SetLineChartInfo(tbl,
                                             YongShuiGuanLiDBI.DBNames.vDitchData.StationName,
                                             YongShuiGuanLiDBI.DBNames.vDitchData.DT,
                                             DataTableHelper.GetExistColumnName(tbl, "InstantFlux", "avgflux"),
                                             title,
                                             yTitle);

            this.GridView1.Columns.Clear();
            Xdgk.UI.GridViewHelper h = new Xdgk.UI.GridViewHelper(this.GridView1);
            h.GridViewConfig = GetGridViewConfig(DataEnum.Flux, tbl);
            h.DataSource     = tbl;
            h.Bind();
        }
示例#34
0
        public static void LoadData()
        {
            Stopwatch         sw      = new Stopwatch();
            string            Data    = System.IO.File.ReadAllText(Constants.StationListPath);
            StationCollection station = Newtonsoft.Json.JsonConvert.DeserializeObject <StationCollection>(Data);

            //To prevent null's in Description

            foreach (Station s in station.Stations)
            {
                if (!s.Description.Any())
                {
                    s.Description.Add("");
                }
            }

            References.stationCollection = station;
            CreateStationList();
        }
示例#35
0
        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        public static StationCollection CreateStationCollection(int channelID)
        {
            StationCollection stations = new StationCollection();
            DataTable channelStationMapTbl = ChannelStationMapDBI.GetChannelStationMapDataTable(channelID);

            //int[] stationIDs = ChannelStationMapDBI.GetStationIDs(channelID);
            int[] stationIDs = DataTableHelper.GetIDs(channelStationMapTbl, "stationid");

            DataTable tbl =  StationDBI.GetStationDataTable(stationIDs);
            foreach (DataRow row in tbl.Rows)
            {
                StationClass c = CreateStation(row);
                c.StationOrdinal = GetStationOrdinal(channelStationMapTbl, c.StationID);
                stations.Add(c);
            }

            stations.SortByStationOrdinal();
            return stations;
        }
示例#36
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="station"></param>
        public frmStationItem(StationCollection stations, Station station)
        {
            this.InitializeComponent();
            this.FillDiscriminateMode();

            BindGroup();
            this._stations = stations;
            this._station = station;

            this.ADEState = ADEState.Edit;

            this.txtStationName.Text = this._station.Name;
            this.GroupID = GetGroupID(this._station.ID);
            this.txtRemark.Text = this._station.Description;

            if (this._station.CommuniType is SocketCommuniType)
            {
                this.rbSocket.Checked = true;
                this.rbSerialPort.Checked = false;
                this.ShowSocketSettingUI();

                SocketCommuniType socketct = this._station.CommuniType as SocketCommuniType;

                if (socketct.DiscriminateMode == DiscriminateMode.ByIPAddress)
                {
                    this.txtStationIP.Text = socketct.IPAddress.ToString();
                }
                this.numLocalPort.Value = socketct.LocalPort;
                this.numRemotePort.Value = socketct.RemotePort;
                this.cmbDiscriminateMode.SelectedValue = socketct.DiscriminateMode;
            }

            if (this._station.CommuniType is SerialCommuniType)
            {
                this.rbSocket.Checked = false;
                this.rbSerialPort.Checked = true;
                this.ShowSerialPortSettingUI();

                SerialCommuniType serialct = this._station.CommuniType as SerialCommuniType;
                this.ucSerialPortSetting1.SerialCommuniType = serialct;
            }
        }
示例#37
0
文件: StationUI.cs 项目: hkiaipc/C3
        /// <summary>
        /// 
        /// </summary>
        /// <param name="stationType"></param>
        /// <param name="newStation"></param>
        /// <returns></returns>
        public DialogResult Add(StationType stationType, StationCollection stations, out IStation newStation)
        {
            newStation = null;

            Debug.Assert(stationType != null);
            Debug.Assert(stations != null);

            FrmStationGroups f = new FrmStationGroups();
            f.AdeStatus = ADEStatus.Add;
            f.StationType = stationType;
            f.Stations = stations;
            f.Station = stationType.Create(this.Spu);
            f.Groups = f.Station.Groups;
            DialogResult dr = f.ShowDialog();
            if (dr == DialogResult.OK)
            {
                newStation = f.Station;
            }
            return dr;
        }
示例#38
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="channelID"></param>
        /// <param name="cblStation"></param>
        /// <param name="deviceTypes"></param>
        /// <param name="isSelected"></param>
        static public void StationOfChannelBind(int channelID, CheckBoxList cblStation, string[] deviceTypes, bool isSelected)
        {
            ChannelClass ch = ChannelFactory.CreateChannel(channelID);

            if (ch != null)
            {
                StationCollection sts = ch.StationCollection.GetStationCollection(deviceTypes);

                ListItemCollection stationList = GetStationListItemCollection(sts);
                cblStation.DataTextField  = "Text";
                cblStation.DataValueField = "Value";
                cblStation.DataSource     = stationList;
                cblStation.DataBind();

                foreach (ListItem stitem in cblStation.Items)
                {
                    stitem.Selected = isSelected;
                }
            }
        }
示例#39
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="station"></param>
        public frmStationItem(StationCollection stations, Station station)
            : this()
        {
            this._stations = stations;
            this._station = station;

            this.ADEState = ADEStatus.Edit;

            SocketCommuniType socketct = this._station.CommuniType as SocketCommuniType;

            this.txtStationName.Text = this._station.Name;
            //this.numOrdinal.Value = this._station.DBStation.Ordinal;
            this.txtRemark.Text = this._station.Description;
            //this.txtStreet.Text = this._station.DBStation.Street;

            if (socketct.DiscriminateMode == DiscriminateMode.ByIPAddress)
            {
                this.txtStationIP.Text = socketct.IPAddress.ToString();
            }
            this.numLocalPort.Value = socketct.LocalPort;
            this.numRemotePort.Value = socketct.RemotePort;
            this.cmbDiscriminateMode.SelectedValue = socketct.DiscriminateMode;
        }
示例#40
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="selected"></param>
        /// <param name="begin"></param>
        /// <param name="end"></param>
        private void QueryFlux(StationCollection selected, DateTime begin, DateTime end)
        {
            string title = string.Format("{0} ~ {1} {2}流量曲线", begin, end, this.GetSelectedChannelName());
            string yTitle = "流量(m3/s)";
            DataTable tbl = selected.GetFluxDataTable(begin, end);
            this.UCAMChart1.SetLineChartInfo(tbl,
                YongShuiGuanLiDBI.DBNames.vDitchData.StationName,
                YongShuiGuanLiDBI.DBNames.vDitchData.DT,
                DataTableHelper.GetExistColumnName (tbl, "InstantFlux","avgflux"),
                title,
                yTitle);

            this.GridView1.Columns.Clear();
            Xdgk.UI.GridViewHelper h = new Xdgk.UI.GridViewHelper(this.GridView1);
            h.GridViewConfig = GetGridViewConfig(DataEnum.Flux, tbl);
            h.DataSource = tbl;
            h.Bind();
        }
示例#41
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="selected"></param>
        /// <param name="begin"></param>
        /// <param name="end"></param>
        private void QueryAmount(StationCollection selected, DateTime begin, DateTime end)
        {
            string title = string.Format("{0} ~ {1} {2}水量曲线", begin, end, this.GetSelectedChannelName());
            string yTitle = "水量(m3)";

            DataTable tbl = selected.GetAmountDataTable(begin, end);
            this.UCAMChart1.SetLineChartInfo(tbl,
                YongShuiGuanLiDBI.DBNames.vDitchDataDay.StationName,
                YongShuiGuanLiDBI.DBNames.vDitchDataDay.DT,
                YongShuiGuanLiDBI.DBNames.vDitchDataDay.DayAmount,
                title,
                yTitle);

            this.GridView1.Columns.Clear();
            Xdgk.UI.GridViewHelper h = new Xdgk.UI.GridViewHelper(this.GridView1);
            h.GridViewConfig = GetGridViewConfig(DataEnum.Amount,tbl);
            h.DataSource = tbl;
            h.Bind();
        }
示例#42
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="selected"></param>
 /// <returns></returns>
 private System.Collections.Generic.List<string> GetStationOrderList(StationCollection selected)
 {
     System.Collections.Generic.List<string> result = new System.Collections.Generic.List<string>();
     foreach (StationClass st in selected)
     {
         result.Add(st.StationName);
     }
     return result;
 }
示例#43
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="stations"></param>
 /// <returns></returns>
 private static ListItemCollection GetStationListItemCollection(StationCollection stations)
 {
     ListItemCollection r = new ListItemCollection();
     foreach (StationClass s in stations)
     {
         int id = s.StationID;
         string name = s.StationName;
         ListItem item = new ListItem(name, id.ToString());
         //item.Selected = true;
         r.Add(item);
     }
     return r;
 }
示例#44
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="selected"></param>
        /// <param name="begin"></param>
        /// <param name="end"></param>
        private void QueryWL(StationCollection selected, DateTime begin, DateTime end)
        {
            DataTable tbl = selected.GetWL1DataTable(begin, end);

            this.UCAMChart1.SetLineChartInfo(tbl,
                YongShuiGuanLiDBI.DBNames.vDitchData.StationName,
                YongShuiGuanLiDBI.DBNames.vDitchData.DT,
                YongShuiGuanLiDBI.DBNames.vDitchData.WL1);

            this.GridView1.DataSource = tbl;
            this.GridView1.DataBind();
        }
示例#45
0
        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        public StationCollection CreateRainStations(CommuniSoft soft)
        {
            string deviceType = "LXRainDevice";

            StationCollection stations = new StationCollection();
            DataTable stTable = LXDBDBI.LXDB.GetRainStationDataTable();
            foreach (DataRow row in stTable.Rows)
            {
                string rainName = row["Rain_Name"].ToString();
                int rainAddress = Convert.ToInt32(row["Rain_addr"]);
                string ipString = row["Rain_IP"].ToString();
                IPAddress ip = IPAddress.Parse(ipString);
                int deviceid = rainAddress;
                int stationid = rainAddress;

                SocketCommuniType ct = new SocketCommuniType(ip);
                Station st = new Station(rainName, ct);
                st.ID = stationid;

                DeviceDefine dd = soft.DeviceDefineManager.
                    DeviceDefineCollection.FindDeviceDefine(deviceType);
                LXRainDevice d = new LXRainDevice(dd,rainAddress);
                d.ID = deviceid;

                st.Devices.Add(d);

                stations.Add(st);
            }
            return stations;
        }
示例#46
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="waterUserID"></param>
 /// <param name="stations"></param>
 public static void AssocicateWaterUserStationIn(int waterUserID, StationCollection stations)
 {
     DeleteWaterUserStationIN(waterUserID);
 }
示例#47
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void cp_Received(object sender, EventArgs e)
        {
            ICommuniPort cp = (ICommuniPort)sender;
            byte[] bs = cp.Read();

            // TODO: cp.stations
            //
            StationCollection stations = new StationCollection();
            foreach (IStation st in this.Soft.Hardware.Stations)
            {
                if (st.CommuniPortConfig.IsMatch(cp))
                {
                    stations.Add(st);
                }
            }

            foreach (IStation st in stations)
            {
                foreach (IDevice d in st.Devices)
                {
                    if (bs.Length > 0)
                    {
                        //ITaskProcessor processor = d.Dpu.Processor;
                        //IUploadParseResult pr = processor.ProcessUpload(d, bs);
                        //bs = pr.Remain;
                        d.ProcessUpload(bs);
                    }
                }
            }
        }
示例#48
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="channelID"></param>
 private StationCollection GetStationList(int channelID)
 {
     StationCollection list = new StationCollection();
     DataTable stationTbl = ChannelDBI.GetStationDataTable(channelID);
     foreach (DataRow row in stationTbl.Rows)
     {
         StationClass sc = new StationClass();
         sc.StationID = Convert.ToInt32(row["StationID"]);
         sc.StationName = row["Name"].ToString();
         //this.StationCollection.Add(sc);
         list.Add(sc);
     }
     return list;
 }
示例#49
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="?"></param>
        public void SetChannalInfo( int channelID )
        {
            this.ChannelID = channelID;
            DataTable tbl = ChannelDBI.GetChannelDataTable(channelID);
            if (tbl.Rows.Count > 0)
            {
                DataRow r = tbl.Rows[0];
                this.ChannelName = r["ChannelName"].ToString();
                this.ChannelRemark = r["Remark"].ToString();
                //this.StationCollection =

                this.StationCollection.Clear();
                StationCollection stationsOfChannel = GetStationList(channelID);
                //this.StationCollection.Add(stationsOfChannel
                this.StationCollection = stationsOfChannel;
            }
        }
示例#50
0
 /// <summary>
 /// 获取候选站点列表
 /// </summary>
 /// <returns></returns>
 public StationCollection GetCandidateStationList()
 {
     StationCollection list = new StationCollection();
     DataTable tbl =  StationDBI.GetNotAssociateStationDataTable();
     foreach (DataRow row in tbl.Rows)
     {
         int stationID = Convert.ToInt32(row["StationID"]);
         string name = row["Name"].ToString();
         StationClass n = new StationClass();
         n.StationID = stationID;
         n.StationName = name;
         list.Add(n);
     }
     list.Remove(this.StationCollection);
     list.Add(GetDeletedStationCollection());
     return list;
 }
示例#51
0
        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        private bool DistributeQueryStringParam_Real()
        {
            string[] paramNames = new string[] { QueryStringNames.StationID};
            Type[] paramTypes = new Type[]{typeof(int)};

            object []result ;
            bool b = QueryStringParamPicker.Pick(this.Request.QueryString, paramNames, paramTypes,
                out result);

            if (b)
            {
                int stationid = (int)result[0];
                this.UCConditionDTTwo1.WaterUser = SessionManager.LoginSession.WaterUser;

                StationClass sc = StationFactory.CreateStationByStationID(stationid);
                StationCollection stations = new StationCollection();
                stations.Add (sc);
                this.UCConditionDTTwo1.Stations = stations;
                this.UCConditionDTTwo1.Begin = DateTime.Now.Date;
                this.UCConditionDTTwo1.End = DateTime.Now.Date + TimeSpan.FromDays(1d);
                return true;
            }
            return false;
        }
示例#52
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="selected"></param>
        /// <param name="begin"></param>
        /// <param name="end"></param>
        private void QueryWL(StationCollection selected, DateTime begin, DateTime end)
        {
            string title = string.Format("{0} ~ {1} {2}水位曲线", begin, end, this.GetSelectedChannelName());
            string ytitle = "水位(cm)";
            DataTable tbl = selected.GetWL1DataTable(begin, end);

            this.UCAMChart1.SetLineChartInfo(tbl,
                YongShuiGuanLiDBI.DBNames.vDitchData.StationName,
                YongShuiGuanLiDBI.DBNames.vDitchData.DT,
                DataTableHelper.GetExistColumnName ( tbl, "wl1", "avgwl" ),
                title,
                ytitle);

            this.GridView1.Columns.Clear();

            Xdgk.UI.GridViewHelper h = GetGridViewHelper();
            h.GridViewConfig = GetGridViewConfig(DataEnum.WL, tbl);
            h.DataSource = tbl;
            h.Bind();
        }
示例#53
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="tbl"></param>
 /// <returns></returns>
 private static StationCollection CreateStationCollection(DataTable tbl)
 {
     StationCollection stations = new StationCollection();
     foreach (DataRow row in tbl.Rows)
     {
         StationClass s = CreateStation(row);
         stations.Add(s);
     }
     return stations;
 }
示例#54
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="waterUserID"></param>
 /// <param name="stations"></param>
 public static void AssociateWaterUserStationOut(int waterUserID, StationCollection stations)
 {
 }
示例#55
0
    // processes the station name - creates readable station URL!
    private string ProcessStation(string stName, Variable var)
    {
        DataManager manager = new DataManager();

        //improved code - first try to load a valid station-variable combination
        Station st = new Station(manager);
        //st.Load

        StationCollection stColl = new StationCollection(manager);
        VariableEnum varEnum = var.VarEnum;
        int varId = var.Id;

        //stColl.LoadByName(stName);
        stColl.LoadByName(stName, var.Id); //try loading a valid station-variable combination

        Station StInfo = new Station(manager);
        int StId = StInfo.StationId;
        string StUri = StInfo.Url;

        if ( stColl.Count == 0 )
        {
            //try to load it only by name
            stColl.LoadByName(stName);
            StUri = stName.Replace(" ", "_");
        }

        if ( stColl.Count == 0 ) //still no stations loaded..No station exists
        {
            StUri = stName.Replace(" ", "_"); //this is in fact a non-existent uri
        }

        else
        {
            StInfo = stColl[0];
            StUri = StInfo.Url;
            if ( varEnum != VariableEnum.Discharge && varEnum != VariableEnum.Stage )
            {
                if ( StUri.IndexOf("/") >= 0 )
                {
                    StUri = StUri.Remove(0, StUri.IndexOf("/"));
                }
            }
        }
        return StUri;
    }
示例#56
0
        public StationCollection getStations(int line)
        {
            SqlConnection con = new SqlConnection(conStr);
            con.Open();

            StationCollection stations = new StationCollection();

            String qry = String.Empty;
            qry = @"SELECT id , description FROM stations where line={0} ORDER by id";

            qry = String.Format(qry, line);

            SqlCommand cmd = new SqlCommand(qry, con);
            SqlDataReader dr = cmd.ExecuteReader();
            DataTable dt = new DataTable();
            dt.Load(dr);
            dr.Close();
            cmd.Dispose();

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                stations.Add(new Station(line,(int)dt.Rows[i]["id"], (string)dt.Rows[i]["description"]));
            }

            con.Close();
            con.Dispose();
            return stations;
        }
示例#57
0
文件: TaskDefine.cs 项目: hkiaipc/c2
        /// <summary>
        /// 
        /// </summary>
        /// <param name="stationCollection"></param>
        /// <returns></returns>
        public TaskCollection Create(StationCollection stationCollection)
        {
            if (stationCollection == null)
            {
                throw new ArgumentNullException("stationCollection");
            }

            TaskCollection taskCollection = new TaskCollection();
            foreach( Station st in stationCollection )
            {
                foreach (Device device in st.Devices)
                {
                    if (StringHelper.Equal(device.DeviceDefine.DeviceType,
                        this.DeviceType))
                    {
                        Opera opera = device.DeviceDefine.CreateOpera(this.OperaName);
                        Strategy strategy = this.StrategyDefine.Create();
                        Task task = new Task(device, opera, strategy, TimeOut);
                        taskCollection.Add(task);
                    }
                }
            }
            return taskCollection;
        }
示例#58
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="selected"></param>
 /// <returns></returns>
 private System.Collections.Generic.List<Xdgk.UI.AMCharts.StationColor> GetStationColorList(StationCollection selected)
 {
     System.Collections.Generic.List<Xdgk.UI.AMCharts.StationColor> list = new System.Collections.Generic.List<Xdgk.UI.AMCharts.StationColor>();
     foreach (StationClass item in selected)
     {
         StationColor stationClr = new StationColor(item.StationName, item.Color);
         list.Add(stationClr);
     }
     return list;
 }
示例#59
0
        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        public override StationCollection BuildStationCollection()
        {
            StationCollection stations = new StationCollection();
            string sql = "select * from tblStation where StationDeleted = 0";
            DataTable stationTbl = DBI.ExecuteDataTable(sql);
            foreach (DataRow row in stationTbl.Rows)
            {
                Station newStation = BuildStation(row);
                stations.Add(newStation);

                DeviceCollection devices = BuildDeviceCollection(newStation);

                newStation.Devices.AddDeviceCollection(devices);
            }
            return stations;
        }
示例#60
0
        public Wimea()
            : base(null)
        {

            _users = new UserCollection(this);
            _stations = new StationCollection(this);
            _metars = new MetarCollection(this);
            _dailys = new DailyCollection(this);
            _syncs = new SyncsCollection(this);
            _synoptics = new SynopticCollection(this);
            _elements = new ElementCollection(this);
            _instruments = new InstrumentCollection(this);

        }