Beispiel #1
0
        protected override void Execute(CodeActivityContext context)
        {
            // Open the config file and get the connection string
            Configuration            config = WebConfigurationManager.OpenWebConfiguration("/RequestWeb");
            ConnectionStringsSection css    =
                (ConnectionStringsSection)config.GetSection("connectionStrings");
            string connectionString = css.ConnectionStrings["Request"].ConnectionString;

            // Lookup the Request
            RequestDataContext dc = new RequestDataContext(connectionString);
            Request            r  = dc.Requests.SingleOrDefault(x => x.RequestKey == RequestKey.Get(context));

            if (r == null)
            {
                throw new InvalidProgramException("The specified request (" + RequestKey.Get(context) + ") was not found");
            }

            r.QC               = true;
            r.AssignedDate     = DateTime.UtcNow;
            r.AssignedOperator = null;

            // Update the Request record
            PersistRequest persist = context.GetExtension <PersistRequest>();

            persist.AddRequest(r);
        }
Beispiel #2
0
        protected override void Execute(CodeActivityContext context)
        {
            // Get the connection string
            DBConnection ext = context.GetExtension <DBConnection>();

            if (ext == null)
            {
                throw new InvalidProgramException("No connection string available");
            }

            // Lookup the Request
            RequestDataContext dc = new RequestDataContext(ext.ConnectionString);
            Request            r  = dc.Requests.SingleOrDefault(x => x.RequestKey == RequestKey.Get(context));

            if (r == null)
            {
                throw new InvalidProgramException("The specified request (" + RequestKey.Get(context) + ") was not found");
            }

            // Update the Request record
            r.ActionTaken = ActionTaken.Get(context);
            r.RouteNext   = RouteNext.Get(context);

            PersistRequest persist = context.GetExtension <PersistRequest>();

            persist.AddRequest(r);

            context.SetValue(Request, r);
        }
Beispiel #3
0
        protected override void Execute(CodeActivityContext context)
        {
            // Open the config file and get the connection string
            Configuration            config = WebConfigurationManager.OpenWebConfiguration("/RequestWeb");
            ConnectionStringsSection css    =
                (ConnectionStringsSection)config.GetSection("connectionStrings");
            string connectionString = css.ConnectionStrings["Request"].ConnectionString;

            // Lookup the Queue
            RequestDataContext dc = new RequestDataContext(connectionString);
            Queue  q     = null;
            string queue = QueueName.Get(context);

            if (queue != null && queue.Length > 0 && queue != "None")
            {
                q = dc.Queues.SingleOrDefault(x => x.QueueName == QueueName.Get(context));
                if (q == null)
                {
                    throw new InvalidProgramException("The specified queue (" + QueueName.Get(context) + ") was not found");
                }
            }

            // Lookup the Request
            Request r = dc.Requests.SingleOrDefault(x => x.RequestKey == RequestKey.Get(context));

            if (r == null)
            {
                throw new InvalidProgramException("The specified request (" + RequestKey.Get(context) + ") was not found");
            }

            if (q != null)
            {
                r.CurrentQueueID   = q.QueueID;
                r.AssignedDate     = DateTime.UtcNow;
                r.AssignedOperator = null;
            }
            else
            {
                r.CurrentQueueID   = null;
                r.AssignedDate     = null;
                r.AssignedOperator = null;
            }

            // Update the Request record
            PersistRequest persist = context.GetExtension <PersistRequest>();

            persist.AddRequest(r);
        }
Beispiel #4
0
        protected override void Execute(CodeActivityContext context)
        {
            // Get the connection string
            DBConnection ext = context.GetExtension <DBConnection>();

            if (ext == null)
            {
                throw new InvalidProgramException("No connection string available");
            }

            // Lookup the Request
            RequestDataContext dc = new RequestDataContext(ext.ConnectionString);
            Request            r  = dc.Requests.SingleOrDefault(x => x.RequestKey == RequestKey.Get(context));

            if (r == null)
            {
                throw new InvalidProgramException("The specified request (" + RequestKey.Get(context) + ") was not found");
            }

            context.SetValue(Request, r);
            context.SetValue(QueueInstanceKey, r.QueueInstanceKey);
        }
Beispiel #5
0
        protected override void Execute(CodeActivityContext context)
        {
            // Open the config file and get the connection string
            Configuration            config = WebConfigurationManager.OpenWebConfiguration("/RequestWeb");
            ConnectionStringsSection css    =
                (ConnectionStringsSection)config.GetSection("connectionStrings");
            string connectionString = css.ConnectionStrings["Request"].ConnectionString;

            // Lookup the Queue
            RequestDataContext dc = new RequestDataContext(connectionString);

            // Lookup the Request
            dc.Refresh(System.Data.Linq.RefreshMode.OverwriteCurrentValues, dc.Requests);
            Request r = dc.Requests.SingleOrDefault(x => x.RequestKey == RequestKey.Get(context));

            if (r == null)
            {
                throw new InvalidProgramException("The specified request (" + RequestKey.Get(context) + ") was not found");
            }

            if (r.AssignedOperator != null)
            {
                if (r.AssignedOperator != OperatorID.Get(context))
                {
                    Result.Set(context, -1);
                    return;
                }
            }

            r.AssignedOperator = OperatorID.Get(context);
            r.AssignedDate     = DateTime.UtcNow;

            // Update the Request record
            PersistRequest persist = context.GetExtension <PersistRequest>();

            persist.AddRequest(r);

            Result.Set(context, 0);
        }