public string Delete()
        {
            RoadFlow.Platform.AppLibrary appLibrary = new RoadFlow.Platform.AppLibrary();
            string        text          = base.Request.Form["ids"];
            StringBuilder stringBuilder = new StringBuilder();

            using (TransactionScope transactionScope = new TransactionScope())
            {
                string[] array = text.Split(',');
                for (int i = 0; i < array.Length; i++)
                {
                    Guid test;
                    if (array[i].IsGuid(out test))
                    {
                        RoadFlow.Data.Model.AppLibrary appLibrary2 = appLibrary.Get(test);
                        if (appLibrary2 != null)
                        {
                            stringBuilder.Append(appLibrary2.Serialize());
                            appLibrary.Delete(test);
                            new RoadFlow.Platform.AppLibraryButtons1().DeleteByAppID(test);
                            new RoadFlow.Platform.AppLibrarySubPages().DeleteByAppID(test);
                        }
                    }
                }
                new RoadFlow.Platform.Menu().ClearAllDataTableCache();
                new RoadFlow.Platform.AppLibraryButtons1().ClearCache();
                new RoadFlow.Platform.AppLibrarySubPages().ClearCache();
                RoadFlow.Platform.Log.Add("删除了一批应用程序库", stringBuilder.ToString(), RoadFlow.Platform.Log.Types.菜单权限);
                transactionScope.Complete();
            }
            return("删除成功!");
        }
        public string Query()
        {
            string str   = base.Request.Form["Title"];
            string str2  = base.Request.Form["Address"];
            string str3  = base.Request.Form["typeid"];
            string text  = base.Request.Form["sidx"];
            string text2 = base.Request.Form["sord"];

            RoadFlow.Platform.Dictionary dictionary = new RoadFlow.Platform.Dictionary();
            RoadFlow.Platform.AppLibrary appLibrary = new RoadFlow.Platform.AppLibrary();
            string type       = str3.IsGuid() ? appLibrary.GetAllChildsIDString(str3.ToGuid()) : "";
            int    pageSize   = Tools.GetPageSize();
            int    pageNumber = Tools.GetPageNumber();
            string order      = (text.IsNullOrEmpty() ? "Title" : text) + " " + (text2.IsNullOrEmpty() ? "asc" : text2);
            long   count;
            List <RoadFlow.Data.Model.AppLibrary> pagerData = appLibrary.GetPagerData(out count, pageSize, pageNumber, str.Trim1(), type, str2.Trim1(), order);
            JsonData jsonData = new JsonData();

            foreach (RoadFlow.Data.Model.AppLibrary item in pagerData)
            {
                string empty = string.Empty;
                empty = ((!item.Ico.IsFontIco()) ? ("<img src=\"" + item.Ico.Trim1() + "\" style=\"vertical-align:middle;\" />") : ("<i class=\"fa " + item.Ico.Trim1() + "\" style=\"font-size:14px;vertical-align:middle;" + (item.Color.IsNullOrEmpty() ? "" : ("color:" + item.Color + ";")) + "\"></i>"));
                JsonData jsonData2 = new JsonData();
                jsonData2["id"]        = item.ID.ToString();
                jsonData2["Title"]     = empty + "<span style=\"vertical-align:middle;margin-left:4px;\">" + item.Title + "</span>";
                jsonData2["Address"]   = item.Address;
                jsonData2["TypeTitle"] = dictionary.GetTitle(item.Type);
                jsonData2["Opation"]   = "<a class=\"editlink\" href=\"javascript:void(0);\" onclick=\"edit('" + item.ID.ToString() + "');return false;\" style=\"margin-right:6px;\">编辑</a><a class=\"editlink\" href=\"javascript:void(0);\" onclick=\"editsubpage('" + item.ID.ToString() + "');return false;\">子页面</a>";
                jsonData.Add(jsonData2);
            }
            return("{\"userdata\":{\"total\":" + count + ",\"pagesize\":" + pageSize + ",\"pagenumber\":" + pageNumber + "},\"rows\":" + jsonData.ToJson() + "}");
        }
        public string QueryCompletedList()
        {
            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();
            string order      = (text.IsNullOrEmpty() ? "CompletedTime1" : text) + " " + (text2.IsNullOrEmpty() ? "asc" : text2);
            long   count;
            List <RoadFlow.Data.Model.WorkFlowTask> tasks = workFlowTask.GetTasks(MyController.CurrentUserID, out count, pageSize, pageNumber, str.Trim1(), flowid, sender, date, date2, 1, order);
            JsonData jsonData = new JsonData();

            foreach (RoadFlow.Data.Model.WorkFlowTask item in tasks)
            {
                bool isHasten = false;
                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);
                }
                StringBuilder stringBuilder = new StringBuilder();
                stringBuilder.Append("<a class=\"viewlink\" href=\"javascript:void(0);\" onclick=\"detail('" + item.FlowID + "','" + item.GroupID + "','" + item.ID + "');return false;\">查看</a>");
                if (item.Status == 2 && workFlowTask.HasWithdraw(item.ID, out isHasten))
                {
                    stringBuilder.Append("<a style=\"background:url(" + base.Url.Content("~/Images/ico/back.gif") + ") no-repeat left center; padding-left:18px;margin-left:5px;\" href=\"javascript:void(0);\" onclick=\"withdraw('" + item.ID + "');\">收回</a>");
                }
                if (isHasten)
                {
                    stringBuilder.Append("<a style=\"background:url(" + base.Url.Content("~/Images/ico/comment_reply.png") + ") no-repeat left center; padding-left:18px;margin-left:5px;\" href=\"javascript:void(0);\" onclick=\"hasten('" + item.ID + "');\">催办</a>");
                }
                JsonData jsonData2 = new JsonData();
                jsonData2["id"]            = item.ID.ToString();
                jsonData2["FlowName"]      = workFlow.GetFlowName(item.FlowID);
                jsonData2["Note"]          = item.Note;
                jsonData2["ReceiveTime"]   = item.ReceiveTime.ToDateTimeString();
                jsonData2["CompletedTime"] = (item.CompletedTime1.HasValue ? item.CompletedTime1.Value.ToDateTimeString() : "");
                jsonData2["SenderName"]    = item.SenderName;
                jsonData2["StepName"]      = item.StepName;
                jsonData2["Title"]         = "<a href=\"javascript:void(0);\" onclick=\"openTask('/WorkFlowRun/Index?" + string.Format("flowid={0}&stepid={1}&instanceid={2}&taskid={3}&groupid={4}&appid={5}&display=1", 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>";
                jsonData2["Opation"]       = stringBuilder.ToString();
                jsonData.Add(jsonData2);
            }
            return("{\"userdata\":{\"total\":" + count + ",\"pagesize\":" + pageSize + ",\"pagenumber\":" + pageNumber + "},\"rows\":" + jsonData.ToJson() + "}");
        }
Beispiel #4
0
        /// <summary>
        /// 得到角色应用刷新JSON
        /// </summary>
        /// <returns></returns>
        public string GetRoleAppRefreshJsonString(Guid roleID, Guid userID, Guid refreshID, string rootDir = "")
        {
            RoleApp    roleApp   = new RoadFlow.Platform.RoleApp();
            UsersApp   UsersApp  = new Platform.UsersApp();
            AppLibrary Applibary = new AppLibrary();
            DataTable  roleAppDt = roleApp.GetAllDataTableFromCache();
            DataTable  appDt1    = CloneDataTable(roleAppDt);

            UsersApp.AppendUserApps(userID, appDt1);
            var dv = appDt1.DefaultView;

            dv.RowFilter = string.Format("ParentID='{0}'", refreshID);
            dv.Sort      = "Sort";
            var appDt = dv.ToTable();

            if (appDt.Rows.Count == 0)
            {
                return("[]");
            }
            int count = appDt.Rows.Count;

            System.Text.StringBuilder json = new System.Text.StringBuilder("[", count * 100);

            foreach (DataRow dr in appDt.Rows)
            {
                if (!dr["UseMember"].ToString().IsNullOrEmpty() && dr["AppID"].ToString().IsGuid() &&
                    !Applibary.GetUseMemberCache(dr["AppID"].ToString().ToGuid()).Contains(userID))
                {
                    continue;
                }
                json.Append("{");
                json.AppendFormat("\"id\":\"{0}\",", dr["ID"].ToString());
                json.AppendFormat("\"title\":\"{0}\",", dr["Title"].ToString().Trim());
                json.AppendFormat("\"ico\":\"{0}\",", dr["Ico"].ToString().IsNullOrEmpty() ? "" : rootDir + dr["Ico"].ToString());
                json.AppendFormat("\"link\":\"{0}\",", getAddress(dr));
                json.AppendFormat("\"model\":\"{0}\",", dr["OpenMode"].ToString());
                json.AppendFormat("\"width\":\"{0}\",", dr["Width"].ToString());
                json.AppendFormat("\"height\":\"{0}\",", dr["Height"].ToString());
                json.AppendFormat("\"hasChilds\":\"{0}\",", appDt1.Select(string.Format("ParentID='{0}'", dr["id"].ToString())).Length > 0 ? "1" : "0");
                json.AppendFormat("\"childs\":[");

                json.Append("]");
                json.Append("}");
                if (dr["ID"].ToString() != appDt.Rows[appDt.Rows.Count - 1]["ID"].ToString())
                {
                    json.Append(",");
                }
            }
            json.Append("]");
            return(json.ToString());
        }
