protected void btnSubmit_Click(object sender, EventArgs e) { Hashtable hashTable = new Hashtable(); hashTable["EstimatedCosts"] = EstimatedCosts.Text; hashTable["_EstimatedCosts"] = EstimatedCosts.Text; hashTable["Outcome"] = Outcome.SelectedValue; hashTable["_Outcome"] = Outcome.SelectedValue; hashTable["TaskStatus"] = "complete"; hashTable["PercentComplete"] = "1"; SPWorkflowTask.AlterTask(this._taskListItem, hashTable, true); this.Page.Response.Clear(); this.Page.Response.Write(string.Format(CultureInfo.InvariantCulture, "<script type=\"text/javascript\">window.frameElement.commonModalDialogClose(1, '{0}');</script>", "")); this.Page.Response.End(); }
public bool AlterTask(SPListItemInstance task, object htData, bool synchronous) { if (task == null) { throw new JavaScriptException(this.Engine, "Error", "A task must be specified."); } if (htData == null) { throw new JavaScriptException(this.Engine, "Error", "A hashtable of data must be specified."); } Hashtable ht; if (htData is HashtableInstance) { var temp = (htData as HashtableInstance).Hashtable; ht = new Hashtable(); foreach (var key in temp.Keys) { if (key is GuidInstance) { ht.Add((key as GuidInstance).Value, temp[key]); } else { ht.Add(TypeConverter.ToObject(this.Engine, key), TypeConverter.ToObject(this.Engine, temp[key])); } } } else if (htData is ObjectInstance) { ht = new Hashtable(); foreach (var prop in (htData as ObjectInstance).Properties) { ht.Add(prop.Name, prop.Value); } } else { throw new JavaScriptException(this.Engine, "Error", "htData argument must either be a hashtable instance, or a js hashtable"); } return(SPWorkflowTask.AlterTask(task.ListItem, ht, synchronous)); }