Ejemplo n.º 1
0
        private void mnu_InitLedMsg_Click(object sender, EventArgs e)
        {
            VehicleLedItem item = null;

            if (dataGridView1.SelectedRows.Count == 1)
            {
                item = dataGridView1.SelectedRows[0].Tag as VehicleLedItem;
            }
            if (item != null)
            {
                if (item.StationID == WorkStationInfo.CurrentStation.StationID)
                {
                    InitLedItemMessage(item);
                    MessageBox.Show(Resources.Resource1.FrmVehicleLedSetting_SendInitLedItemMessage);
                }
                else
                {
                    MessageBox.Show(Resources.Resource1.FrmVehicleLedSetting_CannotContralLed);
                }
            }
            else
            {
                MessageBox.Show(Resources.Resource1.FrmVehicleLedSetting_SelectLed);
            }
        }
Ejemplo n.º 2
0
        private void ShowItemOnRow(DataGridViewRow row, VehicleLedItem item, string park, string entrance, string station)
        {
            row.Tag = item;

            row.Cells["colName"].Value         = item.Name;
            row.Cells["colPark"].Value         = park;
            row.Cells["colPark"].Tag           = item.ParkID;
            row.Cells["colEntrance"].Value     = entrance;
            row.Cells["colEntrance"].Tag       = item.EntranceID;
            row.Cells["colStation"].Value      = station;
            row.Cells["colStation"].Tag        = item.StationID;
            row.Cells["colComPort"].Value      = item.ComPort;
            row.Cells["colShowTitle"].Value    = item.ShowTitle;
            row.Cells["colSubAddress1"].Value  = item.SubAddress1;
            row.Cells["colSubTitle1"].Value    = item.SubTitle1;
            row.Cells["colSubMessage1"].Value  = VehicleLEDMessageTypeDescription.GetDescription(item.SubMessage1);
            row.Cells["colSubMessage1"].Tag    = item.SubMessage1;
            row.Cells["colSubInterval1"].Value = item.SubInterval1;
            row.Cells["colSubAddress2"].Value  = item.SubAddress2;
            row.Cells["colSubTitle2"].Value    = item.SubTitle2;
            row.Cells["colSubMessage2"].Value  = VehicleLEDMessageTypeDescription.GetDescription(item.SubMessage2);
            row.Cells["colSubMessage2"].Tag    = item.SubMessage2;
            row.Cells["colSubInterval2"].Value = item.SubInterval2;
            row.Cells["colSubAddress3"].Value  = item.SubAddress3;
            row.Cells["colSubTitle3"].Value    = item.SubTitle3;
            row.Cells["colSubMessage3"].Value  = VehicleLEDMessageTypeDescription.GetDescription(item.SubMessage3);
            row.Cells["colSubMessage3"].Tag    = item.SubMessage3;
            row.Cells["colSubInterval3"].Value = item.SubInterval3;
            row.Cells["colMemo"].Value         = item.Memo;
        }
