Exemplo n.º 1
0
 private void uiSymbolButton8_Click_1(object sender, EventArgs e)
 {
     if (bookid.Text.Trim() == "" || address.Text.Trim() == "" || state.Text.Trim() == "")
     {
         UIMessageBox.ShowError("请填写完整信息");
     }
     else
     {
         try
         {
             string sql = "insert into bookcase values('" + bookid.Text.Trim() + "','" + address.Text.Trim() + "','" + state.Text.Trim() + "')";
             if (SqlHelper.ExecuteNonQuery(sql) > 0)
             {
                 UIMessageBox.ShowSuccess("添加成功!");
                 caseid.Text  = "";
                 bookid.Text  = "";
                 address.Text = "";
                 state.Text   = "";
                 SqlHelper.setGDV("select caseid 编号, id 书架编号, address 藏书地址,state 借阅状态 from bookcase", uiDataGridView7);
             }
             else
             {
                 UIMessageTip.ShowError("添加失败");
             }
         }
         catch
         {
             UIMessageBox.ShowError("添加失败");
         }
     }
 }
Exemplo n.º 2
0
 // 删除图书
 private void uiSymbolButton9_Click_1(object sender, EventArgs e)
 {
     SqlHelper.ExecuteNonQuery("delete from bookcase where id = '" + tushucaozuoDV[0, tushucaozuoDV.CurrentCell.RowIndex].Value.ToString() + "'");
     SqlHelper.ExecuteNonQuery("delete from book where id = '" + tushucaozuoDV[0, tushucaozuoDV.CurrentCell.RowIndex].Value.ToString() + "'");
     UIMessageBox.ShowSuccess("删除成功!");
     SqlHelper.setGDV("select id 编号, bookName 书名, author 作者,bookNumber 数量, publishCompany 出版社, publishDate 出版时间, bookType 类型, pages 页数, wordsNumber 字数 from book", tushucaozuoDV);
 }
Exemplo n.º 3
0
        private void uiSymbolButton1_Click(object sender, EventArgs e)
        {
            string pwd    = SqlHelper.MD5Hash(uiTextBox2.Text);
            string flag   = uiRadioButton1.Checked ? "admin" : "users";
            string sql    = "select * from " + flag + " where id = '" + uiTextBox1.Text + "' and pwd = '" + pwd + "'";
            object result = SqlHelper.ExecuteScalar(sql);

            if (result != null)
            {
                global.role     = result.ToString();
                global.username = uiTextBox1.Text;
                UIMessageBox.ShowSuccess("登录成功");
                this.Hide();
                if (flag == "admin")
                {
                    new ManagerMain().Show();
                }
                else if (flag == "users")
                {
                    new ReaderMain().Show();
                }
            }
            else
            {
                UIMessageBox.ShowError("用户名或密码错误");
            }
        }
Exemplo n.º 4
0
        public void Visited()
        {
            //筛选出只与当前民族对应的数据
            Nation nation = nations.FirstOrDefault(a => a.nation_name.Equals(info));

            if (nation.nation_name.Equals(info))
            {
                var _nation = new Nation()
                {
                    nation_no    = nation.nation_no,
                    delete_mk    = 1,
                    datachg_usr  = LoginInfo.WorkerNo,
                    datachg_date = DateTime.Now
                };
                if (_nation != null)
                {
                    bool n = new BaseService().DelNation(_nation);
                    if (n == true)
                    {
                        UIMessageBox.ShowSuccess("删除成功!");
                        ReloadNationList();
                    }
                }
            }
        }
Exemplo n.º 5
0
        // 保存
        private void uiButton7_Click(object sender, EventArgs e)
        {
            string sqlsave = "update admin set name = '" + uiTextBox9.Text + "', sex = '" + sex1.Text + "',email = '" + uiTextBox8.Text + "',pwd = '" + SqlHelper.MD5Hash(psd1.Text) + "' where id = '" + uiTextBox10.Text + "'";

            SqlHelper.ExecuteNonQuery(sqlsave);
            UIMessageBox.ShowSuccess("修改成功");
            id.Enabled = name.Enabled = sex1.Enabled = psd1.Enabled = email.Enabled = role.Enabled = false;
        }
