public GetMVGOffersResponse GetOffers(GetMVGOffersRequest reqst)
        {
            DateTime kickoff = DateTime.Now;

            XmlConfigurator.Configure(new System.IO.FileInfo(config.Log4NetConfigPath));

            GetMVGOffersResponse reply = new GetMVGOffersResponse();

            reply.Offers = new OfferList();

            try
            {
                log.Info("GetOffers. AcctNo: " + reqst.AcctNo + ", Start: " + reqst.Start.ToString("yyyy-MM-dd") + ", End: " + reqst.End.ToString("yyyy-MM-dd") + ".");

                reply.Success = true;
                GetOffersFromDB(ref reply, reqst);

                log.Info("Request fulfilled. (" + executionTime(new TimeSpan(DateTime.Now.Ticks - kickoff.Ticks)) + "ms)");

                reply.Success = true;
                return(reply);
            }
            catch (Exception excp)
            {
                log.Error("\nMessage:\n" + excp.Message + "\nStack Trace:\n" + excp.StackTrace);

                reply.Success = false;

                ProcessError err = new ProcessError();
                err.ErrorMessage = excp.Message;

                reply.Errors.Add(err);
                return(reply);
            }
        }
 private void AddError(string error_type, Dictionary <string, List <string> > dictionary)
 {
     using (NHibernate.ISession session = SessionFactory.OpenSession())
     {
         using (NHibernate.ITransaction trans = session.BeginTransaction())
         {
             var process = session
                           .CreateCriteria <SinterProcess>()
                           .Add(Restrictions.Eq("Id", this.id))
                           .UniqueResult <SinterProcess>();
             //ProcessError error;
             foreach (KeyValuePair <String, List <String> > entry in dictionary)
             {
                 foreach (String msg in entry.Value)
                 {
                     var error = new ProcessError();
                     error.type = "convergence";
                     error.name = entry.Key;
                     error.msg  = msg;
                     process.errors.Add(error);
                 }
             }
         }
     }
 }
        public GetPointsBalanceResponse GetPointsBalances(GetPointsBalancesRequest reqst)
        {
            DateTime kickoff = DateTime.Now;

            XmlConfigurator.Configure(new System.IO.FileInfo(ConfigurationManager.AppSettings["Log4NetConfigPath"]));

            GetPointsBalanceResponse reply = new GetPointsBalanceResponse();

            try
            {
                log.Info("GetPointsBalances Request. AcctNo: " + reqst.AcctNo + ".");

                reply.Success = true;
                GetPointsBalancesFromDB(ref reply, reqst.AcctNo);

                log.Info("Request fulfilled. (" + executionTime(new TimeSpan(DateTime.Now.Ticks - kickoff.Ticks)) + "ms)");

                reply.Success = true;
                return(reply);
            }
            catch (Exception excp)
            {
                log.Error("\nMessage:\n" + excp.Message + "\nStack Trace:\n" + excp.StackTrace);

                reply.Success = false;

                ProcessError err = new ProcessError();
                err.ErrorMessage = excp.Message;

                reply.Errors.Add(err);
                return(reply);
            }
        }
 async Task OnError(ProcessErrorEventArgs arg)
 {
     if (ProcessError != null)
     {
         await ProcessError.Invoke(arg).ConfigureAwait(false);
     }
 }
