Ejemplo n.º 1
0
        protected override int OnUpdate()
        {
            if (ID <= 0)
            {
                return(-1);
            }

            var rs = base.OnUpdate();

            var myatt = MyAttachment.FindByID(ID);

            if (myatt == null)
            {
                myatt = new MyAttachment();
                myatt.CopyFrom(this);
                myatt.ID = ID;
                rs      += myatt.Insert();
            }
            else
            {
                myatt.CopyFrom(this);
                myatt.ID = ID;
                rs      += myatt.Update();
            }

            return(rs);
        }
Ejemplo n.º 2
0
        /// <summary>已重载。在事务保护范围内处理业务,位于Valid之后</summary>
        /// <returns></returns>
        protected override Int32 OnInsert()
        {
            var rs = base.OnInsert();

            var myatt = new MyAttachment();

            myatt.CopyFrom(this);
            myatt.ID = ID;
            rs      += myatt.Insert();

            return(rs);
        }