Esempio n. 1
0
        public static void DIConnect()
        {
            if (!DIApplication.Connected)
            {
                DIConnection lObjDIConnection = new DIConnection();
                lObjDIConnection.ConnectToDI(GetCredentials());

                if (lObjDIConnection.Company != null && lObjDIConnection.Company.Connected)
                {
                    DIApplication.DIConnect(lObjDIConnection.Company);
                }
            }
        }
Esempio n. 2
0
        public static void DIReconnect()
        {
            try
            {
                if (Company != null)
                {
                    Company.Disconnect();
                    MemoryUtility.ReleaseComObject(Company);
                }
            }
            catch (Exception lObjException)
            {
                LogUtility.WriteException(lObjException);
            }

            DIConnection lObjDIConnection = new DIConnection();

            lObjDIConnection.ConnectToDI(GetCredentials());

            if (lObjDIConnection.Company != null && lObjDIConnection.Company.Connected)
            {
                DIApplication.DIConnect(lObjDIConnection.Company);
            }
        }
Esempio n. 3
0
        static void Main(string[] args)
        {
            Credentials lObjCredentials = new Credentials();

            //lObjCredentials.LicenseServer = ConfigurationManager.AppSettings["LicenseServer"].ToString();
            lObjCredentials.UserName = ConfigurationManager.AppSettings["UsernameSAP"].ToString();
            lObjCredentials.Password = ConfigurationManager.AppSettings["PasswordSAP"].ToString();
            switch (ConfigurationManager.AppSettings["DBServer"].ToString())
            {
            case "MSSQL2012":
                lObjCredentials.DbServerType = SAPbobsCOM.BoDataServerTypes.dst_MSSQL2012;
                break;

            case "MSSQL2014":
                lObjCredentials.DbServerType = SAPbobsCOM.BoDataServerTypes.dst_MSSQL2014;
                break;

            case "MSSQL2016":
                lObjCredentials.DbServerType = SAPbobsCOM.BoDataServerTypes.dst_MSSQL2016;
                break;

            default:
                break;
            }
            //lObjCredentials.DbServerType = SAPbobsCOM.BoDataServerTypes.dst_MSSQL2012;
            lObjCredentials.SQLServer    = ConfigurationManager.AppSettings["SQLServer"].ToString();
            lObjCredentials.SQLUserName  = ConfigurationManager.AppSettings["UsernameSQL"].ToString();
            lObjCredentials.SQLPassword  = ConfigurationManager.AppSettings["PasswordSQL"].ToString();
            lObjCredentials.DataBaseName = ConfigurationManager.AppSettings["DBName"].ToString();
            //lObjCredentials.Language = SAPbobsCOM.BoSuppLangs.ln_English;

            DIConnection lObjDIConnection = new DIConnection();

            lObjDIConnection.ConnectToDI(lObjCredentials);

            if (lObjDIConnection.Company != null && lObjDIConnection.Company.Connected)
            {
                DIApplication.DIConnect(lObjDIConnection.Company);
            }
            //IList<string> list = new List<string>() { "raul", "martin", "anaya", "rojo" };
            //Console.WriteLine(string.Join(",", list.ToArray()));
            //Console.ReadLine();

            GPSFactoryServices lObjGPSFactoryServices = new GPSFactoryServices();

            lObjGPSFactoryServices.GetSetupService().InitializeTables();
            UGRS.Core.SDK.DI.Configuration.ConfigurationServicesFactory lObjConfigurationFactoryServices = new UGRS.Core.SDK.DI.Configuration.ConfigurationServicesFactory();



            //ServiceBase[] ServicesToRun = new ServiceBase[]
            //{
            //    new SAP_ServiceGPS()
            //};
            //ServiceBase.Run(ServicesToRun);



            string lStrPathKM   = ConfigurationManager.AppSettings["PathKM"].ToString();
            string lStrPathTime = ConfigurationManager.AppSettings["PathTime"].ToString();

            if (!string.IsNullOrEmpty(lStrPathKM))
            {
                //@"C:\Users\amartinez\Desktop\csv\KM";
                List <string> lLstFilesKM = ImportFiles.FindFiles(lStrPathKM);
                ReadCsvKm.VerifyFilesKM(lLstFilesKM, lStrPathKM);
            }
            else
            {
                LogUtility.Write("Error al momento de consultar el directorio Kilometros recorridos");
            }
            if (!string.IsNullOrEmpty(lStrPathTime))
            {
                //@"C:\Users\amartinez\Desktop\csv\TIME";
                List <string> lLstFilesTime = ImportFiles.FindFiles(lStrPathTime);
                // ReadCsvTime.VerifyFilesTime(lLstFilesTime, lStrPathTime);
            }
            else
            {
                LogUtility.Write("Error al momento de consultar el directorio de Horas de motor");
            }

            //ReadCSV.ReadKilometers(@"C:\testkm.csv");
            //ReadCSV.ReadTimeEngine(@"C:\test.csv");
        }