Exemplo n.º 5
0
        /// <summary>
        /// Select an application identifier
        /// </summary>
        /// <param name="toSelect">The application identifier</param>
        /// <returns>The error status</returns>
        public ErrorType Select(Span <byte> toSelect)
        {
            Span <byte> toSend = stackalloc byte[6 + toSelect.Length];

            ApduCommands.Select.CopyTo(toSend);
            toSend[P1] = 0x04;
            toSend[P2] = 0x00;
            toSend[Lc] = (byte)toSelect.Length;
            toSelect.CopyTo(toSend.Slice(Lc + 1));
            toSend[toSend.Length - 1] = 0x00;
            Span <byte> received = stackalloc byte[MaxBufferSize];
            var         ret      = ReadFromCard(_target, toSend, received);

            if (ret >= TailerSize)
            {
                if (ret == TailerSize)
                {
                    // It's an error, process it
                    var err = new ProcessError(received.Slice(0, TailerSize));
                    return(err.ErrorType);
                }

                FillTagList(Tags, received.Slice(0, ret - TailerSize));

                return(ErrorType.ProcessCompletedNormal);
            }

            return(ErrorType.Unknown);
        }
        public GetSlotMachineJackpotResponse GetMachineJackpots(GetSlotMachineJackpotRequest reqst)
        {
            DateTime kickoff = DateTime.Now;

            XmlConfigurator.Configure(new System.IO.FileInfo(ConfigurationManager.AppSettings["Log4NetConfigPath"]));

            GetSlotMachineJackpotResponse reply = new GetSlotMachineJackpotResponse();

            try
            {
                log.Info("GetMachineJackpots Request. Casino: " + reqst.Casino + ". MachineNo: " + reqst.SlotMachine + ". NumberOfLines: " + reqst.NumberOfLines + ".");

                using (SlotsInfoServiceClient service = new SlotsInfoServiceClient(reqst.Casino + "BasicHttpBinding_SlotsInfoService"))
                {
                    svc.GetSlotMachineJackpotRequest request = new svc.GetSlotMachineJackpotRequest();
                    request.SlotMachine   = reqst.SlotMachine;
                    request.NumberOfLines = reqst.NumberOfLines;

                    svc.GetSlotMachineJackpotResponse response = new svc.GetSlotMachineJackpotResponse();
                    response = service.GetMachineJackpots(request);

                    reply.Success = response.Success;
                    foreach (svc.JackpotDetail detail in response.Jackpots)
                    {
                        reply.Jackpots.Add(new JackpotDetail()
                        {
                            HitDate = detail.HitDate, Amount = detail.Amount, JPotType = detail.JPotType
                        });
                    }
                    foreach (svc.ProcessError detail in response.Errors)
                    {
                        reply.Errors.Add(new ProcessError()
                        {
                            ErrorMessage = detail.ErrorMessage
                        });
                    }
                }

                log.Info("Request fulfilled. (" + executionTime(new TimeSpan(DateTime.Now.Ticks - kickoff.Ticks)) + "ms)");

                reply.Success = true;
                return(reply);
            }
            catch (Exception excp)
            {
                log.Error("\nMessage:\n" + excp.Message + "\nStack Trace:\n" + excp.StackTrace);

                reply.Success = false;

                ProcessError err = new ProcessError();
                err.ErrorMessage = excp.Message;

                reply.Errors.Add(err);
                return(reply);
            }
        }
Exemplo n.º 7
0
 public ProcessException(
     string message,
     ProcessError errorType   = ProcessError.GeneralFailure,
     int commandLevel         = -1,
     Exception innerException = null,
     params object[] metadata)
     : base(message)
 {
     ErrorType      = errorType;
     CommandLevel   = commandLevel;
     InnerException = innerException;
     Metadata       = metadata;
 }
Exemplo n.º 8
0
            public void Expected_OptionArgumentValue_AsNext_ButOptionOrSubCommand_Throws(
                string next, ProcessError expectedErrorType)
            {
                Action testCode = () =>
                {
                    RunInfoBuilder builder = GetBuilder();

                    builder.Commands.Add(new Command <TestRunInfo>
                    {
                        Key           = "command",
                        GlobalOptions =
                        {
                            new Option <TestRunInfo, int>
                            {
                                Key      = "int | i",
                                Property = ri => ri.Int1
                            },
                            new Option <TestRunInfo, int>
                            {
                                Key      = "int1 | j",
                                Property = ri => ri.Int2
                            }
                        },
                        SubCommands =
                        {
                            new SubCommand <TestRunInfo>
                            {
                                Key         = "subcommand1",
                                SubCommands =
                                {
                                    new SubCommand <TestRunInfo>
                                    {
                                        Key = "subcommand2"
                                    }
                                }
                            }
                        }
                    });

                    builder.Build(new string[] { "command", "subcommand1", "--int", next });
                };

                Exception exception = Record.Exception(testCode);

                var processException = exception as ProcessException;

                Assert.NotNull(processException);
                Assert.Equal(expectedErrorType, processException.ErrorType);
                Assert.Equal(1, processException.CommandLevel);
            }
