Ejemplo n.º 1
0
        public static Process GetOneProcess(RequestorInfo requestorInfo)
        {
            Process tempProcess = new Process();

            using (GridProteinFoldingEntities ctx = new GridProteinFoldingEntities())
            {
                tempProcess = ctx.Process.Include("DataToProcess").Include("DataToResult").Include("Model").Include("ConfigApp").Include("Output").FirstOrDefault(p => p.status_id == 1); // || p.status_id == 3 || p.status_id == 4);

                try
                {
                    if (tempProcess != null)
                    {
                        //TRATATIVA de INTEGRIDADE dos DADOS
                        ParseIntegration(ref tempProcess);
                        //SETA STATUS, se possível
                        SetStatus(ref tempProcess, ref requestorInfo);
                    }
                    return(tempProcess);
                }
                catch (Exception ex)
                {
                    GICO.WriteLine(String.Format("{0}> {1} ({2} {3})", tempProcess.guid.ToString(), DateTime.Now, "Exception:", ex.Message.ToString()));

                    BasicEnums.State newstatus = BasicEnums.State.Error;
                    SetOneProcess(tempProcess.guid, newstatus, requestorInfo);

                    return(null);
                }
            }
        }
Ejemplo n.º 2
0
        public static Process GetOneProcessGuiForETL(Guid gui, Services.DistributedService.RequestorInfo requestorInf)
        {
            Process tempProcess = new Process();

            using (GridProteinFoldingEntities ctx = new GridProteinFoldingEntities())
            {
                tempProcess = ctx.Process.Include("DataToProcess").Include("DataToResult").Include("Model").Include("ConfigApp").Include("Output").FirstOrDefault(p => p.guid == gui);

                try
                {
                    if (tempProcess != null)
                    {
                        //TRATATIVA de INTEGRIDADE dos DADOS
                        ParseIntegration(ref tempProcess);
                        GICO.WriteLine(gui, String.Format("{0} {1} @ {2}({3})", DateTime.Now, "Processing ETL", requestorInf.macAddr, requestorInf.machineName));
                    }
                    return(tempProcess);
                }
                catch (Exception ex)
                {
                    GICO.WriteLine(String.Format("{0} {1} ({2} {3})", tempProcess.guid.ToString(), DateTime.Now, "Exception:", ex.Message.ToString()));

                    BasicEnums.State newstatus = BasicEnums.State.ETLError;
                    SetOneProcess(tempProcess.guid, newstatus, requestorInf);

                    return(null);
                }
            }
        }
Ejemplo n.º 3
0
        public static void SetOneProcessByGuid(Guid guid, BasicEnums.State state)
        {
            System.Net.NetworkInformation.PhysicalAddress macAddr = Net.GetMacAddress();

            //CheckStatusChannel();

            for (int tryCon = 0; tryCon < numberTry; tryCon++)
            {
                try
                {
                    OpenChannel();
                    objDistributed.SetOneProcessByGuid(guid, state, new RequestorInfo()
                    {
                        macAddr = macAddr.ToString(), machineName = Environment.MachineName
                    });
                    CloseChannel();
                    return;
                }
                catch (CommunicationException)
                {
                    //new CustomLog().CommunicationException(ex);
                    //CheckStatusChannel();
                    throw;
                }
                catch (Exception)
                {
                    //new CustomLog().Exception(ex);
                    throw;
                }
            }

            return;
        }
Ejemplo n.º 4
0
 private static void SetStatus(ref Process tempProcess, ref RequestorInfo requestorInfo)
 {
     if (tempProcess != null)
     {
         BasicEnums.State newstatus = NewStatus(tempProcess.Status);
         if (newstatus != BasicEnums.State.NoChangeStatus)
         {
             SetOneProcess(tempProcess.guid, newstatus, requestorInfo);
         }
     }
 }
Ejemplo n.º 5
0
        public static byte SetOneProcess(Guid guid, BasicEnums.State state, RequestorInfo requestorInfo)
        {
            using (GridProteinFoldingEntities ctx = new GridProteinFoldingEntities())
            {
                Process temp = ctx.Process.FirstOrDefault(p => p.guid == guid);
                temp.status_id   = Convert.ToByte(state);
                temp.macAddr     = requestorInfo.macAddr;
                temp.machineName = requestorInfo.machineName;
                ctx.SaveChanges();

                Condicional(guid, ctx, temp, ref state, ref requestorInfo);
            }

            return(GetStatus(guid));
        }