Beispiel #5
0
        public ActionResult AddApp(FormCollection collection)
        {
            RoadFlow.Platform.AppLibrary appLibrary = new RoadFlow.Platform.AppLibrary();
            RoadFlow.Platform.Menu       menu       = new RoadFlow.Platform.Menu();
            string text = base.Request.QueryString["id"];

            if (collection != null)
            {
                menu.Get(text.ToGuid());
                if (!base.Request.Form["Save"].IsNullOrEmpty())
                {
                    string text2 = base.Request.Form["Name"];
                    string text6 = base.Request.Form["Type"];
                    string str   = base.Request.Form["AppID"];
                    string text3 = base.Request.Form["Params"];
                    string text4 = base.Request.Form["Ico"];
                    string text5 = base.Request.Form["IcoColor"];
                    RoadFlow.Data.Model.Menu menu2 = new RoadFlow.Data.Model.Menu();
                    menu2.ID       = Guid.NewGuid();
                    menu2.ParentID = text.ToGuid();
                    menu2.Title    = text2.Trim();
                    menu2.Sort     = menu.GetMaxSort(menu2.ParentID);
                    if (str.IsGuid())
                    {
                        menu2.AppLibraryID = str.ToGuid();
                    }
                    else
                    {
                        menu2.AppLibraryID = null;
                    }
                    menu2.Params = (text3.IsNullOrEmpty() ? null : text3.Trim());
                    if (!text4.IsNullOrEmpty())
                    {
                        menu2.Ico = text4;
                    }
                    if (!text5.IsNullOrEmpty())
                    {
                        menu2.IcoColor = text5;
                    }
                    menu.Add(menu2);
                    RoadFlow.Platform.Log.Add("添加了菜单", menu2.Serialize(), RoadFlow.Platform.Log.Types.菜单权限);
                    string str2 = text;
                    base.ViewBag.Script = "alert('添加成功');parent.frames[0].reLoad('" + str2 + "');";
                    menu.ClearAllDataTableCache();
                }
            }
            base.ViewBag.AppTypesOptions = appLibrary.GetTypeOptions();
            return(View());
        }
Beispiel #6
0
        /// <summary>
        /// 更新应用程序库使用人员缓存
        /// </summary>
        /// <param name="appid"></param>
        /// <param name="userIdString"></param>
        public List <Guid> UpdateUseMemberCache(Guid appid)
        {
            string key = RoadFlow.Utility.Keys.CacheKeys.AppLibraryUseMember.ToString();
            var    obj = RoadFlow.Cache.IO.Opation.Get(key);
            Dictionary <Guid, List <Guid> > dict;

            if (obj != null && obj is Dictionary <Guid, List <Guid> > )
            {
                dict = obj as Dictionary <Guid, List <Guid> >;
            }
            else
            {
                dict = new Dictionary <Guid, List <Guid> >();
            }
            var app = new AppLibrary().Get(appid);

            if (app == null)
            {
                return(new List <Guid>());
            }
            if (dict.ContainsKey(appid))
            {
                if (app.UseMember.IsNullOrEmpty())
                {
                    dict.Remove(appid);
                    return(new List <Guid>());
                }
                else
                {
                    var userIDs = new Organize().GetAllUsersIdList(app.UseMember);
                    dict[appid] = userIDs;
                    return(userIDs);
                }
            }
            else if (!app.UseMember.IsNullOrEmpty())
            {
                var userIDs = new Organize().GetAllUsersIdList(app.UseMember);
                dict.Add(appid, userIDs);
                return(userIDs);
            }
            return(new List <Guid>());
        }
Beispiel #7
0
        /// <summary>
        /// 得到一个应用程序库的使用人员
        /// </summary>
        /// <param name="appid"></param>
        /// <returns></returns>
        public List <Guid> GetUseMemberCache(Guid appid)
        {
            string key = RoadFlow.Utility.Keys.CacheKeys.AppLibraryUseMember.ToString();
            var    obj = RoadFlow.Cache.IO.Opation.Get(key);

            if (obj != null && obj is Dictionary <Guid, List <Guid> > )
            {
                var dict = obj as Dictionary <Guid, List <Guid> >;
                if (dict.ContainsKey(appid))
                {
                    return(dict[appid]);
                }
            }
            var app = new AppLibrary().Get(appid);

            if (app == null || app.UseMember.IsNullOrEmpty())
            {
                return(new List <Guid>());
            }
            return(UpdateUseMemberCache(appid));
        }
Beispiel #8
0
        public string GetTitles()
        {
            string msg;

            if (!WebMvc.Common.Tools.CheckLogin(out msg) && !RoadFlow.Platform.WeiXin.Organize.CheckLogin())
            {
                return("");
            }
            string text  = base.Request.QueryString["values"];
            string text2 = base.Request.QueryString["titlefield"];
            string text3 = base.Request.QueryString["pkfield"];
            string str   = base.Request.QueryString["applibaryid"];

            RoadFlow.Data.Model.AppLibrary appLibrary = new RoadFlow.Platform.AppLibrary().Get(str.ToGuid());
            if (appLibrary == null)
            {
                return(text);
            }
            RoadFlow.Data.Model.ProgramBuilder programBuilder = new RoadFlow.Platform.ProgramBuilder().Get(appLibrary.Code.ToGuid());
            if (programBuilder == null)
            {
                return(text);
            }
            RoadFlow.Data.Model.DBConnection dBConnection = new RoadFlow.Platform.DBConnection().Get(programBuilder.DBConnID);
            if (dBConnection == null)
            {
                return(text);
            }
            string        sql           = "select " + text2 + " from (" + programBuilder.SQL.ReplaceSelectSql().FilterWildcard(RoadFlow.Platform.Users.CurrentUserID.ToString()) + ") gettitletemptable where " + text3 + " in(" + RoadFlow.Utility.Tools.GetSqlInString(text) + ")";
            DataTable     dataTable     = new RoadFlow.Platform.DBConnection().GetDataTable(dBConnection, sql);
            StringBuilder stringBuilder = new StringBuilder();

            foreach (DataRow row in dataTable.Rows)
            {
                stringBuilder.Append(row[0]);
                stringBuilder.Append(",");
            }
            return(stringBuilder.ToString().TrimEnd(','));
        }