Exemplo n.º 6
0
        // 读者荐购
        private void yes_Click_1(object sender, EventArgs e)
        {
            string sql = "insert into recommend (name, author, type,publish,reason) values('" + name.Text.Trim() + "','" + author.Text.Trim() + "','" + type.Text.Trim() + "','" + publish.Text.Trim() + "','" + reason.Text.Trim() + "')";

            SqlHelper.ExecuteNonQuery(sql);
            UIMessageBox.ShowSuccess("推荐成功,感谢您的推荐!");
            name.Text = author.Text = publish.Text = type.Text = reason.Text = "";
        }
Exemplo n.º 7
0
        private void uiButton7_Click(object sender, EventArgs e)
        {
            string sql = "update users set name = '" + name.Text + "', sex = '" + sex.Text + "',email = '" + email.Text + "', role = '" + role.Text + "',pwd = '" + SqlHelper.MD5Hash(psd.Text) + "' where id = '" + id.Text + "'";

            SqlHelper.ExecuteNonQuery(sql);
            UIMessageBox.ShowSuccess("修改成功");
            id.Enabled = name.Enabled = sex.Enabled = psd.Enabled = email.Enabled = role.Enabled = false;
        }
Exemplo n.º 8
0
        // 修改图书分类
        private void uiSymbolButton9_Click(object sender, EventArgs e)
        {
            string typeid = uiDataGridView5[0, uiDataGridView5.CurrentCell.RowIndex].Value.ToString();
            string sql    = "update bookType set typeName = '" + typetext.Text + "' where bookType = '" + typeid + "'";

            SqlHelper.ExecuteNonQuery(sql);
            UIMessageBox.ShowSuccess("修改成功");
            SqlHelper.setGDV("select bookType 编号, typeName 分类名称 from bookType", uiDataGridView5);
        }
Exemplo n.º 9
0
        private void uiSymbolButton11_Click_1(object sender, EventArgs e)
        {
            string id  = uiDataGridView7[0, uiDataGridView7.CurrentCell.RowIndex].Value.ToString();
            string sql = "delete from bookcase where caseid = '" + id + "'";

            SqlHelper.ExecuteNonQuery(sql);
            UIMessageBox.ShowSuccess("删除成功");
            SqlHelper.setGDV("select caseid 编号, id 书架编号, address 藏书地址,state 借阅状态 from bookcase", uiDataGridView7);
        }
Exemplo n.º 10
0
        //用户类型修改
        private void uiSymbolButton12_Click(object sender, EventArgs e)
        {
            string typeid = uiDataGridView6[0, uiDataGridView6.CurrentCell.RowIndex].Value.ToString();
            string sql    = "update usertype set typename = '" + usertypename.Text + "',days= '" + days.Text + "',numbers= '" + numbers.Text + "' where id = '" + typeid + "'";

            SqlHelper.ExecuteNonQuery(sql);
            UIMessageBox.ShowSuccess("修改成功");
            SqlHelper.setGDV("select id 编号, typename 分类名称,days 可借天数,numbers 数量 from usertype", uiDataGridView6);
        }
Exemplo n.º 11
0
        // 修改
        private void uiSymbolButton4_Click(object sender, EventArgs e)
        {
            string beChecked = uiRadioButton4.Checked ? uiRadioButton4.Text : uiRadioButton3.Text;
            string sql       = "update users set name = '" + uiTextBox3.Text + "', sex = '" + beChecked + "',email = '" + uiTextBox1.Text + "', role = '" + role.Text + "' where id = '" + stunumber.Text + "'";

            SqlHelper.ExecuteNonQuery(sql);
            UIMessageBox.ShowSuccess("修改成功");
            SqlHelper.setGDV("select id 编号, name 姓名, sex 性别, email 邮箱, role 角色 from users", uiDataGridView2);
        }
Exemplo n.º 12
0
 //用户类型添加
 private void uiSymbolButton8_Click(object sender, EventArgs e)
 {
     if (usertypename.Text.Trim() != null)
     {
         string sql = "insert into usertype (typename,days,numbers) values ('" + usertypename.Text.Trim() + "','" + days.Text.Trim() + "','" + numbers.Text.Trim() + "')";
         SqlHelper.ExecuteNonQuery(sql);
         UIMessageBox.ShowSuccess("添加分类成功");
         SqlHelper.setGDV("select id 编号, typename 分类名称,days 天数,numbers 可借数量 from usertype", uiDataGridView6);
     }
 }
