public Composite PseudoClone() { var newPreconds = new List <IPredicate>(); foreach (var precon in base.Preconditions) { newPreconds.Add(precon.Clone() as IPredicate); } var newEffects = new List <IPredicate>(); foreach (var eff in base.Effects) { newEffects.Add(eff.Clone() as IPredicate); } var newBase = new Operator(base.Predicate.Clone() as Predicate, newPreconds, newEffects); var init = InitialStep.Clone() as IPlanStep; init.Action = init.Action.Clone() as Operator; var goal = GoalStep.Clone() as IPlanStep; goal.Action = goal.Action.Clone() as Operator; return(new Composite(newBase, init, goal, SubSteps, SubOrderings, SubLinks) { Height = this.Height, NonEqualities = this.NonEqualities }); }
public Task <IBusinessResult> UpdateGoalStepAsync(GoalStep goalStepEntity) { if (goalStepEntity.GoalTypeId == GoalTypeEnum.Supplier) { goalStepEntity.ComputingValue = goalStepEntity.RawComputingValue + (goalStepEntity.RawComputingValue * goalStepEntity.IncrementPercent.Value / 100); } return(goalStepUpdater.UpdateAsync(goalStepEntity)); }
protected void btnSave_Click(object sender, EventArgs e) { if (isValidData()) { try { GoalStep goalStep = new GoalStep(); if (CurrentPageMode != PageMode.Add) { goalStep = BLLGoalStep.GetGoalStepByID(Convert.ToInt32(this.txtGoalStepID.Text)); } if (goalStep.taskInfo == null) { goalStep.taskInfo = new Task(); } goalStep.taskInfo.ForUser = new AppUser(); goalStep.taskInfo.ForUser.UserID = 1; goalStep.taskInfo.IsGoalStep = true; goalStep.taskInfo.IsMasterTask = false; goalStep.taskInfo.IsRecurring = false; goalStep.taskInfo.Priority = TaskPriorities.A; goalStep.taskInfo.Status = TaskStatuses.Normal; goalStep.taskInfo.TaskDate = this.calForDate.SelectedDate; goalStep.taskInfo.TaskName = this.txtTaskName.Text; goalStep.taskInfo.TaskNotes = this.txtTaskNotes.Text; goalStep.taskInfo.TaskRecurrence = null; goalStep.taskInfo.Categories = new List<Category>(); if (CurrentPageMode == PageMode.Add) { BLLGoalStep.AddGoalStep(Convert.ToInt32(this.txtGoalID.Text),goalStep); this.lblErrorText.Text = "Completed"; } else if (CurrentPageMode == PageMode.Edit) { BLLGoalStep.UpdateGoalStep(Convert.ToInt32(this.txtGoalID.Text),goalStep); this.lblErrorText.Text = "Completed"; } else { throw new Exception("Invalid Action"); } string script = "<script language='javascript' type='text/javascript'>window.returnValue = 1;;window.close();</script>"; Page.RegisterClientScriptBlock("closescript", script); } catch (Exception ex) { this.lblErrorText.Text = ex.Message; this.txtTaskName.Focus(); } } }
public new Object Clone() { var op = base.Clone() as IOperator; var init = InitialStep.Clone() as IPlanStep; var goal = GoalStep.Clone() as IPlanStep; return(new Composite(op, init, goal, SubSteps, SubOrderings, SubLinks) { Height = this.Height, NonEqualities = this.NonEqualities }); }
public static bool AddGoalStep(int goalID, GoalStep goalStep) { bool returnValue = false; List<IBaseQueryData> queryDatum = new List<IBaseQueryData>(); IBaseQueryData queryData = new InsertQueryData(); long taskID = DALTask.getNextTaskID(); queryData = new InsertQueryData(); queryData.TableName = "TSK_Tasks"; queryData.Fields.Add(new FieldData { FieldName = "TaskID", FieldType = SqlDbType.Int, FieldValue = taskID.ToString() }); 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() }); 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 = 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 InsertQueryData(); 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 = taskID.ToString() }); queryData.Fields.Add(new FieldData { FieldName = "Sequence", FieldType = SqlDbType.Int, FieldValue = getNextSequence(goalID).ToString() }); queryDatum.Add(queryData); SQLWrapper.ExecuteQuery(queryDatum); DALGoal.SetGoalDueDate(goalID); return returnValue; }
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; }
public new Object Clone() { var op = base.Clone() as IOperator; var newSubsteps = new List <IPlanStep>(); foreach (var substep in SubSteps) { var newsubstep = substep.Clone() as IPlanStep; newsubstep.Action = newsubstep.Action.Clone() as Operator; newSubsteps.Add(newsubstep); } // var newinitial = InitialStep.Clone() as IPlanStep; //newinitial.Action = InitialStep.Action.Clone() as Operator; // do same for literals return(new Decomposition(op, Literals, InitialStep.Clone() as IPlanStep, GoalStep.Clone() as IPlanStep, newSubsteps, SubOrderings.ToList(), SubLinks.ToList())); // return new Decomposition(op, Literals, newSubsteps, SubOrderings, SubLinks); }
public IPlanStep Find(IPlanStep stepClonedFromOpenCondition) { if (GoalStep.Equals(stepClonedFromOpenCondition)) { return(GoalStep); } // For now, this condition is impossible if (InitialStep.Equals(stepClonedFromOpenCondition)) { return(InitialStep); } if (!Steps.Contains(stepClonedFromOpenCondition)) { throw new System.Exception(); } return(Steps.Single(s => s.ID == stepClonedFromOpenCondition.ID)); }
public static bool UpdateGoalStep(int goalID, GoalStep Goal) { return DALGoalStep.UpdateGoalStep(goalID,Goal); }
public static bool AddGoalStep(int goalID, GoalStep Goal) { return DALGoalStep.AddGoalStep(goalID, Goal); }
private static GoalStep loadGoalStep(DataTable dtGoalSteps, int RowNo) { GoalStep goalStep = new GoalStep(); goalStep.GoalStepID = Convert.ToInt32(dtGoalSteps.Rows[RowNo]["GoalStepID"]); goalStep.Sequence = Convert.ToInt32(dtGoalSteps.Rows[RowNo]["Sequence"]); goalStep.taskInfo = DALTask.GetTaskByID((long)Convert.ToDecimal(dtGoalSteps.Rows[RowNo]["TaskID"])); return goalStep; }
public static GoalStep GetGoalStepByID(int goalStepID) { GoalStep goalStep = new GoalStep(); DataTable dtGoalSteps = SQLWrapper.GetDataTable(new SelectQueryData { TableName = "PLN_GoalSteps", FilterCondition = "GoalStepID = " + goalStepID.ToString(), OrderBy = "Sequence" }); if (dtGoalSteps.Rows.Count > 0) { goalStep = loadGoalStep(dtGoalSteps, 0); } return goalStep; }
public Task <IBusinessResult> DeleteGoalStepAsync(GoalStep goalStepEntity) { return(goalStepEraser.DeleteAsync(goalStepEntity)); }
private void btnSave_Click(object sender, EventArgs e) { bool returnValue = false; if (isValidData(true)) { if (IsPageDirty) { GoalStep goalStep = null; switch (this.CurrentPageMode) { case PageMode.Add: { goalStep = new GoalStep(); break; } case PageMode.Edit: { goalStep = BLLGoalStep.GetGoalStepByID(Convert.ToInt32(this.lblItemID.Text)); break; } } if (goalStep.taskInfo == null) { goalStep.taskInfo = new Task(); } goalStep.taskInfo.ForUser = new AppUser(); goalStep.taskInfo.ForUser.UserID = 1; goalStep.taskInfo.IsGoalStep = true; goalStep.taskInfo.IsMasterTask = false; goalStep.taskInfo.IsRecurring = false; goalStep.taskInfo.Priority = TaskPriorities.A; goalStep.taskInfo.Status = TaskStatuses.Normal; goalStep.taskInfo.TaskDate = this.dtpDueOn.Value; goalStep.taskInfo.TaskName = this.txtTaskName.Text; goalStep.taskInfo.TaskNotes = this.txtTaskNotes.Text; goalStep.taskInfo.TaskRecurrence = null; goalStep.taskInfo.Categories = new List<Category>(); switch (this.CurrentPageMode) { case PageMode.Add: { returnValue = BLLGoalStep.AddGoalStep(GoalID, goalStep); break; } case PageMode.Edit: { returnValue = BLLGoalStep.UpdateGoalStep(GoalID, goalStep); break; } } goalStep = null; } this.Hide(); this.Close(); } }