コード例 #1
0
        private static string CreateMoveinForm(MoveoutFormEntity moveout, string userId, Database db, DbTransaction trans)
        {
            var now = DateTime.Now;

            var movein = new MoveinFormEntity
            {
                MoveoutFormNo = moveout.FormNo,
                MoveoutId     = moveout.Id,
                ScanOver      = false,
                CreatedId     = userId,
                CreatedTime   = now,
                UpdatedId     = userId,
                UpdatedTime   = now
            };

            MoveinFormRepository.Save(movein, db, trans);

            return(movein.Id);
        }
コード例 #2
0
        public static MoveinFormEntity Get(string id)
        {
            var sql = string.Format("select {0} from movein_form where id=@p_id", COLUMN_SQL);

            var db = DatabaseFactory.CreateDatabase();
            var dc = db.GetSqlStringCommand(sql);

            db.AddInParameter(dc, "p_id", DbType.String, id);

            using (var reader = db.ExecuteReader(dc))
            {
                if (reader.Read())
                {
                    var entity = new MoveinFormEntity();
                    entity.Init(reader);

                    return(entity);
                }
            }

            return(null);
        }
コード例 #3
0
        public static void Save(MoveinFormEntity entity, Database db, DbTransaction trans)
        {
            var sql = string.Format(@"insert into movein_form({0})
values(@p_id, @p_moveout_id, @p_moveout_form_no, @p_scan_over, @p_confirm_user_id, @p_confirm_datetime,
        @p_created_id, @p_created_time, @p_updated_id, @p_updated_time)", COLUMN_SQL);

            entity.Id = Guid.NewGuid().ToString();

            var dc = db.GetSqlStringCommand(sql);

            db.AddInParameter(dc, "p_id", DbType.String, entity.Id);
            db.AddInParameter(dc, "p_moveout_id", DbType.String, entity.MoveoutId);
            db.AddInParameter(dc, "p_moveout_form_no", DbType.Int32, entity.MoveoutFormNo);
            db.AddInParameter(dc, "p_scan_over", DbType.Boolean, entity.ScanOver);
            db.AddInParameter(dc, "p_confirm_user_id", DbType.String, DBNull.Value);
            db.AddInParameter(dc, "p_confirm_datetime", DbType.DateTime, DBNull.Value);
            db.AddInParameter(dc, "p_created_id", DbType.String, entity.CreatedId);
            db.AddInParameter(dc, "p_created_time", DbType.DateTime, entity.CreatedTime);
            db.AddInParameter(dc, "p_updated_id", DbType.String, entity.UpdatedId);
            db.AddInParameter(dc, "p_updated_time", DbType.DateTime, entity.UpdatedTime);

            db.ExecuteNonQuery(dc, trans);
        }