Exemplo n.º 9
0
 public void AddStreamError(Dictionary <string, List <string> > dictionary)
 {
     using (TurbineModelContainer container = new TurbineModelContainer())
     {
         SinterProcess entity = container.SinterProcesses.Single <SinterProcess>(s => s.Id == id);
         ProcessError  error;
         foreach (KeyValuePair <String, List <String> > entry in dictionary)
         {
             foreach (String msg in entry.Value)
             {
                 error       = new ProcessError();
                 error.Type  = "stream";
                 error.Name  = entry.Key;
                 error.Error = msg;
                 entity.Errors.Add(error);
             }
         }
         container.SaveChanges();
     }
 }
Exemplo n.º 10
0
        /// <summary>
        /// Get the number of pin tries left. Your credit card may not support this command.
        /// Use GetData(DataType.PinTryCounter) instead if you get a -1 as answer
        /// </summary>
        /// <returns>the number of tries left or -1 if not successful</returns>
        public int GetPinTries()
        {
            int         tryLeft = -1;
            Span <byte> toSend  = stackalloc byte[5];

            ApduCommands.Verify.CopyTo(toSend);
            Span <byte> received = stackalloc byte[MaxBufferSize];
            var         ret      = ReadFromCard(_target, toSend, received);

            if (ret == TailerSize)
            {
                var err = new ProcessError(received.Slice(0, TailerSize));
                if ((err.ErrorType == ErrorType.StateNonVolatileMemoryChangedAuthenticationFailed) ||
                    (err.ErrorType == ErrorType.StateNonVolatileMemoryChanged))
                {
                    tryLeft = err.CorrectLegnthOrBytesAvailable;
                }
            }
            return(tryLeft);
        }
        public GetWapHitResponse GetWapHits(GetWapHitsRequest reqst)
        {
            DateTime kickoff = DateTime.Now;

            XmlConfigurator.Configure(new System.IO.FileInfo(ConfigurationManager.AppSettings["Log4NetConfigPath"]));

            GetWapHitResponse reply = new GetWapHitResponse();

            reply.Success = false;

            string ln = "";

            try
            {
                log.Info("GetWapHits Request. WapId: " + reqst.WapId + ". NumberOfLines: " + reqst.NumberOfLines + ".");

                string url = config.WapQueryUrl + "jackpothits?jpId=" + reqst.WapId + "&noOfRecords=" + reqst.NumberOfLines + "&orderedBy=time&format=json";

                System.Net.WebRequest webRequest = System.Net.WebRequest.Create(url);
                webRequest.Method = "GET";

                System.IO.Stream       objStream = webRequest.GetResponse().GetResponseStream();
                System.IO.StreamReader objReader = new System.IO.StreamReader(objStream);
                ln = objReader.ReadLine();

                jackpotHitsResponse results = new System.Web.Script.Serialization.JavaScriptSerializer().Deserialize <jackpotHitsResponse>(ln);

                reply.Success = true;

                reply.CalcTime  = results.calcTime.ToString();
                reply.IsCached  = results.isCached;
                reply.IsRunning = results.isRunning;

                if (results.oldResult != null)
                {
                    foreach (jackpotHitsResponseResultjackpotHits hit in results.oldResult)
                    {
                        reply.OldResults.Add(new WapJackpotHits
                        {
                            Amount                   = hit.amount,
                            CasinoGroup              = hit.casinoGroup,
                            CasinoName               = hit.casinoName,
                            GamingDay                = hit.gamingDay,
                            Info1                    = hit.info1,
                            Info2                    = hit.info2,
                            Instance                 = hit.instance,
                            InventoryNr              = hit.inventoryNr,
                            Jackpot                  = hit.jackpot,
                            JpId                     = hit.jpId,
                            MainAmount               = hit.mainAmount,
                            PaidAmount               = hit.paidAmount,
                            ParticipatingEgds        = hit.participatingEgds,
                            ParticipationEgdAmount   = hit.participationEgdAmount,
                            Position                 = hit.position,
                            PositionShort            = hit.positionShort,
                            Time                     = hit.time,
                            TotalParticipationAmount = hit.totalParticipationAmount
                        });
                    }
                }
                if (results.result != null)
                {
                    foreach (jackpotHitsResponseResultjackpotHits hit in results.result)
                    {
                        reply.Results.Add(new WapJackpotHits
                        {
                            Amount                   = hit.amount,
                            CasinoGroup              = hit.casinoGroup,
                            CasinoName               = hit.casinoName,
                            GamingDay                = hit.gamingDay,
                            Info1                    = hit.info1,
                            Info2                    = hit.info2,
                            Instance                 = hit.instance,
                            InventoryNr              = hit.inventoryNr,
                            Jackpot                  = hit.jackpot,
                            JpId                     = hit.jpId,
                            MainAmount               = hit.mainAmount,
                            PaidAmount               = hit.paidAmount,
                            ParticipatingEgds        = hit.participatingEgds,
                            ParticipationEgdAmount   = hit.participationEgdAmount,
                            Position                 = hit.position,
                            PositionShort            = hit.positionShort,
                            Time                     = hit.time,
                            TotalParticipationAmount = hit.totalParticipationAmount
                        });
                    }
                }
                if ((reply.OldResults == null || reply.OldResults.Count < 1) && (reply.Results == null || reply.Results.Count < 1))
                {
                    reply.Success = true;
                    reply.Errors.Add(new ProcessError {
                        ErrorMessage = "WapId not found"
                    });
                }
                else
                {
                    log.Info("Request fulfilled. (" + executionTime(new TimeSpan(DateTime.Now.Ticks - kickoff.Ticks)) + "ms)");
                }
            }
            catch (Exception excp)
            {
                log.Error("\nMessage:\n" + excp.Message + "\nresponse:\n" + ln + "\nStack Trace:\n" + excp.StackTrace);

                reply.Success = false;

                ProcessError err = new ProcessError();
                err.ErrorMessage = excp.Message;

                reply.Errors.Add(err);
                return(reply);
            }
            return(reply);
        }
