コード例 #1
0
ファイル: Business.cs プロジェクト: wizhwai/QueueSystem
        //推送提醒
        public object PushNotify(string Id)
        {
            var    qBll  = new BQueueBLL();
            var    oId   = Convert.ToInt32(Id);
            object obj   = new object();
            var    model = qBll.GetModel(oId);

            if (model == null)
            {
                return(new
                {
                    method = "PushNotify",
                    code = 0,
                    desc = "无此编号的排队数据,排队已失效,请核查",
                    result = new
                    {
                    }
                });
            }
            else
            {
                if (model.state == 0)
                {
                    return(new
                    {
                        method = "PushNotify",
                        code = 0,
                        desc = "该排队数据已失效,请核查",
                        result = new
                        {
                        }
                    });
                }
            }
            var list          = qBll.GetModelList(model.busTypeSeq, model.unitSeq, 0);
            var cModel        = new BCallBLL().GetModel(f => f.qId == oId && f.state != 2);
            var areaWindowStr = GetAreaWindowsStr(model.unitSeq, model.busTypeSeq);
            var waitNo        = 1;
            //返回该条数据以及三条待叫号数据
            var objresult = new
            {
                method = "PushNotify",
                code   = 1,
                desc   = "处理成功",
                result = new
                {
                    currentQueue = new
                    {
                        state        = "已叫号",
                        id           = model.ID,
                        ticketNumber = model.ticketNumber,
                        windowName   = cModel.windowNumber,
                        unitSeq      = model.unitSeq,
                        unitName     = model.unitName,
                        busySeq      = model.busTypeSeq,
                        busyName     = model.busTypeName,
                        reserveSeq   = model.reserveSeq,
                        area         = areaWindowStr[0],
                        windowStr    = areaWindowStr[1],
                        cardId       = model.idCard,
                        vip          = GetVipLever(model),
                        wxId         = model.wxId,
                    },
                    waitQueue = list.OrderBy(o => o.ID).Take(3).Select(s => new
                    {
                        id           = s.ID,
                        area         = areaWindowStr[0],
                        windowStr    = areaWindowStr[1],
                        currentState = "排队中",
                        windowNo     = "",
                        waitCount    = waitNo++,
                        unitSeq      = s.unitSeq,
                        unitName     = s.unitName,
                        busySeq      = s.busTypeSeq,
                        busyName     = s.busTypeName,
                        ticketNumber = s.ticketNumber,
                        ticketTime   = s.ticketTime.ToString("yyyy-MM-dd HH:mm:ss"),
                        reserveSeq   = s.reserveSeq,
                        cardId       = s.idCard,
                        vip          = GetVipLever(s),
                        wxId         = s.wxId
                    }).ToList()
                }
            };

            return(objresult);
        }
コード例 #2
0
ファイル: Business.cs プロジェクト: wizhwai/QueueSystem
        //获取当前排队信息
        private object GetQueueById(int Id)
        {
            var    qBll  = new BQueueBLL();
            object obj   = new object();
            var    model = qBll.GetModel(Id);

            if (model == null)
            {
                return(new
                {
                    method = "GetQueueInfo",
                    code = 0,
                    desc = "无此编号的排队数据",
                    result = new
                    {
                    }
                });
            }
            var areaWindowStr = GetAreaWindowsStr(model.unitSeq, model.busTypeSeq);
            var isGreen       = GetVipLever(model);
            var list          = qBll.GetModelList(model.busTypeSeq, model.unitSeq, 0).Where(q => q.ID < model.ID).ToList();
            int waitNo        = list.Count;//计算等候人数

            if (model.state == 1)
            {
                //已叫号/已处理
                var call = new BCallBLL().GetModel(f => f.qId == Id && f.state != 2);
                if (call == null)
                {
                    return(new
                    {
                        method = "GetQueueInfo",
                        code = 0,
                        desc = "无此编号的叫号数据",
                        result = new
                        {
                        }
                    });
                }
                else
                {
                    var currentState = call.ticketTime.Date != DateTime.Now.Date ? "已过期" : (call.state == -1 || call.state == 1) ? "已完成" : "已叫号";
                    obj = new
                    {
                        method = "GetQueueInfo",
                        code   = 1,
                        desc   = "处理成功",
                        result = new
                        {
                            id           = model.ID,
                            area         = areaWindowStr[0],
                            windowStr    = areaWindowStr[1],
                            currentState = currentState,
                            windowNo     = "",
                            waitCount    = waitNo,
                            unitSeq      = model.unitSeq,
                            unitName     = model.unitName,
                            busySeq      = model.busTypeSeq,
                            busyName     = model.busTypeName,
                            ticketNumber = model.ticketNumber,
                            ticketTime   = model.ticketTime.ToString("yyyy-MM-dd HH:mm:ss"),
                            reserveSeq   = model.reserveSeq,
                            cardId       = model.idCard,
                            vip          = isGreen,
                            wxId         = model.wxId
                        }
                    };
                }
            }
            else
            {
                //排队中
                obj = new
                {
                    method = "GetQueueInfo",
                    code   = 1,
                    desc   = "处理成功",
                    result = new
                    {
                        id           = model.ID,
                        area         = areaWindowStr[0],
                        windowStr    = areaWindowStr[1],
                        currentState = "排队中",
                        windowNo     = "",
                        waitCount    = waitNo,
                        unitSeq      = model.unitSeq,
                        unitName     = model.unitName,
                        busySeq      = model.busTypeSeq,
                        busyName     = model.busTypeName,
                        ticketNumber = model.ticketNumber,
                        ticketTime   = model.ticketTime.ToString("yyyy-MM-dd HH:mm:ss"),
                        reserveSeq   = model.reserveSeq,
                        cardId       = model.idCard,
                        vip          = isGreen,
                        wxId         = model.wxId
                    }
                };
            }
            return(obj);
        }
