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); }
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); }
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"); } RequestDataContext dc = new RequestDataContext(ext.ConnectionString); // Create and initialize a Request object Request r = new Request(); r.UserName = UserName.Get(context); r.UserEmail = UserEmail.Get(context); r.RequestType = RequestType.Get(context); r.Comment = Comment.Get(context); r.CreateDate = DateTime.UtcNow; r.RequestKey = RequestKey.Get(context); r.QueueInstanceKey = QueueInstanceKey.Get(context); // Insert the Request record PersistRequest persist = context.GetExtension <PersistRequest>(); persist.AddRequest(r); }
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); }
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); }