コード例 #1
0
ファイル: editbk.cs プロジェクト: ComplexA/BookManage
        private void btbookin_Click(object sender, EventArgs e)
        {
            if (txtcaseID.Text.Trim() == "" || txtclass.Text.Trim() == "" || txtcname.Text.Trim() == "" ||
                txtdpt.Text.Trim() == "" || txtfloor.Text.Trim() == "" || txtisbn.Text.Trim() == "" ||
                txtpress.Text.Trim() == "" || txtpub.Text.Trim() == "" || txtrow.Text.Trim() == "" ||
                txtshelf.Text.Trim() == "" || txtwriter.Text.Trim() == "")
            {
                MessageBox.Show("请填写所有信息");
                return;
            }
            string sqlupcs = "update caseBook set caseName='" + txtcname.Text.Trim()
                             + "',writer='" + txtwriter.Text.Trim()
                             + "',department='" + txtdpt.Text.Trim()
                             + "',floor='" + txtfloor.Text.Trim()
                             + "',press='" + txtpress.Text.Trim()
                             + "',pubdate='" + txtpub.Text.Trim()
                             + "',row='" + txtrow.Text.Trim()
                             + "',shelf='" + txtshelf.Text.Trim()
                             + "',classID='" + txtclass.Text.Trim()
                             + "' where caseID='" + txtcaseID.Text.Trim() + "'";

            Cdatabase.UpdateDB(sqlupcs);
            MessageBox.Show("修改成功");
            this.Close();
            this.refresh();
        }
コード例 #2
0
ファイル: lendbk.cs プロジェクト: ComplexA/BookManage
        private void btlend_Click(object sender, EventArgs e)
        {
            if (txtlendcid.Text.Trim() == "" || txtlendrid.Text.Trim() == "")
            {
                MessageBox.Show("请填写完整信息");
                return;
            }

            if (chkcid() && chkrid())
            {
                string sqllendbk = "insert into lend values('" + txtlendrid.Text.Trim()
                                   + "','" + txtlendcid.Text.Trim() + "','" + DateTime.Now.ToString("yyyy-MM-dd")
                                   + "','" + DateTime.Now.AddMonths(1).ToString("yyyy-MM-dd") + " ','false')";
                string sqlcasest = "update caseBook set state='false' where caseID='" + txtlendcid.Text.Trim() + "'";
                string showinfo  = "读者编码:" + txtlendrid.Text.Trim() +
                                   "\n图书编码:" + txtlendcid.Text.Trim() +
                                   "\n借书日期:" + DateTime.Now.ToString("yyyy-MM-dd") +
                                   "\n还书日期:" + DateTime.Now.AddMonths(1).ToString("yyyy-MM-dd");

                if (MessageBox.Show(showinfo, "借书信息", MessageBoxButtons.OKCancel) == DialogResult.OK)
                {
                    Cdatabase.UpdateDB(sqllendbk);
                    Cdatabase.UpdateDB(sqlcasest);
                    MessageBox.Show("ok");
                    txtlendcid.Text = "";
                    txtlendrid.Text = "";
                }
            }
        }
コード例 #3
0
        private void btaddrd_Click(object sender, EventArgs e)
        {
            if (checkrd())
            {
                return;
            }

            if (txtrdid.Text.Trim() == "" || txtrdName.Text.Trim() == "" ||
                txtYear.Text.Trim() == "" || txtMonth.Text.Trim() == "" || txtDay.Text.Trim() == "" ||
                txtrddpt.Text.Trim() == "" || comboBox1.SelectedIndex == -1)
            {
                MessageBox.Show("请填写所有信息");
                return;
            }
            string sqlupcase = "insert into reader values('" + txtrdid.Text.Trim() + "','"
                               + txtrdName.Text.Trim() + "','"
                               + txtYear.Text.Trim() + "." + txtMonth.Text.Trim() + "." + txtDay.Text.Trim() + "','"
                               + comboBox1.Text.Trim() + "','"
                               + txtrddpt.Text.Trim() +
                               "')";

            Cdatabase.UpdateDB(sqlupcase);
            MessageBox.Show("添加成功!");
            txtrdName.Text = "";
            txtYear.Text   = "";
            txtMonth.Text  = "";
            txtDay.Text    = "";
            txtrddpt.Text  = "";
            txtrdid.Text   = "";
        }
コード例 #4
0
        private void btbookin_Click(object sender, EventArgs e)
        {
            if (txtrdName.Text.Trim() == "" || txtYear.Text.Trim() == "" || txtMonth.Text.Trim() == "" || txtDay.Text.Trim() == "" || txtrdid.Text.Trim() == "" || txtrddpt.Text.Trim() == "")
            {
                MessageBox.Show("请填写所有信息");
                return;
            }


            string sqlupcase = "insert into reader values('" + txtrdid.Text.Trim() + "','"

                               + txtrdName.Text.Trim() + "','"

                               + txtYear.Text.Trim() + "." + txtMonth.Text.Trim() + "." + txtDay.Text.Trim() + "','"
                               + txtrddpt.Text.Trim() + "','"
                               + comboBox1.Text.Trim() +
                               "')";

            //insertvlm();
            //MessageBox.Show(sqlupcase);
            Cdatabase.UpdateDB(sqlupcase);
            MessageBox.Show("录入成功!");
            txtrdName.Text = "";
            txtYear.Text   = "";
            txtMonth.Text  = "";
            txtDay.Text    = "";
            txtrddpt.Text  = "";

            txtrdid.Text = "";
        }
