Example #1
0
        public void Handle(OrderDetailRequest message)
        {
            string             dbcon   = ConfigurationManager.ConnectionStrings["OracleDBStr"].ConnectionString;
            string             sqlstr  = "select * from self_orderinfo a where a.order_id = '{0}'";
            string             result  = "";
            DBInternalMessages qResult = OracleHelper.DBQuery(dbcon, string.Format(sqlstr, message.OrderId), out result);

            if (qResult == DBInternalMessages.DB_QuerySuccess)
            {
                Sender.Tell(new OrderDetailRespond("Success", result, message.Subscriber), Self);
            }
            else
            {
                //error or no data
                Sender.Tell(new OrderDetailRespond("Failed", qResult.ToString(), message.Subscriber), Self);
            }
        }
Example #2
0
        public void Handle(GatherOrderNumber message)
        {
            string             sqlstr  = "select a.order_state, count(*) from self_orderinfo a group by a.order_state";
            string             dbcon   = ConfigurationManager.ConnectionStrings["OracleDBStr"].ConnectionString;
            string             result  = "";
            DBInternalMessages qresult = OracleHelper.DBQuery(dbcon, sqlstr, out result);

            if (qresult == DBInternalMessages.DB_QuerySuccess)
            {
                OrderNumByType _msg     = new OrderNumByType();
                DataSet        _dataset = JsonConvert.DeserializeObject <DataSet>(result);
                DataTable      _dt      = _dataset.Tables[0];
                foreach (DataRow dr in _dt.Rows)
                {
                    if (dr[0].ToString() == "未完成")
                    {
                        _msg.UnfinishedOrder = int.Parse(dr[1].ToString());
                    }
                    else if (dr[0].ToString() == "已交费")
                    {
                        _msg.PaidOrder = int.Parse(dr[1].ToString());
                    }
                    else if (dr[0].ToString() == "待审核")
                    {
                        _msg.WaitForVerifyOrder = int.Parse(dr[1].ToString());
                    }
                    else if (dr[0].ToString() == "待下载")
                    {
                        _msg.ReadyToDownloadOrder = int.Parse(dr[1].ToString());
                    }
                    else if (dr[0].ToString() == "审核失败")
                    {
                        _msg.VerifyFailedOrder = int.Parse(dr[1].ToString());
                    }
                    else if (dr[0].ToString() == "已下载")
                    {
                        _msg.DownloadedOrder = int.Parse(dr[1].ToString());
                    }
                    else if (dr[0].ToString() == "已完成")
                    {
                        _msg.FinishedOrder = int.Parse(dr[1].ToString());
                    }
                    else if (dr[0].ToString() == "已取消")
                    {
                        _msg.CancelledOrder = int.Parse(dr[1].ToString());
                    }
                }

                foreach (ClientConnectRequest ccr in _subscriptions)
                {
                    ccr.Subscriber.Tell(_msg, Self);
                }
            }
            else
            {
                foreach (ClientConnectRequest ccr in _subscriptions)
                {
                    ccr.Subscriber.Tell(new GatherOrderNumberFailed()
                    {
                        Reason = qresult.ToString()
                    }, Self);
                }
            }
        }