Exemplo n.º 1
0
    void OnArena()
    {
        PushMsg msg = DataManager.Manager <FunctionPushManager>().GetPushMsg(m_pushMsgType, m_pushMsgSenderID);

        if (msg == null)
        {
            return;
        }
        string des = msg.sendName + "向你发起武斗场邀请\n是否参战";

        Action agree = delegate
        {
            MainPlayStop();

            GameCmd.stInviteResultArenaUserCmd_CS agreeCmd = new GameCmd.stInviteResultArenaUserCmd_CS();
            agreeCmd.offensive_id = msg.senderId;
            agreeCmd.result       = 1;  //同意
            Client.ClientGlobal.Instance().netService.Send(agreeCmd);
            DataManager.Manager <FunctionPushManager>().RemoveAllMsg(m_pushMsgType);
        };

        Action refuse = delegate
        {
            GameCmd.stInviteResultArenaUserCmd_CS refuseCmd = new GameCmd.stInviteResultArenaUserCmd_CS();
            refuseCmd.offensive_id = msg.senderId;
            refuseCmd.result       = 0; //拒绝
            Client.ClientGlobal.Instance().netService.Send(refuseCmd);
            DataManager.Manager <FunctionPushManager>().RemoveFirstSysMsg(msg);
        };

        TipsManager.Instance.ShowTipWindow(0, (uint)msg.leftTime, Client.TipWindowType.CancelOk, des, agree, refuse, title: "挑战邀请");
    }
Exemplo n.º 2
0
 public void GetUserList(HttpContext context)
 {
     try
     {
         ParamsHelper parms      = null;
         string       sqlWhere   = "";
         string       UserName   = context.Request.QueryString["userName"];
         string       sPageIndex = context.Request.QueryString["pageIndex"];
         string       sPageSize  = context.Request.QueryString["pageSize"];
         if (!string.IsNullOrWhiteSpace(UserName))
         {
             parms     = new ParamsHelper();
             sqlWhere += "and UserName like @UserName ";
             SqlParameter parm = new SqlParameter("@UserName", SqlDbType.NVarChar, 100);
             parm.Value = "%" + UserName + "%";
             parms.Add(parm);
         }
         PushMsg bll          = new PushMsg();
         int     totalRecords = 0;
         int     pageIndex    = Convert.ToInt32(sPageIndex);
         int     pageSize     = Convert.ToInt32(sPageSize);
         DataSet inforAdDs    = bll.GetUserList(pageIndex, pageSize, out totalRecords, sqlWhere, parms == null ? null : parms.ToArray());
         string  strJSON      = JsonConvert.SerializeObject(inforAdDs);
         strJSON = strJSON.Substring(0, strJSON.Length - 1) + ",\"total\":" + totalRecords + "}";
         context.Response.Write(strJSON);
     }
     catch (Exception ex)
     {
         context.Response.Write("{\"success\": false,\"message\": \"" + MessageContent.AlertTitle_Ex_Error + ":" + ex.Message + "\"}");
     }
 }
Exemplo n.º 3
0
    void OnClan()
    {
        PushMsg msg = DataManager.Manager <FunctionPushManager>().GetPushMsg(m_pushMsgType, m_pushMsgSenderID);

        if (msg == null)
        {
            return;
        }
        string content = string.Format("{0}邀请你加入氏族{1}",
                                       ColorManager.GetColorString(ColorType.JZRY_Blue, msg.sendName),
                                       ColorManager.GetColorString(ColorType.JZRY_Oranger, msg.name));

        TipsManager.Instance.ShowTipWindow(0, (uint)msg.leftTime, Client.TipWindowType.CancelOk, content,
                                           () =>
        {
            DataManager.Manager <ClanManger>().AnswerInvite(true, msg.senderId, msg.groupId);
            DataManager.Manager <FunctionPushManager>().RemoveAllMsg(m_pushMsgType);
        },
                                           () =>
        {
            DataManager.Manager <FunctionPushManager>().RemoveFirstSysMsg(msg);

            if (DataManager.Manager <ClanManger>().IsJoinClan)
            {
                return;
            }

            DataManager.Manager <ClanManger>().AnswerInvite(false, msg.senderId, msg.groupId);
        });
    }
Exemplo n.º 4
0
    public void InitClient(PushMsg msgFunc)
    {
        m_socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
        m_byte   = new byte[1024];

        m_msgFunc = msgFunc;
    }
Exemplo n.º 5
0
        /// <summary>
        /// Sends the push message.
        /// </summary>
        /// <param name="value">The value.</param>
        /// <returns></returns>
        private bool SendPushMessageToMQ(PushMsg msg)
        {
            var activemq = CreateActiveMQInstance();
            int sendflag = activemq.SendMessage <PushMsg>(msg);

            return(sendflag > 0 ? true : false);
        }
Exemplo n.º 6
0
 void Update()
 {
     if (m_l_leftSeconds > 0)
     {
         m_l_leftSeconds -= Time.deltaTime;
         if (m_spriteSlider != null)
         {
             m_spriteSlider.fillAmount = m_l_leftSeconds / m_l_pushCD;
         }
         if (m_labelTime != null)
         {
             m_labelTime.text = ((uint)m_l_leftSeconds + 1).ToString();
         }
         if (m_l_leftSeconds <= 0)
         {
             if (m_pushMsg != null)
             {
                 if (CurPushMsgTypeIsInvite)
                 {
                     DataManager.Manager <FunctionPushManager>().RemoveFirstSysMsg(m_pushMsg);
                 }
                 else
                 {
                     DataManager.Manager <FunctionPushManager>().RemoveTransmitMsg(m_pushMsg);
                 }
                 m_pushMsg = null;
             }
         }
     }
 }
Exemplo n.º 7
0
    public void AddSysMsg(PushMsg msg)
    {
        if (IsPushMessageRightPos(msg.msgType))
        {
            if (m_dicInviteMsg.ContainsKey(msg.msgType))
            {
                for (int i = 0; i < m_dicInviteMsg[msg.msgType].Count; i++)
                {
                    if (m_dicInviteMsg[msg.msgType][i].senderId == msg.senderId)
                    {
                        m_dicInviteMsg[msg.msgType].RemoveAt(i);
                    }
                }
                m_dicInviteMsg[msg.msgType].Add(msg);
            }
            else
            {
                List <PushMsg> list = new List <PushMsg>();
                list.Add(msg);
                m_dicInviteMsg.Add(msg.msgType, list);
            }
            Engine.Utility.EventEngine.Instance().DispatchEvent((int)Client.GameEventID.REFRESHINVITEPUSHMSGSTATUS, null);
        }
        else
        {
            if (!m_dicTransmitMsg.ContainsKey(msg.msgType))
            {
                m_dicTransmitMsg.Add(msg.msgType, new Dictionary <uint, PushMsg>());
            }
            if (m_dicTransmitMsg[msg.msgType].ContainsKey(msg.senderId))
            {
                m_dicTransmitMsg[msg.msgType][msg.senderId] = msg;
                for (int i = 0; i < m_lstTransmit.Count; i++)
                {
                    if (m_lstTransmit[i].msgType == msg.msgType && m_lstTransmit[i].senderId == msg.senderId)
                    {
                        m_lstTransmit[i] = msg;
                    }
                }
            }
            else
            {
                m_dicTransmitMsg[msg.msgType].Add(msg.senderId, msg);
                m_lstTransmit.Add(msg);
            }
            Engine.Utility.EventEngine.Instance().DispatchEvent((int)Client.GameEventID.REFRESHTRANSMITPUSHMSGSTATUS, null);
        }


        if (DataManager.Manager <UIPanelManager>().IsShowPanel(PanelID.MessagePushPanel) == false)
        {
            if (!DataManager.Manager <ComBatCopyDataManager>().IsEnterCopy)
            {
                DataManager.Manager <UIPanelManager>().ShowPanel(PanelID.MessagePushPanel);
            }
        }
    }
