Exemplo n.º 1
0
        public static bool DeleteGoal(Goal goal)
        {
            bool returnValue = false;

            List<IBaseQueryData> queryDatum = new List<IBaseQueryData>();

            IBaseQueryData queryData = new DeleteQueryData();
            queryData.TableName = "PLN_GoalCategories";
            queryData.KeyFields.Add(new FieldData { FieldName = "GoalID", FieldType = SqlDbType.Int, FieldValue = goal.GoalID.ToString() });
            queryDatum.Add(queryData);

            queryData = new DeleteQueryData();
            queryData.TableName = "PLN_GoalSteps";
            queryData.KeyFields.Add(new FieldData { FieldName = "GoalID", FieldType = SqlDbType.Int, FieldValue = goal.GoalID.ToString() });
            queryDatum.Add(queryData);

            queryData = new DeleteQueryData();
            queryData.TableName = "PLN_Goals";
            queryData.KeyFields.Add(new FieldData { FieldName = "GoalID", FieldType = SqlDbType.Int, FieldValue = goal.GoalID.ToString() });
            queryDatum.Add(queryData);

            returnValue = SQLWrapper.ExecuteQuery(queryDatum);

            if (goal.Steps != null)
            {
                for (int i = 0; i <= goal.Steps.Count - 1; i++)
                {
                    DALTask.DeleteTask(goal.Steps[i].taskInfo);
                }
            }

            return returnValue;
        }
Exemplo n.º 2
0
        public static bool DeleteBigRock(BigRock bigRock)
        {
            bool returnValue = false;

            List<IBaseQueryData> queryDatum = new List<IBaseQueryData>();

            DeleteQueryData queryData = new DeleteQueryData();
            queryData.TableName = "PLN_BigRocks";
            queryData.KeyFields.Add(new FieldData { FieldName = "BigRockID", FieldType = SqlDbType.Decimal, FieldValue = bigRock.BigRockID.ToString() });
            queryDatum.Add(queryData);

            returnValue = SQLWrapper.ExecuteQuery(queryDatum);

            return returnValue;
        }
Exemplo n.º 3
0
        public static bool DeleteDailyNote(DailyNote dailyNote)
        {
            bool returnValue = false;

            List<IBaseQueryData> queryDatum = new List<IBaseQueryData>();

            DeleteQueryData queryData =  new DeleteQueryData();
            queryData.TableName = "CMN_DailyNotes";
            queryData.KeyFields.Add(new FieldData { FieldName = "ForDate", FieldType = SqlDbType.Date, FieldValue = dailyNote.ForDate.ToString(Constants.DATE_FORMAT_SQL) });
            queryData.KeyFields.Add(new FieldData { FieldName = "UserId", FieldType = SqlDbType.Int, FieldValue = dailyNote.ForUser.UserID.ToString() });
            queryDatum.Add(queryData);

            returnValue = SQLWrapper.ExecuteQuery(queryDatum);

            return returnValue;
        }
Exemplo n.º 4
0
        public static bool DeleteGoalStep(GoalStep goalStep)
        {
            bool returnValue = false;

            List<IBaseQueryData> queryDatum = new List<IBaseQueryData>();

            IBaseQueryData queryData = new DeleteQueryData();
            queryData.TableName = "PLN_GoalSteps";
            queryData.KeyFields.Add(new FieldData { FieldName = "GoalStepID", FieldType = SqlDbType.Int, FieldValue = goalStep.GoalStepID.ToString() });
            queryDatum.Add(queryData);

            SQLWrapper.ExecuteQuery(queryDatum);

            DALTask.DeleteTask(goalStep.taskInfo);

            return returnValue;
        }
Exemplo n.º 5
0
        public static bool DeleteValue(Value value)
        {
            bool returnValue = false;

            List<IBaseQueryData> queryDatum = new List<IBaseQueryData>();

            DeleteQueryData queryData = new DeleteQueryData();
            queryData.TableName = "PLN_ValueCategories";
            queryData.KeyFields.Add(new FieldData { FieldName = "ValueID", FieldType = SqlDbType.Int, FieldValue = value.ValueID.ToString() });
            queryDatum.Add(queryData);

            queryData = new DeleteQueryData();
            queryData.TableName = "PLN_Values";
            queryData.KeyFields.Add(new FieldData { FieldName = "ValueID", FieldType = SqlDbType.Int, FieldValue = value.ValueID.ToString() });
            queryDatum.Add(queryData);

            returnValue = SQLWrapper.ExecuteQuery(queryDatum);

            return returnValue;
        }
