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