Beispiel #9
0
        /// <summary>
        /// 得到角色应用JSON
        /// </summary>
        /// <param name="roleID"></param>
        /// <returns></returns>
        public string GetRoleAppJsonString(Guid roleID, Guid userID, string rootDir = "")
        {
            RoleApp    RoleApp   = new RoadFlow.Platform.RoleApp();
            UsersApp   UsersApp  = new Platform.UsersApp();
            AppLibrary Applibary = new AppLibrary();

            System.Data.DataTable roleAppDt = RoleApp.GetAllDataTableFromCache();
            System.Data.DataTable appDt     = CloneDataTable(roleAppDt);
            UsersApp.AppendUserApps(userID, appDt);
            if (appDt.Rows.Count == 0)
            {
                return("[]");
            }
            var root = appDt.Select(string.Format("ParentID='{0}' AND RoleID='{1}'", Guid.Empty.ToString(), roleID));

            if (root.Length == 0)
            {
                return("[]");
            }

            var apps = appDt.Select(string.Format("ParentID='{0}'", root[0]["ID"].ToString()));

            System.Text.StringBuilder json   = new System.Text.StringBuilder("[", 1000);
            System.Data.DataRow       rootDr = root[0];
            json.Append("{");
            json.AppendFormat("\"id\":\"{0}\",", rootDr["ID"].ToString());
            json.AppendFormat("\"title\":\"{0}\",", rootDr["Title"].ToString().Trim());
            json.AppendFormat("\"ico\":\"{0}\",", rootDr["Ico"].ToString().IsNullOrEmpty() ? "" : rootDir + rootDr["Ico"].ToString());
            json.AppendFormat("\"link\":\"{0}\",", getAddress(rootDr).ToString());
            json.AppendFormat("\"model\":\"{0}\",", rootDr["OpenMode"].ToString());
            json.AppendFormat("\"width\":\"{0}\",", rootDr["Width"].ToString());
            json.AppendFormat("\"height\":\"{0}\",", rootDr["Height"].ToString());
            json.AppendFormat("\"hasChilds\":\"{0}\",", apps.Length > 0 ? "1" : "0");
            json.AppendFormat("\"childs\":[");

            for (int i = 0; i < apps.Length; i++)
            {
                DataRow dr = apps[i];
                if (!dr["UseMember"].ToString().IsNullOrEmpty() && dr["AppID"].ToString().IsGuid() &&
                    !Applibary.GetUseMemberCache(dr["AppID"].ToString().ToGuid()).Contains(userID))
                {
                    continue;
                }
                var childs = appDt.Select("ParentID='" + dr["ID"].ToString() + "'");
                json.Append("{");
                json.AppendFormat("\"id\":\"{0}\",", dr["ID"].ToString());
                json.AppendFormat("\"title\":\"{0}\",", dr["Title"].ToString());
                json.AppendFormat("\"ico\":\"{0}\",", dr["Ico"].ToString().IsNullOrEmpty() ? "" : rootDir + dr["Ico"].ToString());
                json.AppendFormat("\"link\":\"{0}\",", getAddress(dr));
                json.AppendFormat("\"model\":\"{0}\",", dr["OpenMode"].ToString());
                json.AppendFormat("\"width\":\"{0}\",", dr["Width"].ToString());
                json.AppendFormat("\"height\":\"{0}\",", dr["Height"].ToString());
                json.AppendFormat("\"hasChilds\":\"{0}\",", childs.Length > 0 ? "1" : "0");
                json.AppendFormat("\"childs\":[");

                /* DataRow[] apps1 = appDt.Select(string.Format("ParentID='{0}'", dr["ID"].ToString()));
                 * for (int j = 0; j < apps1.Length; j++)
                 * {
                 *  DataRow dr1 = apps1[j];
                 *  var childs1 = appDt.Select("ParentID='" + dr1["ID"].ToString() + "'");
                 *  json.Append("{");
                 *  json.AppendFormat("\"id\":\"{0}\",", dr1["ID"]);
                 *  json.AppendFormat("\"title\":\"{0}\",", dr1["Title"]);
                 *  json.AppendFormat("\"ico\":\"{0}\",", dr1["Ico"].ToString().IsNullOrEmpty() ? "" : rootDir + dr1["Ico"]);
                 *  json.AppendFormat("\"link\":\"{0}\",", getAddress(dr1));
                 *  json.AppendFormat("\"model\":\"{0}\",", dr1["OpenMode"]);
                 *  json.AppendFormat("\"width\":\"{0}\",", dr1["Width"]);
                 *  json.AppendFormat("\"height\":\"{0}\",", dr1["Height"]);
                 *  json.AppendFormat("\"hasChilds\":\"{0}\",", childs1.Length > 0 ? "1" : "0");
                 *  json.AppendFormat("\"childs\":[");
                 *  json.Append("]");
                 *  json.Append("}");
                 *  if (j < apps1.Length - 1)
                 *  {
                 *      json.Append(",");
                 *  }
                 * }*/

                json.Append("]");
                json.Append("}");
                if (dr["ID"].ToString() != apps[apps.Length - 1]["ID"].ToString())
                {
                    json.Append(",");
                }
            }
            json.Append("]");
            json.Append("}");
            json.Append("]");
            return(json.ToString());
        }
        public ActionResult Edit(FormCollection collection)
        {
            string str   = base.Request.QueryString["id"];
            string value = base.Request.QueryString["typeid"];

            RoadFlow.Platform.AppLibrary   appLibrary  = new RoadFlow.Platform.AppLibrary();
            RoadFlow.Data.Model.AppLibrary appLibrary2 = null;
            if (str.IsGuid())
            {
                appLibrary2 = appLibrary.Get(str.ToGuid());
            }
            bool   flag   = !str.IsGuid();
            string oldXML = string.Empty;

            if (appLibrary2 == null)
            {
                appLibrary2              = new RoadFlow.Data.Model.AppLibrary();
                appLibrary2.ID           = Guid.NewGuid();
                base.ViewBag.TypeOptions = new RoadFlow.Platform.AppLibrary().GetTypeOptions(value);
                base.ViewBag.OpenOptions = new RoadFlow.Platform.Dictionary().GetOptionsByCode("appopenmodel");
            }
            else
            {
                oldXML = appLibrary2.Serialize();
                base.ViewBag.TypeOptions = new RoadFlow.Platform.AppLibrary().GetTypeOptions(appLibrary2.Type.ToString());
                base.ViewBag.OpenOptions = new RoadFlow.Platform.Dictionary().GetOptionsByCode("appopenmodel", RoadFlow.Platform.Dictionary.OptionValueField.Value, appLibrary2.OpenMode.ToString());
            }
            if (collection != null)
            {
                string title   = collection["title"];
                string text    = collection["address"];
                string str2    = collection["openModel"];
                string str3    = collection["width"];
                string str4    = collection["height"];
                string @params = collection["Params"];
                string note    = collection["Note"];
                string text2   = collection["Ico"];
                string text3   = collection["IcoColor"];
                value = collection["type"];
                appLibrary2.Address  = text.Trim();
                appLibrary2.Height   = str4.ToIntOrNull();
                appLibrary2.Note     = note;
                appLibrary2.OpenMode = str2.ToInt();
                appLibrary2.Params   = @params;
                appLibrary2.Title    = title;
                appLibrary2.Type     = value.ToGuid();
                appLibrary2.Width    = str3.ToIntOrNull();
                if (!text2.IsNullOrEmpty())
                {
                    appLibrary2.Ico = text2;
                }
                else
                {
                    appLibrary2.Ico = null;
                }
                if (!text3.IsNullOrEmpty())
                {
                    appLibrary2.Color = text3.Trim();
                }
                else
                {
                    appLibrary2.Color = null;
                }
                string text4 = base.Request.QueryString["pagesize"];
                string text5 = base.Request.QueryString["pagenumber"];
                using (TransactionScope transactionScope = new TransactionScope())
                {
                    if (flag)
                    {
                        appLibrary.Add(appLibrary2);
                        RoadFlow.Platform.Log.Add("添加了应用程序库", appLibrary2.Serialize(), RoadFlow.Platform.Log.Types.菜单权限);
                        base.ViewBag.Script = "alert('添加成功!');new RoadUI.Window().reloadOpener(undefined,undefined,\"query('" + text4 + "','" + text5 + "')\");new RoadUI.Window().close();";
                    }
                    else
                    {
                        appLibrary.Update(appLibrary2);
                        RoadFlow.Platform.Log.Add("修改了应用程序库", "", RoadFlow.Platform.Log.Types.菜单权限, oldXML, appLibrary2.Serialize());
                        base.ViewBag.Script = "alert('修改成功!');new RoadUI.Window().reloadOpener(undefined,undefined,\"query('" + text4 + "','" + text5 + "')\");new RoadUI.Window().close();";
                    }
                    RoadFlow.Platform.AppLibraryButtons1 appLibraryButtons = new RoadFlow.Platform.AppLibraryButtons1();
                    string obj = base.Request.Form["buttonindex"] ?? "";
                    List <RoadFlow.Data.Model.AppLibraryButtons1> allByAppID = appLibraryButtons.GetAllByAppID(appLibrary2.ID);
                    List <RoadFlow.Data.Model.AppLibraryButtons1> list       = new List <RoadFlow.Data.Model.AppLibraryButtons1>();
                    string[] array = obj.Split(',');
                    foreach (string index in array)
                    {
                        string str5  = base.Request.Form["button_" + index];
                        string str6  = base.Request.Form["buttonname_" + index];
                        string text6 = base.Request.Form["buttonevents_" + index];
                        string ico   = base.Request.Form["buttonico_" + index];
                        string str7  = base.Request.Form["showtype_" + index];
                        string str8  = base.Request.Form["buttonsort_" + index];
                        if (!str6.IsNullOrEmpty() && !text6.IsNullOrEmpty())
                        {
                            RoadFlow.Data.Model.AppLibraryButtons1 appLibraryButtons2 = allByAppID.Find((RoadFlow.Data.Model.AppLibraryButtons1 p) => p.ID == index.ToGuid());
                            bool flag2 = false;
                            if (appLibraryButtons2 == null)
                            {
                                flag2 = true;
                                appLibraryButtons2    = new RoadFlow.Data.Model.AppLibraryButtons1();
                                appLibraryButtons2.ID = Guid.NewGuid();
                            }
                            else
                            {
                                list.Add(appLibraryButtons2);
                            }
                            appLibraryButtons2.AppLibraryID = appLibrary2.ID;
                            if (str5.IsGuid())
                            {
                                appLibraryButtons2.ButtonID = str5.ToGuid();
                            }
                            appLibraryButtons2.Events   = text6;
                            appLibraryButtons2.Ico      = ico;
                            appLibraryButtons2.Name     = str6.Trim1();
                            appLibraryButtons2.Sort     = str8.ToInt(0);
                            appLibraryButtons2.ShowType = str7.ToInt(0);
                            appLibraryButtons2.Type     = 0;
                            if (flag2)
                            {
                                appLibraryButtons.Add(appLibraryButtons2);
                            }
                            else
                            {
                                appLibraryButtons.Update(appLibraryButtons2);
                            }
                        }
                    }
                    foreach (RoadFlow.Data.Model.AppLibraryButtons1 item in allByAppID)
                    {
                        if (list.Find((RoadFlow.Data.Model.AppLibraryButtons1 p) => p.ID == item.ID) == null)
                        {
                            appLibraryButtons.Delete(item.ID);
                        }
                    }
                    transactionScope.Complete();
                    appLibraryButtons.ClearCache();
                }
                new RoadFlow.Platform.Menu().ClearAllDataTableCache();
                new RoadFlow.Platform.WorkFlow().ClearStartFlowsCache();
                appLibrary.ClearCache();
            }
            return(View(appLibrary2));
        }
        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() + "}");
        }
