예제 #1
0
        public static async Task <bool> BuildSpecificCatalogsAsync(
            Server server,
            DataConnectionManager dataConnectionManager,
            IList <string> catalogs,
            bool closeDataConnectionAfterUse    = true,
            CancellationToken cancellationToken = default(CancellationToken))
        {
            cancellationToken.ThrowIfCancellationRequested();

            Clear(server);

            if (dataConnectionManager == null)
            {
                return(false);
            }

            dataConnectionManager.Open();
            if (!dataConnectionManager.IsOpen() || dataConnectionManager.IsBusy())
            {
                return(false);
            }

            await CatalogAdapter.BuildSpecificAsync(server, dataConnectionManager.DataConnection, dataConnectionManager.DataConnectionInfo.CreateMetadataScriptFactory(), catalogs, cancellationToken);

            if (closeDataConnectionAfterUse)
            {
                dataConnectionManager.Close();
            }

            return(true);
        }
예제 #2
0
        public static bool BuildSpecificCatalogs(
            Server server,
            DataConnectionManager dataConnectionManager,
            IList <string> catalogs,
            bool closeDataConnectionAfterUse = true)
        {
            Clear(server);

            if (dataConnectionManager == null)
            {
                return(false);
            }

            dataConnectionManager.Open();
            if (!dataConnectionManager.IsOpen() || dataConnectionManager.IsBusy())
            {
                return(false);
            }

            CatalogAdapter.BuildSpecific(server, dataConnectionManager.DataConnection, dataConnectionManager.DataConnectionInfo.CreateMetadataScriptFactory(), catalogs);

            if (closeDataConnectionAfterUse)
            {
                dataConnectionManager.Close();
            }

            return(true);
        }
예제 #3
0
        public static bool GetCatalogs(
            Server server,
            DataConnectionManager dataConnectionManager,
            bool closeDataConnectionAfterUse = true)
        {
            Clear(server);

            if (dataConnectionManager == null)
            {
                return(false);
            }

            dataConnectionManager.Open();
            if (!dataConnectionManager.IsOpen() || dataConnectionManager.IsBusy())
            {
                return(false);
            }

            CatalogAdapter.Get(server, dataConnectionManager.DataConnection, dataConnectionManager.DataConnectionInfo.CreateMetadataScriptFactory());

            if (closeDataConnectionAfterUse)
            {
                dataConnectionManager.Close();
            }

            return(true);
        }
예제 #4
0
 public static string GetConnectionStringAjuma()
 {
     if (sConnectionStringAjuma == string.Empty)
     {
         sConnectionStringAjuma = DataConnectionManager.GetSimpleConnectionString("Setting_Ajuma.txt");
     }
     return(sConnectionStringAjuma);
 }
예제 #5
0
 public static string GetConnectionStringFB()
 {
     if (sConnectionString == string.Empty)
     {
         sConnectionString = DataConnectionManager.GetSimpleConnectionString("Setting_Facebook.txt");
     }
     return(sConnectionString);
 }
예제 #6
0
        // GET: Carta
        public ActionResult Redactar()
        {
            ServerInformer    serverInformer    = new ServerInformer();
            ServerInformation serverInformation = serverInformer.GetServerInformation();

            ViewBag.fechaServidor     = serverInformation.ServerDate;
            ViewBag.horaServidor      = serverInformation.ServerHour;
            ViewBag.ipServidorPrivada = serverInformation.PrivateIpServer;
            ViewBag.ipServidorPublica = serverInformation.PublicIpServer;
            ViewBag.countryName       = serverInformation.CountryName;
            ViewBag.regionName        = serverInformation.RegionName;
            ViewBag.cityName          = serverInformation.CityName;


            DataConnectionManager data         = new DataConnectionManager();
            List <Tratamiento>    tratamientos = data.GetTratamientos();
            List <Despedida>      despedidas   = data.GetDespedidas();
            List <Cargo>          cargos       = data.GetCargos();

            ViewBag.tratamientos = tratamientos;
            ViewBag.despedidas   = despedidas;
            ViewBag.cargos       = cargos;
            return(View());
        }
예제 #7
0
 public AjumaDataConnect(string connectionString)
 {
     sConnect = DataConnectionManager.GetDataConnectionString_With_ConnectionString(connectionString, stringMetadata);
     db       = new Ajuma_devEntities(sConnect);
 }
예제 #8
0
 public DatabaseConnect(string connectionString)
 {
     sConnect = DataConnectionManager.GetDataConnectionString_With_ConnectionString(connectionString, stringMetadata);
     db       = new SOLIDDB_DEVEntities(sConnect);
 }