Exemplo n.º 13
0
        // 修改
        private void uiSymbolButton10_Click_1(object sender, EventArgs e)
        {
            string id  = tushucaozuoDV[0, tushucaozuoDV.CurrentCell.RowIndex].Value.ToString();
            string sql = "update book set bookName = '" + nametb.Text + "',author = '" + authertb.Text +
                         "',bookNumber = '" + numbertb.Text + "',publishCompany = '" + publishcompany.Text + "',publishDate = '" + uiDatePicker2.Text.Substring(0, 10) + "',bookType='" + booktype.SelectedText + "',pages = '" + pagestb.Text + "',wordsNumber = '" + wordstb.Text + "' where id = '" + id + "'";

            SqlHelper.ExecuteNonQuery(sql);
            UIMessageBox.ShowSuccess("修改成功");
            SqlHelper.setGDV("select id 编号, bookName 书名, author 作者,bookNumber 数量, publishCompany 出版社, publishDate 出版时间, bookType 类型, pages 页数, wordsNumber 字数 from book", tushucaozuoDV);
        }
Exemplo n.º 14
0
 // 分类 --添加
 private void uiSymbolButton10_Click(object sender, EventArgs e)
 {
     if (typetext.Text.Trim() != null)
     {
         string sql = "insert into bookType (typeName) values ('" + typetext.Text.Trim() + "')";
         SqlHelper.ExecuteNonQuery(sql);
         UIMessageBox.ShowSuccess("添加分类成功");
         SqlHelper.setGDV("select bookType 编号, typeName 分类名称 from bookType", uiDataGridView5);
     }
 }
Exemplo n.º 15
0
        // 删除留言
        private void uiButton3_Click(object sender, EventArgs e)
        {
            string sql = "delete from messageB where id = " + idd;

            if (SqlHelper.ExecuteNonQuery(sql) > 0)
            {
                UIMessageBox.ShowSuccess("删除成功!");
            }
            SqlHelper.setGDV("select id 编号,userid 用户账号,date 留言日期,message 留言 from messageB", uiDataGridView3);
        }
Exemplo n.º 16
0
        //添加
        private void uiSymbolButton7_Click(object sender, EventArgs e)
        {
            string sql = "insert into book(bookName,author,bookNumber,publishCompany,publishDate,bookType,pages,wordsNumber) values('" + bnameTB.Text.Trim() + "','" + authorTB.Text.Trim() + "','" + bookNumTB.Text.Trim() + "','" + publishCTB.Text.Trim() + "','" + uiDatePicker1.Text.Trim() + "','" + booktypecbb.SelectedValue + "','" + pages.Text + "','" + words.Text + "')";

            if (SqlHelper.ExecuteNonQuery(sql) > 0)
            {
                UIMessageBox.ShowSuccess("添加成功!");
            }
            bnameTB.Text    = "";
            authorTB.Text   = "";
            bookNumTB.Text  = "";
            publishCTB.Text = "";
            pages.Text      = "";
            words.Text      = "";
        }
Exemplo n.º 17
0
        private void uiSymbolButton12_Click_1(object sender, EventArgs e)
        {
            string id  = uiDataGridView7[0, uiDataGridView7.CurrentCell.RowIndex].Value.ToString();
            string sql = "update bookcase set id = '" + bookid.Text + "',address = '" + address.Text.Trim() + "',state='" + state.Text.Trim() + "' where caseid = '" + id + "'";

            try
            {
                SqlHelper.ExecuteNonQuery(sql);
                UIMessageBox.ShowSuccess("修改成功");
            }
            catch
            {
                UIMessageBox.ShowError("不存在该书籍");
            }
            SqlHelper.setGDV("select caseid 编号, id 书架编号, address 藏书地址,state 借阅状态 from bookcase", uiDataGridView7);
        }
