예제 #1
0
        private void btnSetToEntity_Click(object sender, EventArgs e)
        {
            Entity et = new Entity();

            row.SetToEntity(et);
            rtxtText.Text = "SetoToEntity:" + GetText(et);
        }
예제 #2
0
 private void btnUpdate_Click(object sender, EventArgs e)
 {
     using (UsersBean ub = new UsersBean())
     {
         MDataRow row = MDataRow.CreateFrom(ub);
         row.LoadFrom(false, this);
         row.SetToEntity(ub);
         ub.Update();
     }
     LoadData();
     OutMsg();
 }
예제 #3
0
 private void btnInsert_Click(object sender, EventArgs e)
 {
     using (UsersBean ub = new UsersBean())
     {
         MDataRow row = MDataRow.CreateFrom(ub);
         row.LoadFrom(false, this);
         row.SetToEntity(ub);
         if (ub.Insert(InsertOp.ID, chbInsertID.Checked))
         {
             row.SetToAll(this);
         }
     }
     LoadData();
     OutMsg();
 }
예제 #4
0
파일: DBFast.cs 프로젝트: yanshen6/cyqdata
        /// <summary>
        /// 添加一条记录
        /// </summary>
        /// <typeparam name="T">实体类型</typeparam>
        /// <param name="t">实体对象</param>
        /// <returns></returns>
        public static bool Insert <T>(T t, InsertOp op, bool insertID)
        {
            bool     result = false;
            MDataRow row    = null;

            using (MAction action = GetMAction <T>())
            {
                action.AllowInsertID = insertID;
                action.Data.LoadFrom(t, BreakOp.Null);
                result = action.Insert(op);
                if (result && op != InsertOp.None)
                {
                    row = action.Data;
                }
            }
            if (row != null)
            {
                row.SetToEntity(t);
            }
            return(result);
        }