Exemple #1
0
        private void delete_Click(object sender, EventArgs e)
        {
            deleteEmployee form = new deleteEmployee();

            oldAccount  = Account.Text.ToString();
            oldPosition = Position.Text.ToString();
            oldEName    = EName.Text.ToString();
            oldECode    = ECode.Text.ToString();

            form.ShowDialog(this);
        }
Exemple #2
0
        private void dgvEmployee_Click(object sender, EventArgs e)//单击,主要是删除和员工状态的改变
        {
            try
            {
                string str, p;
                AccountID     = dgvEmployee.Rows[dgvEmployee.CurrentRow.Index].Cells["AccountID"].Value.ToString();
                Position      = dgvEmployee.Rows[dgvEmployee.CurrentRow.Index].Cells["Position"].Value.ToString();
                DEmployeeCode = dgvEmployee.Rows[dgvEmployee.CurrentRow.Index].Cells["DEmployeeCode"].Value.ToString();
                DEmployeeName = dgvEmployee.Rows[dgvEmployee.CurrentRow.Index].Cells["DEmployeeName"].Value.ToString();
                ID            = dgvEmployee.Rows[dgvEmployee.CurrentRow.Index].Cells["DEmployeeID"].Value.ToString();
                Isvalid       = dgvEmployee.Rows[dgvEmployee.CurrentRow.Index].Cells["IsValid"].Value.ToString();
                EType         = dgvEmployee.Rows[dgvEmployee.CurrentRow.Index].Cells["Type"].Value.ToString();

                p = dgvEmployee.Rows[dgvEmployee.CurrentRow.Index].Cells["Pas"].Value.ToString();
                if (p != "")
                {
                    //Pas = db.Decrypt(p);
                    Pas = p;
                }
                CIndex = dgvEmployee.CurrentCell.ColumnIndex;
                if (CIndex == 0)
                {
                    deleteEmployee DE = new deleteEmployee();
                    if (DE.ShowDialog(this) == DialogResult.OK)
                    {
                        str = "delete from DEmployee where DEmployeeID = " + ID;
                        db.SetPIVAsDB(str);
                        dgvEmployee.Rows.RemoveAt(dgvEmployee.CurrentRow.Index);
                    }
                }
                if (CIndex == 8)
                {
                    string v = dgvEmployee.Rows[dgvEmployee.CurrentRow.Index].Cells["IsValid"].Value.ToString();
                    switch (v)
                    {
                    case "True":
                        v = "False";
                        break;

                    case "False":
                        v = "True";
                        break;
                    }
                    str = "update DEmployee SET IsValid = '" + v + "' where DEmployeeID = " + ID;
                    dgvEmployee.Rows[dgvEmployee.CurrentRow.Index].Cells["IsValid"].Value = v;
                    db.SetPIVAsDB(str);
                }

                /*   else
                 * {
                 *     updateEmployee UE = new updateEmployee();
                 *     if (UE.ShowDialog() == DialogResult.OK)
                 *     {
                 *         dgvEmployee.Rows[dgvEmployee.CurrentRow.Index].Cells["AccountID"].Value = updateEmployee.uAccountID;
                 *         dgvEmployee.Rows[dgvEmployee.CurrentRow.Index].Cells["Pas"].Value = updateEmployee.uPas;
                 *         dgvEmployee.Rows[dgvEmployee.CurrentRow.Index].Cells["Position"].Value = updateEmployee.uPosition;
                 *         dgvEmployee.Rows[dgvEmployee.CurrentRow.Index].Cells["DEmployeeName"].Value = updateEmployee.uDEmployeeName;
                 *         dgvEmployee.Rows[dgvEmployee.CurrentRow.Index].Cells["DEmployeeCode"].Value = updateEmployee.uDEmployeeCode;
                 *         dgvEmployee.Rows[dgvEmployee.CurrentRow.Index].Cells["IsValid"].Value = updateEmployee.uIsvalid;
                 *     }
                 * }*/
            }
            catch (System.Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }