Example #1
0
        public RedirectToRouteResult Delete()
        {
            BizProcess.Platform.AppLibrary bappLibrary = new BizProcess.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))
                {
                    var app = bappLibrary.Get(gid);
                    if (app != null)
                    {
                        delxml.Append(app.Serialize());
                        bappLibrary.Delete(gid);
                    }
                }
            }
            BizProcess.Platform.Log.Add("删除了一批应用程序库", delxml.ToString(), BizProcess.Platform.Log.Types.角色应用);
            return(RedirectToAction("List", Common.Tools.GetRouteValueDictionary()));
        }
Example #2
0
        public ActionResult Edit(FormCollection collection)
        {
            string editID = Request.QueryString["id"];
            string type   = Request.QueryString["typeid"];

            BizProcess.Platform.AppLibrary   bappLibrary = new BizProcess.Platform.AppLibrary();
            BizProcess.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 BizProcess.Data.Model.AppLibrary();
                appLibrary.ID       = Guid.NewGuid();
                ViewBag.TypeOptions = new BizProcess.Platform.AppLibrary().GetTypeOptions(type);
                ViewBag.OpenOptions = new BizProcess.Platform.Dictionary().GetOptionsByCode("appopenmodel", value: "");
            }
            else
            {
                oldXML = appLibrary.Serialize();
                ViewBag.TypeOptions = new BizProcess.Platform.AppLibrary().GetTypeOptions(appLibrary.Type.ToString());
                ViewBag.OpenOptions = new BizProcess.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"];
                string useMember   = collection["UseMember"];
                string isRemovable = collection["IsRemovable"];
                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();
                appLibrary.IsRemovable = string.IsNullOrEmpty(isRemovable)?false:true;

                if (!useMember.IsNullOrEmpty())
                {
                    appLibrary.UseMember = useMember;
                }
                else
                {
                    appLibrary.UseMember = null;
                }

                if (isAdd)
                {
                    appLibrary.IsRemovable = true;
                    bappLibrary.Add(appLibrary);
                    BizProcess.Platform.Log.Add("添加了应用程序库", appLibrary.Serialize(), BizProcess.Platform.Log.Types.角色应用);
                    ViewBag.Script = "alert('添加成功!');new BPUI.Window().reloadOpener();new BPUI.Window().close();";
                }
                else
                {
                    bappLibrary.Update(appLibrary);
                    BizProcess.Platform.Log.Add("修改了应用程序库", "", BizProcess.Platform.Log.Types.角色应用, oldXML, appLibrary.Serialize());
                    ViewBag.Script = "alert('修改成功!');new BPUI.Window().reloadOpener();new BPUI.Window().close();";
                }
                bappLibrary.UpdateUseMemberCache(appLibrary.ID);
                bappLibrary.ClearCache();
                new BizProcess.Platform.RoleApp().ClearAllDataTableCache();
            }
            return(View(appLibrary));
        }