コード例 #1
0
        // GET: PermissionProperties/Edit/5
        public ActionResult Edit(Guid?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            var res = service.GetByID(id.Value, true);

            if (!res.Success)
            {
                return(Json(res.Message, JsonRequestBehavior.AllowGet));
            }

            PermissionProperty permissionProperty = res.Entity;

            if (permissionProperty == null)
            {
                return(HttpNotFound());
            }

            permissionProperty.PropertyValues = permissionProperty.PropertyValues ??
                                                new List <PermissionPropertyValue>();

            return(View(new PermissionPropertyViewModel(permissionProperty)));
        }
コード例 #2
0
 public PermissionPropertyViewModel(PermissionProperty prop) :
     base(prop)
 {
     this.PropertyValueViews = prop.PropertyValues
                               .Where(val => val.IsActive)
                               .Select(val => new PermissionPropertyValueViewModel(val)).ToList();
 }
コード例 #3
0
ファイル: PdfModifier.cs プロジェクト: plcode7/CubePdf
        /* ----------------------------------------------------------------- */
        ///
        /// PermissionToiText
        ///
        /// <summary>
        /// PermissionProperty オブジェクトを iTextSharp で利用可能な数値に
        /// 変換します。
        /// </summary>
        ///
        /* ----------------------------------------------------------------- */
        private int PermissionToiText(PermissionProperty permission)
        {
            int dest =
                iTextSharp.text.pdf.PdfWriter.AllowAssembly |
                iTextSharp.text.pdf.PdfWriter.AllowCopy |
                iTextSharp.text.pdf.PdfWriter.AllowFillIn |
                iTextSharp.text.pdf.PdfWriter.AllowModifyAnnotations |
                iTextSharp.text.pdf.PdfWriter.AllowModifyContents |
                iTextSharp.text.pdf.PdfWriter.AllowPrinting |
                iTextSharp.text.pdf.PdfWriter.AllowScreenReaders;

            if (permission.Password.Length > 0 && !permission.AllowPrint)
            {
                dest &= ~iTextSharp.text.pdf.PdfWriter.AllowPrinting;
            }

            if (permission.Password.Length > 0 && !permission.AllowCopy)
            {
                dest &= ~iTextSharp.text.pdf.PdfWriter.AllowCopy;
            }

            if (permission.Password.Length > 0 && !permission.AllowFormInput)
            {
                dest &= ~iTextSharp.text.pdf.PdfWriter.AllowFillIn;
                dest &= ~iTextSharp.text.pdf.PdfWriter.AllowModifyAnnotations;
            }

            if (permission.Password.Length > 0 && !permission.AllowModify)
            {
                dest &= ~iTextSharp.text.pdf.PdfWriter.AllowModifyContents;
                dest &= ~iTextSharp.text.pdf.PdfWriter.AllowScreenReaders;
            }

            return(dest);
        }
コード例 #4
0
        // GET: PermissionProperties/Create
        public ActionResult Create(Guid id)
        {
            PermissionProperty perProp = new PermissionProperty();

            perProp.ViewOrder             = 10;
            perProp.IsActive              = true;
            perProp.PermissionsCategoryID = id;
            return(View(perProp));
        }
コード例 #5
0
        public ActionResult Create([Bind(Include = "PermissionsCategoryID,Name,IsActive,ViewOrder")] PermissionProperty permissionProperty)
        {
            if (ModelState.IsValid)
            {
                permissionProperty.ID = Guid.NewGuid();
                var res = service.Add(permissionProperty);
                if (!res.Success)
                {
                    ModelState.AddModelError("", res.Message);
                }

                return(RedirectToAction("Index", new { id = permissionProperty.PermissionsCategoryID }));
            }

            return(View(permissionProperty));
        }
コード例 #6
0
        public ActionResult DeleteConfirmed(Guid id)
        {
            var res = service.GetByID(id, false);

            if (!res.Success)
            {
                return(Json(res.Message, JsonRequestBehavior.AllowGet));
            }

            PermissionProperty permissionProperty = res.Entity;

            if (permissionProperty == null)
            {
                return(HttpNotFound());
            }
            Guid categoryId = permissionProperty.PermissionsCategoryID;

            service.Delete(permissionProperty);

            return(RedirectToAction("Index", new { id = categoryId }));
        }
