Exemple #1
0
        /// <summary>
        /// 载入分站信息
        /// </summary>
        /// <param name="smvpSingleStation"></param>
        /// <param name="dr"></param>
        /// <param name="displayType"></param>
        /// <returns></returns>
        public StationMakeupVspanel loadStationInfo(StationMakeupVspanel smvpSingleStation, DataRow dr, int displayType)
        {
            smvpSingleStation.StationAddress = int.Parse(dr["StationAddress"].ToString());// 分站地址号


            //smvpSingleStation.Enabled = false;
            string stationInfo;
            switch (dr["StationState"].ToString())
            {
                case "-1000":
                    {
                        ((StationCaptionPanel)smvpSingleStation.CaptionTitleControl).CaptionForeColor = Color.Red;
                        smvpSingleStation.CaptionTitle = string.Format("{0}号传输分站 故障", dr["StationAddress"].ToString());
                        stationInfo = dr["StationPlace"].ToString() + " 检测到 " + dr["sumCard"].ToString();
                        //smvpSingleStation.IsShrink = true;
                    }
                    break;
                case "0":
                case "-1":
                    {
                        ((StationCaptionPanel)smvpSingleStation.CaptionTitleControl).CaptionForeColor = Color.FromArgb(128, 128, 128);
                        smvpSingleStation.CaptionTitle = string.Format("{0}号传输分站 未初始化", dr["StationAddress"].ToString());
                        stationInfo = dr["StationPlace"].ToString() + " 检测到 " + dr["sumCard"].ToString();
                        //smvpSingleStation.IsShrink = true;
                    }
                    break;
                case "-2000":
                    {
                        ((StationCaptionPanel)smvpSingleStation.CaptionTitleControl).CaptionForeColor = Color.FromArgb(128, 128, 128);
                        smvpSingleStation.CaptionTitle = string.Format("{0}号传输分站 休眠", dr["StationAddress"].ToString());
                        stationInfo = dr["StationPlace"].ToString() + " 检测到 " + dr["sumCard"].ToString();
                        //smvpSingleStation.IsShrink = true;
                    }
                    break;
                default:
                    smvpSingleStation.Enabled = true;
                    ((StationCaptionPanel)smvpSingleStation.CaptionTitleControl).CaptionForeColor = Color.FromArgb(21, 47, 147);
                    //((StationCaptionPanel)smvpSingleStation.CaptionTitleControl).CaptionForeColor = Color.FromArgb(255, 255, 255);
                    smvpSingleStation.CaptionTitle = string.Format("{0}号传输分站", dr["StationAddress"].ToString());
                    stationInfo = dr["StationPlace"].ToString() + " 检测到 " + dr["sumCard"].ToString();
                    //smvpSingleStation.IsShrink = false;
                    break;

            }
            // 分站故障 丁静超

            /*
            if (dr["StationState"].ToString() == "-1000" )
            {
                smvpSingleStation.Enabled = false;
                ((StationCaptionPanel)smvpSingleStation.CaptionTitleControl).CaptionForeColor = Color.Red;
                smvpSingleStation.CaptionTitle = string.Format("{0}号分站 故障", dr["StationAddress"].ToString());
                //((StationCaptionPanel)smvpSingleStation.CaptionTitleControl).CaptionForeColor = Colo

            }
            else
            {
                smvpSingleStation.Enabled = true;
                ((StationCaptionPanel)smvpSingleStation.CaptionTitleControl).CaptionForeColor = Color.FromArgb(21, 47, 147);
                smvpSingleStation.CaptionTitle = string.Format("{0}号分站", dr["StationAddress"].ToString());
            }
            */

            //string stationInfo = dr["StationPlace"].ToString() + " 检测到 " + dr["sumCard"].ToString();

            switch (displayType)
            {
                case 0: stationInfo = stationInfo + " 人";
                    break;
                case 1: stationInfo = stationInfo + " 个设备";
                    break;
                case 2: stationInfo = stationInfo + " 个发码器";
                    break;
                default: stationInfo.ToString();
                    break;
            }

            smvpSingleStation.LabelStationInfoText = stationInfo;

            smvpSingleStation.LayoutType = VSPanelLayoutType.VerticalType;

            //新加的
            //smvpSingleStation.Left = pnlLeft1.Left + pnlLeft1.Width + 30;
            smvpSingleStation.Width = varwidth - 250;
            smvpSingleStation.IsShowAddNewStationHeadInfo = false;
            smvpSingleStation.IsShowEditStationInfo = false;
            smvpSingleStation.IsShowDeleteStationInfo = false;

            //smvpSingleStation.MouseClick += new MouseEventHandler(smvpSingleStation_MouseClick);


            return smvpSingleStation;
        }
