Beispiel #1
0
        /// <summary>
        /// Volání SP pro ověření 'zdraví služeb'
        /// </summary>
        /// <param name="authToken"></param>
        /// <param name="login"></param>
        /// <param name="password"></param>
        /// <param name="partnerCode"></param>
        /// <param name="messageType"></param>
        /// <returns>result.MessageDescription by měla obsahovat string 'Automat Rows : 1  |   DateTime : yyyy-mm-dd hh:mi:ss.mmm'</returns>
        public static SubmitDataToProcessingResult Process(AuthToken authToken, string login, string password, string partnerCode, string messageType)
        {
            SubmitDataToProcessingResult result = new SubmitDataToProcessingResult();

            try
            {
                if (authToken != null)
                {
                    FenixAppSvcClient appClient = new FenixAppSvcClient();
                    appClient.AuthToken = new Fenix.WebService.Service_References.FenixAppService.AuthToken()
                    {
                        Value = authToken.Value
                    };
                    ProcResult procResult = appClient.GetServicesStatuses(BC.ZICYZ_USER_ID);
                    appClient.Close();

                    if (procResult.ReturnValue == (int)BC.OK)
                    {
                        result.MessageDescription = procResult.ReturnMessage;
                    }
                    else
                    {
                        ProjectHelper.CreateErrorResult(ApplicationLog.GetMethodName(), ref result, "90", procResult.ReturnMessage);
                    }
                }
            }
            catch (Exception ex)
            {
                ProjectHelper.CreateErrorResult(ApplicationLog.GetMethodName(), ref result, "100", ex);
            }

            return(result);
        }
        /// <summary>
        /// Zápis do logovací tabulky AppLogNew
        /// </summary>
        /// <param name="authToken"></param>
        /// <param name="type"></param>
        /// <param name="message"></param>
        /// <param name="xmlDeclaration"></param>
        /// <param name="xmlMessage"></param>
        /// <param name="zicyzUserId"></param>
        /// <param name="sourceName"></param>
        /// <returns></returns>
        public static SubmitDataToProcessingResult AppLogWrite(AuthToken authToken, string type, string message, string xmlDeclaration, string xmlMessage, int zicyzUserId, string sourceName)
        {
            SubmitDataToProcessingResult result = new SubmitDataToProcessingResult();

            try
            {
                if (authToken != null)
                {
                    FenixAppSvcClient appClient = new FenixAppSvcClient();
                    appClient.AuthToken = new Fenix.WebService.Service_References.FenixAppService.AuthToken()
                    {
                        Value = authToken.Value
                    };
                    ProcResult procResult = appClient.AppLogWriteNew(type, message, xmlDeclaration, xmlMessage, zicyzUserId, sourceName);
                    appClient.Close();

                    if (procResult.ReturnValue == (int)BC.OK)
                    {
                        CreateOkResult(ref result);
                    }
                    else
                    {
                        CreateErrorResult(ApplicationLog.GetMethodName(), ref result, "90", procResult.ReturnMessage);
                    }
                }
            }
            catch (Exception ex)
            {
                CreateErrorResult(ApplicationLog.GetMethodName(), ref result, "100", ex);
            }

            return(result);
        }
Beispiel #3
0
        private static ProcResult DoProcess(FenixAppSvcClient appClient, string xmlString, string messageType)
        {
            ProcResult procResult = new ProcResult();

            string messageTypeNormalized = messageType.ToUpper().Trim();

            switch (messageTypeNormalized)
            {
            case "RECEPTIONCONFIRMATION":
                procResult = appClient.ReceptionConfirmationProcess(xmlString, BC.ZICYZ_USER_ID);
                break;

            case "KITTINGCONFIRMATION":
                procResult = appClient.KittingConfirmationProcess(xmlString, BC.ZICYZ_USER_ID);
                break;

            case "SHIPMENTCONFIRMATION":
                procResult = appClient.ShipmentConfirmationProcess(xmlString, BC.ZICYZ_USER_ID);
                break;

            case "RETURNED":
            case "RETURNEDEQUIPMENT":
                procResult = appClient.ReturnedEquipmentProcess(xmlString, BC.ZICYZ_USER_ID);
                break;

            case "RETURNEDITEM":
                procResult = appClient.ReturnedItemProcess(xmlString, BC.ZICYZ_USER_ID);
                break;

            case "RETURNEDSHIPMENT":
                procResult = appClient.ReturnedShipmentProcess(xmlString, BC.ZICYZ_USER_ID);
                break;

            case "REFURBISHEDCONFIRMATION":
                procResult = appClient.RefurbishedConfirmationProcess(xmlString, BC.ZICYZ_USER_ID);
                break;

            case "DELETEMESSAGECONFIRMATION":
                procResult = appClient.DeleteMessageConfirmationProcess(xmlString, BC.ZICYZ_USER_ID);
                break;

            case "CRMORDERCONFIRMATION":
                procResult = appClient.CrmOrderConfirmationProcess(xmlString, BC.ZICYZ_USER_ID);
                break;

            case "CRMORDERAPPROVAL":
                procResult = appClient.CrmOrderApprovalProcess(xmlString, BC.ZICYZ_USER_ID);
                break;

            default:
                procResult.ReturnValue   = (int)BC.NOT_OK;
                procResult.ReturnMessage = String.Format("Unknown messageType = [{0}]", messageType);
                break;
            }

            return(procResult);
        }
Beispiel #4
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);
        }