示例#1
0
        private void editworker_Load(object sender, EventArgs e)       //初始化
        {
            mytable.Clear();
            mytable = CommDbOp.Exesql("SELECT * FROM 职工");
            mydv    = mytable.DefaultView;       //获得DataView对象mydv
            if (condstr != "")
            {
                mydv.RowFilter = condstr;
            }
            //以下设置dataGridView1的属性
            dataGridView1.DataSource = mydv;
            dataGridView1.ReadOnly   = true;    //只读
            dataGridView1.GridColor  = Color.RoyalBlue;
            dataGridView1.ScrollBars = ScrollBars.Vertical;
            dataGridView1.ColumnHeadersDefaultCellStyle.Font = new Font("隶书", 12);
            dataGridView1.CellBorderStyle         = DataGridViewCellBorderStyle.Single;
            dataGridView1.Columns[0].AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells;
            dataGridView1.Columns[1].AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells;
            dataGridView1.Columns[2].AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells;
            dataGridView1.Columns[3].AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells;
            dataGridView1.Columns[4].AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells;
            dataGridView1.Columns[5].AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells;

            enbutton();
        }
示例#2
0
        private void countwork_Load(object sender, EventArgs e)       //初始化
        {
            mytable.Clear();
            mytable = CommDbOp.Exesql("select  职工号,  " +
                                      "SUM(完成数量) 完成总量, RANK()OVER " +
                                      "(order by  SUM(完成数量)  desc) 名次 " +
                                      " from 工作量  group by  职工号  " +
                                      " order by   完成总量 desc");
            mydv = mytable.DefaultView;          //获得DataView对象mydv
            if (condstr != "")
            {
                mydv.RowFilter = condstr;
            }
            //以下设置dataGridView1的属性
            dataGridView1.DataSource = mydv;
            dataGridView1.ReadOnly   = true;    //只读
            dataGridView1.GridColor  = Color.RoyalBlue;
            dataGridView1.ScrollBars = ScrollBars.Vertical;
            dataGridView1.ColumnHeadersDefaultCellStyle.Font = new Font("隶书", 12);
            dataGridView1.CellBorderStyle         = DataGridViewCellBorderStyle.Single;
            dataGridView1.Columns[0].AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells;
            dataGridView1.Columns[1].AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells;
            dataGridView1.Columns[2].AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells;


            //以下设置ComboBox1的绑定数据
            // mytable1 = CommDbOp.Exesql("SELECT distinct 班号 FROM student");

            //  ReSetButton_Click(sender, e);
            // enbutton();
        }
示例#3
0
 private void editworker1_Load(object sender, EventArgs e) //初始化
 {
     if (TempData.flag == 1)                               //新增职工记录
     {
         textBox1.Text        = ""; textBox2.Text = "";
         textBox3.Text        = ""; textBox4.Text = "";
         textBox5.Text        = "";
         radioButton1.Checked = false; radioButton2.Checked = false;
         textBox1.Enabled     = true;
         textBox1.Focus();
     }
     else                   //修改职工记录
     {
         DataTable mytable1 = new DataTable();
         mytable1      = CommDbOp.Exesql("SELECT * FROM 职工 WHERE 职工号='" + TempData.no + "'");
         textBox1.Text = mytable1.Rows[0]["职工号"].ToString().Trim();
         textBox2.Text = mytable1.Rows[0]["姓名"].ToString().Trim();
         textBox3.Text = mytable1.Rows[0]["年龄"].ToString().Trim();
         textBox4.Text = mytable1.Rows[0]["所在部门"].ToString().Trim();
         textBox5.Text = mytable1.Rows[0]["联系方式"].ToString().Trim();
         if (mytable1.Rows[0]["性别"].ToString() == "男")
         {
             radioButton1.Checked = true;
         }
         else if (mytable1.Rows[0]["性别"].ToString() == "女")
         {
             radioButton2.Checked = true;
         }
         textBox1.Enabled = false;       //不允许修改职工号
         textBox2.Focus();
     }
 }
示例#4
0
        private void queryworker_Load(object sender, EventArgs e)  //初始化
        {
            mytable.Clear();
            if (condstr != "")
            {
                mytable = CommDbOp.Exesql("SELECT * FROM 职工 WHERE " + condstr);
            }
            else
            {
                mytable = CommDbOp.Exesql("SELECT * FROM 职工");
            }
            mydv = mytable.DefaultView;          //获得DataView对象mydv
            //以下设置dataGridView1的属性
            dataGridView1.DataSource = mydv;
            dataGridView1.ReadOnly   = true;    //只读
            dataGridView1.GridColor  = Color.RoyalBlue;
            dataGridView1.ScrollBars = ScrollBars.Vertical;
            dataGridView1.ColumnHeadersDefaultCellStyle.Font = new Font("隶书", 12);
            dataGridView1.CellBorderStyle         = DataGridViewCellBorderStyle.Single;
            dataGridView1.Columns[0].AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells;
            dataGridView1.Columns[1].AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells;
            dataGridView1.Columns[2].AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells;
            dataGridView1.Columns[3].AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells;
            dataGridView1.Columns[4].AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells;
            dataGridView1.Columns[5].AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells;
            //以下设置ComboBox1的绑定数据

            /* mytable1 = CommDbOp.Exesql("SELECT distinct 所在部门 FROM 职工");
             * comboBox1.DataSource = mytable1;
             * comboBox1.DisplayMember = "所在部门";
             * ReSetButton_Click(sender, e);
             * label1.Text = "满足条件的职工记录个数:" + mydv.Count.ToString();*/
        }
