Пример #1
0
        static void testmqSeek()
        {
            string urlLog = "http://localhost:3737/api/mq/Seek";
            XMQ    mq1    = new XMQ();

            mq1.AppID = appid;
            mq1.Top   = 5;
            mq1.MType = 0;
            List <XMQ> list = AngleX.AppXGlobal.IHttp.PostData <List <XMQ> >(urlLog, mq1);

            Console.WriteLine("list rows " + list.Count);
            foreach (XMQ q in list)
            {
                Console.WriteLine(q.ID);
                string urlDelete = string.Format("http://localhost:3737/api/mq/Delete/{0}/{1}", appid, q.ID);
                int    nRows     = AngleX.AppXGlobal.IHttp.PostData <int>(urlDelete, null);
                Console.WriteLine("delete r={0}", nRows);
            }
        }
Пример #2
0
        public List <XMQ> PopMQ(int Top, int?MType, int?ModeNum)
        {
            if (Top < 1)
            {
                Top = 1;
            }
            if (Top > 200)
            {
                Top = 200;
            }
            List <XMQ> listM = new List <XMQ>();

            System.Data.DataTable dtRows = null;
            string sqlSelect             = string.Format(SqlTemplate.SelectMQ, TableName, Top);

            if (MType != null)
            {
                sqlSelect += string.Format(SqlTemplate.WhereMType, MType.Value);
            }
            if (ModeNum != null)
            {
                sqlSelect += string.Format(SqlTemplate.WhereModel, ModeNum.Value);
            }
            using (var con = SqlHelper.GetConnection(ConfigSetting.ConnectString)) {
                dtRows = SqlHelper.ExecuteDataset(con, sqlSelect);
            }
            if (dtRows != null && dtRows.Rows.Count > 0)
            {
                foreach (System.Data.DataRow drItem in dtRows.Rows)
                {
                    XMQ xm = new XMQ(drItem[TablePreConfigProName.BizBillID].ToString());
                    xm.CanSeekTime = Convert.ToDateTime(drItem[TablePreConfigProName.CanSeekTime]);
                    xm.ID          = Convert.ToInt32(drItem[TablePreConfigProName.ID]);
                    xm.ModeNum     = Convert.ToInt32(drItem[TablePreConfigProName.ModeNum]);
                    xm.MType       = Convert.ToInt32(drItem[TablePreConfigProName.MType]);
                    listM.Add(xm);
                }
            }
            return(listM);
        }
Пример #3
0
        static void testmqpush()
        {
            string urlLog = "http://localhost:3737/api/mq/push";
            XMQ    q1     = new XMQ("from0002");

            q1.AppID       = appid;
            q1.BizBillID   = "003";
            q1.CanSeekTime = DateTime.Now;
            q1.ModeNum     = 0;
            q1.MType       = 0;


            XMQ q2 = new XMQ("form003");

            q2.AppID       = appid;
            q2.CanSeekTime = DateTime.Now.AddMinutes(20);


            XMQ q3 = new XMQ("form000004");

            q3.AppID   = appid;
            q3.ModeNum = 3;
            q3.MType   = 2;



            try {
                string logID1 = AngleX.AppXGlobal.IHttp.PostData <string>(urlLog, q1);
                Console.WriteLine("q1=" + logID1);

                string logID2 = AngleX.AppXGlobal.IHttp.PostData <string>(urlLog, q2);
                Console.WriteLine("q2=" + logID2);

                string logID3 = AngleX.AppXGlobal.IHttp.PostData <string>(urlLog, q3);
                Console.WriteLine("q3=" + logID3);
            }
            catch (Exception ex) {
                Console.WriteLine(ex.Message);
            }
        }
Пример #4
0
 public ActionResult <List <XMQ> > Seek(XMQ mq)
 {
     return(ITC.Find(mq.AppID).PopMQ(mq.Top, mq.MType, mq.ModeNum));
 }
Пример #5
0
        public ActionResult <string> Push(XMQ mq)
        {
            DateTime dtSeek = mq.CanSeekTime == null ? DateTime.Now : mq.CanSeekTime.Value;

            return(ITC.Find(mq.AppID).PushMQ(mq.BizBillID, mq.ModeNum == null?0:mq.ModeNum.Value, mq.MType == null?0:mq.MType.Value, dtSeek.ToString("yyyy-MM-dd HH:mm:ss")));
        }