Ejemplo n.º 1
0
        public override int?Save(string action)
        {
            var data = new TaskAlgorithmItemDataModel();

            data.TaskAlgorithmItemId = TaskAlgorithmItemId;
            data.TaskAlgorithmId     = TaskAlgorithmId;
            data.ActivityId          = ActivityId;
            data.Description         = Description;
            data.SortOrder           = SortOrder;

            if (action == "Insert")
            {
                var dtTaskAlgorithmItem = TaskAlgorithmItemDataManager.DoesExist(data, SessionVariables.RequestProfile);

                if (dtTaskAlgorithmItem.Rows.Count == 0)
                {
                    TaskAlgorithmItemDataManager.Create(data, SessionVariables.RequestProfile);
                }
                else
                {
                    throw new Exception("Record with given ID already exists.");
                }
            }
            else
            {
                TaskAlgorithmItemDataManager.Update(data, SessionVariables.RequestProfile);
            }

            return(TaskAlgorithmItemId);
        }