Exemple #1
0
        public override int?Save(string action)
        {
            var data = new TaskPriorityXApplicationUserDataManager.Data();

            data.TaskPriorityXApplicationUserId = TaskPriorityXApplicationUserId;
            data.TaskId             = TaskId;
            data.ApplicationUserId  = ApplicationUserId;
            data.TaskPriorityTypeId = TaskPriorityTypeId;

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

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

            return(TaskPriorityXApplicationUserId);
        }