Exemplo n.º 6
0
        public static bool DeleteCompassRole(CompassRole CompassRole)
        {
            bool returnValue = false;

            List<IBaseQueryData> queryDatum = new List<IBaseQueryData>();

            DeleteQueryData queryData = new DeleteQueryData();
            queryData.TableName = "PLN_BigRocks";
            queryData.KeyFields.Add(new FieldData { FieldName = "CompassRoleID", FieldType = SqlDbType.Int, FieldValue = CompassRole.CompassRoleID.ToString() });
            queryDatum.Add(queryData);

            queryData = new DeleteQueryData();
            queryData.TableName = "PLN_CompassRoles";
            queryData.KeyFields.Add(new FieldData { FieldName = "CompassRoleID", FieldType = SqlDbType.Int, FieldValue = CompassRole.CompassRoleID.ToString() });
            queryDatum.Add(queryData);

            returnValue = SQLWrapper.ExecuteQuery(queryDatum);

            return returnValue;
        }
Exemplo n.º 7
0
        public static bool DeleteMission(Mission mission)
        {
            bool returnValue = false;

            List<IBaseQueryData> queryDatum = new List<IBaseQueryData>();

            DeleteQueryData queryData = new DeleteQueryData();
            queryData.TableName = "PLN_MissionCategories";
            queryData.KeyFields.Add(new FieldData { FieldName = "MissionID", FieldType = SqlDbType.Int, FieldValue = mission.MissionID.ToString() });
            queryDatum.Add(queryData);

            queryData = new DeleteQueryData();
            queryData.TableName = "PLN_Missions";
            queryData.KeyFields.Add(new FieldData { FieldName = "MissionID", FieldType = SqlDbType.Int, FieldValue = mission.MissionID.ToString() });
            queryDatum.Add(queryData);

            returnValue = SQLWrapper.ExecuteQuery(queryDatum);

            return returnValue;
        }
Exemplo n.º 8
0
        public static bool UpdateGoal(Goal goal)
        {
            bool returnValue = false;
            List<IBaseQueryData> queryDatum = new List<IBaseQueryData>();

            IBaseQueryData queryData = new UpdateQueryData();
            queryData.TableName = "PLN_Goals";
            queryData.Fields.Add(new FieldData { FieldName = "GoalID", FieldType = SqlDbType.Int, FieldValue = goal.GoalID.ToString() });
            queryData.Fields.Add(new FieldData { FieldName = "UserId", FieldType = SqlDbType.Int, FieldValue = goal.ForUser.UserID.ToString() });
            queryData.Fields.Add(new FieldData { FieldName = "IsCompleted", FieldType = SqlDbType.Bit, FieldValue = goal.IsCompleted ? "1" : "0" });
            queryData.Fields.Add(new FieldData { FieldName = "GoalSubject", FieldType = SqlDbType.NVarChar, FieldValue = goal.GoalSubject.Trim() });
            queryData.Fields.Add(new FieldData { FieldName = "GoalReason", FieldType = SqlDbType.NVarChar, FieldValue = goal.GoalReason.Trim() });
            queryData.Fields.Add(new FieldData { FieldName = "GoalNotes", FieldType = SqlDbType.NVarChar, FieldValue = goal.GoalNotes.Trim() });
            queryData.Fields.Add(new FieldData { FieldName = "DueOn", FieldType = SqlDbType.Date, FieldValue = goal.DueOn.ToString(Constants.DATE_FORMAT_SQL) });
            if (goal.Sequence <= 0)
            {
                goal.Sequence = GetGoalsForUser(goal.ForUser.UserID, null).Count + 1;
            }
            queryData.Fields.Add(new FieldData { FieldName = "Sequence", FieldType = SqlDbType.Int, FieldValue = goal.Sequence.ToString() });

            queryData.KeyFields.Add(new FieldData { FieldName = "GoalID", FieldType = SqlDbType.Int, FieldValue = goal.GoalID.ToString() });

            queryDatum.Add(queryData);

            queryData = new DeleteQueryData();
            queryData.TableName = "PLN_GoalCategories";
            queryData.KeyFields.Add(new FieldData { FieldName = "GoalID", FieldType = SqlDbType.Int, FieldValue = goal.GoalID.ToString() });

            queryDatum.Add(queryData);

            for (int i = 0; i <= goal.Categories.Count - 1; i++)
            {
                queryData = new InsertQueryData();

                queryData.TableName = "PLN_GoalCategories";
                queryData.Fields.Add(new FieldData { FieldName = "GoalID", FieldType = SqlDbType.Int, FieldValue = goal.GoalID.ToString() });
                queryData.Fields.Add(new FieldData { FieldName = "CategoryID", FieldType = SqlDbType.Int, FieldValue = goal.Categories[i].CategoryID.ToString() });
                queryData.Fields.Add(new FieldData { FieldName = "Sequence", FieldType = SqlDbType.Int, FieldValue = (i + 1).ToString() });
                queryDatum.Add(queryData);
            }

            returnValue = SQLWrapper.ExecuteQuery(queryDatum);

            return returnValue;
        }