Exemple #2
0
 public void loadStationHead(string addList, Size size, StationMakeupVspanel smv, int headDisplayType)
 {
     DataSet ds = stationBLL.GetRTStationHeadInfo(addList, headDisplayType);
     DataTable dt = ds.Tables[0];
     DataRow[] dr = dt.Select("StationAddress=" + smv.StationAddress.ToString());
     int rows = dr.GetLength(0) / 2;
     for (int i = 0, j = 1; i < dr.GetLength(0); i += 2, j++)
     {
         PanelStationHeadInfo pshi = null;
         // 如果存在修改信息
         if (smv.Controls.Count == rows + 1)
         {
             pshi = (PanelStationHeadInfo)smv.Controls[j];
             pshi.MouseHover += new EventHandler(pshi_MouseHover);
             this.loadStationHeadInfo(pshi, size, dr[i], dr[i + 1], headDisplayType, addList);
         }// 接收器控件少于得到的接收器信息数添加接收器控件
         else if (smv.Controls.Count < rows + 1)
         {
             pshi = new PanelStationHeadInfo();
             pshi.MouseHover += new EventHandler(pshi_MouseHover);
             pshi.MouseClick += new MouseEventHandler(pshi_MouseClick);          //加载 MouseClick 事件
             smv.Controls.Add(this.loadStationHeadInfo(pshi, size, dr[i], dr[i + 1], headDisplayType, addList));
         }
     }
     dt.Dispose();
     ds.Dispose();
 }
