예제 #1
0
        public int Insert()
        {
            CheckContents();

            string sql = @"
INSERT INTO t_board (
	title
	,contents
    ,reg_user
    ,reg_username
    ,reg_date
    ,view_Cnt
    ,status_flag
)
VALUES (
    @title
	,@contents
    ,@reg_user
    ,@reg_username
    ,now()
    ,0
    ,0
)
";

            using (var db = new MySqlDapperHelper())
            {
                return(db.Execute(sql, this));
            }
        }
예제 #2
0
        public int Update()
        {
            using (var db = new MySqlDapperHelper())
            {
                db.BeginTransaction();

                try
                {
                    int r = 0;

                    string sql = @"
UPDATE t_ticket
SET
    title = @title
WHERE
	ticket_id = @ticket_id
";
                    r += db.Execute(sql, this);

                    db.Commit();

                    return(r);
                }
                catch (Exception ex)
                {
                    db.Rollback();
                    throw ex;
                }
            }
        }
예제 #3
0
        public int Insert(MySqlDapperHelper db)
        {
            return(db.Execute($@"
INSERT INTO BOARD (
	BOARD_TYPE
	,SEQ
	,TITLE
	,CONTENTS
	,DUP_KEY
	,VIEW_CNT
	,STATUS_FLAG
	,REG_IP
	,REG_USER
	,REG_USERNAME
	,REG_DATE
)
SELECT
	@BOARD_TYPE
	,IFNULL((SELECT MAX(SEQ) + 1 FROM BOARD), 1)
	,@TITLE
	,@CONTENTS
	,@DUP_KEY
	,@VIEW_CNT
	,'Y'
	,@REG_IP
	,@REG_USER
	,@REG_USERNAME
	,now()
", this));
        }
예제 #4
0
        public int Delete()
        {
            string sql = @"
DELETE FROM t_board
WHERE
    idx = @idx
";

            using (var db = new MySqlDapperHelper())
            {
                return(db.Execute(sql, this));
            }
        }
예제 #5
0
        public int Update()
        {
            CheckContents();

            string sql = @"
UPDATE t_board
SET
    title = @title
	,contents = @contents
WHERE
    idx = @idx
";

            using (var db = new MySqlDapperHelper())
            {
                return(db.Execute(sql, this));
            }
        }
예제 #6
0
        internal int Register()
        {
            //중복 user_name이 있는지?
            //중복 email 있는지?

            string sql = @"
INSERT INTO t_user (
    user_name
    ,email
    ,password
)
SELECT
    @user_name
    ,@email
    ,@password
";

            using (var db = new MySqlDapperHelper())
            {
                return(db.Execute(sql, this));
            }
        }