Exemplo n.º 9
0
        public static bool UpdateGoalStep(int goalID, GoalStep goalStep)
        {
            bool returnValue = false;

            List<IBaseQueryData> queryDatum = new List<IBaseQueryData>();

            IBaseQueryData queryData = new UpdateQueryData();

            queryData = new UpdateQueryData();
            queryData.TableName = "TSK_Tasks";
            queryData.Fields.Add(new FieldData { FieldName = "UserId", FieldType = SqlDbType.Int, FieldValue = goalStep.taskInfo.ForUser.UserID.ToString() });
            queryData.Fields.Add(new FieldData { FieldName = "IsMasterTask", FieldType = SqlDbType.Bit, FieldValue = goalStep.taskInfo.IsMasterTask ? "1" : "0" });
            queryData.Fields.Add(new FieldData { FieldName = "IsGoalStep", FieldType = SqlDbType.Bit, FieldValue = "1" });
            queryData.Fields.Add(new FieldData { FieldName = "IsRecurring", FieldType = SqlDbType.Bit, FieldValue = goalStep.taskInfo.IsRecurring ? "1" : "0" });
            queryData.Fields.Add(new FieldData { FieldName = "ScheduleID", FieldType = SqlDbType.Int, FieldValue = "0" });
            queryData.Fields.Add(new FieldData { FieldName = "TaskName", FieldType = SqlDbType.NVarChar, FieldValue = goalStep.taskInfo.TaskName.Trim() });
            queryData.Fields.Add(new FieldData { FieldName = "TaskNotes", FieldType = SqlDbType.NVarChar, FieldValue = goalStep.taskInfo.TaskNotes.Trim() });
            queryData.Fields.Add(new FieldData { FieldName = "TaskDate", FieldType = SqlDbType.Date, FieldValue = goalStep.taskInfo.TaskDate.ToString(Constants.DATE_FORMAT_SQL) });
            queryData.Fields.Add(new FieldData { FieldName = "TaskPriorityID", FieldType = SqlDbType.Int, FieldValue = ((int)goalStep.taskInfo.Priority).ToString() });
            queryData.Fields.Add(new FieldData { FieldName = "TaskStatusID", FieldType = SqlDbType.Int, FieldValue = ((int)goalStep.taskInfo.Status).ToString() });

            queryData.KeyFields.Add(new FieldData { FieldName = "TaskID", FieldType = SqlDbType.Int, FieldValue = goalStep.taskInfo.TaskID.ToString() });
            queryDatum.Add(queryData);

            queryData = new DeleteQueryData();

            queryData.TableName = "TSK_TaskCategories";
            queryData.KeyFields.Add(new FieldData { FieldName = "TaskID", FieldType = SqlDbType.Int, FieldValue = goalStep.taskInfo.TaskID.ToString() });
            queryDatum.Add(queryData);

            for (int j = 0; j <= goalStep.taskInfo.Categories.Count - 1; j++)
            {
                queryData = new InsertQueryData();

                queryData.TableName = "TSK_TaskCategories";
                queryData.Fields.Add(new FieldData { FieldName = "TaskID", FieldType = SqlDbType.Int, FieldValue = goalStep.taskInfo.TaskID.ToString() });
                queryData.Fields.Add(new FieldData { FieldName = "CategoryID", FieldType = SqlDbType.Int, FieldValue = goalStep.taskInfo.Categories[j].CategoryID.ToString() });
                queryData.Fields.Add(new FieldData { FieldName = "Sequence", FieldType = SqlDbType.Int, FieldValue = (j + 1).ToString() });
                queryDatum.Add(queryData);
            }

            queryData = new UpdateQueryData();

            queryData.TableName = "PLN_GoalSteps";
            queryData.Fields.Add(new FieldData { FieldName = "GoalID", FieldType = SqlDbType.Int, FieldValue = goalID.ToString() });
            queryData.Fields.Add(new FieldData { FieldName = "TaskID", FieldType = SqlDbType.Decimal, FieldValue = goalStep.taskInfo.TaskID.ToString() });
            queryData.Fields.Add(new FieldData { FieldName = "Sequence", FieldType = SqlDbType.Int, FieldValue = goalStep.Sequence.ToString() });

            queryData.KeyFields.Add(new FieldData { FieldName = "GoalStepID", FieldType = SqlDbType.Int, FieldValue = goalStep.GoalStepID.ToString() });
            queryDatum.Add(queryData);

            SQLWrapper.ExecuteQuery(queryDatum);

            DALGoal.SetGoalDueDate(goalID);

            return returnValue;
        }
