protected void Page_Load(object sender, EventArgs e) { FoWoSoft.Platform.AppLibrary bappLibrary = new FoWoSoft.Platform.AppLibrary(); FoWoSoft.Platform.UsersApp busersApp = new FoWoSoft.Platform.UsersApp(); FoWoSoft.Platform.RoleApp broleApp = new FoWoSoft.Platform.RoleApp(); FoWoSoft.Data.Model.UsersApp usersApp = null; string id = Request.QueryString["id"]; string userID = Request.QueryString["userid"]; string roleID = Request.QueryString["roleid"]; if (IsPostBack && id.IsGuid() && userID.IsGuid()) { usersApp = busersApp.Get(id.ToGuid()); if (!Request.Form["Save"].IsNullOrEmpty()) { string name = Request.Form["Name"]; string type = Request.Form["Type"]; string appid = Request.Form["AppID"]; string params1 = Request.Form["Params"]; string ico = Request.Form["Ico"]; FoWoSoft.Data.Model.UsersApp usersApp1 = new FoWoSoft.Data.Model.UsersApp(); usersApp1.ID = Guid.NewGuid(); usersApp1.ParentID = id.ToGuid(); usersApp1.Title = name.Trim(); usersApp1.Sort = broleApp.GetMaxSort(id.ToGuid()); usersApp1.UserID = userID.ToGuid(); usersApp1.RoleID = roleID.IsGuid() ? roleID.ToGuid() : Guid.Empty; if (appid.IsGuid()) { usersApp1.AppID = appid.ToGuid(); } else { usersApp1.AppID = null; } usersApp1.Params = params1.IsNullOrEmpty() ? null : params1.Trim(); if (!ico.IsNullOrEmpty()) { usersApp1.Ico = ico; } busersApp.Add(usersApp1); busersApp.ClearCache(); FoWoSoft.Platform.Log.Add("添加了个人应用", busersApp.Serialize(), FoWoSoft.Platform.Log.Types.角色应用); string refreshID = id; Page.ClientScript.RegisterStartupScript(Page.GetType(), "ok", "alert('添加成功!'); parent.frames[0].reLoad('" + refreshID + "')", true); } } AppTypesOptions = bappLibrary.GetTypeOptions(); }
protected void Page_Load(object sender, EventArgs e) { FoWoSoft.Platform.AppLibrary bappLibrary = new FoWoSoft.Platform.AppLibrary(); FoWoSoft.Platform.RoleApp broleApp = new FoWoSoft.Platform.RoleApp(); FoWoSoft.Data.Model.RoleApp roleApp = null; string id = Request.QueryString["id"]; if (IsPostBack) { roleApp = broleApp.Get(id.ToGuid()); if (!Request.Form["Save"].IsNullOrEmpty()) { string name = Request.Form["Name"]; string type = Request.Form["Type"]; string appid = Request.Form["AppID"]; string params1 = Request.Form["Params"]; string ico = Request.Form["Ico"]; FoWoSoft.Data.Model.RoleApp roleApp1 = new FoWoSoft.Data.Model.RoleApp(); roleApp1.ID = Guid.NewGuid(); roleApp1.ParentID = id.ToGuid(); roleApp1.RoleID = roleApp.RoleID; roleApp1.Title = name.Trim(); roleApp1.ParentID = roleApp.ID; roleApp1.Sort = broleApp.GetMaxSort(roleApp.ID); roleApp1.Type = 0; if (appid.IsGuid()) { roleApp1.AppID = appid.ToGuid(); } else { roleApp1.AppID = null; } roleApp1.Params = params1.IsNullOrEmpty() ? null : params1.Trim(); if (!ico.IsNullOrEmpty()) { roleApp1.Ico = ico; } broleApp.Add(roleApp1); broleApp.ClearAllDataTableCache(); FoWoSoft.Platform.Log.Add("添加了应用模板", roleApp1.Serialize(), FoWoSoft.Platform.Log.Types.角色应用); string refreshID = id; Page.ClientScript.RegisterStartupScript(Page.GetType(), "ok", "alert('添加成功');parent.frames[0].reLoad('" + refreshID + "');", true); } } this.AppTypesOptions.Text = bappLibrary.GetTypeOptions(); }
protected void Page_Load(object sender, EventArgs e) { string pager; string appid = Request.QueryString["appid"]; string tabid = Request.QueryString["tabid"]; string typeid = Request.QueryString["typeid"]; string title1 = Request.QueryString["title1"]; string address = Request.QueryString["address"]; FoWoSoft.Platform.AppLibrary bapp = new FoWoSoft.Platform.AppLibrary(); if (IsPostBack) { title1 = Request.Form["Title1"]; address = Request.Form["Address"]; //删除 if (!Request.Form["Button1"].IsNullOrEmpty()) { string deleteID = Request.Form["checkbox_app"]; System.Text.StringBuilder delxml = new System.Text.StringBuilder(); foreach (string id in deleteID.Split(',')) { Guid gid; if (id.IsGuid(out gid)) { var app = bapp.Get(gid); if (app != null) { delxml.Append(app.Serialize()); bapp.Delete(gid); } } } FoWoSoft.Platform.Log.Add("删除了一批应用程序库", delxml.ToString(), FoWoSoft.Platform.Log.Types.角色应用); } } FoWoSoft.Platform.Dictionary bdict = new FoWoSoft.Platform.Dictionary(); string typeidstring = typeid.IsGuid() ? bapp.GetAllChildsIDString(typeid.ToGuid()) : ""; Query = string.Format("&appid={0}&tabid={1}&title1={2}&typeid={3}&address={4}", Request.QueryString["appid"], Request.QueryString["tabid"], title1.UrlEncode(), typeid, address.UrlEncode() ); Query1 = string.Format("{0}&pagesize={1}&pagenumber={2}", Query, Request.QueryString["pagesize"], Request.QueryString["pagenumber"]); AppList = bapp.GetPagerData(out pager, Query, title1, typeidstring, address); this.Pager.Text = pager; }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; string id = context.Request.Form["id"]; string type = context.Request.Form["type"]; FoWoSoft.Platform.WorkFlow bworkFlow = new FoWoSoft.Platform.WorkFlow(); var flow = bworkFlow.Get(id.ToGuid()); if (flow == null) { context.Response.Write("该流程还未保存!"); context.Response.End(); } else { if ("0" == type) { flow.Status = 3; bworkFlow.Update(flow); bworkFlow.RefreshWrokFlowCache(flow.ID); FoWoSoft.Platform.Log.Add("卸载了流程", flow.Serialize(), FoWoSoft.Platform.Log.Types.流程相关); context.Response.Write("1"); context.Response.End(); } else if ("1" == type) { flow.Status = 4; bworkFlow.Update(flow); //bworkFlow.ClearWorkFlowCache(flow.ID); FoWoSoft.Platform.AppLibrary APP = new FoWoSoft.Platform.AppLibrary(); var app = APP.GetByCode(flow.ID.ToString()); if (app != null) { APP.Delete(app.ID); new FoWoSoft.Platform.RoleApp().DeleteByAppID(app.ID); } FoWoSoft.Platform.Log.Add("删除了流程", flow.Serialize(), FoWoSoft.Platform.Log.Types.流程相关); context.Response.Write("1"); context.Response.End(); } } }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; string html = context.Request["html"]; string name = context.Request["name"]; string att = context.Request["att"]; string id = context.Request["id"]; Guid gid; if (!id.IsGuid(out gid) || name.IsNullOrEmpty() || att.IsNullOrEmpty() || html.IsNullOrEmpty()) { context.Response.Write("参数错误!"); return; } FoWoSoft.Platform.WorkFlowForm WFF = new FoWoSoft.Platform.WorkFlowForm(); FoWoSoft.Data.Model.WorkFlowForm wff = WFF.Get(gid); if (wff == null) { context.Response.Write("未找到表单!"); return; } string fileName = id + ".aspx"; System.Text.StringBuilder serverScript = new System.Text.StringBuilder("<%@ Page Language=\"C#\"%>\r\n<%\r\n"); var attrJSON = LitJson.JsonMapper.ToObject(att); serverScript.Append("\tstring FlowID = Request.QueryString[\"flowid\"];\r\n"); serverScript.Append("\tstring StepID = Request.QueryString[\"stepid\"];\r\n"); serverScript.Append("\tstring GroupID = Request.QueryString[\"groupid\"];\r\n"); serverScript.Append("\tstring TaskID = Request.QueryString[\"taskid\"];\r\n"); serverScript.Append("\tstring InstanceID = Request.QueryString[\"instanceid\"];\r\n"); serverScript.Append("\tstring DisplayModel = Request.QueryString[\"display\"] ?? \"0\";\r\n"); serverScript.AppendFormat("\tstring DBConnID = \"{0}\";\r\n", attrJSON["dbconn"].ToString()); serverScript.AppendFormat("\tstring DBTable = \"{0}\";\r\n", attrJSON["dbtable"].ToString()); serverScript.AppendFormat("\tstring DBTablePK = \"{0}\";\r\n", attrJSON["dbtablepk"].ToString()); serverScript.AppendFormat("\tstring DBTableTitle = \"{0}\";\r\n", attrJSON["dbtabletitle"].ToString()); serverScript.Append("if(InstanceID.IsNullOrEmpty()){InstanceID = Request.QueryString[\"instanceid1\"];}"); serverScript.Append("\tFoWoSoft.Platform.Dictionary BDictionary = new FoWoSoft.Platform.Dictionary();\r\n"); serverScript.Append("\tFoWoSoft.Platform.WorkFlow BWorkFlow = new FoWoSoft.Platform.WorkFlow();\r\n"); serverScript.Append("\tFoWoSoft.Platform.WorkFlowTask BWorkFlowTask = new FoWoSoft.Platform.WorkFlowTask();\r\n"); serverScript.Append("\tstring fieldStatus = BWorkFlow.GetFieldStatus(FlowID, StepID);\r\n"); serverScript.Append("\tLitJson.JsonData initData = BWorkFlow.GetFormData(DBConnID, DBTable, DBTablePK, InstanceID, fieldStatus);\r\n"); serverScript.Append("\tstring TaskTitle = BWorkFlow.GetFromFieldData(initData, DBTable, DBTableTitle);\r\n"); serverScript.Append("%>\r\n"); serverScript.Append("<link href=\"Scripts/Forms/flowform.css\" rel=\"stylesheet\" type=\"text/css\" />\r\n"); serverScript.Append("<script src=\"Scripts/Forms/common.js\" type=\"text/javascript\" ></script>\r\n"); if (attrJSON.ContainsKey("hasEditor") && "1" == attrJSON["hasEditor"].ToString()) { serverScript.Append("<script src=\"../../Scripts/Ueditor/ueditor.config.js\" type=\"text/javascript\" ></script>\r\n"); serverScript.Append("<script src=\"../../Scripts/Ueditor/ueditor.all.min.js\" type=\"text/javascript\" ></script>\r\n"); serverScript.Append("<script src=\"../../Scripts/Ueditor/lang/zh-cn/zh-cn.js\" type=\"text/javascript\" ></script>\r\n"); serverScript.Append("<input type=\"hidden\" id=\"Form_HasUEditor\" name=\"Form_HasUEditor\" value=\"1\" />\r\n"); } string validatePropType = attrJSON.ContainsKey("validatealerttype") ? attrJSON["validatealerttype"].ToString() : "2"; serverScript.Append("<input type=\"hidden\" id=\"Form_ValidateAlertType\" name=\"Form_ValidateAlertType\" value=\"" + validatePropType + "\" />\r\n"); if (attrJSON.ContainsKey("autotitle") && attrJSON["autotitle"].ToString().ToLower() == "true") { serverScript.AppendFormat("<input type=\"hidden\" id=\"{0}\" name=\"{0}\" value=\"{1}\" />\r\n", string.Concat(attrJSON["dbtable"].ToString(), ".", attrJSON["dbtabletitle"].ToString()), "<%=TaskTitle.IsNullOrEmpty() ? BWorkFlow.GetAutoTaskTitle(FlowID, StepID, Request.QueryString[\"groupid\"]) : TaskTitle %>" ); } serverScript.AppendFormat("<input type=\"hidden\" id=\"Form_TitleField\" name=\"Form_TitleField\" value=\"{0}\" />\r\n", string.Concat(attrJSON["dbtable"].ToString(), ".", attrJSON["dbtabletitle"].ToString())); //serverScript.AppendFormat("<input type=\"hidden\" id=\"Form_Name\" name=\"Form_Name\" value=\"{0}\" />\r\n", attrJSON["name"].ToString()); serverScript.AppendFormat("<input type=\"hidden\" id=\"Form_DBConnID\" name=\"Form_DBConnID\" value=\"{0}\" />\r\n", attrJSON["dbconn"].ToString()); serverScript.AppendFormat("<input type=\"hidden\" id=\"Form_DBTable\" name=\"Form_DBTable\" value=\"{0}\" />\r\n", attrJSON["dbtable"].ToString()); serverScript.AppendFormat("<input type=\"hidden\" id=\"Form_DBTablePk\" name=\"Form_DBTablePk\" value=\"{0}\" />\r\n", attrJSON["dbtablepk"].ToString()); serverScript.AppendFormat("<input type=\"hidden\" id=\"Form_DBTableTitle\" name=\"Form_DBTableTitle\" value=\"{0}\" />\r\n", attrJSON["dbtabletitle"].ToString()); serverScript.AppendFormat("<input type=\"hidden\" id=\"Form_AutoSaveData\" name=\"Form_AutoSaveData\" value=\"{0}\" />\r\n", "1"); serverScript.Append("<script type=\"text/javascript\">\r\n"); serverScript.Append("\tvar initData = <%=BWorkFlow.GetFormDataJsonString(initData)%>;\r\n"); serverScript.Append("\tvar fieldStatus = \"1\"==\"<%=Request.QueryString[\"isreadonly\"]%>\"? {} : <%=fieldStatus%>;\r\n"); serverScript.Append("\tvar displayModel = '<%=DisplayModel%>';\r\n"); serverScript.Append("\t$(window).load(function (){\r\n"); serverScript.AppendFormat("\t\tformrun.initData(initData, \"{0}\", fieldStatus, displayModel);\r\n", attrJSON["dbtable"].ToString()); serverScript.Append("\t});\r\n"); serverScript.Append("</script>\r\n"); string file = context.Server.MapPath("Forms/" + fileName); System.IO.Stream stream = System.IO.File.Open(file, FileMode.OpenOrCreate, FileAccess.Write, FileShare.None); stream.SetLength(0); StreamWriter sw = new StreamWriter(stream, System.Text.Encoding.UTF8); sw.Write(serverScript.ToString()); sw.Write(context.Server.HtmlDecode(html)); sw.Close(); stream.Close(); string attr = wff.Attribute; string appType = LitJson.JsonMapper.ToObject(attr)["apptype"].ToString(); FoWoSoft.Platform.AppLibrary App = new FoWoSoft.Platform.AppLibrary(); var app = App.GetByCode(id); bool isAdd = false; if (app == null) { app = new FoWoSoft.Data.Model.AppLibrary(); app.ID = Guid.NewGuid(); app.Code = id; isAdd = true; } app.Address = "/Platform/WorkFlowFormDesigner/Forms/" + fileName; app.Note = "流程表单"; app.OpenMode = 0; app.Params = ""; app.Title = name.Trim(); app.Type = appType.IsGuid() ? appType.ToGuid() : new FoWoSoft.Platform.Dictionary().GetIDByCode("FormTypes"); if (isAdd) { App.Add(app); } else { App.Update(app); } FoWoSoft.Platform.Log.Add("发布了流程表单", app.Serialize() + "内容:" + html, FoWoSoft.Platform.Log.Types.流程相关); wff.Status = 1; WFF.Update(wff); context.Response.Write("发布成功!"); }
protected void Page_Load(object sender, EventArgs e) { FoWoSoft.Platform.AppLibrary bappLibrary = new FoWoSoft.Platform.AppLibrary(); FoWoSoft.Platform.RoleApp broleApp = new FoWoSoft.Platform.RoleApp(); string id = Request.QueryString["id"]; string name = string.Empty; string type = string.Empty; string appid = string.Empty; string params1 = string.Empty; string ico = string.Empty; Guid appID; if (id.IsGuid(out appID)) { roleApp = broleApp.Get(appID); } if (IsPostBack) { if (!Request.Form["Save"].IsNullOrEmpty()) { name = Request.Form["Name"]; type = Request.Form["Type"]; appid = Request.Form["AppID"]; params1 = Request.Form["Params"]; ico = Request.Form["Ico"]; string oldXML = roleApp.Serialize(); roleApp.Title = name.Trim(); if (appid.IsGuid()) { roleApp.AppID = appid.ToGuid(); } else { roleApp.AppID = null; } roleApp.Params = params1.IsNullOrEmpty() ? null : params1.Trim(); if (!ico.IsNullOrEmpty()) { roleApp.Ico = ico; } else { roleApp.Ico = null; } broleApp.Update(roleApp); broleApp.ClearAllDataTableCache(); FoWoSoft.Platform.Log.Add("修改了应用模板", "", FoWoSoft.Platform.Log.Types.角色应用, oldXML, roleApp.Serialize()); string refreshID = roleApp.ParentID == Guid.Empty ? roleApp.ID.ToString() : roleApp.ParentID.ToString(); Page.ClientScript.RegisterStartupScript(Page.GetType(), "ok", "parent.frames[0].reLoad('" + refreshID + "');alert('保存成功!');", true); } if (!Request.Form["Delete"].IsNullOrEmpty()) { int i = broleApp.DeleteAndAllChilds(roleApp.ID); broleApp.ClearAllDataTableCache(); FoWoSoft.Platform.Log.Add("删除了模板及其所有下级共" + i.ToString() + "项", roleApp.Serialize(), FoWoSoft.Platform.Log.Types.角色应用); string refreshID = roleApp.ParentID == Guid.Empty ? roleApp.ID.ToString() : roleApp.ParentID.ToString(); Page.ClientScript.RegisterStartupScript(Page.GetType(), "ok", "parent.frames[0].reLoad('" + refreshID + "');window.location='Body.aspx?id=" + refreshID + "&appid=" + Request.QueryString["appid"] + "&tabid=" + Request.QueryString["tabid"] + "';", true); } } if (roleApp != null && roleApp.AppID.HasValue) { var app = new FoWoSoft.Platform.AppLibrary().Get(roleApp.AppID.Value); if (app != null) { type = app.Type.ToString(); } } if (roleApp != null) { this.Name.Value = roleApp.Title; this.Params.Value = roleApp.Params; this.Ico.Value = roleApp.Ico; } this.AppTypesOptions.Text = bappLibrary.GetTypeOptions(type); AppID = roleApp.AppID.ToString(); }
protected void Page_Load(object sender, EventArgs e) { query = "&id=" + Request.QueryString["id"] + "&appid=" + Request.QueryString["appid"] + "&roleid=" + Request.QueryString["roleid"] + "&userid=" + Request.QueryString["userid"]; FoWoSoft.Platform.AppLibrary bappLibrary = new FoWoSoft.Platform.AppLibrary(); FoWoSoft.Platform.RoleApp broleApp = new FoWoSoft.Platform.RoleApp(); FoWoSoft.Platform.UsersApp buserApp = new FoWoSoft.Platform.UsersApp(); FoWoSoft.Data.Model.UsersApp usersApp = null; string id = Request.QueryString["id"]; Guid appID; if (id.IsGuid(out appID)) { usersApp = buserApp.Get(appID); if (usersApp != null) { name = usersApp.Title; type = usersApp.AppID.HasValue ? bappLibrary.GetTypeByID(usersApp.AppID.Value) : ""; appid = usersApp.AppID.ToString(); params1 = usersApp.Params; ico = usersApp.Ico; ParentID = usersApp.ParentID; } } if (IsPostBack && usersApp != null) { if (!Request.Form["Save"].IsNullOrEmpty()) { name = Request.Form["Name"]; type = Request.Form["Type"]; appid = Request.Form["AppID"]; params1 = Request.Form["Params"]; ico = Request.Form["Ico"]; string oldXML = usersApp.Serialize(); usersApp.Title = name.Trim(); if (appid.IsGuid()) { usersApp.AppID = appid.ToGuid(); } else { usersApp.AppID = null; } usersApp.Params = params1.IsNullOrEmpty() ? null : params1.Trim(); if (!ico.IsNullOrEmpty()) { usersApp.Ico = ico; } else { usersApp.Ico = null; } buserApp.Update(usersApp); buserApp.ClearCache(); FoWoSoft.Platform.Log.Add("修改了个人应用", "", FoWoSoft.Platform.Log.Types.角色应用, oldXML, usersApp.Serialize()); string refreshID = usersApp.ParentID.ToString(); Page.ClientScript.RegisterStartupScript(Page.GetType(), "ok", "alert('保存成功!'); parent.frames[0].reLoad('" + refreshID + "')", true); } if (!Request.Form["Delete"].IsNullOrEmpty()) { int i = buserApp.DeleteAndAllChilds(usersApp.ID); buserApp.ClearCache(); FoWoSoft.Platform.Log.Add("删除了个人应用", usersApp.Serialize(), FoWoSoft.Platform.Log.Types.角色应用); string refreshID = usersApp.ParentID.ToString(); var parent = buserApp.Get(usersApp.ParentID); string page = parent == null ? "Body.aspx" : "Body1.aspx"; Page.ClientScript.RegisterStartupScript(Page.GetType(), "ok", "parent.frames[0].reLoad('" + refreshID + "');window.location='" + page + "?id=" + refreshID + "&appid=" + Request.QueryString["appid"] + "&tabid=" + Request.QueryString["tabid"] + "&userid=" + Request.QueryString["userid"] + "';", true); } } AppID = appid; AppTypesOptions = bappLibrary.GetTypeOptions(type); }