Exemple #1
0
 private void call_paramTextBox_TextChanged_1(object sender, EventArgs e)
 {
     call_paramTextBox.Text = call_paramTextBox.Text.Replace("{HOTELCODE}", myServer.HotelCode);
     call_paramTextBox.Text = call_paramTextBox.Text.Replace("{HOTELNAME}", "Hotel AlpineBits");
     call_paramTextBox.Text = call_paramTextBox.Text.Replace("{YEAR}", DateTime.Now.Year.ToString());
     ABMethods.highlightText(call_paramTextBox);
 }
Exemple #2
0
        private void openFileDialog1_FileOk(object sender, CancelEventArgs e)
        {
            call_paramTextBox.Text = File.ReadAllText(openFileDialog1.FileName);
            var sXML = call_paramTextBox.Text.Replace("{HOTELCODE}", myServer.HotelCode);

            sXML = sXML.Replace("{HOTELNAME}", "");
            sXML = sXML.Replace("{YEAR}", DateTime.Now.Year.ToString());
            call_paramTextBox.Text = sXML;

            ABMethods.highlightText(call_paramTextBox);
        }
Exemple #3
0
 private void SaveServerParams()
 {
     ABMethods.setAppSetting("Username", txtUsername.Text);
     ABMethods.setAppSetting("Password", txtPassword.Text);
     ABMethods.setAppSetting("ClientID", txtClientID.Text);
     ABMethods.setAppSetting("ProtocolVersion", txtClientProtocolVersion.Text);
     ABMethods.setAppSetting("ServerUrl", txtServer.Text);
     ABMethods.setAppSetting("BGZIPReturn", cBGZIP.Checked ? "yes" : "no");
     ABMethods.setAppSetting("BGZIPSend", cBGZIPSend.Checked ? "yes" : "no");
     ABMethods.setAppSetting("HotelCode", txtHotelCode.Text);
     setCredentials();
 }
Exemple #4
0
 private void ReadServerParams()
 {
     txtUsername.Text = ABMethods.getAppSetting("Username");
     txtPassword.Text = ABMethods.getAppSetting("Password");
     txtClientID.Text = ABMethods.getAppSetting("ClientID");
     txtClientProtocolVersion.Text = ABMethods.getAppSetting("ProtocolVersion");
     txtServer.Text     = ABMethods.getAppSetting("ServerUrl");
     cBGZIP.Checked     = ABMethods.getAppSetting("BGZIPReturn") == "yes" ? true : false;
     cBGZIPSend.Checked = ABMethods.getAppSetting("BGZIPSend") == "yes" ? true : false;
     txtHotelCode.Text  = ABMethods.getAppSetting("HotelCode");
     setCredentials();
 }
Exemple #5
0
 public static AlpineBitsServer GetServerCredentials()
 {
     return(new AlpineBitsServer()
     {
         UserName = ABMethods.getAppSetting("Username"),
         Password = ABMethods.getAppSetting("Password"),
         X_AlpineBits_ClientID = ABMethods.getAppSetting("ClientID"),
         X_AlpineBits_ProtocolVersion = ABMethods.getAppSetting("ProtocolVersion"),
         ServerURL = ABMethods.getAppSetting("ServerUrl"),
         AcceptResponseGZIPEncoded = ABMethods.getAppSetting("BGZIPReturn") == "yes" ? true : false,
         InvokeZipped = ABMethods.getAppSetting("BGZIPSend") == "yes" ? true : false,
         HotelCode = ABMethods.getAppSetting("HotelCode")
     });
 }
Exemple #6
0
 private void call_paramTextBox_MultilineChanged(object sender, EventArgs e)
 {
     ABMethods.highlightText(call_paramTextBox);
 }
Exemple #7
0
 private void rules2017BindingSource_CurrentChanged(object sender, EventArgs e)
 {
     ABMethods.highlightText(call_paramTextBox);
 }
Exemple #8
0
 private void ruleForm_Activated(object sender, EventArgs e)
 {
     ABMethods.highlightText(call_paramTextBox);
 }
Exemple #9
0
 private void call_paramTextBox_Leave(object sender, EventArgs e)
 {
     ABMethods.highlightText(call_paramTextBox);
 }
