コード例 #1
0
ファイル: MainWindow.cs プロジェクト: huaminglee/yousoftbath
        //添加备注
        private void CtxAddNote_Click(object sender, EventArgs e)
        {
            //BathDBDataContext db_new = new BathDBDataContext(LogIn.connectionString);
            if (!dao.get_authority(LogIn.m_User, "添加备注"))
            {
                BathClass.printErrorMsg("权限不够!");
                return;
            }

            var seat = getContextSenderSeat(sender);
            if (seat.status != SeatStatus.USING && seat.status != SeatStatus.WARNING)
            {
                BathClass.printErrorMsg("手牌未使用,不能添加备注");
                return;
            }

            NoteForm noteForm = new NoteForm();
            if (noteForm.ShowDialog() != DialogResult.OK)
                return;

            string cmd_str = @"update [Seat] set note='" + noteForm.note + "' where text='" + seat.text + "'";
            if (!dao.execute_command(cmd_str))
            {
                BathClass.printErrorMsg("手牌添加失败!");
                return;
            }
            //seat.note = noteForm.note;
            //db_new.SubmitChanges();
        }
コード例 #2
0
        //添加备注
        private void CtxAddNote_Click(object sender, EventArgs e)
        {
            BathDBDataContext db_new = new BathDBDataContext(LogIn.connectionString);
            Seat seat = getContextSenderSeat(db_new, sender);
            if (seat.status != 2 && seat.status != 6)
            {
                GeneralClass.printErrorMsg("手牌未使用,不能添加备注");
                return;
            }

            NoteForm noteForm = new NoteForm();
            if (noteForm.ShowDialog() != DialogResult.OK)
                return;

            seat.note = noteForm.note;
            db_new.SubmitChanges();
        }