public static bool InitializeCompany(string Company, string User, string Password) { if (!initialized) { StdBSConfApl objAplConf = new StdBSConfApl(); objAplConf.Instancia = "Default"; objAplConf.AbvtApl = "GCP"; objAplConf.PwdUtilizador = Password; objAplConf.Utilizador = User; objAplConf.LicVersaoMinima = "9.00"; StdBETransaccao objStdTransac = new StdBETransaccao(); StdPlatBS Plataforma = new StdPlatBS(); ErpBS MotorLE = new ErpBS(); EnumTipoPlataforma objTipoPlataforma = new EnumTipoPlataforma(); objTipoPlataforma = EnumTipoPlataforma.tpProfissional; objAplConf.Instancia = "Default"; objAplConf.AbvtApl = "GCP"; objAplConf.PwdUtilizador = Password; objAplConf.Utilizador = User; objAplConf.LicVersaoMinima = "9.00"; // Retuns the ptl. Platform = Plataforma; // Returns the engine. Engine = MotorLE; try { Platform.AbrePlataformaEmpresa(ref Company, ref objStdTransac, ref objAplConf, ref objTipoPlataforma, ""); } catch (Exception ex) { throw new Exception("Error on open Primavera Platform."); } // Is plt initialized? if (Platform.Inicializada) { bool blnModoPrimario = true; // Open Engine Engine.AbreEmpresaTrabalho(EnumTipoPlataforma.tpProfissional, ref Company, ref User, ref Password, ref objStdTransac, "Default", ref blnModoPrimario); Engine.set_CacheActiva(false); initialized = true; return(true); } else { return(false); } } else { return(true); } }
public static bool InitializeCompany(string Company, string User, string Password) { var postCompany = HttpContext.Current.Request.Form["company"]; var postUsername = HttpContext.Current.Request.Form["username"]; var postPassword = HttpContext.Current.Request.Form["password"]; StdBSConfApl objAplConf = new StdBSConfApl(); StdPlatBS Plataforma = new StdPlatBS(); ErpBS MotorLE = new ErpBS(); EnumTipoPlataforma objTipoPlataforma = new EnumTipoPlataforma(); objTipoPlataforma = EnumTipoPlataforma.tpProfissional; objAplConf.Instancia = "Default"; objAplConf.AbvtApl = "GCP"; objAplConf.PwdUtilizador = postPassword; objAplConf.Utilizador = postUsername; objAplConf.LicVersaoMinima = "9.00"; StdBETransaccao objStdTransac = new StdBETransaccao(); // Opem platform. try { Plataforma.AbrePlataformaEmpresa(ref postCompany, ref objStdTransac, ref objAplConf, ref objTipoPlataforma, ""); } catch (Exception ex) { HttpContext.Current.Response.StatusCode = (int)HttpStatusCode.Forbidden; HttpContext.Current.Response.SuppressContent = true; HttpContext.Current.ApplicationInstance.CompleteRequest(); return(false); } // Is plt initialized? if (Plataforma.Inicializada) { // Retuns the ptl. Platform = Plataforma; bool blnModoPrimario = true; // Open Engine MotorLE.AbreEmpresaTrabalho(EnumTipoPlataforma.tpProfissional, ref postCompany, ref postUsername, ref postPassword, ref objStdTransac, "Default", ref blnModoPrimario); MotorLE.set_CacheActiva(false); // Returns the engine. Engine = MotorLE; return(true); } else { return(false); } }
public Boolean AbrirMotorPrimavera(string userPrimavera, string passUserPrimavera, string empresa, int tipoEmpPRI) { try { StdBSConfApl objAplConf = new StdBSConfApl(); StdPlatBS Plataforma = new StdPlatBS(); ErpBS MotorLE = new ErpBS(); EnumTipoPlataforma objTipoPlataforma = new EnumTipoPlataforma(); objTipoPlataforma = EnumTipoPlataforma.tpEmpresarial; objAplConf.Instancia = "Default"; objAplConf.AbvtApl = "ERP"; objAplConf.PwdUtilizador = passUserPrimavera; objAplConf.Utilizador = userPrimavera; objAplConf.LicVersaoMinima = "9.00"; StdBETransaccao objStdTransac = new StdBETransaccao(); try { Plataforma.AbrePlataformaEmpresa(ref empresa, ref objStdTransac, ref objAplConf, ref objTipoPlataforma, ""); } catch (Exception ex) { throw ex; } if (Plataforma.Inicializada) { plat = Plataforma.InterfacePublico; bool blnModoPrimario = true; MotorLE.AbreEmpresaTrabalho(tipoEmpPRI == 0 ? EnumTipoPlataforma.tpEmpresarial : EnumTipoPlataforma.tpProfissional, ref empresa, ref userPrimavera, ref passUserPrimavera, ref objStdTransac, "Default", ref blnModoPrimario); MotorLE.set_CacheActiva(true); bso = MotorLE; return(true); } else { return(false); } } catch (Exception ex) { throw ex; } }
public static bool InitializeCompany(string Company, string User, string Password) { StdBSConfApl objAplConf = new StdBSConfApl(); StdPlatBS Plataforma = new StdPlatBS(); ErpBS MotorLE = new ErpBS(); EnumTipoPlataforma objTipoPlataforma = new EnumTipoPlataforma(); objTipoPlataforma = EnumTipoPlataforma.tpProfissional; objAplConf.Instancia = "Default"; objAplConf.AbvtApl = "GCP"; objAplConf.PwdUtilizador = Password; objAplConf.Utilizador = User; objAplConf.LicVersaoMinima = "9.00"; StdBETransaccao objStdTransac = new StdBETransaccao(); // Opem platform (verifica se o utilizador tem permissões de acesso) try { Plataforma.AbrePlataformaEmpresa(ref Company, ref objStdTransac, ref objAplConf, ref objTipoPlataforma, ""); } catch (Exception ex) { throw new Exception("Error on open Primavera Platform: " + ex.Message); } // Is plt initialized? if (Plataforma.Inicializada) { // Retuns the ptl. platform = Plataforma; bool blnModoPrimario = true; // Open Engine MotorLE.AbreEmpresaTrabalho(EnumTipoPlataforma.tpProfissional, ref Company, ref User, ref Password, ref objStdTransac, "Default", ref blnModoPrimario); MotorLE.set_CacheActiva(false); // Returns the engine. engine = MotorLE; string databaseInstance = "Default"; string dbNomeEmpresa = platform.BaseDados.DaNomeBDdaEmpresa(engine.Contexto.CodEmp); databaseConnectionString = platform.BaseDados.DaConnectionStringNET(dbNomeEmpresa, databaseInstance); return(true); } else { return(false); } }
/// <summary> /// Only intialized in the frist time. /// </summary> /// <param name="Company"></param> /// <param name="User"></param> /// <param name="Password"></param> public static bool InitializeCompany(string Company, string User, string Password) { StdBSConfApl objAplConf = new StdBSConfApl(); StdPlatBS Plataforma = new StdPlatBS(); ErpBS MotorLE = new ErpBS(); EnumTipoPlataforma objTipoPlataforma = new EnumTipoPlataforma(); objTipoPlataforma = EnumTipoPlataforma.tpEmpresarial; objAplConf.Instancia = "Default"; objAplConf.AbvtApl = "ERP"; objAplConf.PwdUtilizador = Password; objAplConf.Utilizador = User; objAplConf.LicVersaoMinima = "9.00"; StdBETransaccao objStdTransac = new StdBETransaccao(); try { Plataforma.AbrePlataformaEmpresa(ref Company, ref objStdTransac, ref objAplConf, ref objTipoPlataforma, ""); } catch (Exception ex) { throw (ex); } if (Plataforma.Inicializada) { Platform = Plataforma; bool blnModoPrimario = true; MotorLE.AbreEmpresaTrabalho(EnumTipoPlataforma.tpEmpresarial, ref Company, ref User, ref Password, ref objStdTransac, "Default", ref blnModoPrimario); MotorLE.set_CacheActiva(true); Engine = MotorLE; return(true); } else { return(false); } }
public static bool InitializeCompany() { if (Platform != null && Platform.Inicializada) { return(true); } bool blnModoPrimario = true; var objAplConf = new StdBSConfApl(); objAplConf.Instancia = "Default"; objAplConf.AbvtApl = "GCP"; objAplConf.PwdUtilizador = Properties.Settings.Default.Password.Trim(); objAplConf.Utilizador = Properties.Settings.Default.User.Trim(); objAplConf.LicVersaoMinima = "9.00"; var MotorLE = new ErpBS(); var Plataforma = new StdPlatBS(); var objStdTransac = new StdBETransaccao(); var tipoPlataforma = EnumTipoPlataforma.tpProfissional; try { Plataforma.AbrePlataformaEmpresa(Properties.Settings.Default.Company.Trim(), ref objStdTransac, ref objAplConf, ref tipoPlataforma, ""); } catch { return(false); } PrimaveraEngine.InitializeSQLite(); if (Plataforma.Inicializada) { Platform = Plataforma; MotorLE.AbreEmpresaTrabalho(EnumTipoPlataforma.tpProfissional, Properties.Settings.Default.Company.Trim(), Properties.Settings.Default.User.Trim(), Properties.Settings.Default.Password.Trim(), ref objStdTransac, "Default", ref blnModoPrimario); MotorLE.set_CacheActiva(true); Engine = MotorLE; } return(Plataforma.Inicializada); }