Ejemplo n.º 6
0
        public static Data.XMLData.Entity.Process SetStatusProcessando(GridProteinFolding.Middle.Helpers.ConfigurationHelpers.Param newParam, BasicEnums.State state)
        {
            try
            {
                //Muda Status de Aguardando para EM PROCESSAMENTO no Cliente
                RecoverGuid(newParam, state);

                return(SelectGuid(newParam));
            }
            catch (Exception ex)
            {
                new CustomLog().Exception(ex, Types.ErrorLevel.Critical);
                throw;
            }
        }
Ejemplo n.º 7
0
 public static void InsertGuid(GridProteinFolding.Middle.Helpers.ConfigurationHelpers.Param newParam, BasicEnums.State state)
 {
     Data.XMLData.Bussines.Actions.InsertProcess(new Data.XMLData.Entity.Process()
     {
         Guid = newParam.dataToProcess.Guid, Status = Convert.ToByte(state), Date = DateTime.Now
     });
 }
Ejemplo n.º 8
0
        public static void RecoverGuid(GridProteinFolding.Middle.Helpers.ConfigurationHelpers.Param newParam, BasicEnums.State state)
        {
            Sql.entityProcess = SelectGuid(newParam);

            if (Sql.entityProcess == null)
            {
                InsertGuid(newParam, state);
                Sql.entityProcess = SelectGuid(newParam);
            }
        }
        public static byte SetStatus(GridProteinFolding.Middle.Helpers.ConfigurationHelpers.Param newParam, BasicEnums.State state)
        {
            //CheckStatusChannel();
            byte retProxy = byte.MinValue;

            //Muda Status no Servidor
            for (int tryCon = 0; tryCon < numberTry; tryCon++)
            {
                try
                {
                    OpenChannel();
                    retProxy = objDistributed.SetOneProcess(newParam, state, requestorInfo);
                    CloseChannel();
                    break;
                }
                catch (CommunicationException ex)
                {
                    new CustomLog().CommunicationException(ex);
                    //CheckStatusChannel();
                    //throw;
                }
                catch (Exception ex)
                {
                    new CustomLog().Exception(ex);
                    //throw;
                }
            }

            Sql.entityProcess.guid   = newParam.dataToProcess.Guid;
            Sql.entityProcess.status = Convert.ToByte(retProxy);
            Sql.entityProcess.date   = DateTime.Now;
            //Muda Status no Cliente
            GridProteinFolding.Data.XMLData.Bussines.Actions.UpdateProcess(Sql.entityProcess);

            return(retProxy);
        }
Ejemplo n.º 10
0
 private void UpdateStatus(GridProteinFolding.Middle.Helpers.ConfigurationHelpers.Param newParam, BasicEnums.State state)
 {
     ProxyServiceClient.SetStatus(newParam, state);
 }
Ejemplo n.º 11
0
        //private void RecoverGuid(GridProteinFolding.Middle.Helpers.ConfigurationHelpers.Param newParam, BasicEnums.State state)
        //{
        //    Sql.RecoverGuid(newParam, state);
        //}

        //private void InsertGuid(GridProteinFolding.Middle.Helpers.ConfigurationHelpers.Param newParam, BasicEnums.State state)
        //{
        //    Sql.InsertGuid(newParam, state);
        //}

        //private GridProteinFolding.Data.XMLData.Entity.Process SelectGuid(GridProteinFolding.Middle.Helpers.ConfigurationHelpers.Param newParam)
        //{
        //    return Sql.SelectGuid(newParam);
        //}

        private GridProteinFolding.Data.XMLData.Entity.Process SetStatusProcessandoLocalDBToProcessing(GridProteinFolding.Middle.Helpers.ConfigurationHelpers.Param newParam, BasicEnums.State state)
        {
            return(Sql.SetStatusProcessando(newParam, state));
        }