Exemple #3
0
        // 分站信息显示
        private void AddStationInfo(int pIndex, int loadType)
        {
            DataSet ds = stationBLL.GetRTStationInfo(pIndex - 1, ppageSum, displayType);
            if (pIndex < 1)
            {
                MessageBox.Show("您输入的页数超出范围,请正确输入页数");
                return;
            }
            if (ds.Tables != null && ds.Tables.Count > 0)
            {
                // 重新设置页数
                int sumPage = int.Parse(ds.Tables[1].Rows[0][0].ToString());
                try
                {
                    sumPage = sumPage % ppageSum != 0 ? sumPage / ppageSum + 1 : sumPage / ppageSum;
                }
                catch
                {
                    ppageSum = 20;
                    sumPage = sumPage % ppageSum != 0 ? sumPage / ppageSum + 1 : sumPage / ppageSum;

                    // 弹出错误消息,让用户重新填写某个配置

                    MessageBox.Show("主界面显示设置配置有误,请检查配置后重新配置!");

                }
                //if (ds.Tables[0].Rows.Count <= 0)

                if (!cpUp.Enabled)
                {
                    cpUp.Enabled = true;
                    cpUp.SetCaptionPanelStyle = CaptionPanelStyleEnum.windowsStyle;
                }
                if (!cpDown.Enabled)
                {
                    cpDown.Enabled = true;
                    cpDown.SetCaptionPanelStyle = CaptionPanelStyleEnum.windowsStyle;
                }

                if (pIndex == 1)
                {
                    // 只有一页时
                    if (sumPage <= 1)
                    {
                        //vspStationInfo.Controls.Clear();
                        pageControlsVisible(false);
                    }
                    else
                    {
                        pageControlsVisible(true);
                        cpUp.Enabled = false;
                        cpUp.SetCaptionPanelStyle = CaptionPanelStyleEnum.UnEnableWindowsStyle;
                    }
                }
                else if (pIndex == sumPage)
                {
                    cpDown.Enabled = false;
                    cpDown.SetCaptionPanelStyle = CaptionPanelStyleEnum.UnEnableWindowsStyle;
                    // 最后一页


                }
                else if (pIndex > sumPage)
                {
                    // 大于最后一页


                    AddStationInfo(sumPage, 1);
                    return;
                }
                //cpSumCount.CaptionTitle = "共" + ds.Tables[1].Rows[0][0].ToString() + "条/本页" + ds.Tables[0].Rows.Count.ToString() + "条";
                cpSumCount.CaptionTitle = "共" + ds.Tables[1].Rows[0][0].ToString() + "条";
                txtPage.CaptionTitle = pIndex.ToString();
                lblSumPage.CaptionTitle = "/" + sumPage + "页";
                if (displayFun == 1)
                {
                    if (loadType == 1)
                    {
                        if (vspStationInfo.Controls.Count > 1)
                        {
                            vspStationInfo.Controls.Clear();
                        }
                    }
                    PanelStationInfo psi = null;
                    for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                    {
                        if (vspStationInfo.Controls.Count > i)
                        {
                            if (vspStationInfo.Controls[i] != null)
                            {
                                psi = (PanelStationInfo)vspStationInfo.Controls[i];
                                psi = loadDisplayStationInfo(psi, ds.Tables[0].Rows[i], displayType);
                                vspStationInfo.Anchor = ((AnchorStyles.Left) | (AnchorStyles.Right) | (AnchorStyles.Top));
                            }
                        }
                        else
                        {
                            psi = new PanelStationInfo();
                            vspStationInfo.Anchor = ((AnchorStyles.Left) | (AnchorStyles.Right) | (AnchorStyles.Top));
                            psi = loadDisplayStationInfo(psi, ds.Tables[0].Rows[i], displayType);
                            vspStationInfo.Controls.Add(psi);
                        }
                    }

                }
                else if (displayFun == 3)
                {
                    StationMakeupVspanel smvpSingleStation = null;

                    

                    if (vspStationInfo.Controls.Count != ds.Tables[0].Rows.Count)
                    {
                        vspStationInfo.Controls.Clear();
                    }
                    for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                    {
                        if (vspStationInfo.Controls.Count > i)
                        {
                            if (vspStationInfo.Controls[i] != null)
                            {
                                smvpSingleStation = (StationMakeupVspanel)vspStationInfo.Controls[i];
                                smvpSingleStation = loadStationInfo(smvpSingleStation, ds.Tables[0].Rows[i], displayType);
                                vspStationInfo.Anchor = ((AnchorStyles.Left) | (AnchorStyles.Right) | (AnchorStyles.Top));
                            }
                        }
                        else
                        {
                            smvpSingleStation = new StationMakeupVspanel();
                            smvpSingleStation.ShiftButtonMouseClick += new EventHandler(smvpSingleStation_ShiftButtonMouseClick);
                            vspStationInfo.Anchor = ((AnchorStyles.Left) | (AnchorStyles.Right) | (AnchorStyles.Top));
                            smvpSingleStation = loadStationInfo(smvpSingleStation, ds.Tables[0].Rows[i], displayType);

                            vspStationInfo.Controls.Add(smvpSingleStation);
                        }
                    }
                }
            }
            else
            {
                pageControlsVisible(false);
            }
        }
