Beispiel #1
0
 public BookCateEdit(BookCate bc, LibraryManage lm)
 {
     InitializeComponent();
     bookCate       = bc;
     libraryManage  = lm;
     parentBookCate = libraryManage.bookManage.getBookCate(bookCate.ParentId);
 }
 public void Show(TextBox tb, BookCate bc)
 {
     this.tb  = tb;
     bookCate = bc;
     this.Show();
     return;
 }
        private void SelectBookCate_FormClosing(object sender, FormClosingEventArgs e)
        {
            BookCate bc = libraryManage.bookManage.getBookCate(Id);

            bookCate.Id       = bc.Id;
            bookCate.Name     = bc.Name;
            bookCate.ParentId = bc.ParentId;
        }
Beispiel #4
0
        private void btn_Login_Click(object sender, EventArgs e)
        {
            if ("" == tb_Cate.Text)
            {
                MessageBox.Show("关键项不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                tb_Cate.Focus();
                return;
            }

            if (null == tb_BookCate.Tag)
            {
                MessageBox.Show("父类别不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                tb_Cate.Focus();
                return;
            }
            if (parentBookCate.Id == bookCate.Id)
            {
                MessageBox.Show("父类别不能为自己!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                tb_Cate.Focus();
                return;
            }

            bookCate          = new BookCate();
            bookCate.Name     = tb_Cate.Text;
            bookCate.ParentId = parentBookCate.Id;

            if (libraryManage.bookManage.addBookCate(bookCate))
            {
                m_DialogResult = System.Windows.Forms.DialogResult.OK;
                MessageBox.Show("添加成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                if (true == cb_add.Checked)
                {
                    clear();
                }
                else
                {
                    this.DialogResult = m_DialogResult;
                }
            }
            else
            {
                m_DialogResult = System.Windows.Forms.DialogResult.No;
                MessageBox.Show("添加失败", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                if (false == cb_add.Checked)
                {
                    this.DialogResult = m_DialogResult;
                }
                tb_Cate.Focus();
            }
        }
Beispiel #5
0
 void clear()
 {
     tb_ISBN.Text          = "";
     tb_Name.Text          = "";
     tb_Author.Text        = "";
     tb_BookCate.Text      = "";
     tb_Publisher.Text     = "";
     tb_PublisherDate.Text = "";
     tb_KeyWords.Text      = "";
     cb_Language.Text      = "";
     nud_Price.Value       = 0;
     nup_totalcount.Value  = 0;
     tb_ISBN.Focus();
     tb_BookCate.Tag = null;
     bookCate        = null;
 }
Beispiel #6
0
        private void btn_Login_Click(object sender, EventArgs e)
        {
            if ("" == tb_Cate.Text)
            {
                MessageBox.Show("关键项不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                tb_Cate.Focus();
                return;
            }

            if (null == tb_BookCate.Tag)
            {
                MessageBox.Show("父类别不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                tb_Cate.Focus();
                return;
            }
            if (parentBookCate.Id == bookCate.Id)
            {
                MessageBox.Show("父类别不能为自己!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                tb_Cate.Focus();
                return;
            }


            BookCate tmp = new BookCate();

            tmp.Id       = bookCate.Id;
            tmp.Name     = tb_Cate.Text;
            tmp.ParentId = parentBookCate.Id;

            if (libraryManage.bookManage.upBookCate(tmp))
            {
                m_DialogResult = System.Windows.Forms.DialogResult.OK;
                if (parentBookCate.Id != bookCate.ParentId)
                {
                    String path = libraryManage.bookManage.getFullPath(tmp);
                    libraryManage.bookManage.upBookFullBookCate(tmp.Id, path);
                }
                MessageBox.Show("修改成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                this.DialogResult = m_DialogResult;
            }
            else
            {
                m_DialogResult = System.Windows.Forms.DialogResult.No;
                MessageBox.Show("添加失败", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                this.DialogResult = m_DialogResult;
            }
        }