Exemple #1
0
        //编辑操作员信息
        private void EditOPInfo()
        {
            frmEditOp editop = new frmEditOp();

            editop.GetEmplList();
            editop.TextBox1.Text     = dgOp[dgOp.CurrentRowIndex, 0].ToString();                      //编号
            editop.ComboBox1.Text    = dgOp[dgOp.CurrentRowIndex, 2].ToString();                      //姓名
            editop.CheckBox1.Checked = dgOp[dgOp.CurrentRowIndex, 6].ToString() == "1"?true:false;    //禁用操作员
            editop.CheckBox2.Checked = !(dgOp[dgOp.CurrentRowIndex, 4].ToString() == "1"?true:false); //禁用PPC
            if (!(dgOp[dgOp.CurrentRowIndex, 4].ToString() == "1"?true:false))
            {
                editop.TextBox7.Text = dgOp[dgOp.CurrentRowIndex, 5].ToString();
            }

            editop.frmMode   = 2;                                        //修改记录
            editop.Text      = "修改操作员信息";
            editop.OldOPCode = dgOp[dgOp.CurrentRowIndex, 0].ToString(); //保存原始编号

            editop.ShowDialog();
            if (editop.DialogResult == DialogResult.OK)
            {
                LoadOperatorList();
            }
        }
Exemple #2
0
        private void ToolBar1_ButtonClick(System.Object sender, System.Windows.Forms.ToolBarButtonClickEventArgs e)
        {
            switch (ToolBar1.Buttons.IndexOf(e.Button))
            {
                case 0: //添加数据
                    frmEditOp editop = new frmEditOp();
                    editop.GetEmplList();

                    editop.frmMode = 1; //添加记录
                    editop.Text = "添加操作员信息";

                    editop.ShowDialog();
                    if (editop.DialogResult == DialogResult.OK)
                    {
                        LoadOperatorList();
                    }
                    break;
                case 1: //修改数据
                    if (! (dgOp.CurrentRowIndex < 0))
                    {
                        EditOPInfo();
                    }
                    break;
                case 2: //删除当前数据
                    if (! (dgOp.CurrentRowIndex < 0))
                    {
                        if (MessageBox.Show("确定要删除当前选中的 " + dgOp[dgOp.CurrentRowIndex, 0].ToString().Trim() + " 帐号吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
                        {
                            //'删除操作
                            if (DelOprt(dgOp[dgOp.CurrentRowIndex, 0].ToString()))
                            {
                                LoadOperatorList();
                            }
                        }
                    }
                    break;
                case 4: //密码
                    frmEditPsw frmeditpassword = new frmEditPsw();
                    frmeditpassword.ShowDialog();
                    if (frmeditpassword.DialogResult == DialogResult.OK)
                    {
                        //更新当前操作员帐号的密码
                        System.Data.SqlClient.SqlConnection conn = new System.Data.SqlClient.SqlConnection();
                        conn.ConnectionString = rms_var.ConnStr;
                        try
                        {

                            SqlCommand selectCMD = new SqlCommand();
                            selectCMD.Connection = conn;
                            selectCMD.CommandText = "update Operator set " + "password='******' " + "where operatorid='" + dgOp[dgOp.CurrentRowIndex, 0] + "'";
                            selectCMD.CommandTimeout = 30;
                            conn.Open();
                            selectCMD.ExecuteNonQuery();
                            MessageBox.Show("密码修改成功!");
                        }
                        catch (Exception ex)
                        {
                            MessageBox.Show(ex.ToString());
                        }
                        finally
                        {
                            conn.Close();
                        }
                    }
                    break;
                case 5: //权限
                    frmEditAccess frmeditacs = new frmEditAccess();
                    frmeditacs.OpID = dgOp[dgOp.CurrentRowIndex, 0].ToString(); //保存帐号,用于更新
                    frmeditacs.ShowDialog();
                    break;
                case 7:
                    this.Close();
                    break;

            }
        }
Exemple #3
0
        //编辑操作员信息
        private void EditOPInfo()
        {
            frmEditOp editop = new frmEditOp();
            editop.GetEmplList();
            editop.TextBox1.Text =dgOp[dgOp.CurrentRowIndex, 0].ToString(); //编号
            editop.ComboBox1.Text = dgOp[dgOp.CurrentRowIndex, 2].ToString(); //姓名
            editop.CheckBox1.Checked =dgOp[dgOp.CurrentRowIndex, 6].ToString()=="1"?true:false; //禁用操作员
            editop.CheckBox2.Checked =!(dgOp[dgOp.CurrentRowIndex, 4].ToString()=="1"?true:false); //禁用PPC
            if (!(dgOp[dgOp.CurrentRowIndex, 4].ToString()=="1"?true:false))
            {
                editop.TextBox7.Text = dgOp[dgOp.CurrentRowIndex, 5].ToString();
            }

            editop.frmMode = 2; //修改记录
            editop.Text = "修改操作员信息";
            editop.OldOPCode =dgOp[dgOp.CurrentRowIndex, 0].ToString(); //保存原始编号

            editop.ShowDialog();
            if (editop.DialogResult == DialogResult.OK)
            {
                LoadOperatorList();
            }
        }
Exemple #4
0
        private void ToolBar1_ButtonClick(System.Object sender, System.Windows.Forms.ToolBarButtonClickEventArgs e)
        {
            switch (ToolBar1.Buttons.IndexOf(e.Button))
            {
            case 0:                     //添加数据
                frmEditOp editop = new frmEditOp();
                editop.GetEmplList();

                editop.frmMode = 1;                         //添加记录
                editop.Text    = "添加操作员信息";

                editop.ShowDialog();
                if (editop.DialogResult == DialogResult.OK)
                {
                    LoadOperatorList();
                }
                break;

            case 1:                     //修改数据
                if (!(dgOp.CurrentRowIndex < 0))
                {
                    EditOPInfo();
                }
                break;

            case 2:                     //删除当前数据
                if (!(dgOp.CurrentRowIndex < 0))
                {
                    if (MessageBox.Show("确定要删除当前选中的 " + dgOp[dgOp.CurrentRowIndex, 0].ToString().Trim() + " 帐号吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
                    {
                        //'删除操作
                        if (DelOprt(dgOp[dgOp.CurrentRowIndex, 0].ToString()))
                        {
                            LoadOperatorList();
                        }
                    }
                }
                break;

            case 4:                     //密码
                frmEditPsw frmeditpassword = new frmEditPsw();
                frmeditpassword.ShowDialog();
                if (frmeditpassword.DialogResult == DialogResult.OK)
                {
                    //更新当前操作员帐号的密码
                    System.Data.SqlClient.SqlConnection conn = new System.Data.SqlClient.SqlConnection();
                    conn.ConnectionString = rms_var.ConnStr;
                    try
                    {
                        SqlCommand selectCMD = new SqlCommand();
                        selectCMD.Connection     = conn;
                        selectCMD.CommandText    = "update Operator set " + "password='******' " + "where operatorid='" + dgOp[dgOp.CurrentRowIndex, 0] + "'";
                        selectCMD.CommandTimeout = 30;
                        conn.Open();
                        selectCMD.ExecuteNonQuery();
                        MessageBox.Show("密码修改成功!");
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.ToString());
                    }
                    finally
                    {
                        conn.Close();
                    }
                }
                break;

            case 5:                                                         //权限
                frmEditAccess frmeditacs = new frmEditAccess();
                frmeditacs.OpID = dgOp[dgOp.CurrentRowIndex, 0].ToString(); //保存帐号,用于更新
                frmeditacs.ShowDialog();
                break;

            case 7:
                this.Close();
                break;
            }
        }