Beispiel #1
0
        public SimpleResult NowIs(string login, string password)
        {
            SimpleResult result = new SimpleResult();

            if (String.IsNullOrEmpty(login) || String.IsNullOrEmpty(password))
            {
                result.Number  = 2;
                result.Message = "Login or password is empty";
                return(result);
            }

            try
            {
                AuthResult    authRes;
                AuthSvcClient authProxy = new AuthSvcClient();
                AuthToken     authToken = authProxy.Login(login, password, "", out authRes);
                authProxy.Close();

                if (authToken != null)
                {
                    result.Number  = 0;
                    result.Message = string.Format("Now is {0}", DateTime.Now);
                }
                else
                {
                    result.Number  = 1;
                    result.Message = "Invalid login";
                }
            }
            catch (Exception ex)
            {
                result.Number  = 1;
                result.Message = ex.Message;
            }

            return(result);
        }
Beispiel #2
0
        public SimpleResult TSubmitDataToProcessing(string login, string password)
        {
            SimpleResult result = new SimpleResult();

            try
            {
                if (ProjectHelper.Os.IsWindowsServer() || System.Web.Configuration.WebConfigurationManager.AppSettings["DebugMode"] != "1")
                {
                    throw new Exception("TSubmitDataToProcessing Exception");
                }

                // {TEST; ReceptionConfirmation; KittingConfirmation; ShipmentConfirmation; RefurbishedConfirmation;
                //  ReturnedEquipment; ReturnedItem; ReturnedShipment; GetServicesStatuses}

                //string type = "Test";
                //string inputString = TestManually.GetTest();

                //string type = "ReceptionConfirmation";
                //string inputString = ReceptionConfirmationManually.GetReceptionConfirmation(10);

                //string type = "KittingConfirmation";
                //string inputString = KittingConfirmationManually.GetKittingConfirmation(4);

                //string type = "ShipmentConfirmation";
                //string inputString = ShipmentOrderManually.GetShipmentConfirmation(42);

                //string type = "ReturnedEquipment";
                //string inputString = ReturnedEquipmentManually.GetReturnedEquipment(3);

                //string type = "ReturnedItem";
                //string inputString = ReturnedItemManually.GetReturnedItem(3);

                //string type = "ReturnedShipment";
                //string inputString = ReturnedShipmentManually.GetReturnedShipment(2);

                //string type = "RefurbishedConfirmation";
                //string inputString = RefurbishedConfirmationManually.GetRefurbishedConfirmation(3);

                //string type = "GetServicesStatuses";
                //string inputString = "V tomto případě se nepoužívá - existuje jen pro zachování signatury metody SubmitDataToProcessing";

                //string type = "CrmOrderConfirmation";
                //string inputString = CrmOrderConfirmationManually.GetCrmOrderConfirmation(1);

                string type        = "CrmOrderApproval";
                string inputString = CrmOrderApprovalManually.GetCrmOrderApproval(2);

                byte[] byteU8 = Encoding.UTF8.GetBytes(inputString);

                SubmitDataToProcessingResult processingResult = SubmitDataToProcessing(login, password, Environment.MachineName, type, byteU8, "UTF-8");

                result.Number  = (int)processingResult.MessageNumber;
                result.Message = result.Number == (int)BC.OK ? "OK" : processingResult.Errors[0].ErrorMessage;
            }
            catch (Exception ex)
            {
                result.Number  = 1;
                result.Message = ex.Message;
            }

            return(result);
        }