コード例 #5
0
ファイル: bookin.cs プロジェクト: ComplexA/BookManage
        private void btbookin_Click(object sender, EventArgs e)
        {
            if (txtcaseID.Text.Trim() == "" || txtclass.Text.Trim() == "" || txtcname.Text.Trim() == "" ||
                txtdpt.Text.Trim() == "" || txtfloor.Text.Trim() == "" || txtisbn.Text.Trim() == "" ||
                txtpress.Text.Trim() == "" || txtpub.Text.Trim() == "" || txtrow.Text.Trim() == "" ||
                txtshelf.Text.Trim() == "" || txtwriter.Text.Trim() == "" || chkvin())
            {
                MessageBox.Show("请填写所有信息");
                return;
            }

            for (int i = 0; i < vnumup.Value; i++)
            {
                string  sqlSt = "select * from volume where vID='" + vindata.Rows[i].Cells[0].Value.ToString() + "'";
                DataSet dsv   = new DataSet();
                Cdatabase.conn.ConnectionString = Cdatabase.connStr;
                Cdatabase.conn.Open();
                SqlDataAdapter adapte = new SqlDataAdapter(sqlSt, Cdatabase.conn);
                adapte.Fill(dsv);
                Cdatabase.conn.Close();
                if (!(dsv.Tables[0].Rows.Count == 0))
                {
                    MessageBox.Show("册号重复");
                    vindata.Rows[i].Cells[0].Value = "";
                    return;
                }
            }

            string sqlupcase = "insert into caseBook(caseID,caseName,press,pubdate,vnum,isbn,department,classID,row,shelf,floor,writer,state) values('"
                               + txtcaseID.Text.Trim() + "','"
                               + txtcname.Text.Trim() + "','" + txtpress.Text.Trim() + "','"
                               + txtpub.Text.Trim() + "','" + vnumup.Value.ToString() + "','"
                               + txtisbn.Text.Trim() + "','" + txtdpt.Text.Trim() + "','"
                               + txtclass.Text.Trim() + "','" + txtrow.Text.Trim() + "','"
                               + txtshelf.Text.Trim() + "','" + txtfloor.Text.Trim() + "','"
                               + txtwriter.Text.Trim() + "','True')";

            //MessageBox.Show(sqlupcase);
            Cdatabase.UpdateDB(sqlupcase);
            insertvlm();
            MessageBox.Show("录入成功!");
            txtcaseID.Text = "";
            txtcname.Text  = "";
            txtwriter.Text = "";
            txtdpt.Text    = "";
            txtfloor.Text  = "";
            txtisbn.Text   = "";
            txtpress.Text  = "";
            txtpub.Text    = "";
            txtrow.Text    = "";
            txtshelf.Text  = "";
            txtclass.Text  = "";
            vnumup.Value   = 1;
            for (int j = 0; j < 4; j++)
            {
                vindata.Rows[0].Cells[j].Value = "";
            }
        }
