Esempio n. 1
0
        /// <summary>
        /// Vlastní zpracování XML message (zrušení deklarační části, zušení všech jmenných prostorů a volání stored procedure na MS SQL)
        /// </summary>
        /// <param name="authToken"></param>
        /// <param name="login"></param>
        /// <param name="password"></param>
        /// <param name="partnerCode"></param>
        /// <param name="messageType"></param>
        /// <param name="encoding"></param>
        /// <returns></returns>
        public static SubmitDataToProcessingResult Process(AuthToken authToken, string login, string password, string partnerCode, string messageType, byte[] data, string encoding)
        {
            SubmitDataToProcessingResult result = new SubmitDataToProcessingResult();
            string xmlString = String.Empty;

            try
            {
                if (authToken != null)
                {
                    xmlString = data.ToString(Encoding.GetEncoding(encoding), Encoding.Unicode);
                    xmlString = PrepareXml(xmlString);

                    result = ProjectHelper.AppLogWrite(authToken, "XML",
                                                       ProjectHelper.CreateAppLogMessage(partnerCode, messageType, "modified XML"), "",
                                                       xmlString, BC.ZICYZ_USER_ID, Fenix.ApplicationLog.GetMethodName());

                    if (result.MessageNumber == BC.OK)
                    {
                        FenixAppSvcClient appClient = new FenixAppSvcClient();
                        appClient.AuthToken = new Fenix.WebService.Service_References.FenixAppService.AuthToken()
                        {
                            Value = authToken.Value
                        };
                        ProcResult procResult = DoProcess(appClient, xmlString, messageType);
                        appClient.Close();

                        if (procResult.ReturnValue == (int)BC.OK)
                        {
                            ProjectHelper.CreateOkResult(ref result);
                        }
                        else
                        {
                            ProjectHelper.CreateErrorResult(Fenix.ApplicationLog.GetMethodName(), ref result, "90", procResult.ReturnMessage);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                ProjectHelper.CreateErrorResult(Fenix.ApplicationLog.GetMethodName(), ref result, "100", ex);
                ProjectHelper.AppLogWrite(authToken, "ERROR",
                                          String.Format("Během zpracování XML\n{0}\ndošlo k chybě\n{1}", xmlString, ex.Message),
                                          String.Empty, String.Empty, BC.ZICYZ_USER_ID, Fenix.ApplicationLog.GetMethodName());
            }

            return(result);
        }
Esempio n. 2
0
        /// <summary>
        /// Zpracování testu (zápis do tabulky AppLogNew)
        /// </summary>
        /// <param name="authToken"></param>
        /// <param name="login"></param>
        /// <param name="password"></param>
        /// <param name="partnerCode"></param>
        /// <param name="messageType"></param>
        /// <param name="data"></param>
        /// <param name="encoding"></param>
        /// <returns></returns>
        public static SubmitDataToProcessingResult Process(AuthToken authToken, string login, string password, string partnerCode, string messageType, byte[] data, string encoding)
        {
            SubmitDataToProcessingResult result = new SubmitDataToProcessingResult();

            try
            {
                string xmlStringFromData = data.ToString(Encoding.GetEncoding(encoding), Encoding.Unicode);
                string modifiedXmlString = XmlCreator.CreateXMLRootNode(xmlStringFromData);

                if (authToken != null)
                {
                    return(ProjectHelper.AppLogWrite(authToken, "XML",
                                                     ProjectHelper.CreateAppLogMessage(partnerCode, messageType, "modified XML"), "",
                                                     modifiedXmlString, BC.ZICYZ_USER_ID, ApplicationLog.GetMethodName()));
                }
            }
            catch (Exception ex)
            {
                ProjectHelper.CreateErrorResult(ApplicationLog.GetMethodName(), ref result, "100", ex);
            }

            return(result);
        }