Ejemplo n.º 3
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                VehicleLedSetting setting = new VehicleLedSetting();
                foreach (DataGridViewRow row in dataGridView1.Rows)
                {
                    //VehicleLedItem item = new VehicleLedItem();
                    //item.Name = Convert.ToString(row.Cells["colName"].Value);
                    //item.EntranceID = Convert.ToInt32(row.Cells["colEntrance"].Tag);
                    //item.StationID = Convert.ToString(row.Cells["colStation"].Tag);
                    //item.ComPort = Convert.ToByte(row.Cells["colComPort"].Value);
                    //item.ShowTitle = Convert.ToBoolean(row.Cells["colShowTitle"].Value);
                    //item.SubAddress1 = Convert.ToByte(row.Cells["colSubAddress1"].Value);
                    //item.SubMessage1 = (VehicleLEDMessageType)Convert.ToInt32(row.Cells["colSubMessage1"].Tag);
                    //item.SubAddress2 = Convert.ToByte(row.Cells["colSubAddress2"].Value);
                    //item.SubMessage2 = (VehicleLEDMessageType)Convert.ToInt32(row.Cells["colSubMessage2"].Tag);
                    //item.SubAddress3 = Convert.ToByte(row.Cells["colSubAddress3"].Value);
                    //item.SubMessage3 = (VehicleLEDMessageType)Convert.ToInt32(row.Cells["colSubMessage3"].Tag);
                    //item.Memo = Convert.ToString(row.Cells["colMemo"].Value);

                    VehicleLedItem item = row.Tag as VehicleLedItem;
                    if (item != null)
                    {
                        setting.Items.Add(item);
                    }
                }
                CommandResult ret = (new SysParaSettingsBll(AppSettings.CurrentSetting.ParkConnect)).SaveSetting <VehicleLedSetting>(setting);
                if (ret.Result == ResultCode.Successful)
                {
                    _VehicleLedSetting = setting;
                    foreach (IParkingAdapter pad in ParkingAdapterManager.Instance.ParkAdapters)
                    {
                        UpdateSystemParamSettingNotity notity = new UpdateSystemParamSettingNotity();
                        notity.Operator      = OperatorInfo.CurrentOperator;
                        notity.StationID     = WorkStationInfo.CurrentStation.StationID;
                        notity.StationName   = WorkStationInfo.CurrentStation.StationName;
                        notity.ParamTypeName = typeof(VehicleLedSetting).Name;
                        pad.UpdateSystemParamSetting(notity);
                    }
                    MessageBox.Show(Resources.Resource1.FrmReportBase_SaveSuccess);
                }
                else
                {
                    MessageBox.Show(ret.Message);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 初始化Led屏信息
        /// </summary>
        /// <param name="item"></param>
        private void InitLedItemMessage(VehicleLedItem item)
        {
            string msg = GetInitLedMessage(item.ParkID, item.EntranceID, item.SubMessage1);

            if (VehicleLedItemDisplayMsg(item.ComPort, item.ShowTitle, item.SubAddress1, item.SubTitle1, item.SubInterval1, item.SubMessage1, msg))
            {
                //发送后等待一定时间
                //Thread.Sleep(_SendInterval);
            }
            msg = GetInitLedMessage(item.ParkID, item.EntranceID, item.SubMessage2);
            if (VehicleLedItemDisplayMsg(item.ComPort, item.ShowTitle, item.SubAddress2, item.SubTitle2, item.SubInterval2, item.SubMessage2, msg))
            {
                //发送后等待一定时间
                //Thread.Sleep(_SendInterval);
            }
            msg = GetInitLedMessage(item.ParkID, item.EntranceID, item.SubMessage3);
            if (VehicleLedItemDisplayMsg(item.ComPort, item.ShowTitle, item.SubAddress3, item.SubTitle3, item.SubInterval3, item.SubMessage3, msg))
            {
            }
        }
Ejemplo n.º 5
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            if (CheckInput())
            {
                if (Item == null)
                {
                    Item = new VehicleLedItem();
                }
                Item.Name       = this.txtName.Text.Trim();
                Item.ParkID     = this.ucEntrance.SelectedParkID;
                Item.EntranceID = this.ucEntrance.SelectedEntranceID;
                if (Item.ParkID == 0 && Item.EntranceID != 0)
                {
                    //如果没有选择停车场,而有选择通道的,自动选择通道的停车场
                    EntranceInfo entrance = this.ucEntrance.SelectedEntrance;
                    if (entrance != null)
                    {
                        Item.ParkID = entrance.ParkID;
                    }
                }
                Item.StationID       = this.comStation.StationID;
                Item.ComPort         = this.comPort.ComPort;
                Item.ShowTitle       = this.chkShowTitle.Checked;
                Item.EnabledInterval = this.chkEnabledInterval.Visible ? this.chkEnabledInterval.Checked : false;
                Item.SubAddress1     = (byte)this.comSubAddress1.SelectedIndex;
                Item.SubTitle1       = this.txtSubTitle1.Text.Trim();
                Item.SubMessage1     = this.comSubMessage1.SelectedVehicleLEDMessageType;
                Item.SubInterval1    = this.txtSubInterval1.IntergerValue;
                Item.SubAddress2     = (byte)this.comSubAddress2.SelectedIndex;
                Item.SubTitle2       = this.txtSubTitle2.Text.Trim();
                Item.SubMessage2     = this.comSubMessage2.SelectedVehicleLEDMessageType;
                Item.SubInterval2    = this.txtSubInterval2.IntergerValue;
                Item.SubAddress3     = (byte)this.comSubAddress3.SelectedIndex;
                Item.SubTitle3       = this.txtSubTitle3.Text.Trim();
                Item.SubMessage3     = this.comSubMessage3.SelectedVehicleLEDMessageType;
                Item.SubInterval3    = this.txtSubInterval3.IntergerValue;
                Item.Memo            = this.txtMemo.Text.Trim();

                this.DialogResult = System.Windows.Forms.DialogResult.OK;
            }
        }
Ejemplo n.º 6
0
 private void mnu_Update_Click(object sender, EventArgs e)
 {
     if (dataGridView1.SelectedRows.Count == 1)
     {
         FrmVehicleLedDetail frm  = new FrmVehicleLedDetail();
         VehicleLedItem      item = dataGridView1.SelectedRows[0].Tag as VehicleLedItem;
         frm.Item = item.Clone();
         if (frm.ShowDialog() == DialogResult.OK)
         {
             if (FindRow(frm.Item.Name) >= 0 && FindRow(frm.Item.Name) != dataGridView1.SelectedRows[0].Index)
             {
                 MessageBox.Show(string.Format(Resources.Resource1.FrmVehicleLedSetting_HadLed, frm.Item.Name));
             }
             else
             {
                 dataGridView1.SelectedRows[0].Tag = frm.Item;
                 ShowItemOnRow(dataGridView1.SelectedRows[0], frm.Item, frm.ParkName, frm.EntranceName, frm.StationName);
             }
         }
     }
 }