Exemplo n.º 18
0
        public void Insert()
        {
            var _nation = new Nation()
            {
                nation_no    = new SYS.Core.CounterHelper().GetNewId("NationId").ToString(),
                nation_name  = info,
                delete_mk    = 0,
                datains_usr  = LoginInfo.WorkerNo,
                datains_date = DateTime.Now
            };

            if (_nation != null)
            {
                bool n = new BaseService().AddNation(_nation);
                if (n == true)
                {
                    UIMessageBox.ShowSuccess("新增成功!");
                    ReloadNationList();
                }
            }
        }
Exemplo n.º 19
0
 // 归还
 private void uiImageButton2_Click(object sender, EventArgs e)
 {
     if (Convert.ToInt32((SqlHelper.ExecuteScalar("select count(*) from reseat where userid= '" + global.username + "'"))) <= 0)
     {
         UIMessageBox.ShowSuccess("当前没有预约座位");
     }
     else
     {
         string sql  = "update seat set state = 0 where seatno='" + seatno.Text + "' and location='" + loc.Text + "'";
         string sql1 = "delete from reseat where userid='" + global.username + "'";
         if (SqlHelper.ExecuteNonQuery(sql) > 0)
         {
             if (SqlHelper.ExecuteNonQuery(sql1) > 0)
             {
                 UIMessageBox.ShowSuccess("取消成功!");
                 seatno.Text = " ";
                 loc.Text    = " ";
             }
         }
         SqlHelper.setGDV("select id 编号,seatno 座位号,location 位置,state 预约状态 from seat", uiDataGridView1);
     }
 }
        private void btnUpd_Click(object sender, EventArgs e)
        {
            bool dr = UIMessageBox.Show("是否确认修改员工信息?", "修改提醒", UIStyle.Green, UIMessageBoxButtons.OKCancel);

            if (dr == true)
            {
                string NewTel = Md5LockedUtil.MD5Encrypt32(WorkerTel.Text.ToString());
                #region 员工信息代码块
                Worker worker = new Worker
                {
                    WorkerId        = WorkerNo.Text.Trim(),
                    WorkerName      = WorkerName.Text.Trim(),
                    WorkerNation    = cbWorkerNation.SelectedValue == null ? "N-00001" : cbWorkerNation.SelectedValue.ToString(),
                    WorkerTel       = NewTel,
                    WorkerAddress   = txtAddress.Text,
                    WorkerFace      = cboWorkerFace.Text,
                    WorkerEducation = cboEducation.SelectedValue.ToString() == null ? "E-00001" : cboEducation.SelectedValue.ToString(),
                    datachg_usr     = AdminInfo.Account,
                    datachg_date    = DateTime.Now
                };
                bool i = new WorkerService().UpdateWorker(worker);
                if (i == true)
                {
                    UIMessageBox.ShowSuccess("信息修改成功!");
                    return;
                }
                else
                {
                    UIMessageBox.ShowError("服务器繁忙!");
                    return;
                }
                #endregion
            }
            else
            {
                UIMessageBox.ShowWarning("修改操作已取消!");
                return;
            }
        }