Beispiel #12
0
        public bool Publish(Guid id, bool isMvc = false)
        {
            RoadFlow.Data.Model.ProgramBuilder model1 = this.Get(id);
            if (model1 == null || model1.Name.IsNullOrEmpty() || model1.SQL.IsNullOrEmpty())
            {
                return(false);
            }
            AppLibrary appLibrary = new AppLibrary();

            RoadFlow.Data.Model.AppLibrary model2 = appLibrary.GetByCode(id.ToString(), true);
            bool flag1 = false;

            using (TransactionScope transactionScope = new TransactionScope())
            {
                if (model2 == null)
                {
                    flag1     = true;
                    model2    = new RoadFlow.Data.Model.AppLibrary();
                    model2.ID = Guid.NewGuid();
                }
                model2.Address  = !isMvc ? "/Platform/ProgramBuilder/Run.aspx?programid=" + id.ToString() : "/ProgramBuilder/Run?programid=" + id.ToString();
                model2.Code     = id.ToString();
                model2.OpenMode = 0;
                model2.Title    = model1.Name;
                model2.Type     = model1.Type;
                if (flag1)
                {
                    appLibrary.Add(model2);
                }
                else
                {
                    appLibrary.Update(model2);
                }
                model1.Status = 1;
                this.Update(model1);
                List <RoadFlow.Data.Model.ProgramBuilderButtons> all = new ProgramBuilderButtons().GetAll(model1.ID);
                AppLibraryButtons1 appLibraryButtons1_1 = new AppLibraryButtons1();
                List <RoadFlow.Data.Model.AppLibraryButtons1> allByAppId             = appLibraryButtons1_1.GetAllByAppID(model2.ID);
                List <RoadFlow.Data.Model.AppLibraryButtons1> appLibraryButtons1List = new List <RoadFlow.Data.Model.AppLibraryButtons1>();
                foreach (RoadFlow.Data.Model.ProgramBuilderButtons programBuilderButtons in all)
                {
                    RoadFlow.Data.Model.ProgramBuilderButtons button = programBuilderButtons;
                    RoadFlow.Data.Model.AppLibraryButtons1    model3 = allByAppId.Find((Predicate <RoadFlow.Data.Model.AppLibraryButtons1>)(p => p.ID == button.ID));
                    bool flag2 = false;
                    if (model3 == null)
                    {
                        model3 = new RoadFlow.Data.Model.AppLibraryButtons1();
                        flag2  = true;
                    }
                    model3.AppLibraryID   = model2.ID;
                    model3.ButtonID       = button.ButtonID;
                    model3.Events         = button.ClientScript;
                    model3.Ico            = button.Ico ?? "";
                    model3.ID             = button.ID;
                    model3.Name           = button.ButtonName;
                    model3.ShowType       = button.ShowType;
                    model3.Sort           = button.Sort;
                    model3.Type           = 0;
                    model3.IsValidateShow = button.IsValidateShow;
                    if (flag2)
                    {
                        appLibraryButtons1_1.Add(model3);
                    }
                    else
                    {
                        appLibraryButtons1_1.Update(model3);
                    }
                    appLibraryButtons1List.Add(model3);
                }
                foreach (RoadFlow.Data.Model.AppLibraryButtons1 appLibraryButtons1_2 in allByAppId)
                {
                    RoadFlow.Data.Model.AppLibraryButtons1 button = appLibraryButtons1_2;
                    if (appLibraryButtons1List.Find((Predicate <RoadFlow.Data.Model.AppLibraryButtons1>)(p => p.ID == button.ID)) == null)
                    {
                        appLibraryButtons1_1.Delete(button.ID);
                    }
                }
                transactionScope.Complete();
            }
            new AppLibrary().ClearCache();
            new Menu().ClearAllDataTableCache();
            new AppLibraryButtons1().ClearCache();
            new AppLibrarySubPages().ClearCache();
            this.AddToCache(new ProgramBuilderCache()
            {
                Program   = model1,
                Fields    = new ProgramBuilderFields().GetAll(model1.ID).OrderBy <RoadFlow.Data.Model.ProgramBuilderFields, int>((Func <RoadFlow.Data.Model.ProgramBuilderFields, int>)(p => p.Sort)).ToList <RoadFlow.Data.Model.ProgramBuilderFields>(),
                Querys    = new ProgramBuilderQuerys().GetAll(model1.ID).OrderBy <RoadFlow.Data.Model.ProgramBuilderQuerys, int>((Func <RoadFlow.Data.Model.ProgramBuilderQuerys, int>)(p => p.Sort)).ToList <RoadFlow.Data.Model.ProgramBuilderQuerys>(),
                Buttons   = new ProgramBuilderButtons().GetAll(id).OrderBy <RoadFlow.Data.Model.ProgramBuilderButtons, int>((Func <RoadFlow.Data.Model.ProgramBuilderButtons, int>)(p => p.Sort)).ToList <RoadFlow.Data.Model.ProgramBuilderButtons>(),
                Validates = new ProgramBuilderValidates().GetAll(id),
                Export    = new ProgramBuilderExport().GetAll(id).OrderBy <RoadFlow.Data.Model.ProgramBuilderExport, int>((Func <RoadFlow.Data.Model.ProgramBuilderExport, int>)(p => p.Sort)).ToList <RoadFlow.Data.Model.ProgramBuilderExport>()
            });
            return(true);
        }