示例#5
0
文件: main.cs 项目: sumsunsuns/WWS
        private void 系统初始化ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            DialogResult result;

            result = MessageBox.Show(this, "本功能要清除系统中所有数据,真的初始化吗?", "确认初始化操作", MessageBoxButtons.OKCancel);
            if (result == DialogResult.Yes)
            {
                CommDbOp.deldata("职工");
                CommDbOp.deldata("工作量");
                CommDbOp.deldata("oper");
                MessageBox.Show("系统初始化完毕,下次只能以1234/1234(用户名/口令)进入本系统", "信息提示");
            }
        }
示例#6
0
 private void editworker1_Load(object sender, EventArgs e) //初始化
 {
     if (TempData.flag == 1)                               //新增职工工作量记录
     {
         textBox1.Text    = ""; textBox2.Text = "";
         textBox3.Text    = "";
         textBox1.Enabled = true;
         textBox1.Focus();
     }
     else                   //修改职工工作量记录
     {
         DataTable mytable1 = new DataTable();
         mytable1         = CommDbOp.Exesql("SELECT * FROM 工作量 WHERE 职工号='" + TempData.no + "'");
         textBox1.Text    = mytable1.Rows[0]["职工号"].ToString().Trim();
         textBox2.Text    = mytable1.Rows[0]["月份"].ToString().Trim();
         textBox3.Text    = mytable1.Rows[0]["完成数量"].ToString().Trim();
         textBox1.Enabled = false;       //不允许修改职工号
         textBox2.Focus();
     }
 }
示例#7
0
 private void button5_Click(object sender, EventArgs e)
 {
     TempData.flag = 3;
     if (TempData.no != "")
     {
         if (MessageBox.Show("真的要删除职工号为" + TempData.no + "的职工记录吗?",
                             "删除确认",
                             MessageBoxButtons.OKCancel) == DialogResult.OK)
         {
             TempData.flag = 3;
             string mysql = "DELETE 职工 WHERE 职工号='" + TempData.no.Trim() + "'";
             mytable1 = CommDbOp.Exesql(mysql);
             this.editworker_Load(sender, e);
         }
     }
     else
     {
         MessageBox.Show("先选择要删除的职工记录", "信息提示");
     }
 }
示例#8
0
        private void button1_Click(object sender, EventArgs e)
        {
            string    mysql;
            DataTable mytable1 = new DataTable();

            try
            {
                mysql = "select  职工号,  SUM(完成数量) 完成总量, " +
                        "RANK()OVER (order by SUM(完成数量) desc) 名次 " +
                        " from 工作量  group by  职工号   order by  完成总量 desc";

                mytable1 = CommDbOp.Exesql(mysql);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message.ToString(), "信息提示");
            }

            this.countwork_Load(sender, e);
        }
示例#9
0
文件: login.cs 项目: sumsunsuns/WWS
        private void button1_Click(object sender, EventArgs e)
        {
            DataTable mytable;
            DataTable mytable2;
            //DataTable mytable3;
            string mysql = "SELECT * FROM oper WHERE 用户名='" + textBox1.Text +
                           "' AND 密码='" + textBox2.Text + "'";

            mytable = CommDbOp.Exesql(mysql);
            if (mytable.Rows.Count == 0)
            {
                mysql = "SELECT * FROM 职工 WHERE 职工号='" + textBox1.Text +
                        "' AND 职工号='" + textBox2.Text + "'";
                mytable2 = CommDbOp.Exesql(mysql);
                if (mytable2.Rows.Count == 0)
                {
                    MessageBox.Show("不存在该用户");
                    this.Close();
                }

                else //职工用户
                {
                    TempData.userlevel = "职工";
                    TempData.no        = textBox1.Text.Trim();
                    this.Hide();
                    Form myform = new main();
                    myform.ShowDialog();
                    this.Close();
                }
            }
            else
            {
                TempData.userlevel = mytable.Rows[0]["级别"].ToString().Trim();
                this.Hide();
                Form myform = new main();
                myform.ShowDialog();
                this.Close();
            }
        }
示例#10
0
 private void querywork_Load(object sender, EventArgs e)  //初始化
 {
     mytable.Clear();
     if (condstr != "")
     {
         mytable = CommDbOp.Exesql("SELECT * FROM 工作量 WHERE " + condstr);
     }
     else
     {
         mytable = CommDbOp.Exesql("SELECT * FROM 工作量");
     }
     mydv = mytable.DefaultView;         //获得DataView对象mydv
                                         //以下设置dataGridView1的属性
     dataGridView1.DataSource = mydv;
     dataGridView1.ReadOnly   = true;    //只读
     dataGridView1.GridColor  = Color.RoyalBlue;
     dataGridView1.ScrollBars = ScrollBars.Vertical;
     dataGridView1.ColumnHeadersDefaultCellStyle.Font = new Font("隶书", 12);
     dataGridView1.CellBorderStyle         = DataGridViewCellBorderStyle.Single;
     dataGridView1.Columns[0].AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells;
     dataGridView1.Columns[1].AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells;
     dataGridView1.Columns[2].AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells;
 }