Exemplo n.º 10
0
        public static bool UpdateValue(Value value)
        {
            bool returnValue = false;

            List<IBaseQueryData> queryDatum = new List<IBaseQueryData>();
            IBaseQueryData queryData = new UpdateQueryData();

            queryData.TableName = "PLN_Values";
            queryData.Fields.Add(new FieldData { FieldName = "ValueTitle", FieldType = SqlDbType.NVarChar, FieldValue = value.ValueTitle.Trim() });
            queryData.Fields.Add(new FieldData { FieldName = "ValueNotes", FieldType = SqlDbType.NVarChar, FieldValue = value.ValueNotes.Trim() });
            queryData.Fields.Add(new FieldData { FieldName = "UserId", FieldType = SqlDbType.Int, FieldValue = value.ForUser.UserID.ToString() });
            queryData.Fields.Add(new FieldData { FieldName = "Sequence", FieldType = SqlDbType.Int, FieldValue = ((int)value.Sequence).ToString() });

            queryData.KeyFields.Add(new FieldData { FieldName = "ValueID", FieldType = SqlDbType.Int, FieldValue = value.ValueID.ToString() });

            queryDatum.Add(queryData);

            queryData = new DeleteQueryData();
            queryData.TableName = "PLN_ValueCategories";
            queryData.KeyFields.Add(new FieldData { FieldName = "ValueID", FieldType = SqlDbType.Int, FieldValue = value.ValueID.ToString() });

            queryDatum.Add(queryData);

            if (value.Categories != null)
            {
                for (int i = 0; i <= value.Categories.Count - 1; i++)
                {
                    queryData = new InsertQueryData();

                    queryData.TableName = "PLN_ValueCategories";
                    queryData.Fields.Add(new FieldData { FieldName = "ValueID", FieldType = SqlDbType.Int, FieldValue = value.ValueID.ToString() });
                    queryData.Fields.Add(new FieldData { FieldName = "CategoryID", FieldType = SqlDbType.Int, FieldValue = value.Categories[i].CategoryID.ToString() });
                    queryData.Fields.Add(new FieldData { FieldName = "Sequence", FieldType = SqlDbType.Int, FieldValue = (i + 1).ToString() });
                    queryDatum.Add(queryData);
                }
            }

            returnValue = SQLWrapper.ExecuteQuery(queryDatum);

            return returnValue;
        }
