public ActionResult DetailSubFlow()
        {
            RoadFlow.Platform.WorkFlowTask workFlowTask = new RoadFlow.Platform.WorkFlowTask();
            RoadFlow.Platform.WorkFlow     workFlow     = new RoadFlow.Platform.WorkFlow();
            string text = string.Format("&flowid1={0}&groupid={1}&appid={2}&tabid={3}&title={4}&flowid={5}&sender={6}&date1={7}&date2={8}&iframeid={9}&openerid={10}&taskid={11}", base.Request.QueryString["flowid"], base.Request.QueryString["groupid"], base.Request.QueryString["appid"], base.Request.QueryString["tabid"], base.Request.QueryString["title"].UrlEncode(), base.Request.QueryString["flowid"], base.Request.QueryString["sender"], base.Request.QueryString["date1"], base.Request.QueryString["date2"], base.Request.QueryString["iframeid"], base.Request.QueryString["openerid"], base.Request.QueryString["taskid"]);

            base.ViewBag.flowid       = base.Request.QueryString["flowid"];
            base.ViewBag.groupid      = base.Request.QueryString["groupid"];
            base.ViewBag.displayModel = base.Request.QueryString["displaymodel"];
            base.ViewBag.wfInstall    = null;
            base.ViewBag.query        = text;
            string str   = base.Request.QueryString["taskid"];
            string text2 = base.Request.QueryString["displaymodel"];

            if (!str.IsGuid())
            {
                return(View(new List <RoadFlow.Data.Model.WorkFlowTask>()));
            }
            RoadFlow.Data.Model.WorkFlowTask workFlowTask2 = workFlowTask.Get(str.ToGuid());
            if (workFlowTask2 == null || workFlowTask2.SubFlowGroupID.IsNullOrEmpty())
            {
                return(View(new List <RoadFlow.Data.Model.WorkFlowTask>()));
            }
            List <RoadFlow.Data.Model.WorkFlowTask> list = new List <RoadFlow.Data.Model.WorkFlowTask>();

            string[] array = workFlowTask2.SubFlowGroupID.Split(',');
            foreach (string str2 in array)
            {
                list.AddRange(workFlowTask.GetTaskList(Guid.Empty, str2.ToGuid()));
            }
            if (list.Count == 0)
            {
                base.Response.Write("未找到任务");
                base.Response.End();
                return(null);
            }
            WorkFlowInstalled workFlowRunModel = workFlow.GetWorkFlowRunModel(list.FirstOrDefault().FlowID);

            base.ViewBag.wfInstall = workFlowRunModel;
            base.ViewBag.flowid    = list.FirstOrDefault().FlowID.ToString();
            return(View(list));
        }
        public ActionResult Detail()
        {
            RoadFlow.Platform.WorkFlowTask workFlowTask = new RoadFlow.Platform.WorkFlowTask();
            RoadFlow.Platform.WorkFlow     workFlow     = new RoadFlow.Platform.WorkFlow();
            string            text             = base.Request.QueryString["flowid1"] ?? base.Request.QueryString["flowid"];
            string            text2            = base.Request.QueryString["groupid"];
            string            text3            = base.Request.QueryString["displaymodel"];
            WorkFlowInstalled workFlowRunModel = workFlow.GetWorkFlowRunModel(text);
            IOrderedEnumerable <RoadFlow.Data.Model.WorkFlowTask> orderedEnumerable = from p in workFlowTask.GetTaskList(text.ToGuid(), text2.ToGuid())
                                                                                      where p.Status != -1
                                                                                      orderby p.Sort, p.StepSort
            select p;
            string text4 = string.Format("&flowid1={0}&groupid={1}&appid={2}&tabid={3}&iframeid={4}&openerid={5}", text, text2, base.Request.QueryString["appid"], base.Request.QueryString["tabid"], base.Request.QueryString["iframeid"], base.Request.QueryString["openerid"]);
            string text5 = string.Format("&groupid={0}&appid={1}&tabid={2}&ismobile={3}", text2, base.Request.QueryString["appid"], base.Request.QueryString["tabid"], base.Request.QueryString["ismobile"]);

            base.ViewBag.flowid       = text;
            base.ViewBag.groupid      = text2;
            base.ViewBag.displayModel = text3;
            base.ViewBag.wfInstall    = workFlowRunModel;
            base.ViewBag.query        = text4;
            base.ViewBag.query1       = text5;
            JsonData jsonData = new JsonData();

            foreach (RoadFlow.Data.Model.WorkFlowTask item in orderedEnumerable)
            {
                JsonData jsonData2 = new JsonData();
                jsonData2["StepName"]       = item.StepName;
                jsonData2["SenderName"]     = item.SenderName;
                jsonData2["SenderTime"]     = item.SenderTime.ToDateTimeStringS();
                jsonData2["ReceiveName"]    = item.ReceiveName;
                jsonData2["CompletedTime1"] = (item.CompletedTime1.HasValue ? item.CompletedTime1.Value.ToDateTimeStringS() : "");
                jsonData2["StatusTitle"]    = workFlowTask.GetStatusTitle(item.Status);
                jsonData2["Comment"]        = item.Comment;
                jsonData2["Note"]           = item.Note;
                jsonData.Add(jsonData2);
            }
            base.ViewBag.list = (jsonData.IsArray ? jsonData.ToJson() : "{}");
            return(View(orderedEnumerable));
        }
        public ActionResult InstanceManage()
        {
            RoadFlow.Platform.WorkFlowTask workFlowTask = new RoadFlow.Platform.WorkFlowTask();
            RoadFlow.Platform.WorkFlow     workFlow     = new RoadFlow.Platform.WorkFlow();
            string            text             = base.Request.QueryString["flowid1"];
            string            str              = base.Request.QueryString["groupid"];
            WorkFlowInstalled workFlowRunModel = workFlow.GetWorkFlowRunModel(text);
            IOrderedEnumerable <RoadFlow.Data.Model.WorkFlowTask> orderedEnumerable = from p in workFlowTask.GetTaskList(text.ToGuid(), str.ToGuid())
                                                                                      orderby p.Sort
                                                                                      select p;
            JsonData jsonData = new JsonData();

            foreach (RoadFlow.Data.Model.WorkFlowTask item in orderedEnumerable)
            {
                StringBuilder stringBuilder = new StringBuilder();
                stringBuilder.Append("<a style=\"background:url(" + base.Url.Content("~/Images/ico/permission.gif") + ") no-repeat left center; padding-left:18px;\" href=\"javascript:void(0);\" onclick=\"cngStatus('" + item.ID + "');\">状态</a>");
                if (item.Status.In(0, 1))
                {
                    stringBuilder.Append("<a style=\"background:url(" + base.Url.Content("~/Images/ico/arrow_medium_lower_left.png") + ") no-repeat left center; padding-left:16px;\" href=\"javascript:void(0);\" onclick=\"designate('" + item.ID + "');\">指派</a>");
                    stringBuilder.Append("<a style=\"background:url(" + base.Url.Content("~/Images/ico/arrow_medium_lower_right.png") + ") no-repeat left center; padding-left:16px;\" href=\"javascript:void(0);\" onclick=\"goTo('" + item.ID + "');\">跳转</a>");
                }
                JsonData jsonData2 = new JsonData();
                jsonData2["id"]             = item.ID.ToString();
                jsonData2["StepID"]         = workFlow.GetStepName(item.StepID, workFlowRunModel);
                jsonData2["SenderName"]     = item.SenderName;
                jsonData2["ReceiveTime"]    = item.ReceiveTime.ToDateTimeStringS();
                jsonData2["ReceiveName"]    = item.ReceiveName;
                jsonData2["CompletedTime1"] = (item.CompletedTime1.HasValue ? item.CompletedTime1.Value.ToDateTimeStringS() : "");
                jsonData2["Status"]         = workFlowTask.GetStatusTitle(item.Status);
                jsonData2["Comment"]        = item.Comment;
                jsonData2["Opation"]        = stringBuilder.ToString();
                jsonData.Add(jsonData2);
            }
            base.ViewBag.list = jsonData.ToJson();
            return(View());
        }
        public string QueryWaitList()
        {
            RoadFlow.Platform.WorkFlowTask workFlowTask = new RoadFlow.Platform.WorkFlowTask();
            RoadFlow.Platform.WorkFlow     workFlow     = new RoadFlow.Platform.WorkFlow();
            RoadFlow.Platform.AppLibrary   appLibrary   = new RoadFlow.Platform.AppLibrary();
            string str        = base.Request.Form["title"];
            string flowid     = base.Request.Form["flowid"];
            string sender     = base.Request.Form["sender"];
            string date       = base.Request.Form["date1"];
            string date2      = base.Request.Form["date2"];
            string text       = base.Request.Form["sidx"];
            string text2      = base.Request.Form["sord"];
            string text3      = "";
            int    pageSize   = RoadFlow.Utility.Tools.GetPageSize();
            int    pageNumber = RoadFlow.Utility.Tools.GetPageNumber();
            long   count;
            List <RoadFlow.Data.Model.WorkFlowTask> obj = workFlowTask.GetTasks(order: (text.IsNullOrEmpty() ? "ReceiveTime" : text) + " " + (text2.IsNullOrEmpty() ? "asc" : text2), userID: MyController.CurrentUserID, count: out count, size: pageSize, number: pageNumber, title: str.Trim1(), flowid: flowid, sender: sender, date1: date, date2: date2);
            JsonData jsonData      = new JsonData();
            Guid     currentUserID = MyController.CurrentUserID;

            foreach (RoadFlow.Data.Model.WorkFlowTask item in obj)
            {
                RoadFlow.Data.Model.AppLibrary byCode = appLibrary.GetByCode(item.FlowID.ToString());
                int num  = 0;
                int num2 = 1000;
                int num3 = 500;
                if (byCode != null)
                {
                    num  = byCode.OpenMode;
                    num2 = (byCode.Width.HasValue ? byCode.Width.Value : 1000);
                    num3 = (byCode.Height.HasValue ? byCode.Height.Value : 500);
                }
                WorkFlowInstalled workFlowRunModel = workFlow.GetWorkFlowRunModel(item.FlowID);
                JsonData          jsonData2        = new JsonData();
                jsonData2["id"]          = item.ID.ToString();
                jsonData2["FlowName"]    = workFlow.GetFlowName(item.FlowID);
                jsonData2["StepName"]    = item.StepName;
                jsonData2["Note"]        = item.Note;
                jsonData2["ReceiveTime"] = item.ReceiveTime.ToDateTimeString();
                jsonData2["SenderName"]  = item.SenderName;
                if (item.CompletedTime.HasValue)
                {
                    if (item.CompletedTime.Value < DateTimeNew.Now)
                    {
                        jsonData2["StatusTitle"] = "<i title=\"已过期\" class=\"fa fa-bell\" style=\"color:red;font-weight:bold;\"><span title=\"要求完成时间:" + item.CompletedTime.Value.ToDateTimeString() + "\">已过期</span></i>";
                    }
                    else if ((item.CompletedTime.Value - DateTimeNew.Now).Days <= 3)
                    {
                        jsonData2["StatusTitle"] = "<i title=\"即将过期\" class=\"fa fa-bell\" style=\"color:#fd8a02;font-weight:bold;\"><span title=\"要求完成时间:" + item.CompletedTime.Value.ToDateTimeString() + "\">即将到期</span></i>";
                    }
                    else
                    {
                        jsonData2["StatusTitle"] = "<i title=\"正常\" class=\"fa fa-bell\" style=\"color:#666;font-weight:bold;\"></i><span title=\"要求完成时间:" + item.CompletedTime.Value.ToDateTimeString() + "\">正常</span></i>";
                    }
                }
                else
                {
                    jsonData2["StatusTitle"] = "<i title=\"正常\" class=\"fa fa-bell\" style=\"color:#666;font-weight:bold;\"></i><span title=\"要求完成时间:无时间要求\">正常</span></i>";
                }
                jsonData2["Title"] = "<a href=\"javascript:void(0);\" class=\"blue\" onclick=\"openTask('/WorkFlowRun/Index?" + string.Format("flowid={0}&stepid={1}&instanceid={2}&taskid={3}&groupid={4}&appid={5}", item.FlowID, item.StepID, item.InstanceID, item.ID, item.GroupID, text3) + "','" + item.Title.RemoveHTML().UrlEncode() + "','" + item.ID + "'," + num + "," + num2 + "," + num3 + ");return false;\">" + item.Title.HtmlEncode() + "</a>";
                string text4 = "<a href=\"javascript:void(0);\" class=\"editlink\" onclick=\"openTask('/WorkFlowRun/Index?" + string.Format("flowid={0}&stepid={1}&instanceid={2}&taskid={3}&groupid={4}&appid={5}", item.FlowID, item.StepID, item.InstanceID, item.ID, item.GroupID, text3) + "','" + item.Title.RemoveHTML().UrlEncode() + "','" + item.ID + "'," + num + "," + num2 + "," + num3 + ");return false;\">处理</a>&nbsp;&nbsp;<a class=\"viewlink\" href=\"javascript:void(0);\" onclick=\"detail('" + item.FlowID + "','" + item.GroupID + "','" + item.ID + "');return false;\">查看</a>";
                if (workFlowRunModel != null && workFlowRunModel.FirstStepID == item.StepID && item.SenderID == currentUserID)
                {
                    text4 = text4 + "&nbsp;&nbsp;<a class=\"deletelink\" href=\"javascript:void(0);\" onclick=\"delTask('" + item.FlowID + "','" + item.GroupID + "','" + item.ID + "');return false;\">作废</a>";
                }
                jsonData2["Opation"] = text4;
                jsonData.Add(jsonData2);
            }
            return("{\"userdata\":{\"total\":" + count + ",\"pagesize\":" + pageSize + ",\"pagenumber\":" + pageNumber + "},\"rows\":" + jsonData.ToJson() + "}");
        }
 public ActionResult FlowCopyFor(FormCollection collection)
 {
     RoadFlow.Platform.WorkFlow workFlow = new RoadFlow.Platform.WorkFlow();
     RoadFlow.Platform.WorkFlowTask workFlowTask = new RoadFlow.Platform.WorkFlowTask();
     WorkFlowInstalled workFlowInstalled = null;
     RoadFlow.Data.Model.WorkFlowTask workFlowTask2 = null;
     string flowID = base.Request.QueryString["flowid"];
     string stepid = base.Request.QueryString["stepid"];
     string text = base.Request.QueryString["groupid"];
     string text2 = base.Request.QueryString["instanceid"];
     workFlowInstalled = workFlow.GetWorkFlowRunModel(flowID);
     if (workFlowInstalled == null)
     {
         base.Response.Write("未找到流程运行实体");
         base.Response.End();
         return null;
     }
     if ((from p in workFlowInstalled.Steps
     where p.ID == stepid.ToGuid()
     select p).Count() == 0)
     {
         base.Response.Write("未找到当前步骤");
         base.Response.End();
         return null;
     }
     workFlowTask2 = workFlowTask.Get(base.Request.QueryString["taskid"].ToGuid());
     if (workFlowTask2 == null)
     {
         base.Response.Write("当前任务为空,请先保存再抄送!");
         base.Response.End();
         return null;
     }
     if (collection != null)
     {
         List<RoadFlow.Data.Model.WorkFlowTask> taskList = workFlowTask.GetTaskList(workFlowTask2.ID);
         List<RoadFlow.Data.Model.Users> allUsers = new RoadFlow.Platform.Organize().GetAllUsers(base.Request.Form["user"] ?? "");
         StringBuilder stringBuilder = new StringBuilder();
         foreach (RoadFlow.Data.Model.Users item in allUsers)
         {
             if (taskList.Find((RoadFlow.Data.Model.WorkFlowTask p) => p.ReceiveID == item.ID) == null)
             {
                 Step step = (from p in workFlowInstalled.Steps
                 where p.ID == base.Request.QueryString["stepid"].ToGuid()
                 select p).First();
                 RoadFlow.Data.Model.WorkFlowTask workFlowTask3 = new RoadFlow.Data.Model.WorkFlowTask();
                 if (step.WorkTime > decimal.Zero)
                 {
                     workFlowTask3.CompletedTime = DateTimeNew.Now.AddHours((double)step.WorkTime);
                 }
                 workFlowTask3.FlowID = workFlowTask2.FlowID;
                 workFlowTask3.GroupID = workFlowTask2.GroupID;
                 workFlowTask3.ID = Guid.NewGuid();
                 workFlowTask3.Type = 5;
                 workFlowTask3.InstanceID = workFlowTask2.InstanceID;
                 workFlowTask3.Note = "抄送任务";
                 workFlowTask3.PrevID = workFlowTask2.PrevID;
                 workFlowTask3.PrevStepID = workFlowTask2.PrevStepID;
                 workFlowTask3.ReceiveID = item.ID;
                 workFlowTask3.ReceiveName = item.Name;
                 workFlowTask3.ReceiveTime = DateTimeNew.Now;
                 workFlowTask3.SenderID = workFlowTask2.ReceiveID;
                 workFlowTask3.SenderName = workFlowTask2.ReceiveName;
                 workFlowTask3.SenderTime = workFlowTask3.ReceiveTime;
                 workFlowTask3.Status = 0;
                 workFlowTask3.StepID = workFlowTask2.StepID;
                 workFlowTask3.StepName = workFlowTask2.StepName;
                 workFlowTask3.Sort = workFlowTask2.Sort;
                 workFlowTask3.Title = workFlowTask2.Title;
                 workFlowTask.Add(workFlowTask3);
                 stringBuilder.Append(workFlowTask3.ReceiveName);
                 stringBuilder.Append(",");
             }
         }
         base.ViewBag.script = "alert('成功抄送给:" + stringBuilder.ToString().TrimEnd(',') + "');new RoadUI.Window().close();";
     }
     return View();
 }