Beispiel #13
0
        public ActionResult Body(FormCollection collection)
        {
            RoadFlow.Platform.AppLibrary appLibrary = new RoadFlow.Platform.AppLibrary();
            RoadFlow.Platform.Menu       menu       = new RoadFlow.Platform.Menu();
            RoadFlow.Data.Model.Menu     menu2      = null;
            string str    = base.Request.QueryString["id"];
            string empty  = string.Empty;
            string value  = string.Empty;
            string empty2 = string.Empty;
            string empty3 = string.Empty;
            string empty4 = string.Empty;
            string empty5 = string.Empty;
            Guid   test;

            if (str.IsGuid(out test))
            {
                menu2 = menu.Get(test);
            }
            if (!base.Request.Form["Save"].IsNullOrEmpty())
            {
                empty  = base.Request.Form["Name"];
                value  = base.Request.Form["Type"];
                empty2 = base.Request.Form["AppID"];
                empty3 = base.Request.Form["Params"];
                empty4 = base.Request.Form["Ico"];
                empty5 = base.Request.Form["IcoColor"];
                string oldXML = menu2.Serialize();
                menu2.Title = empty.Trim();
                if (empty2.IsGuid())
                {
                    menu2.AppLibraryID = empty2.ToGuid();
                }
                else
                {
                    menu2.AppLibraryID = null;
                }
                menu2.Params = (empty3.IsNullOrEmpty() ? null : empty3.Trim());
                if (!empty4.IsNullOrEmpty())
                {
                    menu2.Ico = empty4;
                }
                else
                {
                    menu2.Ico = null;
                }
                if (!empty5.IsNullOrEmpty())
                {
                    menu2.IcoColor = empty5;
                }
                else
                {
                    menu2.IcoColor = null;
                }
                menu.Update(menu2);
                RoadFlow.Platform.Log.Add("修改了菜单", "", RoadFlow.Platform.Log.Types.菜单权限, oldXML, menu2.Serialize());
                string str2 = (menu2.ParentID == Guid.Empty) ? menu2.ID.ToString() : menu2.ParentID.ToString();
                base.ViewBag.Script = "parent.frames[0].reLoad('" + str2 + "');alert('保存成功!');";
                menu.ClearAllDataTableCache();
            }
            if (!base.Request.Form["Delete"].IsNullOrEmpty())
            {
                RoadFlow.Platform.Log.Add("删除了菜单及其所有下级共" + menu.DeleteAndAllChilds(menu2.ID).ToString() + "项", menu2.Serialize(), RoadFlow.Platform.Log.Types.菜单权限);
                string text = (menu2.ParentID == Guid.Empty) ? menu2.ID.ToString() : menu2.ParentID.ToString();
                base.ViewBag.Script = "parent.frames[0].reLoad('" + text + "');window.location='Body?id=" + text + "&appid=" + base.Request.QueryString["appid"] + "&tabid=" + base.Request.QueryString["tabid"] + "';";
                menu.ClearAllDataTableCache();
            }
            if (menu2 != null && menu2.AppLibraryID.HasValue)
            {
                RoadFlow.Data.Model.AppLibrary appLibrary2 = new RoadFlow.Platform.AppLibrary().Get(menu2.AppLibraryID.Value);
                if (appLibrary2 != null)
                {
                    value = appLibrary2.Type.ToString();
                }
            }
            base.ViewBag.AppTypesOptions = appLibrary.GetTypeOptions(value);
            base.ViewBag.AppID           = menu2.AppLibraryID.ToString();
            return(View(menu2));
        }
Beispiel #14
0
        public static Dictionary <int, string> getButtonsHtml(string menuID = "", string subpageID = "", string programID = "")
        {
            Guid menuID2;

            if (menuID.IsNullOrEmpty() || !menuID.IsGuid(out menuID2))
            {
                menuID2 = HttpContext.Current.Request.QueryString["appid"].ToGuid();
            }
            Guid subpageID2;

            if (!subpageID.IsGuid(out subpageID2))
            {
                subpageID2 = HttpContext.Current.Request.QueryString["subpageid"].ToGuid();
            }
            Dictionary <int, string> dictionary = new Dictionary <int, string>();

            dictionary.Add(0, "");
            dictionary.Add(1, "");
            dictionary.Add(2, "");
            string      str  = HttpContext.Current.Request.QueryString["applibaryid"];
            List <Guid> list = new List <Guid>();

            if (str.IsGuid())
            {
                foreach (RoadFlow.Data.Model.AppLibraryButtons1 item in new AppLibraryButtons1().GetAllByAppID(str.ToGuid()).FindAll((RoadFlow.Data.Model.AppLibraryButtons1 p) => p.IsValidateShow == 1))
                {
                    list.Add(item.ID);
                }
            }
            else
            {
                foreach (RoadFlow.Data.Model.MenuUser item2 in new MenuUser().GetAll().FindAll(delegate(RoadFlow.Data.Model.MenuUser p)
                {
                    if (p.MenuID == menuID2 && p.SubPageID == subpageID2)
                    {
                        return(p.Users.Contains(Users.CurrentUserID.ToString(), StringComparison.CurrentCultureIgnoreCase));
                    }
                    return(false);
                }))
                {
                    string[] array = item2.Buttons.Split(',');
                    for (int i = 0; i < array.Length; i++)
                    {
                        Guid test;
                        if (array[i].IsGuid(out test) && !list.Contains(test))
                        {
                            list.Add(test);
                        }
                    }
                }
            }
            List <RoadFlow.Data.Model.AppLibraryButtons1> list2 = new List <RoadFlow.Data.Model.AppLibraryButtons1>();

            RoadFlow.Data.Model.AppLibrary byCode = new AppLibrary().GetByCode(programID);
            if (byCode != null)
            {
                list2.AddRange(new AppLibraryButtons1().GetAllByAppID(byCode.ID).FindAll((RoadFlow.Data.Model.AppLibraryButtons1 p) => p.IsValidateShow == 0));
            }
            if (list.Count == 0 && list2.Count == 0)
            {
                return(dictionary);
            }
            StringBuilder      stringBuilder     = new StringBuilder();
            StringBuilder      stringBuilder2    = new StringBuilder();
            StringBuilder      stringBuilder3    = new StringBuilder();
            AppLibraryButtons1 appLibraryButtons = new AppLibraryButtons1();

            foreach (Guid item3 in list)
            {
                RoadFlow.Data.Model.AppLibraryButtons1 appLibraryButtons2 = appLibraryButtons.Get(item3, true);
                if (appLibraryButtons2 != null && appLibraryButtons2.IsValidateShow != 0)
                {
                    list2.Add(appLibraryButtons2);
                }
            }
            foreach (RoadFlow.Data.Model.AppLibraryButtons1 item4 in from p in list2
                     orderby p.Sort
                     select p)
            {
                string userID = Users.CurrentUserID.ToString();
                if (item4.ShowType == 0)
                {
                    string text = "fun_" + Guid.NewGuid().ToString("N");
                    stringBuilder.Append("<a href=\"javascript:void(0);\" onclick=\"" + text + "();return false;\"><span style=\"" + ((!item4.Ico.IsNullOrEmpty() && !item4.Ico.IsFontIco()) ? ("background-image:url(" + Config.BaseUrl + item4.Ico + ");") : "padding-left:0px;") + "\">" + ((!item4.Ico.IsNullOrEmpty() && item4.Ico.IsFontIco()) ? ("<i class='fa " + item4.Ico + "' style='font-size:14px;vertical-align:middle;margin-right:3px;'></i>") : "") + item4.Name + "</span></a>");
                    stringBuilder.Append("<script type=\"text/javascript\">function " + text + "(){" + item4.Events.FilterWildcard(userID) + "}</script>");
                }
                else if (item4.ShowType == 1)
                {
                    string text2 = "fun_" + Guid.NewGuid().ToString("N");
                    stringBuilder2.Append("<button type=\"button\" " + (item4.Ico.IsNullOrEmpty() ? "style=\"margin-left:6px;\"" : ("style=\"margin-left:6px;" + ((!item4.Ico.IsNullOrEmpty() && !item4.Ico.IsFontIco()) ? ("background-image:url(" + Config.BaseUrl + item4.Ico + ");background-repeat:no-repeat;background-position-y:center;background-position-x:8px;padding-left:28px;") : "") + "\"")) + " onclick=\"" + text2 + "();return false;\" class=\"mybutton\">");
                    if (!item4.Ico.IsNullOrEmpty() && item4.Ico.IsFontIco())
                    {
                        stringBuilder2.Append("<i class=\"fa " + item4.Ico + "\" style=\"font-size:14px;vertical-align:middle;margin-right:3px;\"></i>");
                    }
                    stringBuilder2.Append("<span style=\"vertical-align:middle;\">" + item4.Name + "</span>");
                    stringBuilder2.Append("</button>");
                    stringBuilder2.Append("<script type=\"text/javascript\">function " + text2 + "(){" + item4.Events.FilterWildcard(userID) + "}</script>");
                }
                else if (item4.ShowType == 2)
                {
                    string text3 = "fun_" + Guid.NewGuid().ToString("N");
                    stringBuilder3.Append("<a href=\"javascript:void(0);\" onclick=\"" + item4.Events + ";return false;\" " + (item4.Ico.IsNullOrEmpty() ? "style=\"margin-left:0px;\"" : ("style=\"margin-left:0px;" + ((!item4.Ico.IsFontIco()) ? ("padding-left:26px;background-image:url(" + Config.BaseUrl + item4.Ico + ");background-repeat:no-repeat;background-position-y:center;background-position-x:8px;") : "") + "\"")) + ">" + ((!item4.Ico.IsNullOrEmpty() && item4.Ico.IsFontIco()) ? ("<i class='fa " + item4.Ico + "' style='font-size:14px;vertical-align:middle;margin-right:3px;padding-left:10px;'></i>") : "") + item4.Name + "</a>");
                }
            }
            dictionary[0] = ((stringBuilder.Length > 0) ? ("<div class=\"toolbar\" style=\"margin-top:0; border-top:none 0; position:fixed; top:0; left:0; right:0; margin-left:auto; z-index:999; width:100%; margin-right:auto;\">" + stringBuilder.ToString() + "</div>") : "");
            dictionary[1] = stringBuilder2.ToString();
            dictionary[2] = stringBuilder3.ToString();
            return(dictionary);
        }
