public ActionResult InstanceList() { new RoadFlow.Platform.WorkFlowTask(); RoadFlow.Platform.WorkFlow workFlow = new RoadFlow.Platform.WorkFlow(); string text = base.Request.QueryString["typeid"]; Dictionary <Guid, string> instanceManageFlowIDList = workFlow.GetInstanceManageFlowIDList(RoadFlow.Platform.Users.CurrentUserID, text); string options = workFlow.GetOptions(instanceManageFlowIDList, text); string text2 = string.Format("&appid={0}&tabid={1}&typeid={2}", base.Request.QueryString["appid"], base.Request.QueryString["tabid"], text); List <SelectListItem> list = new List <SelectListItem>(); list.Add(new SelectListItem { Text = "==全部==", Value = "0" }); list.Add(new SelectListItem { Text = "未完成", Value = "1" }); list.Add(new SelectListItem { Text = "已完成", Value = "2" }); base.ViewBag.Query = text2; base.ViewBag.StatusItems = list; base.ViewBag.FlowOptions = options; return(View()); }
public ActionResult instanceList1(FormCollection collection) { RoadFlow.Platform.WorkFlowTask bworkFlowTask = new RoadFlow.Platform.WorkFlowTask(); RoadFlow.Platform.WorkFlow bworkFlow = new RoadFlow.Platform.WorkFlow(); string title = ""; string flowid = ""; string sender = ""; string date1 = ""; string date2 = ""; string status = ""; string typeid = Request.QueryString["typeid"]; if (collection != null) { title = Request.Form["Title"]; flowid = Request.Form["FlowID"]; sender = Request.Form["SenderID"]; date1 = Request.Form["Date1"]; date2 = Request.Form["Date2"]; status = Request.Form["Status"]; } else { title = Request.QueryString["Title"]; flowid = Request.QueryString["FlowID"]; sender = Request.QueryString["SenderID"]; date1 = Request.QueryString["Date1"]; date2 = Request.QueryString["Date2"]; status = Request.QueryString["Status"]; } string query1 = string.Format("&appid={0}&tabid={1}&title={2}&flowid={3}&sender={4}&date1={5}&date2={6}&status={7}&typeid={8}", Request.QueryString["appid"], Request.QueryString["tabid"], title.UrlEncode(), flowid, sender, date1, date2, status, typeid); string query = string.Format("{0}&pagesize={1}&pagenumber={2}", query1, Request.QueryString["pagesize"], Request.QueryString["pagenumber"]); string pager; List <SelectListItem> statusItems = new List <SelectListItem>(); statusItems.Add(new SelectListItem() { Text = "==全部==", Value = "0", Selected = "0" == status }); statusItems.Add(new SelectListItem() { Text = "未完成", Value = "1", Selected = "1" == status }); statusItems.Add(new SelectListItem() { Text = "已完成", Value = "2", Selected = "2" == status }); //可管理的流程ID数组 var flows = bworkFlow.GetInstanceManageFlowIDList(RoadFlow.Platform.Users.CurrentUserID, typeid); List <Guid> flowids = new List <Guid>(); foreach (var flow in flows.OrderBy(p => p.Value)) { flowids.Add(flow.Key); } Guid[] manageFlows = flowids.ToArray(); string flowOptions = bworkFlow.GetOptions(flows, typeid, flowid); var taskList = bworkFlowTask.GetInstances(manageFlows, new Guid[] { }, sender.IsNullOrEmpty() ? new Guid[] { } : new Guid[] { sender.Replace(RoadFlow.Platform.Users.PREFIX, "").ToGuid() }, out pager, query1, title, flowid, date1, date2, status.ToInt()); ViewBag.Query = query; ViewBag.Pager = pager; ViewBag.StatusItems = statusItems; ViewBag.Title1 = title; ViewBag.FlowOptions = flowOptions; ViewBag.Sender = sender; ViewBag.Date1 = date1; ViewBag.Date2 = date2; return(View(taskList)); }
protected void Page_Load(object sender1, EventArgs e) { string title = ""; string flowid = ""; string sender = ""; string date1 = ""; string date2 = ""; string status = ""; string typeid = Request.QueryString["typeid"]; if (IsPostBack) { title = Request.Form["Title1"]; flowid = Request.Form["FlowID"]; sender = Request.Form["SenderID"]; date1 = Request.Form["Date1"]; date2 = Request.Form["Date2"]; status = Request.Form["Status"]; } else { title = Request.QueryString["Title"]; flowid = Request.QueryString["FlowID"]; sender = Request.QueryString["SenderID"]; date1 = Request.QueryString["Date1"]; date2 = Request.QueryString["Date2"]; status = Request.QueryString["Status"]; } string query1 = string.Format("&appid={0}&tabid={1}&title={2}&flowid={3}&sender={4}&date1={5}&date2={6}&status={7}&typeid={8}", Request.QueryString["appid"], Request.QueryString["tabid"], title.UrlEncode(), flowid, sender, date1, date2, status, typeid); query = string.Format("{0}&pagesize={1}&pagenumber={2}", query1, Request.QueryString["pagesize"], Request.QueryString["pagenumber"]); string pager; List <System.Web.UI.WebControls.ListItem> statusItems = new List <System.Web.UI.WebControls.ListItem>(); statusItems.Add(new System.Web.UI.WebControls.ListItem() { Text = "==全部==", Value = "0", Selected = "0" == status }); statusItems.Add(new System.Web.UI.WebControls.ListItem() { Text = "未完成", Value = "1", Selected = "1" == status }); statusItems.Add(new System.Web.UI.WebControls.ListItem() { Text = "已完成", Value = "2", Selected = "2" == status }); this.Status.Items.AddRange(statusItems.ToArray()); //可管理的流程ID数组 var flows = bworkFlow.GetInstanceManageFlowIDList(RoadFlow.Platform.Users.CurrentUserID, typeid); List <Guid> flowids = new List <Guid>(); foreach (var flow in flows.OrderBy(p => p.Value)) { flowids.Add(flow.Key); } Guid[] manageFlows = flowids.ToArray(); this.FlowOptions.Text = bworkFlow.GetOptions(flows, typeid, flowid); taskList = bworkFlowTask.GetInstances(manageFlows, new Guid[] { }, sender.IsNullOrEmpty() ? new Guid[] { } : new Guid[] { sender.Replace(RoadFlow.Platform.Users.PREFIX, "").ToGuid() }, out pager, query1, title, flowid, date1, date2, status.ToInt()); this.Pager.Text = pager; }
public string QueryInstanceList() { RoadFlow.Platform.WorkFlowTask workFlowTask = new RoadFlow.Platform.WorkFlowTask(); RoadFlow.Platform.WorkFlow workFlow = new RoadFlow.Platform.WorkFlow(); string text = base.Request.Form["Title"]; string flowid = base.Request.Form["FlowID"]; string text2 = base.Request.Form["SenderID"]; string date = base.Request.Form["Date1"]; string date2 = base.Request.Form["Date2"]; string text3 = base.Request.Form["Status"]; string text4 = base.Request.Form["sidx"]; string text5 = base.Request.Form["sord"]; string typeID = base.Request.Form["typeid"]; string text6 = base.Request.Form["appid"]; Dictionary <Guid, string> instanceManageFlowIDList = workFlow.GetInstanceManageFlowIDList(RoadFlow.Platform.Users.CurrentUserID, typeID); List <Guid> list = new List <Guid>(); foreach (KeyValuePair <Guid, string> item in from p in instanceManageFlowIDList orderby p.Value select p) { list.Add(item.Key); } Guid[] flowID = list.ToArray(); int pageSize = RoadFlow.Utility.Tools.GetPageSize(); int pageNumber = RoadFlow.Utility.Tools.GetPageNumber(); string order = (MyExtensions.IsNullOrEmpty(text4) ? "SenderTime" : text4) + " " + (MyExtensions.IsNullOrEmpty(text5) ? "asc" : text5); long count; DataTable instances = workFlowTask.GetInstances1(flowID, new Guid[0], MyExtensions.IsNullOrEmpty(text2) ? new Guid[0] : new Guid[1] { MyExtensions.ToGuid(text2.Replace("u_", "")) }, out count, pageSize, pageNumber, MyExtensions.Trim1(text), flowid, date, date2, MyExtensions.ToInt(text3), order); JsonData jsonData = new JsonData(); foreach (DataRow row in instances.Rows) { RoadFlow.Data.Model.WorkFlowTask lastTask = workFlowTask.GetLastTask(MyExtensions.ToGuid(row["FlowID"].ToString()), MyExtensions.ToGuid(row["GroupID"].ToString())); if (lastTask != null) { string flowName; string stepName = workFlow.GetStepName(lastTask.StepID, lastTask.FlowID, out flowName); string text7 = $"flowid={lastTask.FlowID}&stepid={lastTask.StepID}&instanceid={lastTask.InstanceID}&taskid={lastTask.ID}&groupid={lastTask.GroupID}&appid={text6}&display=1"; StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append("<a style=\"margin-right:5px; background:url(" + base.Url.Content("~/Images/ico/mouse.png") + ") no-repeat left center; padding-left:18px;\" href=\"javascript:void(0);\" onclick=\"manage('" + lastTask.FlowID.ToString() + "','" + lastTask.GroupID.ToString() + "');\">管理</a>"); if (MyExtensions.In(lastTask.Status, new int[3] { -1, 0, 1 })) { stringBuilder.Append("<a style=\"background:url(" + base.Url.Content("~/Images/ico/trash.gif") + ") no-repeat left center; padding-left:18px;\" href=\"javascript:void(0);\" onclick=\"delete1('" + lastTask.FlowID.ToString() + "','" + lastTask.GroupID.ToString() + "');\">删除</a>"); } JsonData jsonData2 = new JsonData(); jsonData2["id"] = lastTask.ID.ToString(); jsonData2["Title"] = "<a href=\"javascript:void(0);\" onclick=\"openTask('/WorkFlowRun/Index?" + text7 + "','" + MyExtensions.UrlEncode(MyExtensions.RemoveHTML(lastTask.Title)) + "','" + lastTask.ID + "');return false;\" class=\"blue\">" + MyExtensions.HtmlEncode(lastTask.Title) + "</a>"; jsonData2["FlowName"] = flowName; jsonData2["StepName"] = stepName; jsonData2["ReceiveName"] = lastTask.ReceiveName; jsonData2["ReceiveTime"] = MyExtensions.ToDateTimeStringS(lastTask.ReceiveTime); jsonData2["StatusTitle"] = lastTask.Status; jsonData2["Opation"] = stringBuilder.ToString(); jsonData.Add(jsonData2); } } return("{\"userdata\":{\"total\":" + count + ",\"pagesize\":" + pageSize + ",\"pagenumber\":" + pageNumber + "},\"rows\":" + jsonData.ToJson() + "}"); }