Esempio n. 1
0
        void ComparePassord()
        {
            CheckEmpl();
            CheckCondition();
            if ((emplTable != null && emplTable.Rows.Count > 0) && (tsysUser != null && tsysUser.Rows.Count > 0))
            {
                if (this.txtPass.Text == tsysUser.Rows[0]["KEYPASS"].ToString() && tsysUser.Rows[0]["PWPASS"].ToString() == "")
                {
                    using (var frmNewPass = new FormCreateNewPassword() { StartPosition = FormStartPosition.CenterParent, Text = tmpPWEMPLOYEE })
                    {
                        frmNewPass.EmplId = emplTable.Rows[0]["PWEMPLOYEE"].ToString().Trim();
                        frmNewPass.EmplName = emplTable.Rows[0]["PWFULLNAME"].ToString();
                        frmNewPass.Key = tsysUser.Rows[0]["KEYPASS"].ToString();
                        if (DialogResult.OK == frmNewPass.ShowDialog(this))
                        {
                            MessageBox.Show("เปลี่ยนรหัสผ่านใหม่เรียบร้อย");
                            txtPass.Clear();
                            this.txtPass.Focus();
                            return;
                        }
                        else
                        {
                            var UserName = ClassCurUser.LogInEmplId;
                            return;
                        }
                    }
                }
                else
                {
                    // Commare password
                    try
                    {                     
                        var keyPass = tsysUser.Rows[0]["KEYPASS"].ToString().Trim();
                        var pwPass = tsysUser.Rows[0]["PWPASS"].ToString().Trim();
                        var decryption = HROUTOFFICE.ClassCryptography.TripleDESDecrypt(pwPass, keyPass , true);
                        //var decryption = ClassCryptography.TripleDESEncrypt(this.txtPass.Text.Trim(), tmpPASS.ToString(), true);
                        if (this.txtPass.Text.Trim() == decryption)
                        {
                            ClassCurUser.LogInEmplId = emplTable.Rows[0]["PWEMPLOYEE"].ToString().Trim();
                            ClassCurUser.LogInEmplName = emplTable.Rows[0]["PWFULLNAME"].ToString().Trim();
                            ClassCurUser.LogInEmplDivision = emplTable.Rows[0]["PWDIVISION"].ToString().Trim();

                            ClassCurUser.SysOutoffice = tsysUser.Rows[0]["SYS_OUTOFFICE"].ToString().Trim();
                            ClassCurUser.SysHrApproveOut = tsysUser.Rows[0]["SYS_HRAPPROVEOUT"].ToString().Trim();
                            ClassCurUser.SysHrApproveIn = tsysUser.Rows[0]["SYS_HRAPPROVEIN"].ToString().Trim();
                            
                            ClassCurUser.SysMNApproveOut = tsysUser.Rows[0]["SYS_MNAPPROVEOUT"].ToString().Trim();
                            ClassCurUser.SysMNApproveIn = tsysUser.Rows[0]["SYS_MNAPPROVEIN"].ToString().Trim();

                            ClassCurUser.SysAdministrator = tsysUser.Rows[0]["SYS_ADMIN"].ToString().Trim();

                            ClassCurUser.LogInSection = emplTable.Rows[0]["PWSECTION"].ToString().Trim();
                            ClassCurUser.LogInEmplKey = tsysUser.Rows[0]["KEYPASS"].ToString();

                            ClassCurUser.BEFOREDATECREATE = dtcondition.Rows[0]["BEFOREDATECREATE"].ToString();
                            ClassCurUser.AFTERDATECREATE = dtcondition.Rows[0]["AFTERDATECREATE"].ToString();
                            ClassCurUser.LASTDATEAPPROVE_SHIFT = dtcondition.Rows[0]["LASTDATEAPPROVE_SHIFT"].ToString();
                            ClassCurUser.LASTDATEAPPROVE_LEAVE = dtcondition.Rows[0]["LASTDATEAPPROVE_LEAVE"].ToString();
                            ClassCurUser.LASTDATEAPPROVE_CHANGE = dtcondition.Rows[0]["LASTDATEAPPROVE_CHANGE"].ToString();

                            //MDIParent1 mdiparent = new MDIParent1();
                            //mdiparent.Show();
                            this.DialogResult = DialogResult.OK;
                            this.Close();
                        }
                        else
                        {                           
                            MessageBox.Show("รหัสผ่านของคุณไม่ถูกต้อง");
                            this.txtPass.Clear();
                            this.txtPass.Focus();
                        }
                    }
                    catch (DecoderFallbackException callbackEx)
                    {
                        MessageBox.Show(callbackEx.ToString());
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.ToString());
                    }
                }
            }
            else
            {
                return;
            }
        }
Esempio n. 2
0
 private void ChangPass()
 {
     FormCreateNewPassword frmChangPass = new FormCreateNewPassword();
     frmChangPass.EmplId = ClassCurUser.LogInEmplId;
     frmChangPass.EmplName = ClassCurUser.LogInEmplName;
     frmChangPass.Key = ClassCurUser.LogInEmplKey;
     frmChangPass.StartPosition = FormStartPosition.CenterParent;
     // frmChangPass.MdiParent = this;
     frmChangPass.ShowDialog(this);
 }
Esempio n. 3
0
 private void ToolStripMenuItemChangPass_Click(object sender, EventArgs e)
 {
     FormCreateNewPassword frmChangPass = new FormCreateNewPassword();
     frmChangPass.EmplId = ClassCurUser.LogInEmplId;
     frmChangPass.EmplName = ClassCurUser.LogInEmplName;
     frmChangPass.Key = ClassCurUser.LogInEmplKey;
     frmChangPass.StartPosition = FormStartPosition.CenterParent;
    // frmChangPass.MdiParent = this;
     frmChangPass.ShowDialog(this);
 }