Beispiel #15
0
        public bool Publish(Guid id, bool isMvc = false)
        {
            RoadFlow.Data.Model.ProgramBuilder programBuilder = Get(id);
            if (programBuilder == null || programBuilder.Name.IsNullOrEmpty() || programBuilder.SQL.IsNullOrEmpty())
            {
                return(false);
            }
            AppLibrary appLibrary = new AppLibrary();

            RoadFlow.Data.Model.AppLibrary appLibrary2 = appLibrary.GetByCode(id.ToString());
            bool flag = false;

            using (TransactionScope transactionScope = new TransactionScope())
            {
                if (appLibrary2 == null)
                {
                    flag           = true;
                    appLibrary2    = new RoadFlow.Data.Model.AppLibrary();
                    appLibrary2.ID = Guid.NewGuid();
                }
                appLibrary2.Address  = ((!isMvc) ? ("/Platform/ProgramBuilder/Run.aspx?programid=" + id.ToString()) : ("/ProgramBuilder/Run?programid=" + id.ToString()));
                appLibrary2.Code     = id.ToString();
                appLibrary2.OpenMode = 0;
                appLibrary2.Title    = programBuilder.Name;
                appLibrary2.Type     = programBuilder.Type;
                if (flag)
                {
                    appLibrary.Add(appLibrary2);
                }
                else
                {
                    appLibrary.Update(appLibrary2);
                }
                programBuilder.Status = 1;
                Update(programBuilder);
                List <RoadFlow.Data.Model.ProgramBuilderButtons> all = new ProgramBuilderButtons().GetAll(programBuilder.ID);
                AppLibraryButtons1 appLibraryButtons = new AppLibraryButtons1();
                List <RoadFlow.Data.Model.AppLibraryButtons1> allByAppID = appLibraryButtons.GetAllByAppID(appLibrary2.ID);
                List <RoadFlow.Data.Model.AppLibraryButtons1> list       = new List <RoadFlow.Data.Model.AppLibraryButtons1>();
                foreach (RoadFlow.Data.Model.ProgramBuilderButtons item in all)
                {
                    RoadFlow.Data.Model.AppLibraryButtons1 appLibraryButtons2 = allByAppID.Find((RoadFlow.Data.Model.AppLibraryButtons1 p) => p.ID == item.ID);
                    bool flag2 = false;
                    if (appLibraryButtons2 == null)
                    {
                        appLibraryButtons2 = new RoadFlow.Data.Model.AppLibraryButtons1();
                        flag2 = true;
                    }
                    appLibraryButtons2.AppLibraryID   = appLibrary2.ID;
                    appLibraryButtons2.ButtonID       = item.ButtonID;
                    appLibraryButtons2.Events         = item.ClientScript;
                    appLibraryButtons2.Ico            = (item.Ico ?? "");
                    appLibraryButtons2.ID             = item.ID;
                    appLibraryButtons2.Name           = item.ButtonName;
                    appLibraryButtons2.ShowType       = item.ShowType;
                    appLibraryButtons2.Sort           = item.Sort;
                    appLibraryButtons2.Type           = 0;
                    appLibraryButtons2.IsValidateShow = item.IsValidateShow;
                    if (flag2)
                    {
                        appLibraryButtons.Add(appLibraryButtons2);
                    }
                    else
                    {
                        appLibraryButtons.Update(appLibraryButtons2);
                    }
                    list.Add(appLibraryButtons2);
                }
                foreach (RoadFlow.Data.Model.AppLibraryButtons1 item2 in allByAppID)
                {
                    if (list.Find((RoadFlow.Data.Model.AppLibraryButtons1 p) => p.ID == item2.ID) == null)
                    {
                        appLibraryButtons.Delete(item2.ID);
                    }
                }
                transactionScope.Complete();
            }
            new AppLibrary().ClearCache();
            new Menu().ClearAllDataTableCache();
            new AppLibraryButtons1().ClearCache();
            new AppLibrarySubPages().ClearCache();
            ProgramBuilderCache programBuilderCache = new ProgramBuilderCache();

            programBuilderCache.Program = programBuilder;
            programBuilderCache.Fields  = (from p in new ProgramBuilderFields().GetAll(programBuilder.ID)
                                           orderby p.Sort
                                           select p).ToList();
            programBuilderCache.Querys = (from p in new ProgramBuilderQuerys().GetAll(programBuilder.ID)
                                          orderby p.Sort
                                          select p).ToList();
            programBuilderCache.Buttons = (from p in new ProgramBuilderButtons().GetAll(id)
                                           orderby p.Sort
                                           select p).ToList();
            programBuilderCache.Validates = new ProgramBuilderValidates().GetAll(id);
            programBuilderCache.Export    = (from p in new ProgramBuilderExport().GetAll(id)
                                             orderby p.Sort
                                             select p).ToList();
            AddToCache(programBuilderCache);
            return(true);
        }
