Exemplo n.º 1
0
        public Boolean Update()
        {
            Boolean success = false;
            DataLayer.MSSQL mssql = null;
            try
            {
                mssql = new DataLayer.MSSQL(ConnectionString);
                QueueId = mssql.ExecuteScalar(StoredProcedures.Queues_Update.ToString(),
                    "@QueueId", QueueId,
                    "@ServerId", ServerId,
                    "@Error,", Error,
                    "@Priority", Priority,
                    "@Status", Status,
                    "@Url", Url,
                    "@DequeuedOn", DequeuedOn,
                    "@StartedOn", StartedOn,
                    "@DownloadedOn", DownloadedOn,
                    "@ParsedOn", ParsedOn,
                    "@FinishedOn", FinishedOn,
                    "@Attempt", Attempt,
                    "@Results", Results);
                success = QueueId > 0;
            }
            catch (Exception ex) { throw new Exceptions.BusinessLogicException("Error saving queue.", ex); }
            finally { if (mssql != null) mssql.Dispose(); }

            return success;
        }
Exemplo n.º 2
0
        public bool ByQueueId(long queueId)
        {
            bool success = false;
            DataRow row = null;
            DataLayer.MSSQL mssql = null;

            try
            {
                mssql = new DataLayer.MSSQL(ConnectionString);
                row = mssql.GetDataRow(StoredProcedures.Queues_Select_ByQueueId.ToString(),
                    "@QueueId", queueId);
                if (row != null)
                    success = row.TryParse<Queue>(this) && QueueId > 0;
            }
            catch (Exception ex) { throw new Exceptions.BusinessLogicException("Error loading queue.", ex); }
            finally { if (mssql != null) mssql.Dispose(); }
            return success;
        }
Exemplo n.º 3
0
        public Boolean Update()
        {
            Boolean success = false;
            DataLayer.MSSQL mssql = null;
            try
            {
                mssql = new DataLayer.MSSQL(ConnectionString);
                LeadId = mssql.ExecuteScalar(StoredProcedures.Leads_Insert.ToString(),
                    "@LeadId", LeadId,
                    "@Slogan", Slogan,
                    "@Website", Website,
                    "@Creative", Creative,
                    "@PhoneNumber", PhoneNumber,
                    "@Address,", Address,
                    "@Link", Link,
                    "@Latitude", Latitude,
                    "@Longitude", Longitude,
                    "@QueueId", QueueId);
                success = LeadId > 0;
            }
            catch (Exception ex) { throw new Exceptions.BusinessLogicException("Error saving lead.", ex); }
            finally { if (mssql != null) mssql.Dispose(); }

            return success;
        }
Exemplo n.º 4
0
        public static IEnumerable<Queue> SelectNext(int serverId, string connectionString)
        {
            IEnumerable<Queue> queues = null;
            DataTable table = null;
            DataLayer.MSSQL mssql = null;

            try
            {
                mssql = new DataLayer.MSSQL(connectionString);
                table = mssql.GetDataTable(StoredProcedures.Queues_Select_Next.ToString(), "@ServerId", serverId);
                if (table != null)
                    queues = table.Rows.Select<Queue>(new object[] { connectionString });

            }
            catch (Exception ex) { throw new Exceptions.BusinessLogicException("Error loading queue.", ex); }
            finally { if (mssql != null) mssql.Dispose(); }

            return queues;
        }
Exemplo n.º 5
0
        public static IEnumerable<Lead> ByQueueId(long queueId, string connectionString)
        {
            IEnumerable<Lead> leads = null;
            DataTable table = null;
            DataLayer.MSSQL mssql = null;

            try
            {
                mssql = new DataLayer.MSSQL(connectionString);
                table = mssql.GetDataTable(StoredProcedures.Leads_Select_ByQueueId.ToString(), "@QueueId", queueId);
                if (table != null)
                    leads = table.Rows.Select<Lead>(new object[] { connectionString });

            }
            catch (Exception ex) { throw new Exceptions.BusinessLogicException("Error loading leads.", ex); }
            finally { if (mssql != null) mssql.Dispose(); }

            return leads;
        }