Ejemplo n.º 1
0
 public override bool TryGetMember(GetMemberBinder binder, out object result)
 {
     result = null;
     if (binder.Name == "Value")
     {
         result = _elements[0].Value;
     }
     else if (binder.Name == "Count")
     {
         result = _elements.Count;
     }
     else
     {
         var attr = _elements[0].Attribute(
             XName.Get(binder.Name));
         if (attr != null)
         {
             result = attr;
         }
         else
         {
             var items = _elements.Descendants(
                 XName.Get(binder.Name));
             if (items == null || items.Count() == 0)
             {
                 return(false);
             }
             result = new DynamicXml(items);
         }
     }
     return(true);
 }
Ejemplo n.º 2
0
        //[System.Xml.Serialization.XmlElementAttribute("ReturnInvokeReturn", Namespace = "http://www.bnet.cn/v3.0/")]
        public string ReturnInvoke(string reqXml)
        {
            dynamic dx = new DynamicXml(reqXml);

            if (dx != null)
            {
                string callee = "", msgContent = "", strReturnType = "", strStat = "";

                //时间戳
                string strLocateTime = DateTime.ParseExact((string)dx.TimeStamp, "yyyyMMddHHmmssfff", new System.Globalization.CultureInfo("zh-CN", true), System.Globalization.DateTimeStyles.AllowInnerWhite).ToString("yyyy-MM-dd HH:mm:ss");

                foreach (dynamic item in dx.ParamItems.ParamItem)
                {
                    string strParamID    = (string)item.ParamID.value;
                    string strParamValue = (string)item.ParamValue.value;

                    if (strParamID == "DestTermID")
                    {
                        callee = strParamValue;
                    }
                    else if (strParamID == "MsgContent")
                    {
                        msgContent = strParamValue;
                    }
                    else if (strParamID == "ReturnType")
                    {
                        strReturnType = strParamValue;
                    }
                    else if (strParamID == "Stat")
                    {
                        strStat = strParamValue;
                    }
                }

                try
                {
                    if (!string.IsNullOrEmpty(callee) && !string.IsNullOrEmpty(msgContent))
                    {
                        string sql = "";
                        if (strReturnType == "Deliver")
                        {
                            if (msgContent == "105")
                            {
                                sql = "insert Pub_Reminder(SourceTable,SourceColumn,SourceKey,SourceType,RemindTime,RemindContent)" +
                                      "select 'Oca_OldManConfigInfo','OldManId',OldManId,'105','" + strLocateTime + "','电压低于20%报警' from Oca_OldManConfigInfo a.CallNo='" + callee + "' or a.CallNo2='" + callee + "' or a.CallNo3='" + callee + "'";
                            }
                            else
                            {
                                string[] strContent = msgContent.Split('/');
                                sql = "insert Oca_OldManLocateInfo(OldManId,HomeLongitudeS,HomeLatitudeS,LocateTime,LocateLongitudeS,LocateLatitudeS) " +
                                      "select a.OldManId,'" + strContent[2] + "','" + strContent[3] + "','" + strLocateTime + "',b.LongitudeS,b.LatitudeS from Oca_OldManConfigInfo a inner join Oca_OldManBaseInfo b " +
                                      " on a.OldManId=b.OldManId where a.CallNo='" + callee + "' or a.CallNo2='" + callee + "' or a.CallNo3='" + callee + "'";
                            }
                        }
                        else if (strReturnType == "Receipt" && strStat != "UNDELIV")
                        {
                            sql = "update Pub_SmsSend set SendResult=1,SendTime='" + strLocateTime + "' where  Id=(select MAX(Id) From Pub_SmsSend where Mobile='" + callee + "' and SendTime is null group by Mobile)";
                        }

                        BuilderFactory.DefaultBulder().ExecuteNativeSqlNoneQuery(sql);
                    }
                }
                catch (Exception ex)
                {
                    SmartLife.Share.Behaviors.GlobalManager.inputLogger.Info(ex.ToString());
                }
            }

            var sb = new StringBuilder();

            sb.Append("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
            sb.Append("<Package>");
            sb.AppendFormat("<TimeStamp>{0}</TimeStamp>", dx.TimeStamp);
            sb.AppendFormat("<TransactionID>{0}</TransactionID>", dx.TransactionID);
            sb.AppendFormat("<ResultCode>{0}</ResultCode>", "0000");
            sb.AppendFormat("<ResultMsg>{0}</ResultMsg>", "成功");
            sb.AppendFormat("<Status>{0}</Status>", 1);
            sb.Append("</Package>");

            return(sb.ToString());
        }
Ejemplo n.º 3
0
        public override bool TryGetIndex(GetIndexBinder binder, object[] indexes, out object result)
        {
            int ndx = (int)indexes[0]; result = new DynamicXml(_elements[ndx]);

            return(true);
        }