Esempio n. 1
0
        string type = String.Empty; // 对象类型

        #endregion

        #region ASP.NET 事件

        protected void Page_Load(object sender, EventArgs e)
        {
            op   = RequestData.Get <string>("op");
            id   = RequestData.Get <string>("id");
            type = RequestData.Get <string>("type");

            SysGraph ent = null;

            switch (this.RequestAction)
            {
            case RequestActionEnum.Update:
                ent = this.GetMergedData <SysGraph>();
                ent.DoUpdate();
                this.SetMessage("修改成功!");
                break;

            case RequestActionEnum.Create:
                ent = this.GetPostedData <SysGraph>();

                ent.CreaterID   = UserInfo.UserID;
                ent.CreaterName = UserInfo.Name;

                ent.DoCreate();
                this.SetMessage("新建成功!");
                break;

            case RequestActionEnum.Delete:
                ent = this.GetTargetData <SysGraph>();
                ent.DoDelete();
                this.SetMessage("删除成功!");
                return;
            }

            if (op != "c" && op != "cs")
            {
                if (!String.IsNullOrEmpty(id))
                {
                    ent = SysGraph.Find(id);
                    this.SetFormData(ent);
                }
                else
                {
                    if (op == "r")
                    {
                        ent = SysGraph.FindFirst();
                        this.SetFormData(ent);
                    }
                }
            }
            else
            {
                this.PageState.Add("CreaterName", UserInfo.Name);
                this.PageState.Add("CreatedDate", DateTime.Now);
            }
        }
Esempio n. 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            ents = SysGraphRule.FindAll(SearchCriterion);

            this.PageState.Add("SysGraphList", ents);

            SysGraph ent = null;

            switch (this.RequestAction)
            {
            case RequestActionEnum.Delete:
                ent = this.GetTargetData <SysGraph>();
                ent.DoDelete();

                FileService.DeleteFileByFullID(ent.FileID);

                this.SetMessage("删除成功!");
                break;

            case RequestActionEnum.Custom:
                IList <object> idList = RequestData.GetList <object>("IdList");

                if (idList != null && idList.Count > 0)
                {
                    if (RequestActionString == "batchdelete")
                    {
                        SysGraph[] tents = SysGraph.FindAllByPrimaryKeys(idList.ToArray());

                        for (int i = 0; i < tents.Length; i++)
                        {
                            tents[i].DoDelete();

                            FileService.DeleteFileByFullID(tents[i].FileID);
                        }
                    }
                }
                break;
            }
        }