Exemplo n.º 8
0
        void btn_Delete_Click(object sender, EventArgs e)
        {
            var pm = new PushMsg();

            pm.Retrieve(PushMsgAttr.FK_Event, this.Event, PushMsgAttr.FK_Node, this.NodeID);
            pm.Delete();

            Response.Redirect(string.Format("ActionPush2Spec.aspx?NodeID={0}&MyPK={1}&Event={2}&FK_Flow={3}&tk={4}", NodeID, MyPK, Event,
                                            FK_Flow, new Random().NextDouble()), true);
        }
Exemplo n.º 9
0
    /// <summary>
    /// 悬赏任务完成奖励
    /// </summary>
    void OnTokenTaskReward()
    {
        PushMsg msg = DataManager.Manager <FunctionPushManager>().GetPushMsg(m_pushMsgType, m_pushMsgSenderID);

        if (msg == null)
        {
            return;
        }

        DataManager.Manager <UIPanelManager>().ShowPanel(PanelID.RewardMissionPanel);

        DataManager.Manager <FunctionPushManager>().RemoveFirstSysMsg(msg);
    }
Exemplo n.º 10
0
        private void Bind()
        {
            //查询条件
            GetSearchItem();

            int     totalRecords = 0;
            PushMsg bll          = new PushMsg();

            rpData.DataSource = bll.GetListOW(pageIndex, pageSize, out totalRecords, sqlWhere, parms == null ? null : parms.ToArray());
            rpData.DataBind();

            myDataAppend.Append("<div id=\"myDataForPage\" style=\"display:none;\">[{\"PageIndex\":\"" + pageIndex + "\",\"PageSize\":\"" + pageSize + "\",\"TotalRecord\":\"" + totalRecords + "\",\"QueryStr\":\"" + queryStr + "\"}]</div>");
        }
Exemplo n.º 11
0
 public void SetTransmitUI(PushMsg msg)
 {
     m_pushMsgType     = msg.msgType;
     m_pushMsgSenderID = msg.senderId;
     if (m_lableNum != null)
     {
         //这个地方num肯定为0
         int num = DataManager.Manager <FunctionPushManager>().GetMsgNum(m_pushMsgType);
         if (num > 0)
         {
             m_lableNum.text = num.ToString();
         }
         else
         {
             m_lableNum.text = "";
         }
     }
     m_pushMsg              = msg;
     m_l_leftSeconds        = msg.cd - (UnityEngine.Time.realtimeSinceStartup - msg.sendTime);
     m_l_pushCD             = msg.cd;
     CurPushMsgTypeIsInvite = false;
     if (m_spriteIcon != null)
     {
         SysMsgPushParam param = null;
         if (m_pushMsgType == PushMsg.MsgType.TeamTransmit)
         {
             param = ParseBtnSpite(TransmitAndInviteType.TeamTransmit);
         }
         else if (m_pushMsgType == PushMsg.MsgType.ClanTransmit)
         {
             param = ParseBtnSpite(TransmitAndInviteType.ClanTransmit);
         }
         else if (m_pushMsgType == PushMsg.MsgType.CoupleTransmit)
         {
             param = ParseBtnSpite(TransmitAndInviteType.CoupleTransmit);
         }
         else if (m_pushMsgType == PushMsg.MsgType.CityWarTeam)
         {
             param = ParseBtnSpite(TransmitAndInviteType.CityWarTeamTransmit);
         }
         else if (m_pushMsgType == PushMsg.MsgType.CityWarClan)
         {
             param = ParseBtnSpite(TransmitAndInviteType.CityWarClanTransmit);
         }
         if (param != null)
         {
             m_spriteIcon.spriteName  = param.iconName;
             m_spriteTitle.spriteName = param.titleName;
         }
     }
 }
Exemplo n.º 12
0
        /// <summary>
        /// Calls the client method.
        /// </summary>
        /// <param name="m">The m.</param>
        /// <exception cref="System.ArgumentNullException">User list should not be null</exception>
        private static void CallClientMethod(PushMsg m)
        {
            if (m.Users == null)
            {
                throw new ArgumentNullException("User list should not be null");
            }

            var userAccounts = m.Users.ToArray();

            log.InfoFormat("从MQ收到消息{0}", m.MSGCONTENT);
            //GlobalHost.ConnectionManager.GetHubContext<FeedHub>().Clients.All.receive(m);
            //push via
            GlobalHost.ConnectionManager.GetHubContext <FeedHub>().Clients.Users(userAccounts).receive(m);
        }
        /// <summary>
        /// Inserts the push message.
        /// </summary>
        /// <param name="pushmsg">The pushmsg.</param>
        /// <returns>成功插入PushMessage的PK的列表</returns>
        //[TransactionScopeCallHandler]
        public int[] InsertPushMessage(PushMsg pushmsg)
        {
            var dbcontext = new MessageCenterEntities();

            IList <T_BD_PushMessage> pushMessageDtoList = new List <T_BD_PushMessage>();

            pushmsg.Users.ToList().ForEach(u =>
            {
                pushMessageDtoList.Add(
                    new T_BD_PushMessage()
                {
                    IsRead                  = pushmsg.IsRead,
                    MsgTitle                = pushmsg.MSGTITLE,
                    MsgContent              = pushmsg.MSGCONTENT,
                    MsgType                 = Convert.ToInt32(pushmsg.MSGTYPE),
                    MsgSendType             = pushmsg.MsgSendType,
                    ExpirationTime          = pushmsg.ExpirationTime,
                    T_BD_PushMessageToUsers = new List <T_BD_PushMessageToUsers> {
                        new T_BD_PushMessageToUsers()
                        {
                            Userid = GetUserIdListByUserAccount(u), SendingTime = DateTime.Now
                        }
                    }
                    // Userid = GetUserIdListByUserAccount(u)
                }
                    );
            });

            IList <int> pushMessageEntiyIdList = new List <int>();

            pushMessageDtoList.ToList().ForEach(u =>
            {
                //save db

                try
                {
                    dbcontext.T_BD_PushMessage.Add(u);
                    dbcontext.SaveChanges();
                }
                catch (Exception ex)
                {
                    log.Error(ex);
                }

                pushMessageEntiyIdList.Add(u.Id);
            });


            return(pushMessageEntiyIdList.ToArray());
        }