Exemplo n.º 12
0
 protected virtual void OnProcessError(Exception e)
 {
     ProcessError?.Invoke(this, e);
 }
        public GetWapValueResponse GetWapVal(string WapId)
        {
            DateTime kickoff = DateTime.Now;

            XmlConfigurator.Configure(new System.IO.FileInfo(ConfigurationManager.AppSettings["Log4NetConfigPath"]));

            GetWapValueResponse reply = new GetWapValueResponse();

            reply.Success = false;

            string ln = "";

            try
            {
                log.Info("GetWapValues Request. WapId: " + WapId + ".");

                string url = config.WapQueryUrl + "onlinejackpotvalues?jpId=" + WapId + "&format=json";

                System.Net.WebRequest webRequest = System.Net.WebRequest.Create(url);
                webRequest.Method = "GET";

                System.IO.Stream       objStream = webRequest.GetResponse().GetResponseStream();
                System.IO.StreamReader objReader = new System.IO.StreamReader(objStream);
                ln = objReader.ReadLine();

                onlineJackpotValuesResponse results = new System.Web.Script.Serialization.JavaScriptSerializer().Deserialize <onlineJackpotValuesResponse>(ln);
                foreach (onlineJackpotValuesResponseResultonlineJackpotValues jackpotValue in results.result)
                {
                    if (jackpotValue.id == WapId)
                    {
                        reply.Detail = new WapValue();

                        reply.Detail.Id    = jackpotValue.id;
                        reply.Detail.Name  = jackpotValue.name;
                        reply.Detail.Value = jackpotValue.value;
                        reply.Detail.Error = jackpotValue.error;

                        reply.Success = true;
                        break;
                    }
                }
                if (reply.Detail == null)
                {
                    reply.Errors.Add(new ProcessError {
                        ErrorMessage = "WapId not found"
                    });
                }
                else
                {
                    log.Info("Request fulfilled. (" + executionTime(new TimeSpan(DateTime.Now.Ticks - kickoff.Ticks)) + "ms)");
                }
            }
            catch (Exception excp)
            {
                log.Error("\nMessage:\n" + excp.Message + "\nline:\n" + ln + "\nresponse:\n:" + ln + "\nStack Trace:\n" + excp.StackTrace);

                reply.Success = false;

                ProcessError err = new ProcessError();
                err.ErrorMessage = excp.Message;

                reply.Errors.Add(err);
                return(reply);
            }
            return(reply);
        }
        public GetPointsTranansactionResponse GetPointsTrans(GetPointsTransactionRequest reqst)
        {
            DateTime kickoff = DateTime.Now;

            XmlConfigurator.Configure(new System.IO.FileInfo(ConfigurationManager.AppSettings["Log4NetConfigPath"]));

            GetPointsTranansactionResponse reply = new GetPointsTranansactionResponse();

            try
            {
                log.Info("GetPointsTrans Request. Account Number: " + reqst.AcctNo + ". QueryDate: " + reqst.QueryDate.ToString("yyyy-MM-dd") + ". CasinoCode: " + reqst.CasinoCode);

                reply.Success = false;

                //lets call down to the unit
                log.Info("Calling remote property: " + reqst.CasinoCode + ".");
                using (SlotsInfoServiceClient service = new SlotsInfoServiceClient(reqst.CasinoCode + "BasicHttpBinding_SlotsInfoService"))
                {
                    svc.GetPointsTranRequest request = new svc.GetPointsTranRequest
                    {
                        AcctNo     = reqst.AcctNo,
                        QueryDate  = reqst.QueryDate,
                        CasinoCode = reqst.CasinoCode,
                        ZeroDate   = reqst.ZeroDate
                    };

                    svc.GetPointsTranResponse response = new svc.GetPointsTranResponse();
                    response = service.GetPointsTransaction(request);

                    reply.Success    = response.Success;
                    reply.PointsTran = new PointsTransaction
                    {
                        Date     = response.PointsTransaction.Date,
                        Property = response.PointsTransaction.Property,

                        //casino
                        EarnedCasino = response.PointsTransaction.EarnedCasino,
                        BonusCasino  = response.PointsTransaction.BonusCasino,
                        AdjPosCasino = response.PointsTransaction.AdjPosCasino,
                        RedeemCasino = response.PointsTransaction.RedeemCasino,
                        AdjNegCasino = response.PointsTransaction.AdjNegCasino,
                        ExpireCasino = response.PointsTransaction.ExpireCasino,

                        //leisure
                        EarnedLeisure = response.PointsTransaction.EarnedLeisure,
                        AdjPosLeisure = response.PointsTransaction.AdjPosLeisure,
                        RedeemLeisure = response.PointsTransaction.RedeemLeisure,
                        AdjNegLeisure = response.PointsTransaction.AdjNegLeisure,
                        ExpireLeisure = response.PointsTransaction.ExpireLeisure,

                        //tier credits
                        TierCredits = response.PointsTransaction.TierCredits
                    };

                    foreach (svc.ProcessError detail in response.Errors)
                    {
                        reply.Errors.Add(new ProcessError()
                        {
                            ErrorMessage = detail.ErrorMessage
                        });
                    }
                }

                log.Info("Request fulfilled. (" + executionTime(new TimeSpan(DateTime.Now.Ticks - kickoff.Ticks)) + "ms)");

                return(reply);
            }
            catch (Exception excp)
            {
                log.Error("\nMessage:\n" + excp.Message + "\nStack Trace:\n" + excp.StackTrace);

                reply.Success = false;

                ProcessError err = new ProcessError();
                err.ErrorMessage = excp.Message;

                reply.Errors.Add(err);
                return(reply);
            }
        }