Ejemplo n.º 12
0
        private static void Condicional(Guid guid, GridProteinFoldingEntities ctx, Process temp, ref BasicEnums.State state, ref RequestorInfo requestorInfo)
        {
            aspnet_Users user = new GridProteinFolding_MemberShipEntities().aspnet_Users.FirstOrDefault(u => u.UserId == temp.userId);

            if (state == BasicEnums.State.Processing)
            {
                GICO.WriteLine(guid, String.Format("{0} {1} @ {2}({3})", DateTime.Now, "Processing", temp.macAddr, temp.machineName));

                string message = " was started!";

                if (temp.emailNotification == Convert.ToByte(BasicEnums.EmailNotification.Enviar))
                {
                    SendMail(ctx, guid, message, user);
                }

                Expurg(guid, ctx);
            }
            if (state == BasicEnums.State.BULK)
            {
                #region BULK
                GICO.WriteLine(guid, String.Format("{0} {1} @ {2}({3})", DateTime.Now, "BULK", temp.macAddr, temp.machineName));
                //ExtendedDirectoryInfo dirBaseServer = new ExtendedDirectoryInfo(ConfigurationManager.AppSettings["dirBaseServer"].ToString());

                //object[] parameters = new object[2];
                //parameters[0] = dirBaseServer + @"\" + guid + @"\Seed";
                //parameters[1] = guid.ToString();

                //ctx.ExecuteStoreCommand("EXEC dbo.BunkFiles {0},{1}", parameters);

                state          = BasicEnums.State.ClearTempClient;
                temp.status_id = Convert.ToByte(state);
                ctx.SaveChanges();
                #endregion

                #region ClearTempServer
                GICO.WriteLine(guid, String.Format("{0} {1} @ {2}({3})", DateTime.Now, "ClearTempServer", temp.macAddr, temp.machineName));
                DeleteFileServer_temp(guid);

                state          = BasicEnums.State.Finalized;
                temp.status_id = Convert.ToByte(state);
                ctx.SaveChanges();
                #endregion
            }

            //if (state == Enums.BasicEnums.State.Excel)
            //{

            //    Applications objApplications = new Applications();

            //    GICO.Write("Excel..");
            //    objApplications.Excel(param);

            //    GICO.WriteLine("{0}:{1}", param.dataToProcess.Guid.ToString(), "DONE!");
            //    objApplications = null;

            //    state = Enums.BasicEnums.State.Origin;
            //    temp.status_id = Convert.ToByte(state);
            //    ctx.SaveChanges();
            //}

            //if (state == Enums.BasicEnums.State.Origin)
            //{
            //    ProcessData(param.dataToProcess.Guid);

            //    Applications objApplications = new Applications();

            //    GICO.Write("Origin..");
            //    objApplications.Origin(param.dataToProcess.Guid);

            //    GICO.WriteLine("{0}:{1}", param.dataToProcess.Guid.ToString(), "DONE!");
            //    objApplications = null;

            //    state = Enums.BasicEnums.State.ClearTempClient;
            //    temp.status_id = Convert.ToByte(state);
            //    ctx.SaveChanges();
            //}

            //if (state == BasicEnums.State.ClearTempServer)
            //{
            //    GICO.WriteLine(guid, String.Format("{0} {1}:", DateTime.Now, "ClearTempServer.."));
            //    DeleteFileServer_temp(guid);

            //    state = BasicEnums.State.Finalized;
            //    temp.status_id = Convert.ToByte(state);
            //    ctx.SaveChanges();
            //}

            //if (state == Enums.BasicEnums.State.Decrypt)
            //{
            //    Applications objApplications = new Applications();
            //    GICO.Write("Decrypt..");
            //    objApplications.Decrypt(param);
            //    GICO.WriteLine("{0}:{1}", param.dataToProcess.Guid.ToString(), "DONE!");
            //    objApplications = null;

            //    state = Enums.BasicEnums.State.Web;
            //    temp.status_id = Convert.ToByte(state);
            //    ctx.SaveChanges();
            //}

            //if (state == Enums.BasicEnums.State.Web)
            //{

            //    Applications objApplications = new Applications();
            //    GICO.Write("Web..");
            //    objApplications.Web(param);
            //    GICO.WriteLine("{0}:{1}", param.dataToProcess.Guid.ToString(), "DONE!");
            //    objApplications = null;

            //    state = Enums.BasicEnums.State.Finalized;
            //    temp.status_id = Convert.ToByte(state);
            //    ctx.SaveChanges();
            //}

            if (state == BasicEnums.State.Finalized)
            {
                GICO.WriteLine(guid, String.Format("{0} {1} @ {2}({3})", DateTime.Now, "Finalized", temp.macAddr, temp.machineName));

                if (temp.emailNotification == Convert.ToByte(BasicEnums.EmailNotification.Enviar))
                {
                    string message = "was completed!";
                    SendMail(ctx, guid, message, user);
                }
            }
        }
Ejemplo n.º 13
0
 public byte SetOneProcess(Param param, BasicEnums.State state, Services.DistributedService.RequestorInfo requestorInf)
 {
     return(Services.DistributedService.Service.SetOneProcess(param, state, requestorInf));
 }
Ejemplo n.º 14
0
 public byte SetOneProcessByGuid(Guid guid, BasicEnums.State state, Services.DistributedService.RequestorInfo requestorInf)
 {
     return(Services.DistributedService.Service.SetOneProcess(guid, state, requestorInf));
 }