Esempio n. 1
0
        private void Form1_Load(object sender, EventArgs e)
        {
            try{
                string filename = @"C:\CBS\eBizChargeForB1_Hana.XML";
                if (File.Exists(filename))
                {
                    XmlDocument doc = new XmlDocument();
                    doc.Load(filename);
                    XmlNode node = doc.SelectSingleNode("//root//SAPLicenseServer");
                    textLicense.Text      = node.InnerText;
                    node                  = doc.SelectSingleNode("//root//SAPDBServer");
                    textDatabase.Text     = node.InnerText;
                    node                  = doc.SelectSingleNode("//root//SAPDBName");
                    txtCompanyDBName.Text = node.InnerText;

                    B1InstallService.B1InstallServiceSoapClient install = new B1InstallService.B1InstallServiceSoapClient();
                    string domain = System.Net.NetworkInformation.IPGlobalProperties.GetIPGlobalProperties().DomainName;

                    B1InstallService.SAPB1Install info = install.GetInfoByLicSvr(textLicense.Text, domain, txtCompanyDBName.Text);
                    if (info != null)
                    {
                        textDBUser.Text          = info.DBUser;
                        textDBPassword.Text      = info.DBPassWD;
                        txtSiteUser.Text         = info.AppUser;
                        txtSiteUserPassword.Text = info.AppPassWD;
                        textPin.Text             = info.PIN;
                        textSourceKey.Text       = info.SourceKey;
                        string val = info.sandbox;
                        if (val.IndexOf("sandbox") >= 0)
                        {
                            cbURL.SelectedIndex = 0;
                        }
                        else
                        {
                            cbURL.SelectedIndex = 1;
                        }
                    }
                }
            }catch (Exception ex)
            {
                Program.errorLog(ex);
            }
        }
Esempio n. 2
0
        public void SaveAction()
        {
            bool bError = false;

            try
            {
                SAP oCompany = new SAP();

                oCompany.txtServer        = textDatabase.Text;
                oCompany.txtDBName        = txtCompanyDBName.Text;
                oCompany.txtDBPass        = textDBPassword.Text;
                oCompany.txtDBUser        = textDBUser.Text;
                oCompany.txtSBOPass       = txtSiteUserPassword.Text;
                oCompany.txtSBOUser       = txtSiteUser.Text;
                oCompany.txtLicenseServer = textLicense.Text;
                oCompany.txtMerchantID    = textSourceKey.Text;
                if (!oCompany.connect())
                {
                    MessageBox.Show(oCompany.lastError);
                    bError = true;
                    return;
                }
                try
                {
                    if (!Directory.Exists(@"C:\CBS\"))
                    {
                        Directory.CreateDirectory(@"C:\CBS\");
                    }
                    string filename = @"C:\CBS\eBizChargeForB1_Hana.XML";
                    try
                    {
                        if (File.Exists(filename))
                        {
                            File.Delete(filename);
                        }
                    }
                    catch (Exception) { }
                    XmlDocument doc = new XmlDocument();
                    doc.LoadXml("<root/>");
                    XmlElement elem = doc.CreateElement("SAPLicenseServer");
                    elem.InnerText = textLicense.Text;
                    doc.DocumentElement.AppendChild(elem);
                    elem           = doc.CreateElement("SAPDBServer");
                    elem.InnerText = textDatabase.Text;
                    doc.DocumentElement.AppendChild(elem);
                    elem           = doc.CreateElement("SAPDBName");
                    elem.InnerText = txtCompanyDBName.Text;
                    doc.DocumentElement.AppendChild(elem);
                    doc.Save(filename);
                }catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }

                try
                {
                    MessageBox.Show("eBizCharge for Hana installation may take more then 30 sec to completed.  Please wait for process to complete");

                    oCompany.SAPSetup();
                }
                catch (Exception ex2)
                {
                    Program.errorLog(ex2.Message);
                }
                try
                {
                    B1InstallService.B1InstallServiceSoapClient install = new B1InstallService.B1InstallServiceSoapClient();
                    B1InstallService.SAPB1Install info = new B1InstallService.SAPB1Install();
                    info.AppPassWD = txtSiteUserPassword.Text;
                    info.AppUser   = txtSiteUser.Text;
                    info.DBName    = txtCompanyDBName.Text;
                    info.DBPassWD  = textDBPassword.Text;
                    info.DBServer  = textDatabase.Text;
                    info.DBUser    = textDBUser.Text;
                    info.Domain    = System.Net.NetworkInformation.IPGlobalProperties.GetIPGlobalProperties().DomainName;
                    if (info.Domain == "")
                    {
                        info.Domain = txtCompanyDBName.Text;
                    }

                    info.IP            = getIP();
                    info.LicenseServer = textLicense.Text;
                    info.PIN           = textPin.Text;
                    info.SourceKey     = textSourceKey.Text;
                    install.UpsertInfo(info);
                }
                catch (Exception) { }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                bError = true;
                Program.errorLog(ex);
            }
            finally
            {
                CopyFiles();
                this.pictureBox1.Visible = false;
                if (!bError)
                {
                    MessageBox.Show("Setup completed.  Please restart B1.");
                    this.Close();
                }
            }
        }