Exemple #10
0
        private void button15_Click(object sender, EventArgs e)
        {
            string ErrorText;

            ABMethods.XSD_Validation(call_actionTextBox.Text, call_paramTextBox.Text, true, out ErrorText);
        }
Exemple #11
0
        private void button13_Click(object sender, EventArgs e)
        {
            string ErrorText;

            ABMethods.XSD_Validation(call_actionTextBox.Text, call_resultTextBox.Text, false, out ErrorText);
        }
Exemple #12
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="action"></param>
        /// <param name="XML"></param>
        /// <param name="Request">true = validate OTA Request XSD, false=validate OTA Response XSD</param>
        /// <param name="sXSDValidationErrorString"></param>
        /// <param name=""></param>

        public static void XSD_Validation(string action, string XML, bool RQXSD, out string sXSDValidationErrorString)
        {
            var xsdFile = "";

            sXSDValidationErrorString = "";
            var ABServer = ABMethods.GetServerCredentials();

            if (ABServer.X_AlpineBits_ProtocolVersion == "2014-04")
            {
                ABMethods.ValidateXSD(XML, "./xsd/alpinebits2014-04.xsd", out sXSDValidationErrorString);
            }
            if (ABServer.X_AlpineBits_ProtocolVersion == "2015-07")
            {
                ABMethods.ValidateXSD(XML, "./xsd/alpinebits2015-07.xsd", out sXSDValidationErrorString);
            }
            if (ABServer.X_AlpineBits_ProtocolVersion == "2015-07b")
            {
                ABMethods.ValidateXSD(XML, "./xsd/alpinebits2015-07b.xsd", out sXSDValidationErrorString);
            }
            if (sXSDValidationErrorString.Length > 0)
            {
                MessageBox.Show("AlpineBits XSD Error: " + sXSDValidationErrorString);
            }
            else
            {
                MessageBox.Show("AlpineBits " + ABServer.X_AlpineBits_ProtocolVersion + " OK!");
            }

            if (ABServer.X_AlpineBits_ProtocolVersion.Trim() != "2014-04")
            {
                switch (action)
                {
                case "OTA_HotelDescriptiveContentNotif:Inventory":
                    if (RQXSD)
                    {
                        // FOR REQUEST VALIDATION
                        xsdFile = "./xsd/OTA2015A/OTA_HotelDescriptiveContentNotifRQ.xsd";
                    }
                    else
                    {
                        // FOR RESPONSE VALIDATION
                        xsdFile = "./xsd/OTA2015A/OTA_HotelDescriptiveContentNotifRS.xsd";
                    }
                    break;

                case "OTA_HotelRatePlanNotif:RatePlans":
                    if (RQXSD)
                    {
                        xsdFile = "./xsd/OTA2015A/OTA_HotelRatePlanNotifRQ.xsd";
                    }
                    else
                    {
                        xsdFile = "./xsd/OTA2015A/OTA_HotelRatePlanNotifRS.xsd";
                    }
                    break;

                case "OTA_HotelAvailNotif:FreeRooms":
                    if (RQXSD)
                    {
                        xsdFile = "./xsd/OTA2015A/OTA_HotelAvailNotifRQ.xsd";
                    }
                    else
                    {
                        xsdFile = "./xsd/OTA2015A/OTA_HotelAvailNotifRS.xsd";
                    }
                    break;

                case "OTA_Read:GuestRequests":
                    if (RQXSD)
                    {
                        xsdFile = "./xsd/OTA2015A/OTA_ReadRQ.xsd";
                    }
                    else
                    {
                        xsdFile = "./xsd/OTA2015A/OTA_ResRetrieveRS.xsd";
                    }
                    break;

                default:
                    MessageBox.Show("No Action given!");
                    break;
                }
                ABMethods.ValidateXSD(XML, xsdFile, out sXSDValidationErrorString);
                if (sXSDValidationErrorString.Length > 0)
                {
                    MessageBox.Show("OTA XSD Error: " + sXSDValidationErrorString);
                }
                else
                {
                    MessageBox.Show("OTA " + ABServer.X_AlpineBits_ProtocolVersion + " OK!");
                }
            }
        }