Beispiel #1
0
        private void BindQueueData()
        {
            //点击刷新,重复加载list列表情况,先清空数据,列名
            listView1.Items.Clear();
            DataTable dtQueueInfos = _qm.GetQueueInfoByDeptId(cbxDepartment.SelectedValue.ToString());

            foreach (DataRow drItem in dtQueueInfos.Rows)
            {
                QueueData queueData = new QueueData();
                queueData.BindRowData(drItem);

                ListViewItem itemNew = new ListViewItem(new string[] { queueData.队列名称, queueData.队列信息.备注 }, 0);
                //添加Name属性赋值,否则listView1.Items.Find无法查找
                itemNew.Name = queueData.队列ID;
                itemNew.Tag  = queueData;


                listView1.Items.Add(itemNew);
            }

            listView1.View = View.Details;
        }
        /// <summary>
        /// 初始化队列名称
        /// </summary>
        /// <param name="departmentId"></param>
        private void InitQueueName(string departmentId, string applyId)
        {
            cbxQueueName.Items.Clear();

            if (string.IsNullOrEmpty(departmentId))
            {
                return;
            }

            DataTable dtQueues = _qm.GetQueueInfoByDeptId(departmentId);

            cbxQueueName.DisplayMember = "Name";
            cbxQueueName.ValueMember   = "Value";

            DataTable dtRooms = _qm.GetApplyRoomId(applyId);


            foreach (DataRow dr in dtQueues.Rows)
            {
                QueueData queueData = new QueueData();
                queueData.BindRowData(dr);


                //如果队列不包含房间信息,则不进行加载
                if (queueData.包含房间.房间明细.Count <= 0)
                {
                    continue;
                }

                if (dtRooms.Rows.Count > 0)
                {
                    //需要判断队列是否包含了对应的房间
                    bool hasRoom = false;

                    foreach (DataRow drRoom in dtRooms.Rows)
                    {
                        if (queueData.包含房间.房间明细.FindIndex(T => T.房间ID == drRoom["房间ID"].ToString()) >= 0)
                        {
                            hasRoom = true;
                            break;
                        }
                    }

                    if (hasRoom == false)
                    {
                        continue;
                    }
                }


                ItemBind ib = new ItemBind();

                ib.Name  = queueData.队列名称;
                ib.Value = queueData.队列ID;

                ib.Tag = queueData;

                cbxQueueName.Items.Add(ib);
            }

            if (cbxQueueName.Items.Count <= 0)
            {
                return;
            }

            //默认定位到队列人数最少且只有一个房间的队列
            if (cbxQueueName.Items.Count <= 1)
            {
                cbxQueueName.SelectedIndex = 0;
            }
            else
            {
                int    roomCount = 999999;
                string minQueue  = "";
                foreach (ItemBind ib in cbxQueueName.Items)
                {
                    QueueData queData = ib.Tag as QueueData;

                    if (queData.包含房间.房间明细.Count == 1)
                    {
                        int curCount = _qm.GetLineupCount(queData.队列ID, dtpIntoQueue.Value);
                        if (curCount < roomCount)
                        {
                            roomCount = curCount;
                            minQueue  = queData.队列名称;
                        }
                    }
                }

                if (string.IsNullOrEmpty(minQueue) == false)
                {
                    cbxQueueName.Text = minQueue;
                }
            }
        }
        private void frmQueueShowDesign_Load(object sender, EventArgs e)
        {
            try
            {
                txtImgName.Text   = _queueShowDesign.BackgroundImage;
                ceBackColor.Color = _queueShowDesign.BackColor;
                ceForeColor.Color = _queueShowDesign.ForeColor;

                chkShowMemo.Checked     = _queueShowDesign.IsShowMemo;
                chkShowLastCall.Checked = _queueShowDesign.IsShowLastCall;
                chkCallIcon.Checked     = _queueShowDesign.IsShowCallIcon;
                chkQueueIcon.Checked    = _queueShowDesign.IsShowQueueIcon;

                txtWaitCount.Text = _queueShowDesign.WaitCount.ToString();


                float     fontSize = 0;
                FontStyle fs       = FontStyle.Regular;

                try
                {
                    fontSize = _queueShowDesign.HeadFontSize;
                }
                catch { }
                if (fontSize <= 0)
                {
                    fontSize = this.Font.Size;
                }

                if (_queueShowDesign.HeadBold)
                {
                    fs = fs | FontStyle.Bold;
                }
                if (_queueShowDesign.HeadItalic)
                {
                    fs = fs | FontStyle.Italic;
                }

                Font hfont = new Font(_queueShowDesign.HeadFontName, fontSize, fs);
                feHeadFont.Value = hfont;



                fontSize = 0;
                fs       = FontStyle.Regular;

                try
                {
                    fontSize = _queueShowDesign.FontSize;
                }
                catch { }
                if (fontSize <= 0)
                {
                    fontSize = this.Font.Size;
                }

                if (_queueShowDesign.IsBold)
                {
                    fs = fs | FontStyle.Bold;
                }
                if (_queueShowDesign.IsItalic)
                {
                    fs = fs | FontStyle.Italic;
                }

                Font qfont = new Font(_queueShowDesign.FontName, fontSize, fs);
                feQueueFont.Value = qfont;

                txtC1Width.Text = _queueShowDesign.Column1Width.ToString();
                txtC2Width.Text = _queueShowDesign.Column2Width.ToString();
                txtC3Width.Text = _queueShowDesign.Column3Width.ToString();


                cbxReleationQueue.Items.Clear();

                cbxReleationQueue.DisplayMember = "Name";
                cbxReleationQueue.ValueMember   = "Value";

                DataTable dtQueueData = _qm.GetQueueInfoByDeptId(_departmentId);

                foreach (DataRow drQueue in dtQueueData.Rows)
                {
                    ItemBind ib = new ItemBind();

                    ib.Name  = drQueue["队列名称"].ToString();
                    ib.Value = drQueue["队列ID"].ToString();

                    int itemIndex = cbxReleationQueue.Items.Add(ib);

                    if (_queueShowDesign.ReleationQueueItems.Count > 0)
                    {
                        int selIndex = _queueShowDesign.ReleationQueueItems.FindIndex(T => T.QueueId == ib.Value);
                        if (selIndex >= 0)
                        {
                            cbxReleationQueue.SetItemChecked(itemIndex, true);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MsgBox.ShowException(ex, this);
            }
        }
        private void frmQueueCallDesign_Load(object sender, EventArgs e)
        {
            try
            {
                txtImgName.Text              = _queueCallDesign.BackgroundImage;
                chkShowTitle.Checked         = _queueCallDesign.ShowHeader;
                txtTitle.Text                = _queueCallDesign.HeadText;
                cbxHeadDockWay.SelectedIndex = (int)_queueCallDesign.HeadDockWay;
                ceHeadBkColor.Color          = _queueCallDesign.HeadBColor;
                ceHeadBkColor2.Color         = _queueCallDesign.HeadBColor2;
                ceHeadForeColor.Color        = _queueCallDesign.HeadFColor;

                ceTxtBkColor.Color   = _queueCallDesign.TxtBColor;
                ceTxtBkColor2.Color  = _queueCallDesign.TxtBColor2;
                ceTxtForeColor.Color = _queueCallDesign.TxtFColor;

                chkUseRoomReleation.Checked = _queueCallDesign.UserRoomReleationQueue;

                float     fontSize = 0;
                FontStyle fs       = FontStyle.Regular;

                try
                {
                    fontSize = _queueCallDesign.HeadFontSize;
                }
                catch { }
                if (fontSize <= 0)
                {
                    fontSize = this.Font.Size;
                }

                if (_queueCallDesign.HeadFontBold)
                {
                    fs = fs | FontStyle.Bold;
                }
                if (_queueCallDesign.HeadFontItalic)
                {
                    fs = fs | FontStyle.Italic;
                }

                Font hfont = new Font(_queueCallDesign.HeadFontName, fontSize, fs);
                feHeadFont.Value = hfont;



                fontSize = 0;
                fs       = FontStyle.Regular;

                try
                {
                    fontSize = _queueCallDesign.TxtFontSize;
                }
                catch { }
                if (fontSize <= 0)
                {
                    fontSize = this.Font.Size;
                }

                if (_queueCallDesign.TxtFontBold)
                {
                    fs = fs | FontStyle.Bold;
                }
                if (_queueCallDesign.TxtFontItalic)
                {
                    fs = fs | FontStyle.Italic;
                }

                Font txtfont = new Font(_queueCallDesign.TxtFontName, fontSize, fs);
                feTxtFont.Value = txtfont;



                cbxReleationQueue.Items.Clear();

                cbxReleationQueue.DisplayMember = "Name";
                cbxReleationQueue.ValueMember   = "Value";

                DataTable dtQueueData = _qm.GetQueueInfoByDeptId(_departmentId);

                foreach (DataRow drQueue in dtQueueData.Rows)
                {
                    ItemBind ib = new ItemBind();

                    ib.Name  = drQueue["队列名称"].ToString();
                    ib.Value = drQueue["队列ID"].ToString();

                    int itemIndex = cbxReleationQueue.Items.Add(ib);

                    if (_queueCallDesign.QueueItems.Count > 0)
                    {
                        int selIndex = _queueCallDesign.QueueItems.FindIndex(T => T.QueueId == ib.Value);
                        if (selIndex >= 0)
                        {
                            cbxReleationQueue.SetItemChecked(itemIndex, true);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MsgBox.ShowException(ex, this);
            }
        }
        private void frmQueueStateModuleDesign_Load(object sender, EventArgs e)
        {
            try
            {
                InitQueueList();

                ceBackColor.Color = _queueStateDesign.BackColor;
                ceForeColor.Color = _queueStateDesign.ForeColor;
                ceBusyColor.Color = _queueStateDesign.BusyColor;
                ceWorkColor.Color = _queueStateDesign.WorkColor;
                ceFreeColor.Color = _queueStateDesign.FreeColor;

                txtFixRow.Text    = Convert.ToString(_queueStateDesign.FixRow);
                txtFixColumn.Text = Convert.ToString(_queueStateDesign.FixColumn);

                txtDefaultBusyCount.Text = Convert.ToString(_queueStateDesign.DefaultBusyCount);

                float     fontSize = 0;
                FontStyle fs       = FontStyle.Regular;

                try
                {
                    fontSize = _queueStateDesign.FontSize;
                }
                catch { }
                if (fontSize <= 0)
                {
                    fontSize = this.Font.Size;
                }

                if (_queueStateDesign.FontBold)
                {
                    fs = fs | FontStyle.Bold;
                }
                if (_queueStateDesign.FontItalic)
                {
                    fs = fs | FontStyle.Italic;
                }

                Font font = new Font(_queueStateDesign.FontName, fontSize, fs);
                feFontStyle.Value = font;

                chkUseRoomReleation.Checked = _queueStateDesign.UseRoomQueueReleation;

                listView1.Items.Clear();

                DataTable dtQueueData = _qm.GetQueueInfoByDeptId(_departmentId);

                foreach (DataRow drQueue in dtQueueData.Rows)
                {
                    QueueData queInfo = new QueueData();
                    queInfo.BindRowData(drQueue);

                    ListViewItem lvi = new ListViewItem(new string[] { queInfo.队列名称, "0" });

                    if (_queueStateDesign.QueueItems.Count > 0)
                    {
                        int index = _queueStateDesign.QueueItems.FindIndex(T => T.QueueId == queInfo.队列ID);

                        if (index >= 0)
                        {
                            QueueItem qi = _queueStateDesign.QueueItems[index];

                            lvi.SubItems[1].Text = Convert.ToString(qi.BusyCount);
                            lvi.Checked          = true;
                        }
                    }

                    lvi.Name = queInfo.队列名称;

                    lvi.Tag = queInfo;

                    listView1.Items.Add(lvi);
                }

                listView1.View = View.Details;
            }
            catch (Exception ex)
            {
                MsgBox.ShowException(ex, this);
            }
        }
        private void LoadDesign()
        {
            this.ForeColor = _queueShowDesign.ForeColor;
            tableLayoutPanel1.ForeColor = _queueShowDesign.ForeColor;


            float fontSize = 0;

            try
            {
                fontSize = _queueShowDesign.FontSize;
            }
            catch { }
            if (fontSize <= 0)
            {
                fontSize = this.Font.Size;
            }

            FontStyle fs = FontStyle.Regular;

            if (_queueShowDesign.IsBold)
            {
                fs = fs | FontStyle.Bold;
            }
            if (_queueShowDesign.IsItalic)
            {
                fs = fs | FontStyle.Italic;
            }



            Font ft = new Font(_queueShowDesign.FontName, fontSize, fs);

            this.Font = ft;

            tableLayoutPanel1.Font = ft;


            _queueItems.Clear();
            if (_queueShowDesign.ReleationQueueItems.Count > 0)
            {
                _queueItems = new List <QueueItem>(_queueShowDesign.ReleationQueueItems);
            }
            else
            {
                //查询科室包含的队列
                DataTable dtQueueData = QueueModel.GetQueueInfoByDeptId(_stationInfo.DepartmentId);

                if (_queueShowDesign.UseRoomQueueReleation && string.IsNullOrEmpty(_stationInfo.RoomId) == false)
                {
                    foreach (DataRow drQueue in dtQueueData.Rows)
                    {
                        QueueData queData = new QueueData();
                        queData.BindRowData(drQueue);

                        if (queData.包含房间.房间明细.FindIndex(T => T.房间ID == _stationInfo.RoomId) >= 0)
                        {
                            QueueItem qi = new QueueItem();

                            qi.QueueName = drQueue["队列名称"].ToString();
                            qi.QueueId   = drQueue["队列ID"].ToString();

                            _queueItems.Add(qi);
                        }
                    }
                }
                else
                {
                    foreach (DataRow drQueue in dtQueueData.Rows)
                    {
                        QueueItem qi = new QueueItem();

                        qi.QueueName = drQueue["队列名称"].ToString();
                        qi.QueueId   = drQueue["队列ID"].ToString();

                        _queueItems.Add(qi);
                    }
                }
            }


            InitQueueLayout(_queueItems);

            BindQueueListData(_queueItems);
        }