Exemple #4
0
 // 分站接收器信息显示
 private void AddStationHeadInfo(DataTable dt)
 {
     StationMakeupVspanel smvpSingleStation = null;
     for (int i = 0; i < dt.Rows.Count; i++)
     {
         if (vspStationInfo.Controls.Count > i)
         {
             if (vspStationInfo.Controls[i] != null)
             {
                 smvpSingleStation = (StationMakeupVspanel)vspStationInfo.Controls[i];
                 smvpSingleStation = loadStationInfo(smvpSingleStation, dt.Rows[i], displayType);
                 vspStationInfo.Anchor = ((AnchorStyles.Left) | (AnchorStyles.Right) | (AnchorStyles.Top));
             }
         }
         else
         {
             smvpSingleStation = new StationMakeupVspanel();
             vspStationInfo.Anchor = ((AnchorStyles.Left) | (AnchorStyles.Right) | (AnchorStyles.Top));
             smvpSingleStation = loadStationInfo(smvpSingleStation, dt.Rows[i], displayType);
             vspStationInfo.Controls.Add(smvpSingleStation);
         }
     }
 }
        private void smvpSingleStation_ClickAddStationHead(object sender, EventArgs e)
        {
            tempSingleStation = (StationMakeupVspanel)((StationCaptionPanel)((ButtonCaptionPanel)sender).Parent).Parent;
            
            cmsStationHand1 = tempSingleStation.StationAddress;
            cmsStationHand2 = tempSingleStation.StationAddress.ToString();

            intStationAddressJudgment = tempSingleStation.StationAddress;
            intStationHeadID = -1;

            A_Station_Head_Add frm = new A_Station_Head_Add(this);
            frm.ShowDialog();

            //DialogResult dr = frm.ShowDialog();
            //if (dr == DialogResult.OK)
            //{
            //    #region【刷新】

            //    if (!New_DBAcess.IsDouble)
            //    {
            //        //清空添加面板
            //        ClearStaHead();

            //        // 清空接收器panel
            //        if (tempSingleStation != null)
            //        {
            //            for (int i = tempSingleStation.Controls.Count - 1; i >= 0; i--)
            //            {
            //                if (tempSingleStation.Controls[i].GetType().ToString() == "KJ128WindowsLibrary.PanelStationHeadInfo")
            //                {
            //                    tempSingleStation.Controls.RemoveAt(i);
            //                }
            //            }

            //            // 重新加载
            //            DataTable dsStationHead = sbll.getStationHeadInfoAll(int.Parse(tempSingleStation.StationAddress.ToString()));
            //            if (dsStationHead != null)
            //            {
            //                if (dsStationHead.Rows.Count > 0)
            //                {
            //                    foreach (DataRow drStationHead in dsStationHead.Rows)
            //                    {
            //                        addPanelStationHeadInfo(tempSingleStation, drStationHead);
            //                    }
            //                }
            //            }
            //        }
            //    }
            //    else
            //    {
            //        timer1.Start();
            //    }
            //    #endregion
            //}
            //    //添加——接收器信息
            //pl_AddStaHeadInfo.Visible = true;
            //pl_AddStaHeadInfo.BringToFront();

            ////清空
            //ClearStaHead();

            ////tempSingleStation = (StationMakeupVspanel)((StationCaptionPanel)((ButtonCaptionPanel)sender).Parent).Parent;
            ////判断是A版,还是V2版
            //if (GetStationModel(tempSingleStation.StationAddress))     //A版
            //{
            //    txt_StaHeadAddress.Text = "";
            //    txt_StaHeadAddress.Enabled = true;
            //}
            //else                                                        //V2版
            //{
            //    txt_StaHeadAddress.Text = "1";
            //    txt_StaHeadAddress.Enabled = false;
            //}
            //txt_StaHead_StaAddress.Text = tempSingleStation.StationAddress.ToString();

            //bcp_StaHeadTitle.CaptionTitle = "新增读卡分站";


            //bt_StaHead_Reset.Enabled = true;
            //bt_StaHead_Save.Enabled = gb_AddStaHeadInfo.Enabled = true;
            //lb_StaHeadTipsInfo.Visible = lb_StaHeadTipsInfo2.Visible = false;
        }