コード例 #7
0
        // GET: PermissionProperties/Delete/5
        public ActionResult Delete(Guid?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            var res = service.GetByID(id.Value, false);

            if (!res.Success)
            {
                return(Json(res.Message, JsonRequestBehavior.AllowGet));
            }

            PermissionProperty permissionProperty = res.Entity;

            if (permissionProperty == null)
            {
                return(HttpNotFound());
            }

            return(View(permissionProperty));
        }
コード例 #8
0
        public ActionResult Edit(PermissionPropertyViewModel permissionProperty)
        {
            if (ModelState.IsValid)
            {
                PermissionProperty updateItem = permissionProperty as PermissionProperty;

                updateItem.PropertyValues = permissionProperty.PropertyValueViews
                                            ?.Where(val => !val.IsDeleted)
                                            .Select(val => new PermissionPropertyValue(val))
                                            .ToList();

                var res = service.Update(updateItem);
                if (res.Success)
                {
                    return(RedirectToAction("Index", new { id = permissionProperty.PermissionsCategoryID }));
                }
                else
                {
                    ModelState.AddModelError("", res.Message);
                }
            }
            return(View(permissionProperty));
        }
コード例 #9
0
ファイル: MainForm.cs プロジェクト: zyylonghai/BWYSDP
        private void treeView1_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e)
        {
            LibTreeNode node = (LibTreeNode)e.Node;

            if (node.NodeType != NodeType.Class && node.NodeType != NodeType.Func && node.NodeType != NodeType.ReportFunc)
            {
                #region  创建Tabpage
                string tabNm = string.Format("{0}{2}{1}", node.Name, node.NodeType.ToString(), SysConstManage.Underline);
                if (this.libTabControl1.TabPages.ContainsKey(tabNm))
                {
                    this.libTabControl1.SelectedTab = this.libTabControl1.TabPages[tabNm];
                    return;
                }
                TabPage page = new TabPage(string.Format("{0}({1})", node.Text, node.NodeType.ToString()));
                page.Name = tabNm;

                #endregion

                this.libTabControl1.TabPages.Add(page);
                this.libTabControl1.SelectedTab = page;
                switch (node.NodeType)
                {
                case NodeType.DataModel:
                    DataSourceControl dsControl = new DataSourceControl(node);
                    dsControl.Dock = DockStyle.Fill;
                    page.Controls.Add(dsControl);
                    break;

                case NodeType.FormModel:
                    FormTemplate fmControl = new FormTemplate(node);
                    fmControl.Dock = DockStyle.Fill;
                    page.Controls.Add(fmControl);
                    break;

                case NodeType.PermissionModel:
                    PermissionProperty permissionctrl = new PermissionProperty(node.Name);
                    permissionctrl.Dock = DockStyle.Fill;
                    page.Controls.Add(permissionctrl);
                    SDPCRL.COM.ModelManager.LibPermissionSource libpermission = ModelDesignProject.GetLibPermissionById(node.Name);
                    libpermission.Package = node.Package;
                    permissionctrl.SetPropertyValue(libpermission, node);
                    break;

                case NodeType.KeyValues:
                    KeyValuesControl keyvaluectrl = new KeyValuesControl(node);
                    keyvaluectrl.Dock = DockStyle.Fill;
                    page.Controls.Add(keyvaluectrl);
                    break;

                case NodeType.ReportModel:
                    ReportSourceControl reportSourceControl = new ReportSourceControl(node);
                    reportSourceControl.Dock = DockStyle.Fill;
                    page.Controls.Add(reportSourceControl);
                    break;

                case NodeType.TransBillModel:
                    TransSourceControl tranSourceControl = new TransSourceControl(node);
                    tranSourceControl.Dock = DockStyle.Fill;
                    page.Controls.Add(tranSourceControl);
                    break;
                }
            }
        }