Exemplo n.º 1
0
 private void buttonSearch_Click(object sender, EventArgs e)
 {
     try
     {
         Connstr     connstr = new Connstr();
         databaseexe dbexe   = new databaseexe();
         string      ProName = textBoxName.Text.Trim();
         string      sql     = "select id as 编码,productName as 品名,productType as 箱式,PLength as 长,Pwide as 宽,Pheight as 高,unit as 单位, Price as 单价  from T_fixpro where fatherid is null and CusId ='" + Cid + "'and productname like'%" + ProName + "%'";
         //string sql = "select CusID as 客户编码,CusShort as 客户简称, CusName as 客户全称, CusTelephone as 电话,CusFax as 传真,CusAdress as 地址,CusPerson as 联系人 from T_customer where CusId like'%" + CusId + "%'";
         DataTable dt =
             dbexe.getdataset(sql, "T_T_fixpro").Tables[0];
         ProductdataGridView2.DataSource = dt;
         if (dt.Rows.Count == 0)
         {
             MessageBox.Show("没有符合条件的记录!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
             //buttonModify.Enabled = false;
             textBoxName.Clear();
         }
         else
         {
             MessageBox.Show("查询到:" + dt.Rows.Count + " 条记录!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
             //buttonModify.Enabled = true;
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Exemplo n.º 2
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            if (i > 2)
            {
                MessageBox.Show("您已经密码错误了2次,不能登录");
                textBox1.Clear();
                textBox2.Clear();
                timer1.Enabled = true;
                btnOK.Enabled  = false;
                timer2.Enabled = true;
                return;
            }
            string yhm = textBox1.Text.ToString().Trim();
            string mm  = textBox2.Text.ToString().Trim();
            string yzm = textBox3.Text.ToString().Trim();

            dataValue.UserName = yhm;
            dataValue.Password = mm;
            string      sql2         = "select * from T_member where jobno='" + yhm + "' ";
            databaseexe databaseexe1 = new databaseexe();

            dataValue.StaffName = databaseexe1.getTopName(sql2);
            if (yhm == "")
            {
                MessageBox.Show("用户名不能为空!");
            }
            else
            {
                Connstr       connstr = new Connstr();
                SqlConnection conn    = connstr.getcon();
                string        sql     = "select * from T_user where username='******' and password='******' ";
                SqlCommand    cmd     = new SqlCommand(sql, conn);
                SqlDataReader dr      = cmd.ExecuteReader();
                if (dr.Read())
                {
                    MessageBox.Show("登陆成功");
                    databaseexe dbexe = new databaseexe();
                    string      sql1  = "select jobname from T_Member where jobNo='" + yhm + "'";
                    DataTable   de    =
                        dbexe.getdataset(sql1, "T_member").Tables[0];
                    for (int i = 0; i < de.Rows.Count; i++)
                    {
                        DataRow dc = de.Rows[i];
                        dataValue.StaffName = dc["jobname"].ToString();
                    }
                    FrmMain mainform = new FrmMain();
                    mainform.Show();
                    this.Hide();
                }
                else
                {
                    MessageBox.Show("用户名或密码错误!");
                    textBox1.Clear();
                    textBox2.Clear();
                    i++;
                }
            }
        }
Exemplo n.º 3
0
        private void buttonSearch_Click(object sender, EventArgs e)
        {
            if (radioButtonNo.Checked)
            {
                if (textBoxNo.Text == "")
                {
                    MessageBox.Show("未输入编号!");
                    return;
                }
                try
                {
                    Connstr     connstr = new Connstr();
                    databaseexe dbexe   = new databaseexe();
                    string      CusId   = textBoxNo.Text.Trim();
                    string      sql     = "select CusID as 客户编码,CusShort as 客户简称, CusName as 客户全称, CusTelephone as 电话," +
                                          "CusFax as 传真,CusAdress as 地址,CusPerson as 联系人 from T_customer where CusId like'%" + CusId + "%'";
                    DataTable dt =
                        dbexe.getdataset(sql, "T_Customer").Tables[0];
                    ClientdataGridView1.DataSource = dt;
                    if (dt.Rows.Count == 0)
                    {
                        MessageBox.Show("没有符合条件的记录!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        buttonModify.Enabled = false;
                    }
                    else
                    {
                        MessageBox.Show("查询到:" + dt.Rows.Count + " 条记录!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        buttonModify.Enabled = true;
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
            else
            {
                if (textBoxName.Text == "")
                {
                    MessageBox.Show("查询客户名称不得为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                else
                {
                    string CusShort = textBoxName.Text.Trim();
                    string sql      = "select CusID as 客户编码,CusShort as 客户简称, CusName as 客户全称, CusTelephone as 电话,CusFax as 传真,CusAdress as 地址,CusPerson as 联系人 from T_customer where CusShort like'%" + CusShort + "%'";
                    try
                    {
                        Connstr     connstr = new Connstr();
                        databaseexe dbexe   = new databaseexe();
                        DataTable   dt      =
                            dbexe.getdataset(sql, "T_customer").Tables[0];
                        ClientdataGridView1.DataSource = dt;
                        if (dt.Rows.Count == 0)
                        {
                            MessageBox.Show("没有符合条件的记录!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            buttonModify.Enabled = false;
                        }
                        else
                        {
                            MessageBox.Show("查询到:" + dt.Rows.Count + " 条记录!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            buttonModify.Enabled = true;
                        }
                    }

                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message);
                    }
                }
            }
        }
Exemplo n.º 4
0
        private void buttonSearch_Click(object sender, EventArgs e)
        {
            if (radioButtonNo.Checked)
            {
                if (textBoxNo.Text == "")
                {
                    MessageBox.Show("未输入编号!");
                    return;
                }
                try
                {
                    Connstr     connstr = new Connstr();
                    databaseexe dbexe   = new databaseexe();
                    string      SupId   = textBoxNo.Text.Trim();
                    string      sql     = "select SupId as 供方编码,SupShort as 供方简称, SupName as 供方全称, SupTelephone as 电话,SupFax as 传真,SupAdress as 地址,SupPerson as 负责人 from T_Supplier where SupId like'%" + SupId + "%'";
                    DataTable   dt      =
                        dbexe.getdataset(sql, "T_Supplier").Tables[0];
                    SupplierdataGridView.DataSource = dt;
                    if (dt.Rows.Count == 0)
                    {
                        MessageBox.Show("没有符合条件的记录!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        buttonModify.Enabled = false;
                    }
                    else
                    {
                        MessageBox.Show("查询到:" + dt.Rows.Count + " 条记录!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        buttonModify.Enabled = true;
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
            else
            {
                if (textBoxName.Text == "")
                {
                    MessageBox.Show("查询供方名称不得为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                else
                {
                    string SupShort = textBoxName.Text.Trim();
                    string sql      = "select SupId as 供方编码,SupShort as 供方简称, SupName as 供方全称, SupTelephone as 电话,SupFax as 传真,SupAdress as 地址,SupPerson as 负责人 from T_Supplier where SupShort like'%" + SupShort + "%'";
                    try
                    {
                        Connstr     connstr = new Connstr();
                        databaseexe dbexe   = new databaseexe();
                        DataTable   dt      =
                            dbexe.getdataset(sql, "T_Supplier").Tables[0];
                        SupplierdataGridView.DataSource = dt;
                        if (dt.Rows.Count == 0)
                        {
                            MessageBox.Show("没有符合条件的记录!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            buttonModify.Enabled = false;
                        }
                        else
                        {
                            MessageBox.Show("查询到:" + dt.Rows.Count + " 条记录!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            buttonModify.Enabled = true;
                        }
                    }

                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message);
                    }
                }
            }
        }
Exemplo n.º 5
0
        private void buttonSearch_Click(object sender, EventArgs e)
        {
            if (radioButtonNo.Checked)
            {
                if (textBoxNo.Text == "")
                {
                    MessageBox.Show("未输入编号!");
                    return;
                }
                try
                {
                    Connstr     connstr    = new Connstr();
                    databaseexe dbexe      = new databaseexe();
                    string      MaterialID = textBoxNo.Text.Trim();
                    string      sql        = "select MaterialId as 纸板编码,MaterialName as 纸板名称, MaterialType as 瓦楞类型 from T_material where MaterialId like'%" + MaterialID + "%'";
                    DataTable   dt         =
                        dbexe.getdataset(sql, "T_Supplier").Tables[0];
                    MaterialdataGridView1.DataSource = dt;
                    if (dt.Rows.Count == 0)
                    {
                        MessageBox.Show("没有符合条件的记录!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        buttonModify.Enabled = false;
                    }
                    else
                    {
                        MessageBox.Show("查询到:" + dt.Rows.Count + " 条记录!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        buttonModify.Enabled = true;
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
            else
            {
                if (textBoxName.Text == "")
                {
                    MessageBox.Show("查询名称不得为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                else
                {
                    string MaterialName = textBoxName.Text.Trim();
                    string sql          = "select MaterialId as 纸板编码,MaterialName as 纸板名称, MaterialType as 瓦楞类型 from T_material where MaterialName like'%" + MaterialName + "%'";
                    try
                    {
                        Connstr     connstr = new Connstr();
                        databaseexe dbexe   = new databaseexe();
                        DataTable   dt      =
                            dbexe.getdataset(sql, "T_Supplier").Tables[0];
                        MaterialdataGridView1.DataSource = dt;
                        if (dt.Rows.Count == 0)
                        {
                            MessageBox.Show("没有符合条件的记录!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            buttonModify.Enabled = false;
                        }
                        else
                        {
                            MessageBox.Show("查询到:" + dt.Rows.Count + " 条记录!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            buttonModify.Enabled = true;
                        }
                    }

                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message);
                    }
                }
            }
        }
Exemplo n.º 6
0
        private void buttonSearch_Click(object sender, EventArgs e)
        {
            if (radioButtonNo.Checked)
            {
                if (textBoxNo.Text == "")
                {
                    MessageBox.Show("未输入编号!");
                    return;
                }
                try
                {
                    Connstr     connstr   = new Connstr();
                    databaseexe dbexe     = new databaseexe();
                    string      ProductId = textBoxNo.Text.Trim();
                    string      sql       = "select id as 编码,ProductName as 品名, productType as 箱式,PLength as 长,Pwide as 宽,Pheight as 高,unit as 单位, Price as 单价  from T_FixPRO where ID like'%" + ProductId + "%'";
                    DataTable   dt        =
                        dbexe.getdataset(sql, "T_FixPRO").Tables[0];
                    FixProductGridView1.DataSource = dt;
                    if (dt.Rows.Count == 0)
                    {
                        MessageBox.Show("没有符合条件的记录!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        buttonModify.Enabled = false;
                    }
                    else
                    {
                        MessageBox.Show("查询到:" + dt.Rows.Count + " 条记录!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        buttonModify.Enabled = true;
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
            else
            {
                if (textBoxName.Text == "")
                {
                    MessageBox.Show("查询产品名称不得为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                else
                {
                    string ProductName = textBoxName.Text.Trim();
                    string sql         = "select id as 编码,ProductName as 品名, productType as 箱式,PLength as 长,Pwide as 宽,Pheight as 高,unit as 单位, Price as 单价  from T_FixPRO where ProductName like'%" + ProductName + "%'";
                    try
                    {
                        Connstr     connstr = new Connstr();
                        databaseexe dbexe   = new databaseexe();
                        DataTable   dt      =
                            dbexe.getdataset(sql, "T_FixPRO'").Tables[0];
                        FixProductGridView1.DataSource = dt;
                        if (dt.Rows.Count == 0)
                        {
                            MessageBox.Show("没有符合条件的记录!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            buttonModify.Enabled = false;
                        }
                        else
                        {
                            MessageBox.Show("查询到:" + dt.Rows.Count + " 条记录!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            buttonModify.Enabled = true;
                        }
                    }

                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message);
                    }
                }
            }
        }