Exemplo n.º 14
0
    void OnFeiLeng(GameCmd.FeiLeiType transmit)
    {
        PushMsg msg = DataManager.Manager <FunctionPushManager>().GetPushMsg(m_pushMsgType, m_pushMsgSenderID);

        if (msg == null)
        {
            return;
        }
        string des   = "";
        string title = "";

        if (transmit == GameCmd.FeiLeiType.FeiLeiType_Team || transmit == GameCmd.FeiLeiType.CallUp_CityWarTeam)
        {
            des   = string.Format("队伍成员{0}({1},{2}级)正在召唤你前往{3}({4}),是否前往加入", msg.sendName, msg.profession, msg.level, msg.map, msg.vector);
            title = "队伍召集";
        }
        else
        {
            des   = string.Format("氏族成员{0}({1},{2}级)正在召唤你前往{3}({4}),是否前往加入", msg.sendName, msg.profession, msg.level, msg.map, msg.vector);
            title = "氏族召集";
        }
        Action agree = delegate
        {
            if (!KHttpDown.Instance().SceneFileExists(msg.mapId))
            {
                DataManager.Manager <FunctionPushManager>().RemoveTransmitMsg(msg);
                //打开下载界面
                DataManager.Manager <UIPanelManager>().ShowPanel(PanelID.DownloadPanel);

                return;
            }

            NetService.Instance.Send(new GameCmd.stInviteGoMapRequestUserCmd_CS()
            {
                userid = msg.senderId, type = (uint)transmit
            });
            DataManager.Manager <FunctionPushManager>().RemoveTransmitMsg(msg);
        };

        Action close = delegate
        {
            DataManager.Manager <FunctionPushManager>().RemoveTransmitMsg(msg);
        };
        Action refuse = delegate
        {
        };

        TipsManager.Instance.ShowTipWindow(0, (uint)msg.leftTime, Client.TipWindowType.CancelOk, des, agree, refuse, close, title: title, okstr: "确定", cancleStr: "挂起");
    }
Exemplo n.º 15
0
 public void RemoveFirstSysMsg(PushMsg msg)
 {
     if (m_dicInviteMsg.ContainsKey(msg.msgType))
     {
         if (m_dicInviteMsg[msg.msgType].Contains(msg))
         {
             m_dicInviteMsg[msg.msgType].Remove(msg);
             if (m_dicInviteMsg[msg.msgType].Count == 0)
             {
                 m_dicInviteMsg.Remove(msg.msgType);
             }
         }
     }
     Engine.Utility.EventEngine.Instance().DispatchEvent((int)Client.GameEventID.REFRESHINVITEPUSHMSGSTATUS, null);
 }
Exemplo n.º 16
0
        /// <summary>
        /// Calls the client method.
        /// </summary>
        /// <param name="m">The m.</param>
        /// <exception cref="System.ArgumentNullException">User list should not be null</exception>
        private static void CallClientMethod(PushMsg m)
        {
            if (m.Users == null)
            {
                throw new ArgumentNullException("User list should not be null");
            }

            var userAccounts = m.Users.ToArray();

            log.InfoFormat("Get Message from MQ 从MQ收到消息{0}, Users: {1}", m.MSGCONTENT, String.Join(",", m.Users));
            //GlobalHost.ConnectionManager.GetHubContext<FeedHub>().Clients.All.receive(m);

            //Tips:WebAuth will receive message By specifc user account while login system, ex:[email protected], account need to login
            GlobalHost.ConnectionManager.GetHubContext <FeedHub>().Clients.Users(userAccounts).receive(m);
        }
Exemplo n.º 17
0
 public void Publish(string filter, PushMsg message)
 {
     if (_disposeCount != 0)
     {
         throw new ObjectDisposedException(this.GetType().Name);
     }
     try
     {
         _socket.Send(filter, false, true);
         _socket.Send(message.SerializeMessage());
     }
     catch (TerminatingException)
     {
         Debug.WriteLine(string.Format("TerminatingException: auto-disposing {0}...", this.GetType().Name));
         ((IDisposable)this).Dispose();
     }
 }
Exemplo n.º 18
0
        /// <summary>
        /// Pushes the message to mq.
        /// </summary>
        /// <param name="pushmsg">The pushmsg.</param>
        /// <returns></returns>
        /// <exception cref="System.ArgumentNullException">
        /// PushMsg object should not be null
        /// or
        /// User list should not be null
        /// </exception>
        protected bool PushMessageToMQ(PushMsg pushmsg)
        {
            if (pushmsg == null)
            {
                throw new ArgumentNullException("PushMsg object should not be null");
            }

            if (pushmsg.Users == null)
            {
                throw new ArgumentNullException("User list should not be null");
            }

            //判断过期logic
            if (pushmsg.ExpirationTime >= DateTime.Now)
            {
                // Clients.
                return(SendPushMessageToMQ(pushmsg));
            }
            return(false);
        }
 /// <summary>
 /// Sends to server.
 /// </summary>
 /// <param name="messagemodel">The messagemodel.</param>
 /// <returns></returns>
 private IHttpActionResult SendToServer(PushMsg messagemodel)
 {
     if (ModelState.IsValid)
     {
         if (messageRepository.SendMessage(messagemodel))
         {
             log.Debug("发送成功 Send success!");
             return(Ok());
         }
         else
         {
             log.ErrorFormat("发送失败!Sent failure ! {0}", messagemodel);
             return(Content(HttpStatusCode.ExpectationFailed, new Exception("send message error")));
         }
     }
     else
     {
         log.ErrorFormat("参数验证失败!ModelState is not Valid{0}", messagemodel);
         return(Content(HttpStatusCode.BadRequest, ModelState));
     }
 }
Exemplo n.º 20
0
    //队长邀请组队
    void OnTeamLeaderInvite()
    {
        PushMsg msg = DataManager.Manager <FunctionPushManager>().GetPushMsg(m_pushMsgType, m_pushMsgSenderID);

        if (msg == null)
        {
            return;
        }

        string des   = string.Format("{0}邀请你加入{1}的队伍", msg.sendName, msg.name);
        Action agree = delegate
        {
            GameCmd.stAnswerTeamRelationUserCmd_CS sendCmd = new GameCmd.stAnswerTeamRelationUserCmd_CS();
            //sendCmd.dwRequestUserID = DataManager.Manager<TeamDataManager>().ReceiveTeamInviteInfo.uid;
            sendCmd.dwRequestUserID = msg.senderId;
            sendCmd.byAgree         = 1;
            NetService.Instance.Send(sendCmd);

            DataManager.Manager <FunctionPushManager>().RemoveAllMsg(m_pushMsgType);
        };

        Action refuse = delegate
        {
            DataManager.Manager <FunctionPushManager>().RemoveFirstSysMsg(msg);

            if (DataManager.Manager <TeamDataManager>().IsJoinTeam)
            {
                return;
            }

            GameCmd.stAnswerTeamRelationUserCmd_CS sendCmd = new GameCmd.stAnswerTeamRelationUserCmd_CS();
            //sendCmd.dwRequestUserID = DataManager.Manager<TeamDataManager>().ReceiveTeamInviteInfo.uid;
            sendCmd.dwRequestUserID = msg.senderId;
            sendCmd.byAgree         = 0;
            NetService.Instance.Send(sendCmd);
        };

        TipsManager.Instance.ShowTipWindow(0, (uint)msg.leftTime, Client.TipWindowType.CancelOk, des, agree, refuse, title: "组队邀请");
    }