Beispiel #16
0
        public static System.Collections.Generic.Dictionary <int, string> getButtonsHtml(string menuID = "", string subpageID = "", string programID = "")
        {
            Guid menuID1;

            if (menuID.IsNullOrEmpty() || !menuID.IsGuid(out menuID1))
            {
                menuID1 = HttpContext.Current.Request.QueryString["appid"].ToGuid();
            }
            Guid subpageID1;

            if (!subpageID.IsGuid(out subpageID1))
            {
                subpageID1 = HttpContext.Current.Request.QueryString["subpageid"].ToGuid();
            }
            System.Collections.Generic.Dictionary <int, string> dictionary = new System.Collections.Generic.Dictionary <int, string>();
            dictionary.Add(0, "");
            dictionary.Add(1, "");
            dictionary.Add(2, "");
            string      str1     = HttpContext.Current.Request.QueryString["applibaryid"];
            List <Guid> guidList = new List <Guid>();

            if (str1.IsGuid())
            {
                foreach (RoadFlow.Data.Model.AppLibraryButtons1 appLibraryButtons1 in new AppLibraryButtons1().GetAllByAppID(str1.ToGuid()).FindAll((Predicate <RoadFlow.Data.Model.AppLibraryButtons1>)(p => p.IsValidateShow == 1)))
                {
                    guidList.Add(appLibraryButtons1.ID);
                }
            }
            else
            {
                foreach (RoadFlow.Data.Model.MenuUser menuUser in new MenuUser().GetAll(true).FindAll((Predicate <RoadFlow.Data.Model.MenuUser>)(p =>
                {
                    if (p.MenuID == menuID1 && p.SubPageID == subpageID1)
                    {
                        return(p.Users.Contains(Users.CurrentUserID.ToString(), StringComparison.CurrentCultureIgnoreCase));
                    }
                    return(false);
                })))
                {
                    string buttons = menuUser.Buttons;
                    char[] chArray = new char[1] {
                        ','
                    };
                    foreach (string str2 in buttons.Split(chArray))
                    {
                        Guid test;
                        if (str2.IsGuid(out test) && !guidList.Contains(test))
                        {
                            guidList.Add(test);
                        }
                    }
                }
            }
            List <RoadFlow.Data.Model.AppLibraryButtons1> source = new List <RoadFlow.Data.Model.AppLibraryButtons1>();

            RoadFlow.Data.Model.AppLibrary byCode = new AppLibrary().GetByCode(programID, true);
            if (byCode != null)
            {
                source.AddRange((IEnumerable <RoadFlow.Data.Model.AppLibraryButtons1>) new AppLibraryButtons1().GetAllByAppID(byCode.ID).FindAll((Predicate <RoadFlow.Data.Model.AppLibraryButtons1>)(p => p.IsValidateShow == 0)));
            }
            if (guidList.Count == 0 && source.Count == 0)
            {
                return(dictionary);
            }
            StringBuilder      stringBuilder1       = new StringBuilder();
            StringBuilder      stringBuilder2       = new StringBuilder();
            StringBuilder      stringBuilder3       = new StringBuilder();
            AppLibraryButtons1 appLibraryButtons1_1 = new AppLibraryButtons1();

            foreach (Guid id in guidList)
            {
                RoadFlow.Data.Model.AppLibraryButtons1 appLibraryButtons1_2 = appLibraryButtons1_1.Get(id, true);
                if (appLibraryButtons1_2 != null && appLibraryButtons1_2.IsValidateShow != 0)
                {
                    source.Add(appLibraryButtons1_2);
                }
            }
            foreach (RoadFlow.Data.Model.AppLibraryButtons1 appLibraryButtons1_2 in (IEnumerable <RoadFlow.Data.Model.AppLibraryButtons1>)source.OrderBy <RoadFlow.Data.Model.AppLibraryButtons1, int>((Func <RoadFlow.Data.Model.AppLibraryButtons1, int>)(p => p.Sort)))
            {
                string userID = Users.CurrentUserID.ToString();
                if (appLibraryButtons1_2.ShowType == 0)
                {
                    string str2 = "fun_" + Guid.NewGuid().ToString("N");
                    stringBuilder1.Append("<a href=\"javascript:void(0);\" onclick=\"" + str2 + "();return false;\"><span style=\"" + (appLibraryButtons1_2.Ico.IsNullOrEmpty() || appLibraryButtons1_2.Ico.IsFontIco() ? "padding-left:0px;" : "background-image:url(" + Config.BaseUrl + appLibraryButtons1_2.Ico + ");") + "\">" + (appLibraryButtons1_2.Ico.IsNullOrEmpty() || !appLibraryButtons1_2.Ico.IsFontIco() ? "" : "<i class='fa " + appLibraryButtons1_2.Ico + "' style='font-size:14px;vertical-align:middle;margin-right:3px;'></i>") + appLibraryButtons1_2.Name + "</span></a>");
                    stringBuilder1.Append("<script type=\"text/javascript\">function " + str2 + "(){" + appLibraryButtons1_2.Events.FilterWildcard(userID) + "}</script>");
                }
                else if (appLibraryButtons1_2.ShowType == 1)
                {
                    string str2 = "fun_" + Guid.NewGuid().ToString("N");
                    stringBuilder2.Append("<button type=\"button\" " + (appLibraryButtons1_2.Ico.IsNullOrEmpty() ? "style=\"margin-left:6px;\"" : "style=\"margin-left:6px;" + (appLibraryButtons1_2.Ico.IsNullOrEmpty() || appLibraryButtons1_2.Ico.IsFontIco() ? "" : "background-image:url(" + Config.BaseUrl + appLibraryButtons1_2.Ico + ");background-repeat:no-repeat;background-position-y:center;background-position-x:8px;padding-left:28px;") + "\"") + " onclick=\"" + str2 + "();return false;\" class=\"mybutton\">");
                    if (!appLibraryButtons1_2.Ico.IsNullOrEmpty() && appLibraryButtons1_2.Ico.IsFontIco())
                    {
                        stringBuilder2.Append("<i class=\"fa " + appLibraryButtons1_2.Ico + "\" style=\"font-size:14px;vertical-align:middle;margin-right:3px;\"></i>");
                    }
                    stringBuilder2.Append("<span style=\"vertical-align:middle;\">" + appLibraryButtons1_2.Name + "</span>");
                    stringBuilder2.Append("</button>");
                    stringBuilder2.Append("<script type=\"text/javascript\">function " + str2 + "(){" + appLibraryButtons1_2.Events.FilterWildcard(userID) + "}</script>");
                }
                else if (appLibraryButtons1_2.ShowType == 2)
                {
                    string str2 = "fun_" + Guid.NewGuid().ToString("N");
                    stringBuilder3.Append("<a href=\"javascript:void(0);\" onclick=\"" + appLibraryButtons1_2.Events + ";return false;\" " + (appLibraryButtons1_2.Ico.IsNullOrEmpty() ? "style=\"margin-left:0px;\"" : "style=\"margin-left:0px;" + (!appLibraryButtons1_2.Ico.IsFontIco() ? "padding-left:26px;background-image:url(" + Config.BaseUrl + appLibraryButtons1_2.Ico + ");background-repeat:no-repeat;background-position-y:center;background-position-x:8px;" : "") + "\"") + ">" + (appLibraryButtons1_2.Ico.IsNullOrEmpty() || !appLibraryButtons1_2.Ico.IsFontIco() ? "" : "<i class='fa " + appLibraryButtons1_2.Ico + "' style='font-size:14px;vertical-align:middle;margin-right:3px;padding-left:10px;'></i>") + appLibraryButtons1_2.Name + "</a>");
                }
            }
            dictionary[0] = stringBuilder1.Length > 0 ? "<div class=\"toolbar\" style=\"margin-top:0; border-top:none 0; position:fixed; top:0; left:0; right:0; margin-left:auto; z-index:999; width:100%; margin-right:auto;\">" + stringBuilder1.ToString() + "</div>" : "";
            dictionary[1] = stringBuilder2.ToString();
            dictionary[2] = stringBuilder3.ToString();
            return(dictionary);
        }
        public string Publish()
        {
            string text  = base.Request["html"];
            string text2 = base.Request["name"];
            string text3 = base.Request["att"];
            string text4 = base.Request["id"];
            string str   = base.Request["formats"];
            Guid   test;

            if (!text4.IsGuid(out test) || text2.IsNullOrEmpty() || text3.IsNullOrEmpty())
            {
                return("参数错误!");
            }
            RoadFlow.Platform.WorkFlowForm   workFlowForm  = new RoadFlow.Platform.WorkFlowForm();
            RoadFlow.Data.Model.WorkFlowForm workFlowForm2 = workFlowForm.Get(test);
            if (workFlowForm2 == null)
            {
                return("请先保存表单再发布!");
            }
            string        str2          = text4 + ".cshtml";
            StringBuilder stringBuilder = new StringBuilder("@{\r\n");
            JsonData      jsonData      = JsonMapper.ToObject(text3);

            stringBuilder.Append("\tstring FlowID = Request.QueryString[\"flowid\"];\r\n");
            stringBuilder.Append("\tstring StepID = Request.QueryString[\"stepid\"];\r\n");
            stringBuilder.Append("\tstring GroupID = Request.QueryString[\"groupid\"];\r\n");
            stringBuilder.Append("\tstring TaskID = Request.QueryString[\"taskid\"];\r\n");
            stringBuilder.Append("\tstring InstanceID = Request.QueryString[\"instanceid\"];\r\n");
            stringBuilder.Append("\tstring DisplayModel = Request.QueryString[\"display\"] ?? \"0\";\r\n");
            stringBuilder.AppendFormat("\tstring DBConnID = \"{0}\";\r\n", jsonData["dbconn"].ToString());
            stringBuilder.AppendFormat("\tstring DBTable = \"{0}\";\r\n", jsonData["dbtable"].ToString());
            stringBuilder.AppendFormat("\tstring DBTablePK = \"{0}\";\r\n", jsonData["dbtablepk"].ToString());
            stringBuilder.AppendFormat("\tstring DBTableTitle = \"{0}\";\r\n", jsonData["dbtabletitle"].ToString());
            stringBuilder.Append("\tif(InstanceID.IsNullOrEmpty()){InstanceID = Request.QueryString[\"instanceid1\"];}\r\n");
            stringBuilder.Append("\tRoadFlow.Platform.Dictionary BDictionary = new RoadFlow.Platform.Dictionary();\r\n");
            stringBuilder.Append("\tRoadFlow.Platform.WorkFlow BWorkFlow = new RoadFlow.Platform.WorkFlow();\r\n");
            stringBuilder.Append("\tRoadFlow.Platform.WorkFlowTask BWorkFlowTask = new RoadFlow.Platform.WorkFlowTask();\r\n");
            stringBuilder.Append("\tstring fieldStatus = BWorkFlow.GetFieldStatus(FlowID, StepID);\r\n");
            stringBuilder.Append("\tLitJson.JsonData initData = BWorkFlow.GetFormData(DBConnID, DBTable, DBTablePK, InstanceID, fieldStatus, \"" + str + "\");\r\n");
            stringBuilder.Append("\tstring TaskTitle = BWorkFlow.GetFromFieldData(initData, DBTable, DBTableTitle);\r\n");
            stringBuilder.Append("}\r\n");
            stringBuilder.Append("<link href=\"~/Scripts/FlowRun/Forms/flowform.css\" rel=\"stylesheet\" type=\"text/css\" />\r\n");
            stringBuilder.Append("<script src=\"~/Scripts/FlowRun/Forms/common.js\" type=\"text/javascript\" ></script>\r\n");
            if (jsonData.ContainsKey("hasEditor") && "1" == jsonData["hasEditor"].ToString())
            {
                stringBuilder.Append("<script src=\"~/Scripts/Ueditor/ueditor.config.js\" type=\"text/javascript\" ></script>\r\n");
                stringBuilder.Append("<script src=\"~/Scripts/Ueditor/ueditor.all.min.js\" type=\"text/javascript\" ></script>\r\n");
                stringBuilder.Append("<script src=\"~/Scripts/Ueditor/lang/zh-cn/zh-cn.js\" type=\"text/javascript\" ></script>\r\n");
                stringBuilder.Append("<input type=\"hidden\" id=\"Form_HasUEditor\" name=\"Form_HasUEditor\" value=\"1\" />\r\n");
            }
            string str3 = jsonData.ContainsKey("validatealerttype") ? jsonData["validatealerttype"].ToString() : "2";

            stringBuilder.Append("<input type=\"hidden\" id=\"Form_ValidateAlertType\" name=\"Form_ValidateAlertType\" value=\"" + str3 + "\" />\r\n");
            if (jsonData.ContainsKey("autotitle") && jsonData["autotitle"].ToString().ToLower() == "true")
            {
                stringBuilder.AppendFormat("<input type=\"hidden\" id=\"{0}\" name=\"{0}\" value=\"{1}\" />\r\n", jsonData["dbtable"].ToString() + "." + jsonData["dbtabletitle"].ToString(), "@(TaskTitle.IsNullOrEmpty() ? BWorkFlow.GetAutoTaskTitle(FlowID, StepID, Request.QueryString[\"groupid\"]) : TaskTitle)");
            }
            stringBuilder.AppendFormat("<input type=\"hidden\" id=\"Form_TitleField\" name=\"Form_TitleField\" value=\"{0}\" />\r\n", jsonData["dbtable"].ToString() + "." + jsonData["dbtabletitle"].ToString());
            stringBuilder.AppendFormat("<input type=\"hidden\" id=\"Form_DBConnID\" name=\"Form_DBConnID\" value=\"{0}\" />\r\n", jsonData["dbconn"].ToString());
            stringBuilder.AppendFormat("<input type=\"hidden\" id=\"Form_DBTable\" name=\"Form_DBTable\" value=\"{0}\" />\r\n", jsonData["dbtable"].ToString());
            stringBuilder.AppendFormat("<input type=\"hidden\" id=\"Form_DBTablePk\" name=\"Form_DBTablePk\" value=\"{0}\" />\r\n", jsonData["dbtablepk"].ToString());
            stringBuilder.AppendFormat("<input type=\"hidden\" id=\"Form_DBTableTitle\" name=\"Form_DBTableTitle\" value=\"{0}\" />\r\n", jsonData["dbtabletitle"].ToString());
            stringBuilder.AppendFormat("<input type=\"hidden\" id=\"Form_AutoSaveData\" name=\"Form_AutoSaveData\" value=\"{0}\" />\r\n", "1");
            stringBuilder.AppendFormat("<textarea id=\"Form_DBTableTitleExpression\" name=\"Form_DBTableTitleExpression\" style=\"display:none;width:0;height:0;\">{0}</textarea>\r\n", jsonData.ContainsKey("dbtabletitle1") ? jsonData["dbtabletitle1"].ToString() : "");
            stringBuilder.Append("<script type=\"text/javascript\">\r\n");
            stringBuilder.Append("\tvar initData = @Html.Raw(BWorkFlow.GetFormDataJsonString(initData));\r\n");
            stringBuilder.Append("\tvar fieldStatus = \"1\"==\"@Request.QueryString[\"isreadonly\"]\" ? {} : @Html.Raw(fieldStatus);\r\n");
            stringBuilder.Append("\tvar displayModel = '@DisplayModel';\r\n");
            stringBuilder.Append("\t$(window).load(function (){\r\n");
            stringBuilder.AppendFormat("\t\tformrun.initData(initData, \"{0}\", fieldStatus, displayModel);\r\n", jsonData["dbtable"].ToString());
            stringBuilder.Append("\t});\r\n");
            stringBuilder.Append("</script>\r\n");
            FileStream fileStream = System.IO.File.Open(base.Server.MapPath("~/Views/WorkFlowFormDesigner/Forms/" + str2), FileMode.OpenOrCreate, FileAccess.Write, FileShare.None);

            fileStream.SetLength(0L);
            StreamWriter streamWriter = new StreamWriter(fileStream, Encoding.UTF8);

            streamWriter.Write(stringBuilder.ToString());
            streamWriter.Write(base.Server.HtmlDecode(text));
            streamWriter.Close();
            fileStream.Close();
            string str4 = JsonMapper.ToObject(workFlowForm2.Attribute)["apptype"].ToString();

            RoadFlow.Platform.AppLibrary   appLibrary  = new RoadFlow.Platform.AppLibrary();
            RoadFlow.Data.Model.AppLibrary appLibrary2 = appLibrary.GetByCode(text4);
            bool flag = false;

            if (appLibrary2 == null)
            {
                appLibrary2      = new RoadFlow.Data.Model.AppLibrary();
                appLibrary2.ID   = Guid.NewGuid();
                appLibrary2.Code = text4;
                flag             = true;
            }
            appLibrary2.Address  = "/Views/WorkFlowFormDesigner/Forms/" + str2;
            appLibrary2.Note     = "流程表单";
            appLibrary2.OpenMode = 0;
            appLibrary2.Params   = "";
            appLibrary2.Title    = text2.Trim();
            appLibrary2.Type     = (str4.IsGuid() ? str4.ToGuid() : new RoadFlow.Platform.Dictionary().GetIDByCode("FormTypes"));
            if (flag)
            {
                appLibrary.Add(appLibrary2);
            }
            else
            {
                appLibrary.Update(appLibrary2);
            }
            RoadFlow.Platform.Log.Add("发布了流程表单", appLibrary2.Serialize() + "内容:" + text, RoadFlow.Platform.Log.Types.流程相关);
            workFlowForm2.Status = 1;
            workFlowForm.Update(workFlowForm2);
            return("发布成功!");
        }