Exemplo n.º 1
0
        private void button2_Click(object sender, EventArgs e)
        {
            strID  = tbID.Text.Trim();
            strPsd = tbPsd.Text.Trim();

            string strSql = "";

            strSql = "select * from userTable where userID = '" + strID + "'";

            SqlDataReader dr = db.DB_Red(strSql);

            if (dr.Read())
            {
                string psd = db.DB_C(strSql, 1);
                if (strPsd.Equals(psd))
                {
                    string name    = dr.GetString(2);
                    string strSql2 = "delete from Users";
                    db.DB_ZSG(strSql2);
                    string strSql1 = "insert into Users values('" + strID + "')";
                    db.DB_ZSG(strSql1);
                    MessageBox.Show("登录成功");
                    Gloable.username = "******" + name;
                    this.Close();
                }
            }
            else
            {
                MessageBox.Show("用户名或者密码错误");
                tbID.Text  = "";
                tbPsd.Text = "";
                tbID.Focus();
            }
        }
Exemplo n.º 2
0
        private void button6_Click(object sender, EventArgs e)
        {
            if (radioButton1.Checked == false && radioButton2.Checked == false)
            {
                MessageBox.Show("性别不能为空");
                return;
            }
            string strSql = "";

            if (radioButton1.Checked == true)
            {
                strSql = "update userTable set userName = '******',userSex='" + radioButton1.Text + "',userIdent='" + comboBox1.Text + "',userDiploma='" + comboBox2.Text + "',userPhone='" + tbPhone.Text.Trim() + "',userAddProvince='" + comboBox3.Text + "',userAddCity='" + comboBox4.Text + "',userAddArea='" + comboBox5.Text + "' where userID = '" + username + "'";
            }
            else if (radioButton2.Checked == true)
            {
                strSql = "update userTable set userName = '******',userSex='" + radioButton2.Text + "',userIdent='" + comboBox1.Text + "',userDiploma='" + comboBox2.Text + "',userPhone='" + tbPhone.Text.Trim() + "',userAddProvince='" + comboBox3.Text + "',userAddCity='" + comboBox4.Text + "',userAddArea='" + comboBox5.Text + "' where userID = '" + username + "'";
            }
            try
            {
                db.DB_ZSG(strSql);
                MessageBox.Show("修改成功");
            }
            catch
            {
                MessageBox.Show("修改失败!");
            }
        }
Exemplo n.º 3
0
        private void button2_Click(object sender, EventArgs e)
        {
            strID       = tbID.Text.Trim();
            strPsd      = tbPsd.Text.Trim();
            strPsd1     = tbPsd1.Text.Trim();
            strUserName = tbUserName.Text.Trim();
            if (radioButton1.Checked == true)
            {
                strSex = radioButton1.Text;
            }
            else if (radioButton2.Checked == true)
            {
                strSex = radioButton2.Text;
            }
            strShenFen = comboBox1.Text;
            strXueLi   = comboBox2.Text;
            strPhone   = tbPhone.Text.Trim();
            strArea1   = comboBox3.Text;
            strArea2   = comboBox4.Text;
            strArea3   = comboBox5.Text;

            if (strID == "" || strPsd == "" || strPsd1 == "" || strUserName == "" || strSex == "" || strShenFen == "" || strXueLi == "" || strPhone == "" || strArea1 == "" || strArea2 == "" || strArea3 == "")
            {
                MessageBox.Show("注册内容不能为空");
                return;
            }

            if (strPsd != strPsd1)
            {
                MessageBox.Show("两次输入的密码不一样");
                return;
            }

            string strSql = "";

            strSql = "insert into userTable values('" + strID + "','" + strPsd + "','" + strUserName + "','" + strSex + "','" + strShenFen + "','" + strXueLi + "','" + strPhone + "','" + strArea1 + "','" + strArea2 + "','" + strArea3 + "')";
            try
            {
                db.DB_ZSG(strSql);
                db.connClose();
                MessageBox.Show("注册成功");
                this.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Exemplo n.º 4
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                string QuaType        = "";
                string QuaName        = "";
                string QuaCandidate   = "";
                string QuaRequirement = "";
                string QuaCost        = "";
                string QuaTime        = "";
                string QuaCourse      = "";
                string QuaAttention   = "";
                QuaType        = CbAllType.Text;
                QuaName        = textBox7.Text.Trim();
                QuaCandidate   = textBox2.Text.Trim();
                QuaRequirement = textBox4.Text.Trim();
                QuaCost        = textBox1.Text.Trim();
                QuaTime        = textBox3.Text.Trim();
                QuaCourse      = textBox5.Text.Trim();
                QuaAttention   = textBox6.Text.Trim();


                if (QuaType == "" || QuaName == "" || QuaCandidate == "" || QuaRequirement == "" || QuaCost == "" || QuaTime == "" || QuaCourse == "" || QuaAttention == "")
                {
                    MessageBox.Show("提交内容不能为空");
                    return;
                }

                string sql1 = "";
                //sql1 = "insert into Users values('5')";
                sql1 = "insert into Qualifications values('" + QuaType + "','" + QuaName + "','" + QuaCandidate + "','" + QuaRequirement + "','" + QuaCost + "','" + QuaTime + "','" + QuaCourse + "','" + QuaAttention + "')";
                db.DB_ZSG(sql1);
                db.connClose();
                MessageBox.Show("提交成功");
            }
            catch
            {
                MessageBox.Show("信息提交异常");
            }
        }
