Esempio n. 1
0
        private void dataUser_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            string action = dataUser.Columns[e.ColumnIndex].Name;//操作类型

            if (action == "caozuo")
            {
                string id = dataUser.Rows[e.RowIndex].Cells[9].Value.ToString();
                MainWindow.userID = id;
                UserDetail detail = new UserDetail();
                detail.Show();
            }
            if (action == "shanchu")
            {
                if (MessageBox.Show("确认删除?") == DialogResult.OK)
                {
                    string id  = dataUser.Rows[e.RowIndex].Cells[9].Value.ToString();
                    string sql = "delete [user] where id='" + id + "'";
                    MainConfig.Excute(sql);
                    DataSet ds = MainConfig.GetRecord("select * from [User]");
                    dataUser.AutoGenerateColumns = false;
                    dataUser.AllowUserToAddRows  = false;
                    dataUser.DataSource          = ds.Tables[0].DefaultView;
                }
            }
        }
Esempio n. 2
0
        private void button1_Click(object sender, EventArgs e)
        {
            string sql = "update [word] set word='" + word.Text + "',yinbiao='" + this.yinbiao.Text + "',Type='" + wordtype.Text + "',Translate='" + translate.Text + "',fenzu='" + fenzu.Text + "' where id='" + MainWindow.wordID + "'";

            MainConfig.Excute(sql);
            MessageBox.Show("保存成功!");
        }
Esempio n. 3
0
        private void button1_Click(object sender, EventArgs e)
        {
            string sql = "insert into word(word,yinbiao,translate,type,fenzu,zhongwenyuyin,YingWenYuYan,SuoXie) values('" + word.Text + "','" + yinbiao.Text + "','" + translate.Text + "','" + wordtype.Text + "','" + fenzu.Text + "','" + textBox1.Text + "','" + textBox2.Text + "','" + txtSuoXie.Text + "')";

            MainConfig.Excute(sql);
            MessageBox.Show("添加成功!");
        }
Esempio n. 4
0
        private void button1_Click(object sender, EventArgs e)
        {
            string type = UserType.Text == "管理员" ? "1" : "2";
            string sql  = "update [User] set IdCard='" + IdCard.Text + "',Birthday='" + this.Birthday.Text + "',Sex='" + Sex.Text + "',RealName='" + realName.Text + "',Email='" + Email.Text + "',Telephone='" + Telephone.Text + "',Remark='" + remark.Text + "',UserType='" + type + "' where id='" + MainWindow.userID + "'";

            MainConfig.Excute(sql);
            MessageBox.Show("保存成功!");
        }
Esempio n. 5
0
        private void dataSC_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            string action = dataSC.Columns[e.ColumnIndex].Name;     //操作类型

            if (action == "deleteStrage")
            {
                if (MessageBox.Show("确认删除?") == DialogResult.OK)
                {
                    string id  = dataSC.Rows[e.RowIndex].Cells[5].Value.ToString();
                    string sql = "delete Storage where id='" + id + "'";
                    MainConfig.Excute(sql);
                    DataSet ds = MainConfig.GetRecord("select Storage.ID as aid,word.* from Storage inner join Word on word.ID=Storage.wordID where Storage.UserID='" + MainConfig.Userds.Tables[0].Rows[0]["ID"].ToString() + "' and word.word like '%" + SCTXT.Text + "%'");
                    dataSC.AutoGenerateColumns = false;
                    dataSC.AllowUserToAddRows  = false;
                    dataSC.DataSource          = ds.Tables[0].DefaultView;
                }
            }
        }
Esempio n. 6
0
        private void button1_Click(object sender, EventArgs e)
        {
            string  exist = "select * from [User] where username='******'";
            DataSet ds    = MainConfig.GetRecord(exist);

            if (ds.Tables[0].Rows.Count > 0)
            {
                MessageBox.Show("该用户名已注册!");
                return;
            }
            if (pass.Text == string.Empty || pass.Text != confirm.Text)
            {
                MessageBox.Show("密码输入不正确!");
            }
            string sql = "insert into [User](UserName,PassWord,IdCard,Birthday,Sex,RealName,Email,Telephone,Remark,UserType) values('" + UserName.Text + "','" + pass.Text + "','" + IdCard.Text + "','" + this.Birthday.Text + "','" + Sex.Text + "','" + realName.Text + "','" + Email.Text + "','" + Telephone.Text + "','" + remark.Text + "',2)";

            //string sql = "update [User] set IdCard='" + IdCard.Text + "',Birthday='" + this.Birthday.Text + "',Sex='" + Sex.Text + "',RealName='" + realName.Text + "',Email='" + Email.Text + "',Telephone='" + Telephone.Text + "',Remark='" + remark.Text + "',UserType='" + type + "' where id='" + MainWindow.userID + "'";
            MainConfig.Excute(sql);
            MessageBox.Show("注册成功!");
        }
Esempio n. 7
0
        private void dataFenzu_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            string action = dataFenzu.Columns[e.ColumnIndex].Name;//操作类型

            if (action == "StorageBtn")
            {
                string  id  = dataFenzu.Rows[e.RowIndex].Cells[4].Value.ToString();
                string  sql = "select * from Storage where UserId='" + MainConfig.Userds.Tables[0].Rows[0]["ID"].ToString() + "' and wordID='" + id + "'";
                DataSet ds  = MainConfig.GetRecord(sql);
                if (ds.Tables[0].Rows.Count > 0)
                {
                    MessageBox.Show("您已收藏过该单词!");
                }
                else
                {
                    string sql1 = "insert into Storage(UserID,UserName,WordID,WordName) values('" + MainConfig.Userds.Tables[0].Rows[0]["ID"].ToString() + "','" + MainConfig.Userds.Tables[0].Rows[0]["UserName"].ToString() + "','" + id + "','" + dataFenzu.Rows[e.RowIndex].Cells[0].Value.ToString() + "')";
                    MainConfig.Excute(sql1);
                    MessageBox.Show("收藏成功!");
                }
            }
        }
Esempio n. 8
0
        private void button14_Click(object sender, EventArgs e)
        {
            DataTable dt = ConvertCSVToTable(this.textBox3.Text);

            foreach (DataRow dr in dt.Rows)
            {
                try
                {
                    DataSet dsds = MainConfig.GetRecord("select * from Word where Word='" + dr[0].ToString() + "'");
                    if (dsds != null && dsds.Tables[0].Rows.Count > 0)
                    {
                    }
                    else
                    {
                        string sql = "insert into word(word,translate,type) values('" + dr[0].ToString() + "','" + dr[2].ToString() + "','" + dr[1].ToString() + "')";
                        MainConfig.Excute(sql);
                    }
                }
                catch
                {
                }
            }
            MessageBox.Show("数据导入完毕");
        }