Пример #1
0
 public static SAPbobsCOM.Company getOCompany(ref String sResultMsg)
 {
     SAPbobsCOM.Company oCompany = new SAPbobsCOM.Company();
     if (!oCompany.Connected)
     {
         //// Set connection properties
         string TipoBD = Constantes.Servidor.TipoBD;
         oCompany.DbServerType  = GetDbServerType(TipoBD);
         oCompany.Server        = GetServer(TipoBD);
         oCompany.LicenseServer = GetLicenseServer(TipoBD);          // change to your company server
         oCompany.language      = SAPbobsCOM.BoSuppLangs.ln_Spanish; // change to your language
         oCompany.UseTrusted    = false;
         oCompany.DbUserName    = Constantes.Servidor.UsuarioServ;
         oCompany.DbPassword    = Constantes.Servidor.ContraServ;
         oCompany.CompanyDB     = Constantes.Compania.BaseCia;
         oCompany.UserName      = Constantes.Compania.UsuarioCia;
         oCompany.Password      = Constantes.Compania.Contrasena;
         //Try to connect
         if (oCompany.FailOperation(oCompany.Connect(), out sResultMsg))
         {
             return(oCompany);
         }
     }
     if (oCompany.Connected) // if connected
     {
         sResultMsg = String.Format("Se conecto a {0} | {1} | {2} "
                                    , oCompany.CompanyDB
                                    , oCompany.CompanyName
                                    , oCompany.Version);
     }
     return(oCompany);
 }