Exemplo n.º 21
0
 public void RemoveTransmitMsg(PushMsg msg)
 {
     if (M_dicTransmitMsg.ContainsKey(msg.msgType))
     {
         if (M_dicTransmitMsg[msg.msgType].ContainsKey(msg.senderId))
         {
             PushMsg.MsgType type     = msg.msgType;
             uint            senderid = msg.senderId;
             if (m_lstTransmit.Contains(msg))
             {
                 m_lstTransmit.Remove(msg);
                 M_dicTransmitMsg[msg.msgType].Remove(msg.senderId);
             }
             if (!StillHasThisTypeLeft(m_lstTransmit, msg.msgType))
             {
                 M_dicTransmitMsg[msg.msgType].Clear();
                 M_dicTransmitMsg.Remove(msg.msgType);
             }
         }
     }
     Engine.Utility.EventEngine.Instance().DispatchEvent((int)Client.GameEventID.REFRESHTRANSMITPUSHMSGSTATUS, null);
 }
Exemplo n.º 22
0
    /// <summary>
    /// 队长召唤跟随
    /// </summary>
    void OnTeamLeaderCallFollow()
    {
        PushMsg msg = DataManager.Manager <FunctionPushManager>().GetPushMsg(m_pushMsgType, m_pushMsgSenderID);

        if (msg == null)
        {
            return;
        }

        string des   = string.Format("队长向您发出跟随请求");
        Action agree = delegate
        {
            DataManager.Manager <TeamDataManager>().ReqManualFollow();
            DataManager.Manager <FunctionPushManager>().RemoveAllMsg(m_pushMsgType);
        };

        Action refuse = delegate
        {
            DataManager.Manager <FunctionPushManager>().RemoveFirstSysMsg(msg);
        };

        TipsManager.Instance.ShowTipWindow(0, (uint)msg.leftTime, Client.TipWindowType.CancelOk, des, agree, refuse, title: "跟随请求");
    }
Exemplo n.º 23
0
        /// <summary>
        /// 异步执行并返回
        /// </summary>
        /// <param name="key"></param>
        /// <param name="msg"></param>
        /// <returns></returns>
        public void PushDelayRun(string key, string msg, string cmd, int delayMinute)
        {
            if (string.IsNullOrEmpty(cmd))
            {
                cmd = key;
            }
            var time     = DateTime.Now.AddMinutes(delayMinute);
            var sencond  = time.Second / 10 * 10;
            var timeKey  = time.ToString("yyyyMMddHHmm") + sencond;
            var innerMsg = new PushMsg
            {
                Key     = key,
                Command = cmd,
                Body    = msg,
                Time    = DateTime.Now,
                IsBack  = false
            };

            Exec(db =>
            {
                db.ListLeftPush(FormatKey(MsgQuoteDelayCommonChannel(timeKey)), innerMsg.ToJson());
            }, 2);
        }
Exemplo n.º 24
0
    //队员邀请
    void OnTeamMemberInvite()
    {
        PushMsg msg = DataManager.Manager <FunctionPushManager>().GetPushMsg(m_pushMsgType, m_pushMsgSenderID);

        if (msg == null)
        {
            return;
        }

        string des   = string.Format("{0}邀请你加入{1}的队伍", msg.sendName, msg.name);
        Action agree = delegate
        {
            GameCmd.stTeamMemInviteRelationUserCmd_CS sendCmd = new GameCmd.stTeamMemInviteRelationUserCmd_CS();
            sendCmd.teamid = msg.senderId;
            sendCmd.ret    = true;
            NetService.Instance.Send(sendCmd);
            DataManager.Manager <FunctionPushManager>().RemoveAllMsg(m_pushMsgType);
        };

        Action refuse = delegate
        {
            DataManager.Manager <FunctionPushManager>().RemoveFirstSysMsg(msg);

            if (DataManager.Manager <TeamDataManager>().IsJoinTeam)
            {
                return;
            }

            GameCmd.stTeamMemInviteRelationUserCmd_CS sendCmd = new GameCmd.stTeamMemInviteRelationUserCmd_CS();
            sendCmd.teamid = msg.senderId;
            sendCmd.ret    = false;
            NetService.Instance.Send(sendCmd);
        };

        TipsManager.Instance.ShowTipWindow(0, (uint)msg.leftTime, Client.TipWindowType.CancelOk, des, agree, refuse, title: "组队邀请");
    }
 public IHttpActionResult SendMessage(PushMsg messagemodel)
 {
     return(SendToServer(messagemodel));
 }
Exemplo n.º 26
0
 /// <summary>
 /// 发起信息推送
 /// </summary>
 /// <param name="msg">信息</param>
 /// <param name="type">信息类型</param>
 public static void RaisePushMsg(string msg, MsgType type = MsgType.Info)
 {
     PushMsg.Invoke(msg, type);
 }