Exemplo n.º 5
0
        private void buttonformGYSAdd_Click(object sender, EventArgs e)
        {
            //定义变量
            string  strGYS       = "";
            string  strFoodName  = "";
            decimal strDM        = 0;
            decimal strDiscountL = 0;
            decimal strQuantity  = 0;
            string  strFoodType  = "";
            string  strText      = "";

            //校验
            if (textBoxformGYSFoodName.Text.Trim() == "")
            {
                MessageBox.Show("商品名不能为空!");
                textBoxformGYSFoodName.Focus();
                return;
            }
            if (Validator.IsNumber(textBoxformGYSDM.Text.Trim()) == false)
            {
                MessageBox.Show("请输入单价并输入数值型数!");
                textBoxformGYSDM.Focus();
                return;
            }
            if (Validator.IsNumber(textBoxformGYSDiscountL.Text.Trim()) == false)
            {
                MessageBox.Show("请输入折扣率并输入数值型数!");
                textBoxformGYSDiscountL.Focus();
                return;
            }
            if (Validator.IsNumber(textBoxformGYSQuantity.Text.Trim()) == false)
            {
                MessageBox.Show("请输入货存并输入数值型数!");
                textBoxformGYSQuantity.Focus();
                return;
            }

            // 获取数据
            strGYS       = textBoxformGYS.Text.Trim();
            strFoodName  = textBoxformGYSFoodName.Text.Trim();
            strFoodType  = comboBoxformGYSFoodType.Text;
            strDM        = Convert.ToDecimal(textBoxformGYSDM.Text.Trim());
            strDiscountL = Convert.ToDecimal(textBoxformGYSDiscountL.Text.Trim());
            strQuantity  = Convert.ToDecimal(textBoxformGYSQuantity.Text.Trim());
            strText      = textBoxformGYSText.Text.Trim();

            string        strSql = "select * from GYSAllFood where GYSFoodName = '" + strFoodName + "' and GYS = '" + strGYS + "'";
            SqlDataReader dr     = db.DB_Red(strSql);

            if (dr.Read())
            {
                MessageBox.Show("添加失败,该供应商已拥有此商品!", "警告");
                dr.Close();
                return;
            }
            else
            {
                string strSql1 = "insert into GYSAllFood values('" + strGYS + "','" + strFoodName + "','" + strFoodType + "','" + strDM + "','" + strDiscountL + "','" + strQuantity + "','" + strText + "')";
                try
                {
                    db.DB_ZSG(strSql1);
                    MessageBox.Show("添加成功!", "添加");
                    this.Close();
                }
                catch {
                    MessageBox.Show("添加失败,请重新添加", "警告");
                    return;
                }
            }
        }
Exemplo n.º 6
0
        private void button2_Click(object sender, EventArgs e)
        {
            try
            {
                DBCL.DataBase db = new DBCL.DataBase();

                string name      = "";
                string sex       = "";
                string diploma   = "";
                string cardclass = "";
                string card      = "";
                string school    = "";
                string idnum     = "";
                string tel       = "";
                string tel1      = "";
                string tel2      = "";
                string phone     = "";
                string province  = "";
                string city      = "";
                string area      = "";
                string note      = "";

                name = textBox1.Text;
                if (radioButton1.Checked == true)
                {
                    sex = radioButton1.Text;
                }
                else if (radioButton2.Checked == false)
                {
                    sex = radioButton2.Text;
                }
                diploma   = comboBox2.Text;
                cardclass = comboBox8.Text;
                card      = comboBox7.Text;
                school    = comboBox1.Text;
                idnum     = textBox7.Text.Trim();
                tel1      = textBox6.Text.Trim();
                tel2      = textBox3.Text.Trim();
                tel       = tel1 + tel2;
                phone     = textBox4.Text.Trim();
                province  = comboBox3.Text;
                city      = comboBox4.Text;
                area      = comboBox5.Text;
                note      = textBox2.Text.Trim();

                if (sex == "" || cardclass == "" || card == "" || idnum == "" || phone == "" || province == "" || city == "" || area == "" || note == "")
                {
                    MessageBox.Show("提交内容不能为空");
                    return;
                }

                string sql1 = "";
                //sql1 = "insert into Users values('5')";
                sql1 = "insert into signUp values('" + username + "','" + name + "','" + sex + "','" + diploma + "','" + cardclass + "','" + card + "','" + school + "','" + idnum + "','" + tel + "','" + phone + "','" + province + "','" + city + "','" + area + "','" + note + "')";
                db.DB_ZSG(sql1);
                db.connClose();
                MessageBox.Show("提交成功");
            }
            catch
            {
                MessageBox.Show("信息提交异常");
            }
        }