public void Save(int workFlowUserAssignmentActionID)
        {
            using (var db = new CRMDb())
            {
                if (this.RoundRobinContactAssignmentID == 0)
                {
                    var assignment = GetObject();
                    assignment.WorkFlowUserAssignmentActionID = workFlowUserAssignmentActionID;

                    db.RoundRobinAssignment.Add(assignment);
                    db.SaveChanges();
                }
                else
                {
                    var assignment = GetObject();
                    if (workFlowUserAssignmentActionID != 0)
                    {
                        assignment.WorkFlowUserAssignmentActionID = workFlowUserAssignmentActionID;

                        db.Entry(assignment).State = System.Data.Entity.EntityState.Modified;
                        db.SaveChanges();
                    }
                }
            }
        }
 public override void Save(CRMDb db)
 {
     if (WorkflowDelayTimerActionID == 0)
     {
         db.WorkFlowDelayTimerActions.Add(this);
     }
     else
     {
         db.Entry(this).State = EntityState.Modified;
     }
 }
 public override void Save(CRMDb db)
 {
     if (WorkFlowUserAssignmentActionID == 0)
     {
         db.WorkflowUserAssignmentActions.Add(this);
     }
     else
     {
         var  assignmentsActions = db.WorkflowUserAssignmentActions.AsNoTracking().Where(w => w.WorkFlowUserAssignmentActionID == WorkFlowUserAssignmentActionID).FirstOrDefault();
         bool isScheduleChanged  = assignmentsActions != null ? assignmentsActions.ScheduledID != this.ScheduledID : false;
         if (isScheduleChanged)
         {
             var oldAssignments = db.RoundRobinAssignment.Where(w => w.WorkFlowUserAssignmentActionID == WorkFlowUserAssignmentActionID);
             foreach (var oa in oldAssignments)
             {
                 db.Entry(oa).State = System.Data.Entity.EntityState.Deleted;
             }
         }
         db.Entry(this).State = EntityState.Modified;
     }
 }
 public override void Save(CRMDb db)
 {
     if (TriggerWorkflowActionID == 0)
     {
         var triggerWorkflowDb = this;
         db.TriggerWorkflowActions.Add(triggerWorkflowDb);
     }
     else
     {
         db.Entry(this).State = EntityState.Modified;
     }
 }
 public override void Save(CRMDb db)
 {
     if (WorkflowLifeCycleActionID == 0)
     {
         if (this.LifecycleDropdownValueID > 0)
         {
             db.WorkflowLifeCycleActions.Add(this);
         }
     }
     else
     {
         db.Entry(this).State = EntityState.Modified;
     }
 }
Example #6
0
 public override void Save(CRMDb db)
 {
     if (WorkflowContactFieldActionID == 0)
     {
         if ((this.FieldID.HasValue && this.FieldID.Value > 0) || (this.DropdownValueID.HasValue && this.DropdownValueID.Value > 0))
         {
             db.WorkflowContactFieldActions.Add(this);
         }
     }
     else
     {
         db.Entry(this).State = EntityState.Modified;
     }
 }
 public override void Save(CRMDb db)
 {
     if (WorkflowTagActionID == 0)
     {
         if (this.TagID > 0)
         {
             db.WorkflowTagActions.Add(this);
         }
     }
     else
     {
         db.Entry(this).State = EntityState.Modified;
     }
 }
        public override void Save(CRMDb db)
        {
            if (WorkFlowEmailNotificationActionID == 0)
            {
                if (this.FromEmailID > 0)
                {
                    db.WorkflowEmailNotificationAction.Add(this);
                }
            }

            else
            {
                db.Entry(this).State = EntityState.Modified;
            }
        }
Example #9
0
 public void Save(CRMDb db)
 {
     try
     {
         if (WorkflowActionID == 0)
         {
             db.WorkflowActions.Add(this);
         }
         else
         {
             db.Entry(this).State = EntityState.Modified;
         }
     }
     catch (Exception ex)
     {
         Logger.Current.Error("Error while saving action", ex);
         ex.Data.Clear();
         ex.Data.Add("Workflow", WorkflowID);
     }
 }