예제 #9
0
        //public bool FetchTargetDataModelFromJson(string json)
        //{

        //    var ticks = DateTime.Now.Ticks;
        //    TotalDataEventWaitTime = new TimeSpan(ticks);
        //    TotalDataEventWaitTime = TotalDataEventWaitTime.Subtract(TotalDataEventWaitTime);
        //    var start = new TimeSpan(ticks);
        //    DataTimer.RaiseTimerStatusEvent("Fetching target database JSon metadata.");

        //    Clear();

        //    try
        //    {
        //        if (string.IsNullOrEmpty(json) || string.IsNullOrWhiteSpace(json))
        //        {
        //            Exceptions.Add(new Exception(
        //                "Target metadeta could not be pulled from JSon."));
        //            return false;
        //        }

        //        var server = Server.FromJson(json);
        //        if (server == null)
        //        {
        //            Exceptions.Add(new Exception(
        //                "Target metadeta could not be pulled from JSon."));
        //            return false;
        //        }

        //        TargetServer = server;

        //        if (DataProperties.CatalogsToCompare.Count > 0)
        //            foreach (var catalogValue in
        //                DataProperties.CatalogsToCompare.Values.Where(
        //                    catalogValue => !TargetServer.Catalogs.ContainsKey(catalogValue)
        //                ))
        //                Server.RemoveCatalog(TargetServer, catalogValue);
        //    }
        //    catch (Exception ex)
        //    {
        //        Exceptions.Add(ex);
        //        return false;
        //    }

        //    var finish = new TimeSpan(DateTime.Now.Ticks);
        //    var interval = finish.Subtract(start);
        //    interval = interval.Subtract(TotalDataEventWaitTime);
        //    DataTimer.RaiseTimerStatusEvent(interval, "Finished fetching target database JSon metadata.");
        //    if (TotalDataEventWaitTime.Ticks > 0)
        //        DataTimer.RaiseTimerStatusEvent(TotalDataEventWaitTime, "Total user response time in dialog windows.");

        //    return true;
        //}

        public bool FetchTargetDataModelFromServer(bool closeDataConnectionAfterUse = true)
        {
            if (TargetDataConnectionInfo == null)
            {
                Exceptions.Add(new Exception("Target connection info has not been provided."));
                return(false);
            }

            var ticks = DateTime.Now.Ticks;

            TotalDataEventWaitTime = new TimeSpan(ticks);
            TotalDataEventWaitTime = TotalDataEventWaitTime.Subtract(TotalDataEventWaitTime);
            var start = new TimeSpan(ticks);

            DataTimer.RaiseTimerStatusEvent("Fetching target database metadata.");

            Clear();

            // Open target data connection if it does not already exist and should exist.
            if (TargetDataConnectionManager == null)
            {
                var targetStart = new TimeSpan(DateTime.Now.Ticks);
                DataTimer.RaiseTimerStatusEvent(string.Format("Creating and opening connection for target server: [{0}]", TargetDataConnectionInfo.Name));
                TargetDataConnectionManager = new DataConnectionManager(TargetDataConnectionInfo);
                TargetDataConnectionManager.Open();
                var targetFinish   = new TimeSpan(DateTime.Now.Ticks);
                var targetInterval = targetFinish.Subtract(targetStart);
                DataTimer.RaiseTimerStatusEvent(
                    targetInterval,
                    string.Format("Finished creating and opening connection for target server: [{0}]",
                                  TargetDataConnectionInfo.Name));
            }
            else if (!TargetDataConnectionManager.IsOpen())
            {
                if (TargetDataConnectionManager.IsBusy())
                {
                    Exceptions.Add(new Exception(
                                       string.Format("Target connection for server: [{0}]... is busy! Please try again in a few moments.",
                                                     TargetDataConnectionInfo.Name)
                                       ));
                    return(false);
                }

                var targetStart = new TimeSpan(DateTime.Now.Ticks);
                DataTimer.RaiseTimerStatusEvent(
                    string.Format("Opening connection for target connection: [{0}]",
                                  TargetDataConnectionInfo.Name));
                TargetDataConnectionManager.Open();
                var targetFinish   = new TimeSpan(DateTime.Now.Ticks);
                var targetInterval = targetFinish.Subtract(targetStart);
                DataTimer.RaiseTimerStatusEvent(
                    targetInterval,
                    string.Format("Finished opening connection for target server: [{0}]",
                                  TargetDataConnectionInfo.Name));
            }

            TargetServer     = null;
            DataSyncComparer = null;

            if (!TargetDataConnectionManager.IsOpen())
            {
                Exceptions.Add(new Exception(
                                   string.Format("Connection for target server: [{0}]... could not be opened.",
                                                 TargetDataConnectionInfo.Name)));
                return(false);
            }

            var targetServerStart = new TimeSpan(DateTime.Now.Ticks);

            DataTimer.RaiseTimerStatusEvent(
                string.Format("Creating and pulling data objects for target connection [{0}]",
                              TargetDataConnectionInfo.Name));
            TargetServer = new Server
            {
                ObjectName  = TargetDataConnectionInfo.Name,
                DataContext = TargetDataConnectionInfo.DataContext
            };

            Server.BuildCatalogs(TargetServer, TargetDataConnectionManager, closeDataConnectionAfterUse);

            var targetServerFinish   = new TimeSpan(DateTime.Now.Ticks);
            var targetServerInterval = targetServerFinish.Subtract(targetServerStart);

            DataTimer.RaiseTimerStatusEvent(
                targetServerInterval,
                string.Format(
                    "Finished creating data objects for target connection [{0}]",
                    TargetDataConnectionInfo.Name));

            var finish   = new TimeSpan(DateTime.Now.Ticks);
            var interval = finish.Subtract(start);

            interval = interval.Subtract(TotalDataEventWaitTime);
            DataTimer.RaiseTimerStatusEvent(interval, "Finished fetching target database metadata.");
            if (TotalDataEventWaitTime.Ticks > 0)
            {
                DataTimer.RaiseTimerStatusEvent(TotalDataEventWaitTime, "Total user response time in dialog windows.");
            }

            return(true);
        }