Exemplo n.º 15
0
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="error">错误信息</param>
 public ProcessResult(ProcessError error)
     : this(default(T), error)
 {
 }
Exemplo n.º 16
0
 protected virtual void OnProcessError()
 {
     ProcessError?.Invoke(this, new ExecutableEventArgs(this));
 }
Exemplo n.º 17
0
 protected virtual void OnProcessError()
 {
     ProcessError?.Invoke(this, new EventArgs());
 }
Exemplo n.º 18
0
        private void cbTypProcesu_SelectedIndexChanged(object sender, EventArgs e)
        {
            processId = -1;
            string procType = cbTypProcesu.SelectedItem.ToString().Split(' ').First();

            List <List <string> > processInfo = gujacz2.ExecuteStoredProcedure("GetProcessByName", new string[] { procType }, DatabaseName.SupportCP);

            if (processInfo != null && processInfo.Count > 0)
            {
                processId = int.Parse(processInfo[0][0]);
            }
            else
            {
                return;
            }

            List <List <string> > topErrorSolution = gujacz2.ExecuteStoredProcedure("GetTopErrorAndSolutionForProcess", new string[] { processId.ToString(), "-1" }, DatabaseName.SupportCP);

            int topError = -1;

            //int topSolution = -1;
            try
            {
                topError = int.Parse(topErrorSolution[0][1]);
                //topSolution = int.Parse(topErrorSolution[0][2]);
            }
            catch
            { }

            List <List <string> > errorsData = gujacz2.ExecuteStoredProcedure("GetErrorsForProcess", new string[] { processId.ToString() }, DatabaseName.SupportCP);

            foreach (var a in errorsData)
            {
                Entities.ProcessError error = new ProcessError();
                error.id              = int.Parse(a[0]);
                error.idErrorType     = int.Parse(a[1]);
                error.description     = a[2];
                error.descriptionFull = a[3];
                errors.Add(error);
            }


            cbBlad.Items.Clear();
            foreach (Entities.ProcessError er in errors)
            {
                cbBlad.Items.Add(er.description);
            }

            if (topErrorSolution.Count > 0)
            {
                cbBlad.SelectedItem = errors.Where(x => x.id == int.Parse(topErrorSolution[0][1])).FirstOrDefault().description;

                Entities.ProcessError errorInfo   = errors.Where(x => x.description == cbBlad.SelectedItem.ToString()).First();
                List <List <string> > topSolution = gujacz2.ExecuteStoredProcedure("GetTopErrorAndSolutionForProcess", new string[] { processId.ToString(), errorInfo.id.ToString() }, DatabaseName.SupportCP);


                cbRozwiazanie.SelectedItem = solutions.Where(x => x.id == int.Parse(topSolution[0][2])).FirstOrDefault().nameCP;
            }

            dodatkoweDane[2] = ((Entities.BillingDthLBItem)cbTypProcesu.SelectedItem).Value;
            dodatkoweInfo();
        }
        public GetGameCelebrationsResponse GetGameCelebrationsByMachine(GetGameCelebrationsMachineRequest reqst)
        {
            DateTime kickoff = DateTime.Now;

            XmlConfigurator.Configure(new System.IO.FileInfo(config.Log4NetConfigPath));

            GetGameCelebrationsResponse reply = new GetGameCelebrationsResponse();

            reply.Payouts = new GameCelebrationsList();

            try
            {
                log.Info("GetGameCelebrationsByMachine(" + reqst.MachineNo + ")Above(" + reqst.Amount + ") Request.");

                using (SlotsInfoServiceClient service = new SlotsInfoServiceClient(reqst.Casino + "BasicHttpBinding_SlotsInfoService"))
                {
                    svc.GetGameCelebrationsMachineRequest request = new svc.GetGameCelebrationsMachineRequest();
                    request.MachineNo     = reqst.MachineNo;
                    request.Amount        = reqst.Amount;
                    request.NumberOfLines = reqst.NumberOfLines;

                    svc.GetGameCelebrationsResponse response = new svc.GetGameCelebrationsResponse();
                    response = service.GetGameCelebrationsByMachine(request);

                    reply.Success = response.Success;
                    if (response.Payouts != null)
                    {
                        foreach (svc.GameCelebrationsDetail detail in response.Payouts)
                        {
                            reply.Payouts.Add(new GameCelebrationsHits
                            {
                                Amount      = detail.Amount,
                                SlotMachine = detail.SlotMachine,
                                HitDate     = detail.HitDate
                            });
                        }
                    }
                    foreach (svc.ProcessError detail in response.Errors)
                    {
                        reply.Errors.Add(new ProcessError()
                        {
                            ErrorMessage = detail.ErrorMessage
                        });
                    }
                }

                log.Info("Request fulfilled. (" + executionTime(new TimeSpan(DateTime.Now.Ticks - kickoff.Ticks)) + "ms)");

                reply.Success = true;
                return(reply);
            }
            catch (Exception excp)
            {
                log.Error("\nMessage:\n" + excp.Message + "\nStack Trace:\n" + excp.StackTrace);

                reply.Success = false;

                ProcessError err = new ProcessError();
                err.ErrorMessage = excp.Message;

                reply.Errors.Add(err);
                return(reply);
            }
        }