コード例 #6
0
ファイル: schrd.cs プロジェクト: ComplexA/BookManage
        private void btdelete_Click(object sender, EventArgs e)
        {
            string dltnm = dataGridView1.CurrentRow.Cells[1].Value.ToString();
            string dltid = dataGridView1.CurrentRow.Cells[0].Value.ToString();

            if (MessageBox.Show("确定删除\n读者号为" + dltid + "\n姓名为\t" + dltnm + "?", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
            {
                string sqldltv    = "delete from reader where rdID ='" + dltid + "'";
                string sqldltlend = "delete from lend where rdID='" + dltid + "'";
                Cdatabase.UpdateDB(sqldltv);
                MessageBox.Show("删除成功");
                RefreshForm();
            }
        }
コード例 #7
0
ファイル: bookin.cs プロジェクト: ComplexA/BookManage
        private void insertvlm()
        {
            for (int i = 0; i < vnumup.Value; i++)
            {
                string sqlinv = "insert into volume(vID,division,vwriter,topic,cID) values('";
                for (int j = 0; j < 4; j++)
                {
                    sqlinv += vindata.Rows[i].Cells[j].Value.ToString() + "','";
                }

                sqlinv += txtcaseID.Text.ToString() + "')";
                Cdatabase.UpdateDB(sqlinv);
                //MessageBox.Show(sqlinv);
            }
        }
コード例 #8
0
        private void btrtn_Click(object sender, EventArgs e)
        {
            if (txtrtn.Text.Trim() == "")
            {
                MessageBox.Show("请填写图书编码");
                return;
            }

            //修改图书的状态、从lend表中删去此行、判断日期,如果日期在今天之后则提醒
            string  sql    = "select * from lend where cID='" + txtrtn.Text.Trim() + "'";
            DataSet dscase = new DataSet();

            Cdatabase.conn.ConnectionString = Cdatabase.connStr;
            Cdatabase.conn.Open();
            SqlDataAdapter adapter = new SqlDataAdapter(sql, Cdatabase.conn);

            adapter.Fill(dscase);
            Cdatabase.conn.Close();
            if (!(dscase.Tables[0].Rows.Count == 0))
            {
                string sqlupcase = "update caseBook set state='True' where caseID='" + txtrtn.Text.Trim() + "'";
                string sqldelete = "delete from lend where cID='" + txtrtn.Text.Trim() + "'";

                DateTime d = Convert.ToDateTime(dscase.Tables[0].Rows[0]["rtndate"].ToString());
                if (DateTime.Now < d)
                {
                    Cdatabase.UpdateDB(sqlupcase);
                    Cdatabase.UpdateDB(sqldelete);
                    MessageBox.Show("ok");
                    txtrtn.Text = "";
                }
                else
                {
                    if (MessageBox.Show("超时" + (DateTime.Now - d).TotalDays.ToString() + "天", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
                    {
                        Cdatabase.UpdateDB(sqlupcase);
                        Cdatabase.UpdateDB(sqldelete);
                    }
                }
            }
            else
            {
                MessageBox.Show("该图书未被借出");
            }
        }
コード例 #9
0
        private void btaddrd_Click(object sender, EventArgs e)
        {
            if (txtrdid.Text.Trim() == "" || txtrdName.Text.Trim() == "" ||
                txtYear.Text.Trim() == "" || txtMonth.Text.Trim() == "" ||
                txtDay.Text.Trim() == "" ||
                txtrddpt.Text.Trim() == "" || comboBox1.SelectedIndex == -1)
            {
                MessageBox.Show("请填写所有信息");
                return;
            }
            string sqlupcase = "update reader set rdname='" + txtrdName.Text.Trim()
                               + "',rdbirth='" + txtYear.Text.Trim() + "." + txtMonth.Text.Trim() + "." + txtDay.Text.Trim()
                               + "',rdsex='" + comboBox1.Text.Trim()
                               + "',rddpt='" + txtrddpt.Text.Trim() + "' where rdID='" + txtrdid.Text.Trim() + "'";

            Cdatabase.UpdateDB(sqlupcase);
            MessageBox.Show("修改成功!");
            this.Close();
            this.refresh();
        }
コード例 #10
0
ファイル: editvlm.cs プロジェクト: ComplexA/BookManage
        private void btedit_Click(object sender, EventArgs e)
        {
            if (txtvid.Text.Trim() == "" ||
                txtdivision.Text.Trim() == "" ||
                txtvwriter.Text.Trim() == "" ||
                txttopic.Text.Trim() == "")
            {
                MessageBox.Show("请填写所有信息");
                return;
            }
            string sqlupvlm = "update volume set division='" + txtdivision.Text.Trim()
                              + "',vwriter='" + txtvwriter.Text.Trim()
                              + "',topic='" + txttopic.Text.Trim()
                              + "' where vid='" + txtvid.Text.Trim()
                              + "'";

            Cdatabase.UpdateDB(sqlupvlm);
            MessageBox.Show("修改成功");
            this.Close();
            this.refresh();
        }
コード例 #11
0
        private void chgname_Click(object sender, EventArgs e)
        {
            if (chgname.Text == "修改")
            {
                usernm.ReadOnly = false;
                chgname.Text    = "确定";
            }
            else if (chgname.Text == "确定")
            {
                if (usernm.Text.Trim() == "")
                {
                    MessageBox.Show("不能为空!");
                    return;
                }

                string sqlupnm = "update admin set adminName='" + usernm.Text.Trim()
                                 + "' where adminID='" + UserPublic.userInfo[0] + "'";
                Cdatabase.UpdateDB(sqlupnm);
                usernm.ReadOnly = true;
                chgname.Text    = "修改";
            }
        }
コード例 #12
0
        private void chgpwd_Click(object sender, EventArgs e)
        {
            if (chgpwd.Text == "修改")
            {
                txtpwd.ReadOnly     = false;
                chgpwd.Text         = "确定";
                txtpwd.PasswordChar = new char();
            }
            else if (chgpwd.Text == "确定")
            {
                if (txtpwd.Text.Trim() == "")
                {
                    MessageBox.Show("不能为空!");
                    return;
                }

                txtpwd.PasswordChar = '*';
                string sqluppwd = "update admin set adminPwd='" + txtpwd.Text.Trim()
                                  + "' where adminID='" + UserPublic.userInfo[0] + "'";
                Cdatabase.UpdateDB(sqluppwd);
                txtpwd.ReadOnly = true;
                chgpwd.Text     = "修改";
            }
        }