Ejemplo n.º 1
0
        int SendToQueue(XmlDocument domOperLog,
                        string strOperation,
                        out string strError)
        {
            strError = "";

            string strBodyXml       = "";
            string strReaderBarcode = "";
            string strReaderRefID   = "";

            try
            {
                if (strOperation == "borrow" || strOperation == "return")
                {
                    BuildBorrowReturnRecord(domOperLog,
                                            out strBodyXml,
                                            out strReaderBarcode,
                                            out strReaderRefID);
                }
                else if (strOperation == "amerce")
                {
                    BuildAmerceRecord(domOperLog,
                                      out strBodyXml,
                                      out strReaderBarcode,
                                      out strReaderRefID);
                }
                else if (strOperation == "setReaderInfo")
                {
                    BuildReaderChangedRecord(domOperLog,
                                             out strBodyXml,
                                             out strReaderBarcode,
                                             out strReaderRefID);
                }
                else if (strOperation == "setUser")
                {
                    BuildUserChangedRecord(domOperLog,
                                           out strBodyXml,
                                           out strReaderBarcode,
                                           out strReaderRefID);
                }
            }
            catch (Exception ex)
            {
                strError = ex.Message;
                return(-1);
            }

            if (string.IsNullOrEmpty(strBodyXml))
            {
                return(0);
            }

            // 向 MSMQ 消息队列发送消息
            return(ReadersMonitor.SendToQueue(this._queue,
                                              (string.IsNullOrEmpty(strReaderRefID) ? strReaderBarcode : "!refID:" + strReaderRefID)
                                              + "@LUID:" + this.App.UID,
                                              "xml",
                                              strBodyXml,
                                              out strError));
        }