コード例 #1
0
        protected override void ImplementBusinessLogic()
        {
            AutoViewFactory factory = new AutoViewFactory(this.Info.AppSqlCon, this);
            View            view    = factory.GetView(this.Option.SaveObj.ViewID);
            var             sql     = GetViewSql(view);

            global::Soway.Model.SqlServer.dbContext context = new global::Soway.Model.SqlServer.dbContext(sql, this);
            IObjectProxy iObjectProxy = new Soway.Model.ObjectProxy(view.Model, this);

            if (String.IsNullOrEmpty(this.Option.OwnerViewId) == false)
            {
                var ownerModel = factory.GetView(this.Option.OwnerViewId).Model;
                var owner      = context.GetDetail(ownerModel, this.Option.OwnerId);
                Soway.Model.ModelBindingList array = owner[this.Option.Property] as Soway.Model.ModelBindingList;
                iObjectProxy = array.AddNew();
                DataFormator.ObjUpdateToProxy(this.Option.SaveObj, iObjectProxy);
                context.Save(owner);
                //iObjectProxy.Owner = new ObjectProxy(ownerModel) { ID = this.Option.OwnerId ,SaveInDB=true,IsLoad= LoadType.Complete};
            }
            else
            {
                DataFormator.ObjUpdateToProxy(this.Option.SaveObj, iObjectProxy);
                context.Create(iObjectProxy);
            }
        }
コード例 #2
0
        protected override void ImplementBusinessLogic()
        {
            AutoViewFactory factory = new AutoViewFactory(this.Info.AppSqlCon, this);
            View            view    = factory.GetView(this.Option.SaveObj.ViewID);
            var             sql     = GetViewSql(view);


            global::Soway.Model.SqlServer.dbContext context = new global::Soway.Model.SqlServer.dbContext(sql, this);

            IObjectProxy iObjectProxy = context.GetDetail(view.Model, this.Option.SaveObj.Id);

            DataFormator.ObjUpdateToProxy(this.Option.SaveObj, iObjectProxy);
            context.Save(iObjectProxy);
        }
コード例 #3
0
ファイル: HandlerInitNew.cs プロジェクト: lixiangyi/FoolFrame
        protected override void ImplementBusinessLogic()
        {
            AutoViewFactory factory = new AutoViewFactory(this.Info.AppSqlCon, this);
            View            view    = factory.GetView(this.Option.ViewId);
            var             sql     = GetViewSql(view);

            global::Soway.Model.SqlServer.dbContext context = new global::Soway.Model.SqlServer.dbContext(sql, this);
            IObjectProxy iObjectProxy = new Soway.Model.ObjectProxy(view.Model, this);

            Data.Data = DataFormator.IObjectProxyToDetail(iObjectProxy, view);
            if (String.IsNullOrEmpty((this.Option.ParentObjId ?? "").ToString()) == false)
            {
                Data.Data.ParentId = this.Option.ParentObjId;
            }

            this.Result = Data;
        }