Esempio n. 1
0
        private void btnSave()
        {
            IList <string> entStrList = RequestData.GetList <string>("data");

            if (entStrList != null && entStrList.Count > 0)
            {
                IList <WelfareConfig> ents = entStrList.Select(tent => JsonHelper.GetObject <WelfareConfig>(tent) as WelfareConfig).ToList();

                foreach (WelfareConfig ent in ents)
                {
                    if (ent != null)
                    {
                        WelfareConfig tent = ent;

                        if (String.IsNullOrEmpty(tent.Id))
                        {
                            tent.CreateId   = UserInfo.UserID;
                            tent.CreateName = UserInfo.Name;
                        }
                        else
                        {
                            tent = DataHelper.MergeData(WelfareConfig.Find(tent.Id), tent);
                        }

                        tent.DoSave();
                    }
                }
            }
        }
Esempio n. 2
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");

            WelfareConfig ent = null;

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

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

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

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

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

                this.SetFormData(ent);
            }
        }