Exemple #6
0
        public StationMakeupVspanel InitSmvp(StationMakeupVspanel Smvp,string str, Point x,Size y  )
        {
            Smvp.Anchor = ((AnchorStyles.Left) | (AnchorStyles.Top) | (AnchorStyles.Right));
            Smvp.CaptionTitle = str;
            Smvp.VerticalInterval = 8;
            Smvp.LeftInterval = 22;
            Smvp.TopInterval = 8;
            Smvp.BackColor = color_BackColor;
            Smvp.IsmiddleInterval = true;
            Smvp.IsCaptionSingleColor = true;

            Smvp.IsShowAddNewStationHeadInfo = false;   //不显示增加接收器为
            Smvp.IsShowDeleteStationInfo = false;       //不显示删除分站
            Smvp.IsShowEditStationInfo = false;         //不显示编辑分站

            Smvp.IsShowLabelStationInfo = false;
            Smvp.LayoutType = VSPanelLayoutType.VerticalType;
            Smvp.Location = x;
            Smvp.Size = y; ;

            return Smvp;
        }
        // 右键单击接收器信息
        void pshi_one_MouseDown(object sender, MouseEventArgs e)
        {
            //接收器右键菜单操作

            if (e.Button == MouseButtons.Right)
            {
                tempSingleStation = ((StationMakeupVspanel)((PanelStationHeadInfo)sender).Parent);
                cmsStationHand.Tag = ((PanelStationHeadInfo)sender).Tag;
                cmsStationHand.Items["tsMenuDelete"].Tag = ((PanelStationHeadInfo)sender).ValueStationHeadAddress.ToString();
                //vspAddNewStation.Visible = false;
            }
        }
        /// 添加接收器
        private void addPanelStationHeadInfo(StationMakeupVspanel smv,DataRow drStationHead)
        {            
            shAddStationTitle.CaptionTitle = "添加" + KJ128NDataBase.HardwareName.Value(KJ128NDataBase.CorpsName.StaHead) + "信息";
            PanelStationHeadInfo pshi_one = new PanelStationHeadInfo();

            pshi_one.MouseHover += pshi_one_MouseHover;

            pshi_one.ValueEnterTotalPerson.FieldName = "";
            
            pshi_one.Height = 84;
            pshi_one.Width = 120;
            pshi_one.SetBackGroundGradineMode = System.Drawing.Drawing2D.LinearGradientMode.BackwardDiagonal;
            pshi_one.ContextMenuStrip = cmsStationHand;
            pshi_one.MouseDown += new MouseEventHandler(pshi_one_MouseDown);
            pshi_one.Click += new EventHandler(pshi_one_Click);
            
            //tag保存接收器唯一表示列

            pshi_one.Tag = drStationHead["StationHeadID"].ToString();
            LabelInfo stationHeadAddress = pshi_one.ValueStationHeadAddress;
            // 赋值接收器地址号

            stationHeadAddress.FieldName = drStationHead["StationHeadAddress"].ToString();
            pshi_one.ValueStationHeadAddress = stationHeadAddress;

            //赋值接收器安装位置
            LabelInfo l = new LabelInfo("进入总人数", new PointF(4, 60));
            l.FieldName = "安装位置:" + drStationHead["StationHeadPlace"].ToString();
            pshi_one.ValueStationHeadPlace = l;
            smv.Controls.Add(pshi_one);
            //vspAddNewStation.Visible = false;

        }
        /// 增加单个分站信息
        private void AddSingleStationInfo(int pIndex,bool isCheckPage)
        {
            if (pIndex <= 0)
            {
                AddSingleStationInfo(1,false);
                return;
            }

            DataSet ds = sbll.getStationHeadInfo(pIndex - 1, pageSize);
            
            if (ds.Tables != null && ds.Tables.Count > 0)
            {
                // 重新设置页数
                int sumPage = int.Parse(ds.Tables[2].Rows[0][0].ToString());
                sumPage = sumPage % pageSize != 0 ? sumPage / pageSize + 1 : sumPage / pageSize;
                
                if (!cpUp.Enabled)
                {
                    cpUp.Enabled = true;
                }
                if (!cpDown.Enabled)
                {
                    cpDown.Enabled = true;
                }

                if (pIndex == 1)
                {
                    // 只有一页时
                    if (sumPage <= 1)
                    {
                        checkPageControls(false);
                    }
                    else
                    {
                        checkPageControls(true);
                        cpUp.Enabled = false;
                    }
                }
                else if (pIndex == sumPage)
                {
                    cpDown.Enabled = false;
                    // 最后一页

                }
                else if (pIndex > sumPage)
                {
                    // 大于最后一页
                    AddSingleStationInfo(sumPage, false);
                    return;
                }
                vspStationConfigInfo.Hide();

                vspStationConfigInfo.Controls.Clear();          //清空数据

                sumCount.CaptionTitle = "共" + ds.Tables[2].Rows[0][0].ToString() + "条/本页" + ds.Tables[0].Rows.Count.ToString() + "条";
                txtPage.CaptionTitle = pIndex.ToString();
                lblSumPage.CaptionTitle = "/" + sumPage + "页";

                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    string az = "安装位置" + dr["StationPlace"].ToString();
                    string sa = dr["StationAddress"].ToString();

                    StationMakeupVspanel smvpSingleStation = new StationMakeupVspanel();
                    smvpSingleStation.LayoutType = VSPanelLayoutType.VerticalType;
                    smvpSingleStation.Width = vspStationConfigInfo.Width;
                    smvpSingleStation.StationAddress = int.Parse(sa);
                    smvpSingleStation.ClickEditStationButton += new EventHandler(smvpSingleStation_ClickEditStationButton);
                    smvpSingleStation.ClickDeleteStationButton += new EventHandler(smvpSingleStation_ClickDeleteStationButton);
                    smvpSingleStation.ClickAddStationHead += new EventHandler(smvpSingleStation_ClickAddStationHead);
                    smvpSingleStation.Anchor = ((AnchorStyles.Left) | (AnchorStyles.Right) | (AnchorStyles.Top));
                    smvpSingleStation.CaptionTitle = string.Format("{0}号"+KJ128NDataBase.HardwareName.Value(KJ128NDataBase.CorpsName.Station), sa);
                    smvpSingleStation.LabelStationInfoLeft = 300;
                    smvpSingleStation.LabelStationInfoText = az;
                    smvpSingleStation.LabelStatonInfoWidth = 200;
                    smvpSingleStation.ShiftButtonMouseClick += new EventHandler(smvpSingleStation_ShiftButtonMouseClick);
                    vspStationConfigInfo.Controls.Add(smvpSingleStation);

                    DataRow[] drArray = ds.Tables[1].Select("StationAddress =" + sa);
                    if (drArray.Length > 0)
                    {
                        foreach (DataRow drStationHead in drArray)
                        {
                            addPanelStationHeadInfo(smvpSingleStation, drStationHead);
                        }
                    }
                }
                //cmsStationHand.Items[0].Click += new EventHandler(FrmStationManage_Click);
                //cmsStationHand.Items[1].Click += new EventHandler(tsMenuDelete_Click);
            }
            else
            {
                checkPageControls(false);
            }
                if (vspStationConfigInfo != null)
                    vspStationConfigInfo.Show();
        }
 private void smvpSingleStation_ClickEditStationButton(object sender, EventArgs e)
 {
     
     bcpAddStationTitle.CaptionTitle = "修改"+KJ128NDataBase.HardwareName.Value(KJ128NDataBase.CorpsName.Station)+"信息";
     vspAddNewStation.Visible = true;
     vspAddNewStation.BringToFront();
     lblBatchSeparate.Visible = false;
     chbEnabledBatchAdd.Visible = false;                 //隐藏批量添加按钮
     tempSingleStation = (StationMakeupVspanel)((StationCaptionPanel)((ButtonCaptionPanel)sender).Parent).Parent;
     DataRow dr = sbll.getStationInfo(int.Parse(((StationMakeupVspanel)((StationCaptionPanel)((ButtonCaptionPanel)sender).Parent).Parent).StationAddress.ToString()));
     txtBatchStationAddressMin.Enabled = false;
     txtBatchStationAddressMin.Text = dr["StationAddress"].ToString();
     txtBatchStationAddressMax.Text = string.Empty;
     txtBatchStationAddressMax.Visible = false;
     txtPlace.Text = dr["StationPlace"].ToString();
     txtTel.Text = dr["StationTel"].ToString();
     cmbType.SelectedIndex = cmbType.FindString(dr["StationType"].ToString()) == 0 ? 0 : cmbType.FindString(dr["StationType"].ToString());
     cmbGroup.SelectedIndex = cmbGroup.FindString(dr["StationGroup"].ToString());
     shStationHeadFrm.Visible = false;
 }
 private void smvpSingleStation_ClickAddStationHead(object sender, EventArgs e)
 {
     shAddStationTitle.CaptionTitleLeft = 1;
     shAddStationTitle.CaptionTitle = "添加" + KJ128NDataBase.HardwareName.Value(KJ128NDataBase.CorpsName.StaHead) + "信息";
     stationHeadClear();
     shAddStationNewStation.Show();
     shStationHeadFrm.Show();
     StationHeadFrmControlsEnable(true);
     shlblInfo.Text = "";
     lblStationHeadAddress.Enabled = true;
     tempSingleStation = (StationMakeupVspanel)((StationCaptionPanel)((ButtonCaptionPanel)sender).Parent).Parent;
     lblStationAddress.Text = tempSingleStation.StationAddress.ToString();
     shcmbType.SelectedIndex = 0;
     vspAddNewStation.Visible = false;
 }