public virtual void Validate(ProcessQueueState item) { string strMsg = string.Empty; if (item.Process.Id <= 0) { strMsg += "FeedId Id nao pode ser menor ou igual a zero." + Environment.NewLine; } if (strMsg != string.Empty) { throw new TebaldiMarketDataException(strMsg); } }
public List <ProcessQueueState> GetQueue(DateTime?dtAgendadaMax, bool?executado, bool?activeFeeds) { IDbCommand cmd; string strSQL; Tebaldi.MarketData.Models.State.ProcessQueueState obj = new ProcessQueueState(); strSQL = "procGetProcessQueue"; cmd = DataLayer.CreateCommand(strSQL, mstrConnectString); cmd.CommandType = CommandType.StoredProcedure; if (dtAgendadaMax != null) { cmd.Parameters.Add(DataLayer.CreateParameter("@dt_agd_max", DbType.DateTime, dtAgendadaMax, mstrConnectString)); } if (executado != null) { cmd.Parameters.Add(DataLayer.CreateParameter("@executado", DbType.Boolean, executado, mstrConnectString)); } if (activeFeeds != null) { cmd.Parameters.Add(DataLayer.CreateParameter("@activeFeeds", DbType.Boolean, activeFeeds, mstrConnectString)); } DataSet ds = DataLayer.GetDataSet(cmd, mstrConnectString); List <ProcessQueueState> lstQueue = (from dr in ds.Tables[0].AsEnumerable() select new State.ProcessQueueState() { QueueId = Convert.ToInt32(dr[obj.Schema.QueueId]), Process = new ImportProcessState { Id = Convert.ToInt32(dr[obj.Schema.ProcessId]), Active = Convert.ToBoolean(dr[obj.Process.Schema.ObjectName + "." + obj.Process.Schema.Active]), AutoQueue = Convert.ToBoolean(dr[obj.Process.Schema.ObjectName + "." + obj.Process.Schema.AutoQueue]), Feed = new FeedState { ID = Convert.ToInt32(dr[obj.Process.Schema.ObjectName + "." + obj.Process.Schema.FeedId]), }, Name = Convert.ToString(dr[obj.Process.Schema.ObjectName + "." + obj.Process.Schema.Name]) }, DataAgendada = Convert.ToDateTime(dr[obj.Schema.DataAgendada]), DataExecucao = dr[obj.Schema.DataExecucao] == DBNull.Value ? DateTime.MinValue : Convert.ToDateTime(dr[obj.Schema.DataExecucao]), DataReferencia = Convert.ToDateTime(dr[obj.Schema.DataReferencia]), Executado = Convert.ToBoolean(dr[obj.Schema.Executado]), Success = Convert.ToBoolean(dr[obj.Schema.Success]) }).ToList(); FeedHandler feed_handller = new FeedHandler(mstrConnectString); foreach (ProcessQueueState item in lstQueue) { item.Process.Feed = feed_handller.GetFeed(item.Process.Feed.ID); } return(lstQueue); }