Repository navigation
Expand file tree
/
Copy pathAppLibraryController.cs
More file actions
153 lines (141 loc) · 6.35 KB
/
Copy pathAppLibraryController.cs
File metadata and controls
153 lines (141 loc) · 6.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace WebMvc.Controllers
{
public class AppLibraryController : MyController
{
//
// GET: /AppLibrary/
public ActionResult Index()
{
return View();
}
public ActionResult Tree()
{
return View();
}
public ActionResult List()
{
string title1 = Request.QueryString["title1"];
string address = Request.QueryString["address"];
return query(title1, address);
}
[HttpPost]
public ActionResult List(FormCollection collection)
{
if (!Request.Form["DeleteBut"].IsNullOrEmpty())
{
Business.Platform.AppLibrary bappLibrary = new Business.Platform.AppLibrary();
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))
{
delxml.Append(bappLibrary.Get(gid).Serialize());
bappLibrary.Delete(gid);
}
}
Business.Platform.Log.Add("删除了一批应用程序库", delxml.ToString(), Business.Platform.Log.Types.角色应用);
}
string title1 = collection["title1"];
string address = collection["address"];
return query(title1, address);
}
private ActionResult query(string title1, string address)
{
string pager;
string appid = Request.QueryString["appid"];
string tabid = Request.QueryString["tabid"];
string typeid = Request.QueryString["typeid"];
Business.Platform.Dictionary bdict = new Business.Platform.Dictionary();
Business.Platform.AppLibrary bapp = new Business.Platform.AppLibrary();
string typeidstring = typeid.IsGuid() ? bapp.GetAllChildsIDString(typeid.ToGuid()) : "";
string query = string.Format("&appid={0}&tabid={1}&title1={2}&typeid={3}&address={4}",
Request.QueryString["appid"],
Request.QueryString["tabid"],
title1.UrlEncode(), typeid, address.UrlEncode()
);
string query1 = string.Format("{0}&pagesize={1}&pagenumber={2}", query, Request.QueryString["pagesize"], Request.QueryString["pagenumber"]);
List<Data.Model.AppLibrary> appList = bapp.GetPagerData(out pager, query, title1, typeidstring, address);
ViewBag.Pager = pager;
ViewBag.AppID = appid;
ViewBag.TabID = tabid;
ViewBag.TypeID = typeid;
ViewBag.Title1 = title1;
ViewBag.Address = address;
ViewBag.Query1 = query1;
return View(appList);
}
public ActionResult Edit()
{
return Edit(null);
}
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult Edit(FormCollection collection)
{
string editID = Request.QueryString["id"];
string type = Request.QueryString["typeid"];
Business.Platform.AppLibrary bappLibrary = new Business.Platform.AppLibrary();
Data.Model.AppLibrary appLibrary = null;
if (editID.IsGuid())
{
appLibrary = bappLibrary.Get(editID.ToGuid());
}
bool isAdd = !editID.IsGuid();
string oldXML = string.Empty;
if (appLibrary == null)
{
appLibrary = new Data.Model.AppLibrary();
appLibrary.ID = Guid.NewGuid();
ViewBag.TypeOptions = new Business.Platform.AppLibrary().GetTypeOptions(type);
ViewBag.OpenOptions = new Business.Platform.Dictionary().GetOptionsByCode("appopenmodel", value: "");
}
else
{
oldXML = appLibrary.Serialize();
ViewBag.TypeOptions = new Business.Platform.AppLibrary().GetTypeOptions(appLibrary.Type.ToString());
ViewBag.OpenOptions = new Business.Platform.Dictionary().GetOptionsByCode("appopenmodel", value: appLibrary.OpenMode.ToString());
}
if (collection != null)
{
string title = collection["title"];
string address = collection["address"];
string openModel = collection["openModel"];
string width = collection["width"];
string height = collection["height"];
string params1 = collection["Params"];
string note = collection["note"];
type = collection["type"];
appLibrary.Address = address.Trim();
appLibrary.Height = height.ToIntOrNull();
appLibrary.Note = note;
appLibrary.OpenMode = openModel.ToInt();
appLibrary.Params = params1;
appLibrary.Title = title;
appLibrary.Type = type.ToGuid();
appLibrary.Width = width.ToIntOrNull();
if (isAdd)
{
bappLibrary.Add(appLibrary);
Business.Platform.Log.Add("添加了应用程序库", appLibrary.Serialize(), Business.Platform.Log.Types.角色应用);
ViewBag.Script = "alert('添加成功!');new RoadUI.Window().reloadOpener();new RoadUI.Window().close();";
}
else
{
bappLibrary.Update(appLibrary);
Business.Platform.Log.Add("修改了应用程序库", "", Business.Platform.Log.Types.角色应用, oldXML, appLibrary.Serialize());
ViewBag.Script = "alert('修改成功!');new RoadUI.Window().reloadOpener();new RoadUI.Window().close();";
}
bappLibrary.ClearCache();
new Business.Platform.RoleApp().ClearAllDataTableCache();
}
return View(appLibrary);
}
}
}