Пример #1
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
     });
 }
 void Processing(ref GridProteinFolding.Core.eFolding.Main objProcess,
                 ref GridProteinFolding.Middle.Helpers.ConfigurationHelpers.Param newParam,
                 ref ServiceParamWcf paramWCF)
 {
     //PROCESS MAIN
     returnOfProcess = objProcess.Process(ref newParam);
     objProcess      = null;
 }
Пример #3
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);
            }
        }
Пример #4
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;
            }
        }
        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);
        }
Пример #6
0
 public static GridProteinFolding.Data.XMLData.Entity.Process SelectGuid(GridProteinFolding.Middle.Helpers.ConfigurationHelpers.Param newParam)
 {
     Data.XMLData.Entity.Process process = GridProteinFolding.Data.XMLData.Bussines.Actions.GetProcess(newParam.dataToProcess.Guid);
     return(process);
 }
        private bool Run(ServiceParamWcf paramWCF)
        {
            GridProteinFolding.Core.eFolding.Main objProcess = new GridProteinFolding.Core.eFolding.Main();

            //Executa REQUISICAO
            GridProteinFolding.Middle.Helpers.ConfigurationHelpers.Param newParam = new GridProteinFolding.Middle.Helpers.ConfigurationHelpers.Param();
            //Preparar os parametros para execução
            Param temp = paramWCF.param;

            GridProteinFolding.Middle.Helpers.ConfigurationHelpers.Param.PreperParams(ref temp, ref newParam);

            #region Atualiza Status local
            if (Status(paramWCF.param.dataToProcess.Guid) == (int)BasicEnums.State.Processing)
            {
                Sql.entityProcess = SetStatusProcessandoLocalDBToProcessing(newParam, BasicEnums.State.Processing);
            }
            #endregion

            try
            {
                //if (Status(paramWCF.param.dataToProcess.Guid) == (int)BasicEnums.State.Waiting)
                //{
                //    DisplayMessage(ExtendedString.Format("{0}> {1}...", paramWCF.param.dataToProcess.Guid, BasicEnums.State.Waiting.ToString()));
                //    Sql.entityProcess = SetStatusProcessando(newParam, BasicEnums.State.Processing);
                //}

                if (Status(paramWCF.param.dataToProcess.Guid) == (int)BasicEnums.State.Processing)
                {
                    DisplayMessage(ExtendedString.Format("{0}> {1}...", paramWCF.param.dataToProcess.Guid, BasicEnums.State.Processing.ToString()));

                    Processing(ref objProcess, ref newParam, ref paramWCF);

                    if (returnOfProcess)
                    {
                        UpdateStatus(newParam, BasicEnums.State.Processed);
                    }
                    else
                    {
                        UpdateStatus(newParam, BasicEnums.State.Error);
                        DisplayMessage(ExtendedString.Format("{0}> {1}...", paramWCF.param.dataToProcess.Guid, BasicEnums.State.Error.ToString()));
                    }
                }

                if (Status(paramWCF.param.dataToProcess.Guid) == (int)BasicEnums.State.Processed)
                {
                    DisplayMessage(ExtendedString.Format("{0}> {1}...", paramWCF.param.dataToProcess.Guid, BasicEnums.State.Processed.ToString()));
                    UpdateStatus(newParam, returnOfProcess == true ? BasicEnums.State.Upload : BasicEnums.State.Error);
                    //System.Threading.Thread.Sleep(1000);
                }

                if (Status(paramWCF.param.dataToProcess.Guid) == (int)BasicEnums.State.Upload)
                {
                    DisplayMessage(ExtendedString.Format("{0}> {1}...", paramWCF.param.dataToProcess.Guid, (BasicEnums.State.Upload.ToString())));
                    returnOfProcess = true;
                    //Upload dos resultados
                    Upload(paramWCF);
                    //Atualiza Status
                    UpdateStatus(newParam, returnOfProcess == true ? BasicEnums.State.BULK : BasicEnums.State.Error);
                    //System.Threading.Thread.Sleep(500);
                }

                if (Status(paramWCF.param.dataToProcess.Guid) == (int)BasicEnums.State.ClearTempClient)
                {
                    if (AppConfigClient.Param == null)
                    {
                        AppConfigClient.Param = newParam;
                    }
                    //Limpar folder cliente utilizado no processamento
                    new GridProteinFolding.Core.eFolding.IO.Directory().ClearProcessClientFolder();

                    //Atualiza Status
                    UpdateStatus(newParam, returnOfProcess == true ? BasicEnums.State.ClearTempServer : BasicEnums.State.Error);
                    DisplayMessage(ExtendedString.Format("{0}> {1}...", paramWCF.param.dataToProcess.Guid, returnOfProcess == true ? BasicEnums.State.ClearTempServer.ToString() : BasicEnums.State.Error.ToString()));
                }

                GICO.WriteLine(ExtendedString.Format("{0}> {1}...", paramWCF.param.dataToProcess.Guid, "Process of simulation finished!"));


                return(returnOfProcess);
            }
            catch (Exception ex)
            {
                new CustomLog().Exception(ex);

                UpdateStatus(newParam, BasicEnums.State.Error);

                return(false);
            }
            //finally
            //{
            //    GridProteinFolding.Data.SQLite.SQLite.CloseDatabase();
            //}
        }
 private void UpdateStatus(GridProteinFolding.Middle.Helpers.ConfigurationHelpers.Param newParam, BasicEnums.State state)
 {
     ProxyServiceClient.SetStatus(newParam, state);
 }
        //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));
        }