public virtual ActionResult Add()
        {
            var entity = Factory.Create() as TEntity;

            // 填充QueryString参数
            var qs = Request.QueryString;

            foreach (var item in Entity <TEntity> .Meta.Fields)
            {
                var v = qs[item.Name];
                if (!v.IsNullOrEmpty())
                {
                    entity[item.Name] = v;
                }
            }

            // 验证数据权限
            Valid(entity, DataObjectMethodType.Insert, false);

            // 记下添加前的来源页,待会添加成功以后跳转
            //Session["Cube_Add_Referrer"] = Request.UrlReferrer.ToString();

            var url = Request.UrlReferrer + "";

            SetSession("Cube_Add_Referrer", url);

            return(FormView(entity));
        }
Exemple #2
0
        public virtual ActionResult Add()
        {
            var entity = Factory.Create() as TEntity;

            // 记下添加前的来源页,待会添加成功以后跳转
            Session["Cube_Add_Referrer"] = Request.UrlReferrer.ToString();

            return(FormView(entity));
        }
Exemple #3
0
        private XmlSerializer CreateXmlSerializer(Type type)
        {
            XmlAttributeOverrides ovs     = new XmlAttributeOverrides();
            IEntityOperate        factory = Factory;
            IEntity entity = factory.Create();

            foreach (FieldItem item in factory.Fields)
            {
                XmlAttributes atts = new XmlAttributes();
                atts.XmlAttribute    = new XmlAttributeAttribute();
                atts.XmlDefaultValue = entity[item.Name];
                ovs.Add(item.DeclaringType, item.Name, atts);
            }
            return(new XmlSerializer(type, ovs));
        }
        public virtual ActionResult Add()
        {
            var entity = Factory.Create() as TEntity;

#if __CORE__
            // 填充QueryString参数
            var qs = Request.Query;
            foreach (var item in Entity <TEntity> .Meta.Fields)
            {
                var v = qs[item.Name];
                if (v.Count > 0)
                {
                    entity[item.Name] = v[0];
                }
            }
#else
            // 填充QueryString参数
            var qs = Request.QueryString;
            foreach (var item in Entity <TEntity> .Meta.Fields)
            {
                var v = qs[item.Name];
                if (!v.IsNullOrEmpty())
                {
                    entity[item.Name] = v;
                }
            }
#endif

            // 验证数据权限
            Valid(entity, DataObjectMethodType.Insert, false);

            // 记下添加前的来源页,待会添加成功以后跳转
            //Session["Cube_Add_Referrer"] = Request.UrlReferrer.ToString();
#if __CORE__
            var url = Request.Headers["Referer"].FirstOrDefault() + "";
#else
            var url = Request.UrlReferrer + "";
#endif
            SetSession("Cube_Add_Referrer", url);

            return(FormView(entity));
        }
        public virtual ActionResult Add()
        {
            var entity = Factory.Create() as TEntity;

            // 填充QueryString参数
            var qs = Request.Query;

            foreach (var item in Entity <TEntity> .Meta.Fields)
            {
                var v = qs[item.Name];
                if (v.Count > 0)
                {
                    entity[item.Name] = v;
                }
            }

            // 验证数据权限
            Valid(entity, DataObjectMethodType.Insert, false);

            // 记下添加前的来源页,待会添加成功以后跳转
            HttpContext.Session.Set("Cube_Add_Referrer", Request.Headers["Referer"].FirstOrDefault().GetBytes());

            return(FormView(entity));
        }