コード例 #3
0
ファイル: frmMain.cs プロジェクト: ztxyzu/QueueSystem
        private void BindData()
        {
            List <msInfo> mList = new List <msInfo>();

            #region 正式数据
            var vList = new List <BCallModel>();
            try
            {
                vList     = cBll.ScreenShowByArea(areaList).Take(rowCount).ToList();
                ShowError = false;
            }
            catch (Exception ex)
            {
                WriterLog("获取大屏显示数据异常,方法[ScreenShowByArea],错误原因:" + ex.Message);
                ShowError = (isShowError == 0 ? false : true);
            }
            int  i       = 0;
            Font vipFont = new Font(fontName, VIPFontSize, FontStyle.Bold);
            Font msgFont = new Font(fontName, fontSize, FontStyle.Bold);
            if (vList == null || vList.Count == 0)
            {
                this.pnMain.Controls.Clear();
                this.pnMain.ResumeLayout();
                return;
            }

            #region
            foreach (var v in vList)
            {
                var         bam   = baList.Where(b => b.busiSeq == v.busiSeq && b.unitSeq == v.unitSeq).FirstOrDefault();
                BQueueModel queue = null;
                try
                {
                    queue = qBll.GetModel(q => q.ID == v.qId);
                }
                catch (Exception ex)
                {
                    WriterLog("获取排队数据异常,方法[GetModel],错误原因:" + ex.Message);
                }
                string strVip = "";
                if (bam != null && bam.isGreenChannel == 1)
                {
                    strVip = "绿色\r\n通道";
                }
                else
                {
                    if ((queue != null && queue.type == 0 && queue.appType == 1 && queue.reserveStartTime <= v.handleTime && queue.reserveEndTime >= v.handleTime))
                    {
                        strVip = "网上\r\n预约";
                    }
                    else if (queue != null && queue.type == 1)
                    {
                        strVip = "网上\r\n申办";
                    }
                }
                msInfo ms = new msInfo();
                ms.Index        = (i + 1);
                ms.RowHeight    = rowHeight;
                ms.TextFont     = msgFont;
                ms.WindowColor  = window;
                ms.TicketColor  = ticket;
                ms.VIPColor     = vipColor;
                ms.VIPFont      = vipFont;
                ms.VIPText      = strVip;
                ms.OtherColor   = other;
                ms.WindowNumber = v.windowNumber;
                ms.QueueNumber  = v.ticketNumber;
                ms.msClick     += ms_Click;
                if (i % 2 != 0)
                {
                    ms.BackColorPage = blue;
                }
                else
                {
                    ms.BackColorPage = gray;
                }
                mList.Add(ms);
                i++;
            }
            #endregion

            #endregion

            if (pnMain.Controls.Count == 0)
            {
                int t = 0;
                foreach (var ms in mList)
                {
                    ms.Location = new Point(0, t);
                    this.pnMain.Controls.Add(ms);
                    t += ms.Height;
                }
                pnMain.ResumeLayout();
            }
            else
            {
                var deleteControl = new List <Control>();
                int jCount        = pnMain.Controls.Count;
                for (int j = 0; j < jCount; j++)
                {
                    if ((j + 1) <= mList.Count)
                    {
                        var ctl = pnMain.Controls[j] as msInfo;
                        ctl.WindowNumber = mList[j].WindowNumber;
                        ctl.QueueNumber  = mList[j].QueueNumber;
                        ctl.VIPText      = mList[j].VIPText;
                        ctl.Refresh();
                        ctl.Invalidate();
                    }
                    else
                    {
                        deleteControl.Add(pnMain.Controls[j]);
                    }
                }
                foreach (var con in deleteControl)
                {
                    pnMain.Controls.Remove(con);
                }
                pnMain.Refresh();
                pnMain.Invalidate();
                pnMain.ResumeLayout();
                int tCount = pnMain.Controls.Count;
                if (tCount < mList.Count)
                {
                    int t = (pnMain.Controls[0] as msInfo).Height * pnMain.Controls.Count;
                    for (int m = 0; m < mList.Count - tCount; m++)
                    {
                        var ms = mList[m + tCount];
                        ms.Location = new Point(0, t);
                        this.pnMain.Controls.Add(ms);
                        t += ms.Height;
                    }
                    pnMain.Refresh();
                    pnMain.Invalidate();
                    pnMain.ResumeLayout();
                }
            }
        }