Exemplo n.º 11
0
        public static bool UpdateTask(Task task)
        {
            bool returnValue = false;

            List<IBaseQueryData> queryDatum = new List<IBaseQueryData>();
            IBaseQueryData queryData = new UpdateQueryData();

            queryData.TableName = "TSK_Tasks";
            queryData.Fields.Add(new FieldData { FieldName = "UserId", FieldType = SqlDbType.Int, FieldValue = task.ForUser.UserID.ToString() });
            queryData.Fields.Add(new FieldData { FieldName = "IsMasterTask", FieldType = SqlDbType.Bit, FieldValue = task.IsMasterTask ? "1" : "0" });
            queryData.Fields.Add(new FieldData { FieldName = "IsGoalStep", FieldType = SqlDbType.Bit, FieldValue = task.IsGoalStep ? "1" : "0" });
            queryData.Fields.Add(new FieldData { FieldName = "IsRecurring", FieldType = SqlDbType.Bit, FieldValue = task.IsRecurring ? "1" : "0" });
            queryData.Fields.Add(new FieldData { FieldName = "ScheduleID", FieldType = SqlDbType.Int, FieldValue = "0" });
            queryData.Fields.Add(new FieldData { FieldName = "TaskName", FieldType = SqlDbType.NVarChar, FieldValue = task.TaskName.Trim() });
            queryData.Fields.Add(new FieldData { FieldName = "TaskNotes", FieldType = SqlDbType.NVarChar, FieldValue = task.TaskNotes.Trim() });
            queryData.Fields.Add(new FieldData { FieldName = "TaskDate", FieldType = SqlDbType.Date, FieldValue = task.TaskDate.ToString(Constants.DATE_FORMAT_SQL) });
            queryData.Fields.Add(new FieldData { FieldName = "TaskPriorityID", FieldType = SqlDbType.Int, FieldValue = ((int)task.Priority).ToString() });
            queryData.Fields.Add(new FieldData { FieldName = "TaskStatusID", FieldType = SqlDbType.Int, FieldValue = ((int)task.Status).ToString() });

            queryData.KeyFields.Add(new FieldData { FieldName = "TaskID", FieldType = SqlDbType.Int, FieldValue = task.TaskID.ToString() });

            queryDatum.Add(queryData);

            queryData = new DeleteQueryData();
            queryData.TableName = "TSK_TaskCategories";
            queryData.KeyFields.Add(new FieldData { FieldName = "TaskID", FieldType = SqlDbType.Int, FieldValue = task.TaskID.ToString() });

            queryDatum.Add(queryData);

            for (int i = 0; i <= task.Categories.Count - 1; i++)
            {
                queryData = new InsertQueryData();

                queryData.TableName = "TSK_TaskCategories";
                queryData.Fields.Add(new FieldData { FieldName = "TaskID", FieldType = SqlDbType.Int, FieldValue = task.TaskID.ToString() });
                queryData.Fields.Add(new FieldData { FieldName = "CategoryID", FieldType = SqlDbType.Int, FieldValue = task.Categories[i].CategoryID.ToString() });
                queryData.Fields.Add(new FieldData { FieldName = "Sequence", FieldType = SqlDbType.Int, FieldValue = (i + 1).ToString() });
                queryDatum.Add(queryData);
            }

            returnValue = SQLWrapper.ExecuteQuery(queryDatum);

            return returnValue;
        }
Exemplo n.º 12
0
        public static List<IBaseQueryData> PrepareDeleteTaskQueries(Task task)
        {
            List<IBaseQueryData> queryDatum = new List<IBaseQueryData>();

            DeleteQueryData queryData = new DeleteQueryData();
            queryData.TableName = "TSK_TaskCategories";
            queryData.KeyFields.Add(new FieldData { FieldName = "TaskID", FieldType = SqlDbType.Int, FieldValue = task.TaskID.ToString() });
            queryDatum.Add(queryData);

            queryData = new DeleteQueryData();
            queryData.TableName = "TSK_Tasks";
            queryData.KeyFields.Add(new FieldData { FieldName = "TaskID", FieldType = SqlDbType.Int, FieldValue = task.TaskID.ToString() });
            queryDatum.Add(queryData);

            return queryDatum;
        }