Ejemplo n.º 1
0
        private void commentUpload_Click(object sender, EventArgs e)//发布评论
        {
            string time       = System.DateTime.Now.ToString();
            string nameUpload = username.Text;
            string bookname   = bookName.Text;
            string comment    = commentText.Text;

            if (comment == null)
            {
                return;
            }
            LibraryBLL.book bookupdate = new LibraryBLL.book();
            try
            {
                bookupdate.bookCommentCheckIn(bookname, nameUpload, time, comment);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                return;
            }
            if (MessageBox.Show("评论成功") == DialogResult.OK)
            {
                bookcommentshow(bookname);
            }
        }
Ejemplo n.º 2
0
        private void bookdelet_Click(object sender, EventArgs e)//书本信息删除
        {
            int a = 0; string b = ""; ArrayList bookname = new ArrayList();

            for (int i = 0; i < bookinfolist.RowCount; i++)
            {
                DataGridViewCell bookselect = (DataGridViewCell)bookinfolist.Rows[i].Cells[0];
                if ((string)bookselect.Value == "True")
                {
                    b = bookinfolist.Rows[i].Cells[8].Value.ToString();
                    bookname.Add(b);
                }
            }
            if (MessageBox.Show("确定删除" + bookname.Count + "条数据吗?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Asterisk) == DialogResult.OK)
            {
                LibraryBLL.book book = new LibraryBLL.book();
                try
                {
                    a = book.bookdelete(bookname);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                    return;
                }
                bookinfoshow("", "");
                MessageBox.Show("删除了" + a + "条数据");
            }
        }
Ejemplo n.º 3
0
 private void covershow(string name)//封面显示
 {
     byte[]          b;
     LibraryBLL.book show = new LibraryBLL.book();
     try
     {
         b = show.covershow(name);
     }
     catch
     {
         bookPicture.BackgroundImage = null;
         return;
     }
     if (b.Length > 0)
     {
         try
         {
             byte[] ima = b;
             bookPicture.BackgroundImage = LibraryBLL.drawimag.headima(ima, bookPicture.Width, bookPicture.Height);
         }
         catch
         {
             bookPicture.BackgroundImage = null;
             return;
         }
     }
 }
Ejemplo n.º 4
0
        private void toolStripButton1_Click(object sender, EventArgs e)
        {
            int a = 0; ArrayList name = new ArrayList(); ArrayList commentText = new ArrayList();

            for (int i = 0; i < commentList.RowCount; i++)
            {
                string           b, c;
                DataGridViewCell checkbox = (DataGridViewCell)this.commentList.Rows[i].Cells[0];
                if ((string)checkbox.Value == "True")
                {
                    b = commentList.Rows[i].Cells[1].Value.ToString();
                    c = commentList.Rows[i].Cells[4].Value.ToString();
                    name.Add(b);
                    commentText.Add(c);
                }
            }
            if (MessageBox.Show("确定删除" + name.Count + "条数据吗?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Asterisk) == DialogResult.OK)
            {
                LibraryBLL.book comment = new LibraryBLL.book();
                try
                {
                    a = comment.commentdelete(name, commentText);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                    return;
                }
                bookcommentshow();
                MessageBox.Show("已经删除" + a + "条数据");;
            }
        }
Ejemplo n.º 5
0
        private void sure_Click(object sender, EventArgs e)
        {
            if (bookname.Text == "" || autor.Text == "" || pubname.Text == "" || type.Text == "" || date.Text == "" || page.Text == "" || textBox1.Text == "" || bookIntro.Text == "")
            {
                if (MessageBox.Show("存在字段为空") == DialogResult.OK)
                {
                    return;
                }
            }

            DateTime tm;

            if (false == DateTime.TryParse(date.Text, out tm))
            {
                if (MessageBox.Show("时间格式错误") == DialogResult.OK)
                {
                    return;
                }
            }
            byte[]          road       = ESBasic.Helpers.ImageHelper.Convert(this.bookimg.BackgroundImage);
            LibraryBLL.book bookupdate = new LibraryBLL.book();
            try
            {
                bookupdate.bookinfochange(bookname.Text, autor.Text, type.Text, pubname.Text, date.Text, code, road, bookIntro.Text, Convert.ToInt32(page.Text), Convert.ToInt32(textBox1.Text));
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                return;
            }
            this.Hide();
            UImain main = new UImain();

            main.Focus();
        }
Ejemplo n.º 6
0
        private void bookInfoFilled()//书本信息填充
        {
            SqlDataReader bookinfo;

            try
            {
                bookinfo = LibraryBLL.book.bookinfodata(code);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                return;
            }
            bookname.Text  = bookinfo["name"].ToString();
            autor.Text     = bookinfo["autor"].ToString();
            pubname.Text   = bookinfo["pubname"].ToString();
            type.Text      = bookinfo["type"].ToString();
            date.Text      = bookinfo["date"].ToString();
            page.Text      = bookinfo["pagecode"].ToString();
            bookIntro.Text = bookinfo["about"].ToString();
            textBox1.Text  = bookinfo["price"].ToString();
            byte[]          b;
            LibraryBLL.book show = new LibraryBLL.book();
            try
            {
                b = show.covershow(bookname.Text);
            }
            catch
            {
                bookimg.BackgroundImage = null;
                return;
            }
            if (b.Length > 0)
            {
                try
                {
                    byte[] ima = b;
                    bookimg.BackgroundImage = LibraryBLL.drawimag.headima(ima, bookimg.Width, bookimg.Height);
                }
                catch
                {
                    bookimg.BackgroundImage = null;
                    return;
                }
            }
        }
Ejemplo n.º 7
0
        private void sure_Click(object sender, EventArgs e)
        {
            if (bookname.Text == "" || autor.Text == "" || pubname.Text == "" || type.Text == "" || date.Text == "" || bookIds.Text == "" || page.Text == "" || textBox1.Text == "" || bookIntro.Text == "")
            {
                if (MessageBox.Show("存在字段为空") == DialogResult.OK)
                {
                    return;
                }
            }

            DateTime tm;

            if (false == DateTime.TryParse(date.Text, out tm))
            {
                if (MessageBox.Show("时间格式错误") == DialogResult.OK)
                {
                    return;
                }
            }

            string[] code = this.bookIds.Text.Trim().Split(';');
            for (int i = 0; i < code.Length; i++)
            {
                byte[]          road       = ESBasic.Helpers.ImageHelper.Convert(this.bookimg.BackgroundImage);
                LibraryBLL.book bookupdate = new LibraryBLL.book();
                try
                {
                    bookupdate.bookCheckIn(bookname.Text, autor.Text, type.Text, pubname.Text, date.Text, code[i], road, bookIntro.Text, Convert.ToInt32(page.Text), Convert.ToInt32(textBox1.Text));
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                    return;
                }
            }
            if (MessageBox.Show("书本增加成功") == DialogResult.OK)
            {
                this.Hide();
                UImain main = new UImain();
                main.Focus();
            }
        }