public bool Create503Message(LogisticsStatus logisticsStatus)
 {
     bool isSuccess = true;
     BaseSubscribe baseSubscribe = null;
     XElement xele = null;
     XNamespace ns = null;
     try
     {
         Logs.Debug("Create503Message Start! OrderNo_" + logisticsStatus.logisticsNo);
         baseSubscribe = GetBaseSubscribe();
         ns = "http://www.chinaport.gov.cn/ceb";
         xele = new XElement(ns + "CEB503Message");
         xele.SetAttributeValue(XNamespace.Xmlns + "ceb", ns);
         xele = logisticsStatus.ToXElememt(xele, ns);
         xele = baseSubscribe.ToXElememt(xele, ns);
         FileUtilities.CreateFolder(ConfigurationInfo.PathSend);
         xele.Save(ConfigurationInfo.PathSend + "\\" + logisticsStatus.logisticsNo + "_" + logisticsStatus.logisticsStatus + "_503.xml");
         Logs.Debug("Create503Message End! OrderNo_" + logisticsStatus.logisticsNo);
     }
     catch (Exception ex)
     {
         Logs.Error("Create503Message Exception: " + ex.ToString());
         isSuccess = false;
     }
     return isSuccess;
 }
        public bool CreateMessage503R(string logisticsNo)
        {
            bool success = true;
            LogisticsStatus logisticsStatus = null;
            MessageSql mssql = null;
            MessageService msService = null;
            XElement xele = null;
            XNamespace ns = null;
            try
            {
                mssql = new MessageSql();
                logisticsStatus = new LogisticsStatus();
                mssql.QueryData503ByLogisticsNo(logisticsNo, ref logisticsStatus);
                if (logisticsStatus.guid != new Guid())
                {
                    string url = GetRequestHostByCode(logisticsStatus.logisticsCode);
                    RestRequest restRequest = new RestRequest(string.Format("{0}:{1}/Logistics/Create503", url, ConfigurationInfo.RestPort), Utilities.JsonSerialize(logisticsStatus));
                    success = Convert.ToBoolean(restRequest.Execute());
                }
                else
                {
                    success = false;
                }
                if (success)
                {
                    mssql.UpdateSchedule503(null, logisticsNo);

                    ns = "http://www.chinaport.gov.cn/ceb";
                    xele = new XElement(ns + "CEB503Message");
                    xele.SetAttributeValue(XNamespace.Xmlns + "ceb", ns);
                    xele = logisticsStatus.ToXElememt(xele, ns);

                    string destPath = FileUtilities.GetNewFolderName(true, ConfigurationInfo.PathBackUp, "503") + "\\" + FileUtilities.GetNewFileName(logisticsNo, "Create", "R") + ".xml";

                    xele.Save(destPath);

                    msService = new MessageService();
                    msService.DealMessage503(false, true, logisticsStatus.guid.ToString(), logisticsNo, destPath, "R");
                }
                else
                {
                    success = false;
                    Logs.Info("CreateMessage503R Response Error! Date:" + Utilities.JsonSerialize(logisticsStatus));
                }
            }
            catch (Exception ex)
            {
                success = false;
                Logs.Error("CreateMessage503R Exception: " + ex.ToString());
            }
            return success;
        }
 private LogisticsStatus GetLogisticsStatus(SqlDataReader dr)
 {
     LogisticsStatus result = null;
     try
     {
         result = new LogisticsStatus();
         result.guid = Guid.NewGuid();
         result.customsCode = Convert.ToString(dr["customsCode"]);
         result.appType = Convert.ToInt32(AppType.Add);
         result.appTime = DateTime.UtcNow;
         result.appStatus = Convert.ToInt32(AppStatus.Declare);
         result.appUid = Convert.ToString(dr["appUid"]);
         result.appUname = Convert.ToString(dr["appUname"]);
         result.logisticsCode = Convert.ToString(dr["logisticsCode"]);
         result.logisticsName = Convert.ToString(dr["logisticsName"]);
         result.logisticsNo = Convert.ToString(dr["logisticsNo"]);
         result.logisticsStatus = Convert.ToString(dr["logisticsRL"]); //L
         result.ieFlag = OrderType.E;
         result.trafMode = "9";
         result.trafName = Convert.ToString(dr["trafName"]);
         result.voyageNo = Convert.ToString(dr["voyageNo"]);
         result.billNo = Convert.ToString(dr["billNo"]);
         result.note = "";
     }
     catch (Exception ex)
     {
         throw new Exception("GetLogisticsStatus Exception : " + ex.ToString());
     }
     return result;
 }
 public void QueryDate503ByOrderNo(string orderNo, ref LogisticsStatus logisticsStatus)
 {
     try
     {
         SqlDataReader dr = a_sqlServer.ExePROC("MessageCenterQuery", ConvertToSqlParameters(5032, orderNo, ""));
         if (dr.HasRows)
         {
             while (dr.Read())
             {
                 logisticsStatus = GetLogisticsStatus(dr);
                 logisticsStatus.logisticsStatus = "L";
             }
         }
     }
     catch (Exception ex)
     {
         Logs.Error("Query503DataByOrderNo Exception : " + ex.ToString());
     }
 }
 public bool UploadLogistics503(LogisticsStatus info)
 {
     LogisticsControl control = new LogisticsControl();
     return control.Create503Message(info);
 }