Example #1
0
        private void pbAdd_Click(object sender, EventArgs e)
        {
            P1Z02_USER_SUB sub = new P1Z02_USER_SUB();

            sub.lblTitle.Text = sub.lblTitle.Text + "[추가]";
            sub.parentWin     = this;
            sub.ShowDialog();
        }
Example #2
0
        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex < 0)
            {
                return;
            }
            if (dataGridView1.Rows.GetLastRow(DataGridViewElementStates.Visible) == e.RowIndex)
            {
                return;
            }

            if (e.ColumnIndex == 0)
            {
                P1Z02_USER_SUB sub = new P1Z02_USER_SUB();
                sub.lblTitle.Text = sub.lblTitle.Text + "[수정]";
                sub.parentWin     = this;
                sub.ShowDialog();
            }
            else if (e.ColumnIndex == 6)
            {
                int    index    = 0;
                string userID   = string.Empty;
                string userName = string.Empty;

                try
                {
                    index    = dataGridView1.CurrentRow.Index;
                    userID   = dataGridView1.Rows[index].Cells[0].Value.ToString();
                    userName = dataGridView1.Rows[index].Cells[1].Value.ToString();

                    if (dataGridView1.Rows[index].Selected != true)
                    {
                        return;
                    }
                }
                catch (NullReferenceException)
                {
                    return;
                }

                if (string.IsNullOrEmpty(userID))
                {
                    return;
                }

                DialogResult dr = MessageBox.Show(userName + "\r\r선택된 사용자의 암호를 초기화(1234) 하시겠습니까?", this.lblTitle.Text + "[암호초기화]", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);

                if (dr == DialogResult.No)
                {
                    return;
                }


                string InitPwd = new MyClass().EncryptSHA512("1234");
                string sql     = "update tb_sys_user set pwd = '" + InitPwd + "' where user_id = '" + userID + "'";

                MariaCRUD m   = new MariaCRUD();
                string    msg = string.Empty;
                m.dbCUD(sql, ref msg);

                if (msg != "OK")
                {
                    MessageBox.Show(msg);
                }
            }
            else
            {
                return;
            }
        }