Exemple #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");

            ProjectFile ent = null;

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

            case RequestActionEnum.Insert:
            case RequestActionEnum.Create:
                ent = this.GetPostedData <ProjectFile>();
                //ent.CreateTime = DateTime.Now;
                // DataTable dt = DataHelper.QueryDataTable("select case when TypeId is not null then TypeId+Id+',' else Id+',' end as typid from NCRL_SP..ProjectFile where Id='" + RequestData.Get<string>("id") + "'");
                // if (dt.Rows.Count != 0)
                // {
                //     ent.TypeID =  dt.Rows[0]["typid"].ToString();
                // }
                // ent.IsDelete = "0";


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

            default:
                if (RequestActionString == "createsub")
                {
                    ent            = this.GetPostedData <ProjectFile>();
                    ent.CreateTime = DateTime.Now;
                    DataTable dt = DataHelper.QueryDataTable("select case when TypeId is not null then TypeId+Id+',' else Id+',' end as typid from NCRL_SP..ProjectFile where Id='" + RequestData.Get <string>("id") + "'");
                    if (dt.Rows.Count != 0)
                    {
                        ent.TypeID   = dt.Rows[0]["typid"].ToString();
                        ent.ParentID = RequestData.Get <string>("id");
                    }
                    ent.IsDelete = "0";


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

            if (op != "c" && op != "cs")
            {
                if (!String.IsNullOrEmpty(id))
                {
                    ent = ProjectFile.Find(id);
                }

                this.SetFormData(ent);
            }
        }