internal void AddAssignment(Guid id, Assignment a, string action)
        {
            // Make sure there isn't one already here
            _object.Remove(id);
            _action.Remove(id);

            _object.Add(id, a);
            _action.Add(id, action);
        }
        protected override void Execute(CodeActivityContext context)
        {
            // Create an Assignment class and populate its properties
            Assignment a = new Assignment();

            a.WorkflowID = context.WorkflowInstanceId;
            a.LeadID = LeadID.Get(context);
            a.DateAssigned = DateTime.Now;
            a.AssignedTo = AssignedTo.Get(context);
            a.Status = "Assigned";
            a.DateDue = DateTime.Now + TimeSpan.FromDays(5);

            PersistAssignment persist = context.GetExtension<PersistAssignment>();
            persist.AddAssignment(context.WorkflowInstanceId, a, "Insert");

            // Store the request in the OutArgument
            Assignment.Set(context, a);
        }
        private void UpdateControls(Assignment a)
        {
            lblSelectedNotes.Content = a.Lead.Comments;
            lblSelectedNotes.Visibility = Visibility.Visible;

            lblDateAssigned.Content = a.DateAssigned.ToShortDateString();

            if (a.DateDue.HasValue)
                lblDateDue.Content = a.DateDue.Value.ToShortDateString();
            else
                lblDateDue.Content = "";

            if (a.DateCompleted.HasValue)
                lblDateCompleted.Content
                    = a.DateCompleted.Value.ToShortDateString();
            else
                lblDateCompleted.Content = "";

            txtRemarks.Visibility = Visibility.Visible;
            txtRemarks.Text = a.Remarks;

            if (a.Status == "Assigned")
            {
                btnComplete.Visibility = Visibility.Visible;
                txtRemarks.IsReadOnly = false;
            }
            else
            {
                btnComplete.Visibility = Visibility.Hidden;
                txtRemarks.IsReadOnly = true;
            }
        }
        public void UpdateAssignment(Assignment assignment)
        {
            // Find the row that matches this record
            int nSelected = -1;
            for (int i = 0; i < lstLeads.Items.Count; i++)
            {
                Assignment a = lstLeads.Items[i] as Assignment;
                if (a.AssignmentID == assignment.AssignmentID)
                {
                    nSelected = i;
                    break;
                }
            }

            // Update the grid
            if (nSelected >= 0)
            {
                lstLeads.Items[nSelected] = assignment;
                lstLeads.Items.Refresh();

                UpdateControls(assignment);
            }
        }
        public void AddAssignment(Assignment a)
        {
            LeadDataDataContext dc = new LeadDataDataContext(_connectionString);

            dc.Refresh(RefreshMode.OverwriteCurrentValues, dc.Leads);
            Assignment aTmp = dc.Assignments
                .SingleOrDefault<Assignment>
                    (x => x.AssignmentID == a.AssignmentID);

            if (aTmp != null)
                this.lstLeads.Items.Add(aTmp);
        }
 partial void DeleteAssignment(Assignment instance);
 partial void UpdateAssignment(Assignment instance);
 partial void InsertAssignment(Assignment instance);