Exemplo n.º 21
0
        public static void setVirtualMemory(UIComboBox disk, int size, ref UILabel display)
        {
            driveSetImpl = new DriveSetImpl();
            if (size < 0)
            {
                MessageBox.Show("输入错误!", "提示");
                return;
            }
            //if()
            if ((driveSetImpl._drives[disk.SelectedIndex].AvailableFreeSpace / 1024 / 1024 / 1024) + (driveSetImpl._drives[disk.SelectedIndex].AvailableFreeSpace / 1024 / 1024 / 1024) < size)
            {
                MessageBox.Show("虚拟内存不可大于磁盘剩余空间!", "提示");
                return;
            }
            List <string> list = new List <string>();

            for (int i = 0; i < driveSetImpl._drives.Count; i++)
            {
                if (i == disk.SelectedIndex)
                {
                    if (size != 0)
                    {
                        list.Add(DriveSetImpl.VirtualMemoryFormatString(driveSetImpl._drives[i].Name, size * 1024));
                    }
                }
                else
                {
                    if (driveSetImpl._drives[i].VirtualMemoryMaxSizeMb != 0)
                    {
                        list.Add(DriveSetImpl.VirtualMemoryFormatString(driveSetImpl._drives[i].Name, driveSetImpl._drives[i].VirtualMemoryMaxSizeMb));
                    }
                }
            }
            DriveSetImpl.SetValue(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management", "PagingFiles", list.ToArray());
            UIMessageBox.ShowSuccess("虚拟内存设置成功,重启后生效");
            driveSetImpl = new DriveSetImpl();
            display.Text = "本盘已使用虚拟内存" + (driveSetImpl._drives[disk.SelectedIndex].VirtualMemoryMaxSizeMb / 1024).ToString() + "GB," + "剩余空间" + (driveSetImpl._drives[disk.SelectedIndex].AvailableFreeSpace / 1024 / 1024 / 1024).ToString() + "GB";
        }
Exemplo n.º 22
0
        //预约
        private void uiImageButton1_Click(object sender, EventArgs e)
        {
            string sql1 = "select count(*) from reseat where userid= '" + global.username + "'";
            int    n    = Convert.ToInt32(SqlHelper.ExecuteScalar(sql1));

            if (n > 0)
            {
                UIMessageBox.ShowInfo("您已预约了座位,无法再预约");
            }
            else
            {
                string sql4 = "select state from seat where seatno='" + id + "' and location='" + location + "'";
                if (SqlHelper.ExecuteScalar(sql4).ToString() == "True")
                {
                    UIMessageBox.Show("该座位已经被预约!");
                }
                else
                {
                    string sql2 = "insert into reseat(seatid,location,userid,username,retime,isbacktime) values('" + id + "','" + location + "','" + global.username + "','" + global.name + "','" + DateTime.Now.ToString("yyyy-MM-dd") + "','" + SqlHelper.ReTime(DateTime.Now.ToString("yyyy-MM-dd"), 1) + "')";
                    string sql  = "update seat set state = 1 where seatno='" + id + "' and location='" + location + "'";
                    if (SqlHelper.ExecuteNonQuery(sql) > 0)
                    {
                        if (SqlHelper.ExecuteNonQuery(sql2) > 0)
                        {
                            UIMessageBox.ShowSuccess("预约成功!");
                            string        sql3 = "select * from reseat where userid= '" + global.username + "'";
                            SqlDataReader sdr  = SqlHelper.ExecuteReader(sql3);
                            if (sdr.Read())
                            {
                                loc.Text    = sdr["location"].ToString();
                                seatno.Text = sdr["seatid"].ToString();
                            }
                        }
                    }
                }
                SqlHelper.setGDV("select id 编号,seatno 座位号,location 位置,state 预约状态 from seat", uiDataGridView1);
            }
        }
Exemplo n.º 23
0
 // 删除用户
 private void uiSymbolButton5_Click(object sender, EventArgs e)
 {
     SqlHelper.ExecuteNonQuery("delete from users where id = '" + uiDataGridView2[0, uiDataGridView2.CurrentCell.RowIndex].Value.ToString() + "'");
     UIMessageBox.ShowSuccess("删除成功!");
     SqlHelper.setGDV("select id 编号, name 姓名, sex n别, email 邮箱, role 角色 from users", uiDataGridView2);
 }
Exemplo n.º 24
0
 private void deletebtn_Click(object sender, EventArgs e)
 {
     SqlHelper.ExecuteNonQuery("delete from bookType where bookType = '" + uiDataGridView5[0, uiDataGridView5.CurrentCell.RowIndex].Value.ToString() + "'");
     UIMessageBox.ShowSuccess("删除成功!");
     SqlHelper.setGDV("select bookType 编号, typeName 分类名称 from bookType", uiDataGridView5);
 }
Exemplo n.º 25
0
 //用户类型删除
 private void uiSymbolButton11_Click(object sender, EventArgs e)
 {
     SqlHelper.ExecuteNonQuery("delete from usertype where id = '" + uiDataGridView6[0, uiDataGridView6.CurrentCell.RowIndex].Value.ToString() + "'");
     UIMessageBox.ShowSuccess("删除成功!");
     SqlHelper.setGDV("select id 编号, typename 分类名称,days 可借天数,numbers 数量 from usertype", uiDataGridView6);
 }