Exemplo n.º 27
0
        void btn_Click(object sender, EventArgs e)
        {
            var pm = new PushMsg();

            pm.Retrieve(PushMsgAttr.FK_Event, this.Event, PushMsgAttr.FK_Node, this.NodeID);

            if (!string.IsNullOrWhiteSpace(pm.MyPK))
            {
                pm.Delete();
            }

            pm.FK_Event = this.Event;
            pm.FK_Node  = int.Parse(this.NodeID);

            var ddl = Pub1.GetDDLByID("DDL_" + PushMsgAttr.PushWay);

            pm.PushWay = ddl.SelectedItemIntVal;
            pm.PushDoc = string.Empty;

            switch ((PushWay)pm.PushWay)
            {
            case PushWay.ByParas:

                #region  照系统指定参数

                var rb = Pub1.GetRadioBtnByID("RB_0");

                if (rb.Checked)
                {
                    pm.PushDoc = "0";
                    pm.Tag     = Pub1.GetTBByID("TB_" + PushMsgAttr.Tag).Text;
                }
                else
                {
                    rb = Pub1.GetRadioBtnByID("RB_1");

                    if (rb.Checked)
                    {
                        pm.PushDoc = "1";
                    }

                    pm.Tag = Pub1.GetDDLByID("DDL_" + PushMsgAttr.Tag).SelectedItemStringVal;
                }

                #endregion

                break;

            case PushWay.NodeWorker:

                #region  照指定结点的工作人员

                CheckBox cb = null;

                foreach (var ctrl in Pub1.Controls)
                {
                    cb = ctrl as CheckBox;
                    if (cb == null || !cb.ID.StartsWith("CB_") || !cb.Checked)
                    {
                        continue;
                    }

                    pm.PushDoc += "@" + cb.ID.Substring(3) + "@";
                }

                #endregion

                break;

            case PushWay.SpecDepts:

                #region  照指定的部门

                foreach (var ctrl in Pub1.Controls)
                {
                    cb = ctrl as CheckBox;
                    if (cb == null || !cb.ID.StartsWith("CB_") || !cb.Checked)
                    {
                        continue;
                    }

                    pm.PushDoc += "@" + cb.ID.Substring(3) + "@";
                }

                #endregion

                break;

            case PushWay.SpecEmps:

                #region  照指定的人员

                var hid = Pub1.FindControl("HID_Users") as HiddenField;

                if (!string.IsNullOrWhiteSpace(hid.Value))
                {
                    pm.PushDoc = hid.Value.Split(',').Select(o => "@" + o + "@").Aggregate(string.Empty,
                                                                                           (curr, next) =>
                                                                                           curr + next);
                }
                //foreach (var ctrl in Pub1.Controls)
                //{
                //    cb = ctrl as CheckBox;
                //    if (cb == null || !cb.ID.StartsWith("CB_E_") || !cb.Checked) continue;

                //    pm.PushDoc += "@" + cb.ID.Substring(5) + "@";
                //}

                #endregion

                break;

            case PushWay.SpecSQL:

                #region  照指定的SQL查询语句

                pm.PushDoc = Pub1.GetTBByID("TB_" + PushMsgAttr.PushDoc).Text;

                #endregion

                break;

            case PushWay.SpecStations:

                #region  照指定的岗位

                foreach (var ctrl in Pub1.Controls)
                {
                    cb = ctrl as CheckBox;
                    if (cb == null || !cb.ID.StartsWith("CB_S_") || !cb.Checked)
                    {
                        continue;
                    }

                    pm.PushDoc += "@" + cb.ID.Substring(5) + "@";
                }

                #endregion

                break;
            }

            pm.Save();
            Response.Redirect(string.Format("ActionPush2Spec.aspx?NodeID={0}&MyPK={1}&Event={2}&FK_Flow={3}&tk={4}", NodeID, MyPK, Event,
                                            FK_Flow, new Random().NextDouble()), true);
        }
Exemplo n.º 28
0
    public void SetSysMsgUI(PushMsg.MsgType msgType)
    {
        m_pushMsgType = msgType;

        if (m_lableNum != null)
        {
            int num = DataManager.Manager <FunctionPushManager>().GetMsgNum(m_pushMsgType);
            if (num > 0)
            {
                m_lableNum.text = num.ToString();
            }
            else
            {
                m_lableNum.text = "";
            }
        }
        PushMsg msg = DataManager.Manager <FunctionPushManager>().GetPushMsg(m_pushMsgType);

        if (msg == null)
        {
            Engine.Utility.Log.Error("pushmsg == null");
            return;
        }
        m_pushMsg = msg;

        m_l_leftSeconds        = msg.cd - (UnityEngine.Time.realtimeSinceStartup - msg.sendTime);
        m_l_pushCD             = msg.cd;
        CurPushMsgTypeIsInvite = true;
        if (m_l_leftSeconds >= SHOWCDLIMIT)
        {
            ShowCDUI(false);
        }
        else
        {
            ShowCDUI(true);
        }

        if (m_spriteSlider != null)
        {
            m_spriteSlider.fillAmount = msg.leftTime / msg.cd;
        }
        if (m_labelTime != null)
        {
            m_labelTime.text = ((uint)msg.leftTime + 1).ToString();
        }

        if (m_spriteIcon != null)
        {
            SysMsgPushParam param = null;
            if (msg.msgType == PushMsg.MsgType.TeamLeaderInvite)
            {
                param = ParseBtnSpite(TransmitAndInviteType.TeamInvite);
            }
            else if (msg.msgType == PushMsg.MsgType.TeamMemberInvite)
            {
                param = ParseBtnSpite(TransmitAndInviteType.TeamMemberInvite);
            }
            else if (msg.msgType == PushMsg.MsgType.Arena)
            {
                param = ParseBtnSpite(TransmitAndInviteType.ArenaInvite);
            }
            else if (msg.msgType == PushMsg.MsgType.Clan)
            {
                param = ParseBtnSpite(TransmitAndInviteType.ClanInvite);
            }
            else if (msg.msgType == PushMsg.MsgType.TeamLeaderCallFollow)
            {
                param = ParseBtnSpite(TransmitAndInviteType.TeamLeaderCallFollow);
            }
            else if (msg.msgType == PushMsg.MsgType.TokenTaskReward)
            {
                param = ParseBtnSpite(TransmitAndInviteType.TokenTaskReward);
            }
            if (param != null)
            {
                m_spriteIcon.spriteName  = param.iconName;
                m_spriteTitle.spriteName = param.titleName;
            }
        }
    }
Exemplo n.º 29
0
    //-----------------------------------------------------------------------------------------------
    public void AddTransmitMsg(GameCmd.stInviteGoMapRequestUserCmd_CS cmd)
    {
        PushMsg msg = new PushMsg();

        if (cmd.type == (int)GameCmd.FeiLeiType.FeiLeiType_Clan)
        {
            msg.msgType = PushMsg.MsgType.ClanTransmit;
            msg.cd      = (float)GameTableManager.Instance.GetGlobalConfig <int>("ClanTransmitMsgCD");
        }
        else if (cmd.type == (int)GameCmd.FeiLeiType.FeiLeiType_Couple)
        {
            msg.msgType = PushMsg.MsgType.CoupleTransmit;
            msg.cd      = (float)GameTableManager.Instance.GetGlobalConfig <int>("CoupleTransmitMsgCD");
        }
        else if (cmd.type == (int)GameCmd.FeiLeiType.FeiLeiType_Team)
        {
            msg.msgType = PushMsg.MsgType.TeamTransmit;
            msg.cd      = (float)GameTableManager.Instance.GetGlobalConfig <int>("TeamTransmitMsgCD");
        }
        else if (cmd.type == (int)GameCmd.FeiLeiType.CallUp_CityWarClan)
        {
            msg.msgType = PushMsg.MsgType.CityWarClan;
            msg.cd      = (float)GameTableManager.Instance.GetGlobalConfig <int>("ClanTransmitMsgCD");
        }
        else if (cmd.type == (int)GameCmd.FeiLeiType.CallUp_CityWarTeam)
        {
            msg.msgType = PushMsg.MsgType.CityWarTeam;
            msg.cd      = (float)GameTableManager.Instance.GetGlobalConfig <int>("ClanTransmitMsgCD");
        }

        msg.senderId = cmd.userid;
        msg.sendName = cmd.username;
        msg.sendTime = UnityEngine.Time.realtimeSinceStartup;
        msg.vector   = cmd.pos;
        table.MapDataBase mdb = GameTableManager.Instance.GetTableItem <table.MapDataBase>(cmd.mapid);
        if (mdb != null)
        {
            msg.map   = mdb.strName;
            msg.mapId = cmd.mapid;
        }
        if (DataManager.Manager <ClanManger>().ClanInfo != null)
        {
            GameCmd.stClanMemberInfo clanInfo = DataManager.Manager <ClanManger>().ClanInfo.GetMemberInfo(cmd.userid);
            if (clanInfo != null)
            {
                msg.level = (int)clanInfo.level;
                SelectRoleDataBase data = table.SelectRoleDataBase.Where((GameCmd.enumProfession)clanInfo.job, (GameCmd.enmCharSex) 1);
                if (data != null)
                {
                    msg.profession = data.professionName;
                }
            }
        }
        TeamMemberInfo info = DataManager.Manager <TeamDataManager>().GetTeamMember(cmd.userid);

        if (info != null)
        {
            msg.level = (int)info.lv;
            SelectRoleDataBase data = table.SelectRoleDataBase.Where((GameCmd.enumProfession)info.job, (GameCmd.enmCharSex) 1);
            if (data != null)
            {
                msg.profession = data.professionName;
            }
        }
        AddSysMsg(msg);
        if (DataManager.Manager <UIPanelManager>().IsShowPanel(PanelID.MessagePushPanel) == false)
        {
            if (!DataManager.Manager <ComBatCopyDataManager>().IsEnterCopy)
            {
                DataManager.Manager <UIPanelManager>().ShowPanel(PanelID.MessagePushPanel);
            }
        }
        Engine.Utility.EventEngine.Instance().DispatchEvent((int)Client.GameEventID.REFRESHTRANSMITPUSHMSGSTATUS, null);
    }