Exemplo n.º 20
0
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="data">执行结果</param>
 /// <param name="error">错误信息</param>
 public ProcessResult(T data, ProcessError error)
 {
     this._data  = data;
     this._error = error;
 }
Exemplo n.º 21
0
        private static Dictionary <string, object> GetJobRepresentation(Turbine.Data.Entities.Job entity, bool verbose)
        {
            var    dict  = new Dictionary <string, Object>();
            string input = entity.Process.Input;
            IDictionary <string, Object> inputDict = new Dictionary <string, Object>()
            {
            };

            if (input != null)
            {
                inputDict = Newtonsoft.Json.JsonConvert.DeserializeObject <Dictionary <string, Object> >(input);
            }

            string output = entity.Process.Output;
            IDictionary <string, Object> outputDict = null;

            if (output != null)
            {
                outputDict = Newtonsoft.Json.JsonConvert.DeserializeObject <Dictionary <string, Object> >(output);
            }

            string[] msg_array = null;
            if (verbose)
            {
                msg_array = entity.Messages.Select <Turbine.Data.Entities.Message, string>(s => s.Value).ToArray <string>();
            }

            /*
             * Serialize.ProcessErrorList errorList = new Serialize.ProcessErrorList();
             *
             * foreach (var error in entity.Process.Errors)
             * {
             *  var pe = new Serialize.ProcessError();
             *  pe.Error = error.Error;
             *  pe.Type = error.Type;
             *  pe.Name = error.Name;
             *  errorList.Add(pe);
             * }
             */
            ProcessErrorList errorList = new ProcessErrorList();

            foreach (var error in entity.Process.Error)
            {
                var pe = new ProcessError()
                {
                    Error = error.Error, Name = error.Name, Type = error.Type
                };
                errorList.Add(pe);
            }
            int status;

            try
            {
                status = (int)entity.Process.Status;
            }
            catch (Exception)
            {
                status = -1;
            }

            dict["Id"]         = entity.Count;
            dict["Guid"]       = entity.Id;
            dict["Simulation"] = entity.Simulation.Name;
            dict["State"]      = entity.State;
            dict["Messages"]   = msg_array;
            dict["Input"]      = inputDict;
            dict["Output"]     = outputDict;
            dict["Errors"]     = errorList;
            dict["Status"]     = status;
            dict["Session"]    = entity.Session.Id;
            dict["Initialize"] = entity.Initialize;
            dict["Reset"]      = entity.Reset;
            dict["Visible"]    = entity.Visible;

            if (entity.Consumer != null)
            {
                dict["Consumer"] = entity.Consumer.Id;
            }
            if (entity.Create != null)
            {
                dict["Create"] = ConvertDateTime((DateTime)entity.Create);
            }
            if (entity.Submit != null)
            {
                dict["Submit"] = ConvertDateTime((DateTime)entity.Submit);
            }
            if (entity.Setup != null)
            {
                dict["Setup"] = ConvertDateTime((DateTime)entity.Setup);
            }
            if (entity.Running != null)
            {
                dict["Running"] = ConvertDateTime((DateTime)entity.Running);
            }
            if (entity.Finished != null)
            {
                dict["Finished"] = ConvertDateTime((DateTime)entity.Finished);
            }

            return(dict);
        }
Exemplo n.º 22
0
        public ErrorPathInfo(IPathInfo path, ProcessError error)
        {
            Path = path;

            Error = error;
        }
Exemplo n.º 23
0
 protected void OnProcessError(DownloadErrorEventArgs e)
 {
     ProcessError?.Invoke(this, e);
     DownloadsUpdated?.Invoke(this);
 }
 private void OnProcessError(LookupValuesProcessorErrorEventArgs eventArgs)
 {
     ProcessError?.Invoke(this, eventArgs);
 }