示例#11
0
        private void button1_Click(object sender, EventArgs e)
        {
            string    mysql;
            DataTable mytable1 = new DataTable();

            if (textBox1.Text.ToString() == "")
            {
                MessageBox.Show("必须输入职工号", "信息提示");
                return;
            }
            if (textBox2.Text.ToString() == "")
            {
                MessageBox.Show("必须输入月份", "信息提示");
                return;
            }
            if (textBox3.Text.ToString() == "")
            {
                MessageBox.Show("必须输入产品完成数量", "信息提示");
                return;
            }



            try
            {
                if (TempData.flag == 1)  //新增职工记录
                {
                    mytable1 = CommDbOp.Exesql("SELECT * FROM 工作量 WHERE 职工号='" + textBox1.Text + "'and 月份='" + textBox2.Text + "'");
                    if (mytable1.Rows.Count == 1)
                    {
                        MessageBox.Show("输入的记录重复,不能新增记录", "信息提示");
                        textBox1.Focus();
                        textBox2.Focus();
                        return;
                    }
                    else          //不重复时插入职工记录
                    {
                        mysql = "INSERT INTO 工作量 VALUES( '" + textBox1.Text.Trim() + "','" +
                                textBox2.Text.Trim() + "','" +

                                textBox3.Text.Trim() +
                                "')";
                        //  textBox1.Text.Trim() + ")";
                        //默认职工的初始密码与其职工号相同
                        mytable1 = CommDbOp.Exesql(mysql);
                        this.Close();
                    }
                }
                else               //修改职工记录
                {
                    mysql = "UPDATE 工作量 SET 完成数量='" + textBox3.Text.Trim() +

                            // "',密码='" + textBox1.Text.Trim() +
                            "' WHERE 职工号='" + textBox1.Text.Trim() + "'and 月份='" + textBox2.Text.Trim() + "'";
                    //默认职工的初始密码与其职工号相同
                    mytable1 = CommDbOp.Exesql(mysql);
                    this.Close();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message.ToString(), "信息提示");
            }
        }
示例#12
0
        private void button1_Click(object sender, EventArgs e)
        {
            string    xb, mysql;
            DataTable mytable1 = new DataTable();

            if (textBox1.Text.ToString() == "")
            {
                MessageBox.Show("必须输入职工号", "信息提示");
                return;
            }
            if (textBox2.Text.ToString() == "")
            {
                MessageBox.Show("必须输入姓名", "信息提示");
                return;
            }
            if (textBox3.Text.ToString() == "")
            {
                MessageBox.Show("必须输入年龄", "信息提示");
                return;
            }
            if (textBox4.Text.Trim() == "")
            {
                MessageBox.Show("必须输入所在部门", "信息提示");
                return;
            }
            if (textBox5.Text.Trim() == "")
            {
                MessageBox.Show("必须输入联系方式", "信息提示");
                return;
            }
            if (radioButton1.Checked)
            {
                xb = "男";
            }
            else if (radioButton2.Checked)
            {
                xb = "女";
            }
            else
            {
                xb = "";
            }
            try
            {
                if (TempData.flag == 1)  //新增职工记录
                {
                    mytable1 = CommDbOp.Exesql("SELECT * FROM 职工 WHERE 职工号='" + textBox1.Text + "'");
                    if (mytable1.Rows.Count == 1)
                    {
                        MessageBox.Show("输入的职工号重复,不能新增职工记录", "信息提示");
                        textBox1.Focus();
                        return;
                    }
                    else          //不重复时插入职工记录
                    {
                        mysql = "INSERT INTO 职工 VALUES( '" + textBox1.Text.Trim() + "','" +
                                textBox2.Text.Trim() + "','" +
                                xb + "','" +
                                textBox3.Text.Trim() + "','" +
                                textBox4.Text.Trim() + "','" +
                                textBox5.Text.Trim() + "')";
                        //  textBox1.Text.Trim() + ")";
                        //默认职工的初始密码与其职工号相同
                        mytable1 = CommDbOp.Exesql(mysql);
                        this.Close();
                    }
                }
                else               //修改职工记录
                {
                    mysql = "UPDATE 职工 SET 姓名='" + textBox2.Text.Trim() +
                            "',性别='" + xb +
                            "',年龄='" + textBox3.Text.Trim() +
                            "',所在部门='" + textBox4.Text.Trim() +
                            "',联系方式='" + textBox5.Text.Trim() +
                            // "',密码='" + textBox1.Text.Trim() +
                            "' WHERE 职工号='" + textBox1.Text.Trim() + "'";
                    //默认职工的初始密码与其职工号相同
                    mytable1 = CommDbOp.Exesql(mysql);
                    this.Close();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message.ToString(), "信息提示");
            }
        }