Exemplo n.º 30
0
        protected void Page_Load(object sender, EventArgs e)
        {
            PushMsgs msgs = new PushMsgs(this.FK_Flow);
            var      msg  = msgs.GetEntityByKey(PushMsgAttr.FK_Event, this.Event, PushMsgAttr.FK_Node, int.Parse(this.NodeID)) as PushMsg;

            if (msg == null)
            {
                msg          = new PushMsg();
                msg.FK_Event = this.Event;
                msg.FK_Node  = int.Parse(this.NodeID);
            }

            if (!string.IsNullOrWhiteSpace(this.ThePushWay))
            {
                if (this.ThePushWay != msg.PushWay.ToString())
                {
                    msg.PushDoc = string.Empty;
                    msg.Tag     = string.Empty;
                }

                msg.PushWay = int.Parse(this.ThePushWay);
            }

            this.Pub1.AddTable("class='Table' cellspacing='1' cellpadding='1' border='1' style='width:100%'");

            this.Pub1.AddTR();
            this.Pub1.AddTD("style='width:100px'", "推送设置方式:");
            var ddl = new DDL();

            ddl.BindSysEnum(PushMsgAttr.PushWay);
            ddl.ID = "DDL_" + PushMsgAttr.PushWay;
            ddl.SetSelectItem((int)msg.PushWay);
            ddl.AutoPostBack          = true;
            ddl.SelectedIndexChanged += new EventHandler(ddl_SelectedIndexChanged);
            this.Pub1.AddTD(ddl);
            this.Pub1.AddTREnd();

            switch ((PushWay)msg.PushWay)
            {
            case PushWay.ByParas:

                #region  照系统指定参数

                Pub1.AddTR();
                Pub1.AddTD("输入参数名:");
                Pub1.AddTDBegin();

                var rad = new RadioBtn();
                rad.GroupName = "Para";
                rad.ID        = "RB_0";
                rad.Text      = "系统参数";
                rad.Checked   = msg.PushDoc == "0";

                Pub1.Add(rad);

                var tb = new TB();
                tb.ID = "TB_" + PushMsgAttr.Tag;

                if (msg.PushDoc == "0")
                {
                    tb.Text = msg.Tag;
                }
                else
                {
                    tb.Text = "NoticeTo";
                }

                Pub1.Add(tb);

                Pub1.Add("&nbsp;默认为NoticeTo");
                Pub1.AddBR();

                rad           = new RadioBtn();
                rad.GroupName = "Para";
                rad.ID        = "RB_1";
                rad.Text      = "表单字段参数";
                rad.Checked   = msg.PushDoc == "1";

                Pub1.Add(rad);

                MapAttrs attrs = new MapAttrs();
                attrs.Retrieve(MapAttrAttr.FK_MapData, "ND" + this.NodeID);

                MapAttrs attrNs = new MapAttrs();

                foreach (MapAttr attr in attrs)
                {
                    if (attr.IsBigDoc)
                    {
                        continue;
                    }

                    switch (attr.KeyOfEn)
                    {
                    case "Title":
                    case "FK_Emp":
                    case "MyNum":
                    case "FK_NY":
                    case WorkAttr.Emps:
                    case WorkAttr.OID:
                    case StartWorkAttr.Rec:
                    case StartWorkAttr.FID:
                        continue;

                    default:
                        break;
                    }

                    attrNs.AddEntity(attr);
                }

                ddl    = new DDL();
                ddl.ID = "DDL_" + PushMsgAttr.Tag;
                ddl.BindEntities(attrNs, MapAttrAttr.MyPK, MapAttrAttr.Name);
                ddl.AutoPostBack = false;

                if (msg.PushDoc == "1")
                {
                    ddl.SetSelectItem(msg.Tag);
                }

                Pub1.Add(ddl);
                Pub1.AddTREnd();
                #endregion

                break;

            case PushWay.NodeWorker:

                #region  照指定结点的工作人员

                Pub1.AddTR();
                Pub1.AddTDBegin("colspan='2'");

                Pub1.Add("请选择要推送到的节点工作人员:<br />");
                Nodes    nds = new Nodes(this.FK_Flow);
                CheckBox cb  = null;

                foreach (BP.WF.Node nd in nds)
                {
                    if (nd.NodeID == int.Parse(this.NodeID))
                    {
                        continue;
                    }

                    cb         = new CheckBox();
                    cb.ID      = "CB_" + nd.NodeID;
                    cb.Text    = nd.NodeID + " &nbsp;" + nd.Name;
                    cb.Checked = msg.PushDoc.Contains("@" + nd.NodeID + "@");
                    Pub1.Add(cb);
                    Pub1.AddBR();
                }

                Pub1.AddTDEnd();
                Pub1.AddTREnd();
                #endregion

                break;

            case PushWay.SpecDepts:

                #region  照指定的部门

                Pub1.AddTR();
                Pub1.AddTDBegin("colspan='2'");

                this.Pub1.AddTable("class='Table' cellSpacing='1' cellPadding='1'  border='1' style='width:100%'");
                this.Pub1.AddTR();
                this.Pub1.AddTD("colspan='3' class='GroupTitle'", "部门选择");
                this.Pub1.AddTREnd();

                //NodeDepts ndepts = new NodeDepts(int.Parse(this.NodeID));
                Depts depts = new Depts();
                depts.RetrieveAll();
                int i = 0;

                //foreach (NodeDept dept in ndepts)
                foreach (Dept dept in depts)
                {
                    i++;

                    if (i == 4)
                    {
                        i = 1;
                    }

                    if (i == 1)
                    {
                        Pub1.AddTR();
                    }

                    cb = new CheckBox();
                    //cb.ID = "CB_" + dept.FK_Dept;
                    //cb.Text = (depts.GetEntityByKey(dept.FK_Dept) as Dept).Name;
                    cb.ID   = "CB_" + dept.No;
                    cb.Text = dept.Name;

                    //if (msg.PushDoc.Contains("@" + dept.FK_Dept + "@"))
                    if (msg.PushDoc.Contains("@" + dept.No + "@"))
                    {
                        cb.Checked = true;
                    }

                    this.Pub1.AddTD(cb);

                    if (i == 3)
                    {
                        Pub1.AddTREnd();
                    }
                }

                switch (i)
                {
                case 1:
                    Pub1.AddTD();
                    Pub1.AddTD();
                    Pub1.AddTREnd();
                    break;

                case 2:
                    Pub1.AddTD();
                    Pub1.AddTREnd();
                    break;

                default:
                    break;
                }

                this.Pub1.AddTableEnd();
                Pub1.AddTDEnd();
                Pub1.AddTREnd();
                #endregion

                break;

            case PushWay.SpecEmps:

                #region  照指定的人员

                Pub1.AddTR();
                //Pub1.AddTDBegin("colspan='2'");

                Pub1.AddTD("选择人员:");
                Pub1.AddTDBegin();

                tb          = new TB();
                tb.ID       = "TB_Users";
                tb.TextMode = TextBoxMode.MultiLine;
                tb.Style.Add("width", "99%");
                tb.Rows     = 4;
                tb.ReadOnly = true;

                var hf = new HiddenField();
                hf.ID = "HID_Users";

                //加载已经选择的人员
                if (!string.IsNullOrWhiteSpace(msg.PushDoc))
                {
                    hf.Value = msg.PushDoc.Replace("@@", ",").Trim('@');

                    var emps = new Emps();
                    emps.RetrieveAll();

                    tb.Text =
                        hf.Value.Split(',').Select(o => (emps.GetEntityByKey(o) as Emp).Name).Aggregate(
                            string.Empty, (curr, next) => curr + next + ",").TrimEnd(',');
                }

                Pub1.Add(tb);
                Pub1.Add(hf);
                Pub1.AddBR();
                Pub1.AddBR();

                Pub1.Add(
                    "<a class='easyui-linkbutton' data-options=\"iconCls:'icon-user'\" href='javascript:void(0)' onclick=\"showWin('../Comm/Port/SelectUser_Jq.aspx','" +
                    tb.ClientID + "','" + hf.ClientID + "');\">选择人员...</a>");
                Pub1.AddTDEnd();
                //Pub1.AddTable("class='Table' cellSpacing='1' cellPadding='1'  border='1' style='width:100%'");
                //depts = new Depts();
                //depts.RetrieveAll();
                //var emps = new Emps();
                //emps.RetrieveAll();
                //var empDepts = new EmpDepts();
                //empDepts.RetrieveAll();
                //var nemps = new NodeEmps(int.Parse(this.NodeID));

                //Emp emp = null;

                //foreach (Dept dept in depts)
                //{
                //    this.Pub1.AddTR();
                //    var mycb = new CheckBox();
                //    mycb.Text = dept.Name;
                //    mycb.ID = "CB_D_" + dept.No;
                //    this.Pub1.AddTD("colspan='3' class='GroupTitle'", mycb);
                //    this.Pub1.AddTREnd();

                //    i = 0;
                //    string ctlIDs = "";

                //    foreach (EmpDept ed in empDepts)
                //    {
                //        if (ed.FK_Dept != dept.No)
                //            continue;

                //        //排除非当前结点绑定的人员
                //        if (nemps.GetEntityByKey(NodeEmpAttr.FK_Emp, ed.FK_Emp) == null)
                //            continue;

                //        i++;

                //        if (i == 4)
                //            i = 1;

                //        if (i == 1)
                //            Pub1.AddTR();

                //        emp = emps.GetEntityByKey(ed.FK_Emp) as Emp;

                //        cb = new CheckBox();
                //        cb.ID = "CB_E_" + emp.No;
                //        ctlIDs += cb.ID + ",";
                //        cb.Text = emp.Name;
                //        if (msg.PushDoc.Contains("@" + emp.No + "@"))
                //            cb.Checked = true;

                //        Pub1.AddTD(cb);

                //        if (i == 3)
                //            Pub1.AddTREnd();
                //    }

                //    mycb.Attributes["onclick"] = "SetSelected(this,'" + ctlIDs + "')";

                //    switch (i)
                //    {
                //        case 1:
                //            Pub1.AddTD();
                //            Pub1.AddTD();
                //            Pub1.AddTREnd();
                //            break;
                //        case 2:
                //            Pub1.AddTD();
                //            Pub1.AddTREnd();
                //            break;
                //        default:
                //            break;
                //    }
                //}

                //Pub1.AddTableEnd();

                //Pub1.AddTDEnd();
                Pub1.AddTREnd();
                #endregion

                break;

            case PushWay.SpecSQL:

                #region  照指定的SQL查询语句

                Pub1.AddTR();

                this.Pub1.AddTDBegin("colspan='2'");
                this.Pub1.Add("SQL查询语句:<br />");
                tb         = new TB();
                tb.ID      = "TB_" + PushMsgAttr.PushDoc;
                tb.Columns = 50;
                tb.Style.Add("width", "99%");
                tb.TextMode = TextBoxMode.MultiLine;
                tb.Rows     = 4;
                tb.Text     = msg.PushDoc;
                this.Pub1.Add(tb);
                this.Pub1.AddTDEnd();
                Pub1.AddTREnd();
                #endregion

                break;

            case PushWay.SpecStations:

                #region  照指定的岗位

                Pub1.AddTR();
                Pub1.AddTDBegin("colspan='2'");

                if (BP.WF.Glo.OSModel == OSModel.WorkFlow)
                {
                    SysEnums ses = new SysEnums("StaGrade");
                    Stations sts = new Stations();
                    sts.RetrieveAll();

                    string    sql = "SELECT No,Name FROM Port_Station WHERE StaGrade  NOT IN (SELECT IntKey FROM Sys_Enum WHERE EnumKey='StaGrade')";
                    DataTable dt  = DBAccess.RunSQLReturnTable(sql);
                    if (dt.Rows.Count != 0)
                    {
                        if (ses.Count == 0)
                        {
                            SysEnum se = new SysEnum();
                            se.EnumKey = "StaGrade";
                            se.Lab     = "普通岗";
                            se.IntKey  = 0;
                            se.Insert();

                            ses.AddEntity(se);
                        }

                        foreach (Station st in sts)
                        {
                            st.StaGrade = 0;
                            st.Save();
                        }
                    }

                    this.Pub1.AddTable("class='Table' cellSpacing='0' cellPadding='0'  border='0' style='width:100%'");

                    foreach (SysEnum se in ses)
                    {
                        this.Pub1.AddTR();
                        CheckBox mycb = new CheckBox();
                        mycb.Text = se.Lab;
                        mycb.ID   = "CB_SG_" + se.IntKey;
                        this.Pub1.AddTD("colspan='3' class='GroupTitle'", mycb);
                        this.Pub1.AddTREnd();

                        i = 0;
                        string ctlIDs = "";

                        foreach (Station st in sts)
                        {
                            if (st.StaGrade != se.IntKey)
                            {
                                continue;
                            }

                            i++;

                            if (i == 4)
                            {
                                i = 1;
                            }

                            if (i == 1)
                            {
                                Pub1.AddTR();
                            }

                            cb      = new CheckBox();
                            cb.ID   = "CB_S_" + st.No;
                            ctlIDs += cb.ID + ",";
                            cb.Text = st.Name;

                            if (msg.PushDoc.Contains("@" + st.No + "@"))
                            {
                                cb.Checked = true;
                            }

                            Pub1.AddTD(cb);

                            if (i == 3)
                            {
                                Pub1.AddTREnd();
                            }
                        }

                        mycb.Attributes["onclick"] = "SetSelected(this,'" + ctlIDs + "')";

                        switch (i)
                        {
                        case 1:
                            Pub1.AddTD();
                            Pub1.AddTD();
                            Pub1.AddTREnd();
                            break;

                        case 2:
                            Pub1.AddTD();
                            Pub1.AddTREnd();
                            break;

                        default:
                            break;
                        }
                    }

                    this.Pub1.AddTableEnd();
                }
                else
                {
                    /*BPM 模式*/
                    BP.GPM.StationTypes tps = new BP.GPM.StationTypes();
                    tps.RetrieveAll();

                    BP.GPM.Stations sts = new BP.GPM.Stations();
                    sts.RetrieveAll();

                    string    sql = "SELECT No,Name FROM Port_Station WHERE FK_StationType NOT IN (SELECT No FROM Port_StationType)";
                    DataTable dt  = DBAccess.RunSQLReturnTable(sql);
                    if (dt.Rows.Count != 0)
                    {
                        if (tps.Count == 0)
                        {
                            var stp = new BP.GPM.StationType {
                                No = "01", Name = "普通岗"
                            };
                            stp.Save();

                            tps.AddEntity(stp);
                        }

                        //更新所有对不上岗位类型的岗位,岗位类型为01或第一个
                        foreach (BP.GPM.Station st in sts)
                        {
                            st.FK_StationType = tps[0].No;
                            st.Update();
                        }
                    }

                    this.Pub1.AddTable("class='Table' cellSpacing='0' cellPadding='0'  border='0' style='width:100%'");

                    foreach (BP.GPM.StationType tp in tps)
                    {
                        this.Pub1.AddTR();
                        CheckBox mycb = new CheckBox();
                        mycb.Text = tp.Name;
                        mycb.ID   = "CB_ST_" + tp.No;
                        this.Pub1.AddTD("colspan='3' class='GroupTitle'", mycb);
                        this.Pub1.AddTREnd();

                        i = 0;
                        string ctlIDs = "";

                        foreach (BP.GPM.Station st in sts)
                        {
                            if (st.FK_StationType != tp.No)
                            {
                                continue;
                            }

                            i++;

                            if (i == 4)
                            {
                                i = 1;
                            }

                            if (i == 1)
                            {
                                Pub1.AddTR();
                            }

                            cb      = new CheckBox();
                            cb.ID   = "CB_S_" + st.No;
                            ctlIDs += cb.ID + ",";
                            cb.Text = st.Name;

                            if (msg.PushDoc.Contains("@" + st.No + "@"))
                            {
                                cb.Checked = true;
                            }

                            this.Pub1.AddTD(cb);

                            if (i == 3)
                            {
                                Pub1.AddTREnd();
                            }
                        }

                        mycb.Attributes["onclick"] = "SetSelected(this,'" + ctlIDs + "')";

                        switch (i)
                        {
                        case 1:
                            Pub1.AddTD();
                            Pub1.AddTD();
                            Pub1.AddTREnd();
                            break;

                        case 2:
                            Pub1.AddTD();
                            Pub1.AddTREnd();
                            break;

                        default:
                            break;
                        }
                    }

                    this.Pub1.AddTableEnd();
                }

                #region 原逻辑,只考虑了一种模式,停用
                //Pub1.AddTable("class='Table' cellSpacing='1' cellPadding='1'  border='1' style='width:100%'");
                //SysEnums ses = new SysEnums("StaGrade");
                //Stations sts = new Stations();
                //NodeStations nsts = new NodeStations(int.Parse(this.NodeID));
                //sts.RetrieveAll();

                //foreach (SysEnum se in ses)
                //{
                //    this.Pub1.AddTR();
                //    var mycb = new CheckBox();
                //    mycb.Text = se.Lab;
                //    mycb.ID = "CB_SG_" + se.IntKey;
                //    this.Pub1.AddTD("colspan=3 class='GroupTitle'", mycb);
                //    this.Pub1.AddTREnd();

                //    i = 0;
                //    string ctlIDs = "";

                //    foreach (Station st in sts)
                //    {
                //        if (st.StaGrade != se.IntKey)
                //            continue;

                //        //排除非当前结点的岗位
                //        if (nsts.GetEntityByKey(NodeStationAttr.FK_Station, st.No) == null)
                //            continue;

                //        i++;

                //        if (i == 4)
                //            i = 1;

                //        if (i == 1)
                //            Pub1.AddTR();

                //        cb = new CheckBox();
                //        cb.ID = "CB_S_" + st.No;
                //        ctlIDs += cb.ID + ",";
                //        cb.Text = st.Name;
                //        if (msg.PushDoc.Contains("@" + st.No + "@"))
                //            cb.Checked = true;

                //        Pub1.AddTD(cb);

                //        if (i == 3)
                //            Pub1.AddTREnd();
                //    }

                //    mycb.Attributes["onclick"] = "SetSelected(this,'" + ctlIDs + "')";

                //    switch (i)
                //    {
                //        case 1:
                //            Pub1.AddTD();
                //            Pub1.AddTD();
                //            Pub1.AddTREnd();
                //            break;
                //        case 2:
                //            Pub1.AddTD();
                //            Pub1.AddTREnd();
                //            break;
                //        default:
                //            break;
                //    }
                //}
                //Pub1.AddTableEnd();
                #endregion

                Pub1.AddTDEnd();
                Pub1.AddTREnd();
                #endregion

                break;
            }

            Pub1.AddTableEnd();

            Pub1.AddBR();
            Pub1.AddSpace(1);

            var btn = new LinkBtn(false, NamesOfBtn.Save, "保存");
            btn.Click += new EventHandler(btn_Click);
            Pub1.Add(btn);

            if (!string.IsNullOrWhiteSpace(msg.MyPK))
            {
                Pub1.AddSpace(1);
                btn        = new LinkBtn(false, NamesOfBtn.Delete, "删除");
                btn.Click += new EventHandler(btn_Delete_Click);
                btn.Attributes["onclick"] = "return confirm('你确定要删除此消息推送设置吗?');";
                Pub1.Add(btn);
            }
        }