Example #1
0
        public override OutputData DoAction(IInputData input)
        {
            if (input.Style.Style == PageStyle.Insert)
            {
                if (input.IsPost)
                {
                    try
                    {
                        return(Source.Insert(input, input.PostObject));
                    }
                    catch (WebPostException ex)
                    {
                        return(OutputData.CreateToolkitObject(ex.CreateErrorResult()));
                    }
                }
                else
                {
                    EditObjectModel model     = new EditObjectModel();
                    object          newObject = Source.CreateNew(input);
                    ObjectContainer container = new ObjectContainer(newObject);
                    model.Object = container;
                    IEnumerable <IFieldInfoEx> fields = GetFields();
                    container.Decode(fields);
                    model.FillCodeTable(fields);

                    input.CallerInfo.AddInfo(model.CallerInfo);

                    return(OutputData.CreateObject(model));
                }
            }
            else
            {
                return(ErrorPageStyle(PageStyle.Insert, input));
            }
        }
Example #2
0
        protected OutputData DoDetailAction(IInputData input)
        {
            DetailObjectModel model     = new DetailObjectModel();
            object            newObject = Source.Query(input, input.QueryString["Id"]);
            ObjectContainer   container = new ObjectContainer(newObject);

            model.Object = container;
            container.Decode(GetFields());
            MakeOperateRight(model, input);
            input.CallerInfo.AddInfo(model.CallerInfo);

            return(OutputData.CreateObject(model));
        }
Example #3
0
        protected OutputData DoDetailAction(IInputData input)
        {
            EditObjectModel model     = new EditObjectModel();
            object          newObject = Source.Query(input, input.QueryString["Id"]);
            ObjectContainer container = new ObjectContainer(newObject);

            model.Object = container;
            IEnumerable <IFieldInfoEx> fields = GetFields();

            container.Decode(fields);
            model.FillCodeTable(fields);

            input.CallerInfo.AddInfo(model.CallerInfo);

            return(OutputData.CreateObject(model));
        }
Example #4
0
        internal void SetList(IEnumerable list, IEnumerable <IFieldInfoEx> metaFields)
        {
            var objList = new List <ObjectContainer>(Count.PageSize);

            List = objList;
            if (list == null)
            {
                return;
            }

            foreach (var item in list)
            {
                ObjectContainer listItem = new ObjectContainer(item);
                listItem.Decode(metaFields);
                objList.Add(listItem);
            }
        }