Пример #1
0
        /// <summary>
        /// 로그인처리
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void BtnLogin_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                //로그인 정보가 없는 경우 체크
                if (cbSite.Text == "" || txtID.Text == "" || pwdPW.Text == "")
                {
                    Messages.ShowInfoMsgBox("로그인 정보가 틀립니다.");
                    return;
                }

                if (dtDBInfo.Rows.Count != 1)
                {
                    Messages.ShowInfoMsgBox("해당 프로그램의 접속정보가 없습니다.");
                    return;
                }

                htconditions.Clear();
                htconditions.Add("SITE_CD", cbSite.EditValue.ToString());
                htconditions.Add("USER_ID", txtID.EditValue.ToString());
                htconditions.Add("USER_PWD", EncryptionConvert.Base64Encoding(pwdPW.EditValue.ToString()));
                htconditions.Add("SYS_CD", FmsUtil.sysCd);

                DataTable dtLoginCheck = new DataTable();
                dtLoginCheck = work.LoginCheck(htconditions);

                //사용자가 입력한 로그인 정보로 일치하는 데이터가 없을 경우
                if (dtLoginCheck.Rows.Count == 0)
                {
                    Messages.ShowInfoMsgBox("로그인 정보가 틀립니다.");
                    return;
                }

                //비밀번호 체크
                if (!dtLoginCheck.Rows[0]["USER_PWD"].ToString().Equals(htconditions["USER_PWD"].ToString()))
                {
                    Messages.ShowInfoMsgBox("로그인 정보가 틀립니다.");
                    return;
                }

                //시스템 권한 체크
                if (!dtLoginCheck.Rows[0]["SYS_CD"].ToString().Equals("1"))
                {
                    Messages.ShowInfoMsgBox("해당 시스템에 권한이 없습니다.");
                    return;
                }

                //아이디 저장 체크박스 확인 후 최근 접속아이디 및 체크 값 setting.
                Properties.Settings.Default.bSaveID = (bool)chkSaveID.EditValue;
                if ((bool)chkSaveID.EditValue)
                {
                    Properties.Settings.Default.strRecentID = txtID.Text;
                    Properties.Settings.Default.Save();
                }
                else
                {
                    Properties.Settings.Default.strRecentID = "";
                    Properties.Settings.Default.Save();
                }


                //로그인 성공이후
                //..로그인 성공한 아이디, 사이트, IP  저장
                Logs.strLogin_ID   = txtID.Text;
                Logs.strLogin_SITE = cbSite.EditValue.ToString();
                Logs.strLogin_IP   = ((IPAddress[])Dns.GetHostAddresses(""))[1].ToString();

                //..로그인 성공한 메뉴별 권한 저장
                DataTable dtPermission = new DataTable();
                dtPermission = work.Select_LoginUser_Permission(htconditions);

                foreach (DataRow dr in dtPermission.Rows)
                {
                    Logs.htPermission.Add(dr["MNU_CD"].ToString(), dr["MNU_AUTH"].ToString());
                }

                Logs.WNMSConfig.strIP   = GTIFramework.Properties.Settings.Default.strIP;
                Logs.WNMSConfig.strPort = GTIFramework.Properties.Settings.Default.strPort;
                Logs.WNMSConfig.strSID  = GTIFramework.Properties.Settings.Default.strSID;
                Logs.WNMSConfig.strID   = GTIFramework.Properties.Settings.Default.strID;
                Logs.WNMSConfig.strPWD  = GTIFramework.Properties.Settings.Default.strPWD;
                //Logs.configChange(infomanagerConfig);


                // App.xaml의 팝업호출지점으로 리턴
                DialogResult = true;
                Close();
            }
            catch (Exception ex)
            {
                Messages.ShowErrMsgBoxLog(ex);
            }
        }
Пример #2
0
        /// <summary>
        /// 저장 이벤트
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void BtnSave_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (Messages.ShowYesNoMsgBox("사용자정보를 저장 하시겠습니까?") == MessageBoxResult.Yes)
                {
                    Hashtable htConditions = new Hashtable();

                    if (txtNM.Text.Equals(""))
                    {
                        Messages.ShowErrMsgBox("이름을 입력해주세요.");
                        txtNM.Focus();
                        return;
                    }

                    // 비밀번호 관련 입력란(현재,변경,변경확인)이 공란이면 비밀번호 변경 절차 없음.
                    if (!pwdCurrent.Text.ToString().Equals("") || !pwdChange.Text.ToString().Equals("") || !pwdChangeChk.Text.ToString().Equals(""))
                    {
                        if (pwdCurrent.Text.ToString().Equals(""))
                        {
                            Messages.ShowErrMsgBox("현재 비밀번호를 입력해주세요.");
                            pwdCurrent.Focus();
                            return;
                        }

                        if (pwdChange.Text.ToString().Equals(""))
                        {
                            Messages.ShowErrMsgBox("변경 비밀번호를 입력해주세요.");
                            pwdChange.Focus();
                            return;
                        }

                        if (pwdChangeChk.Text.ToString().Equals(""))
                        {
                            Messages.ShowErrMsgBox("변경 비밀번호 확인을 입력해주세요.");
                            pwdChangeChk.Focus();
                            return;
                        }

                        //입력한 현재 비밀번호가 일치하는지 체크
                        if (EncryptionConvert.Base64Encoding(pwdCurrent.Text.ToString()).Equals(dtLogUserInfo.Rows[0]["USER_PWD"].ToString()))
                        {
                            if (pwdChange.Text.ToString().Equals(pwdChangeChk.Text.ToString()))
                            {
                                htConditions.Add("USER_PWD", EncryptionConvert.Base64Encoding(pwdChange.EditValue.ToString()));
                            }
                            else
                            {
                                Messages.ShowErrMsgBox("변경 비밀번호가 일치하지 않습니다.");
                                pwdChange.Focus();
                                return;
                            }
                        }
                        else
                        {
                            Messages.ShowErrMsgBox("현재 비밀번호가 일치하지 않습니다.");
                            pwdCurrent.Focus();
                            return;
                        }
                    }
                    htConditions.Add("USER_ID", txtID.Text.ToString());
                    htConditions.Add("USER_NM", txtNM.Text.ToString());
                    htConditions.Add("DEPT_CD", lookUpEditDept.EditValue);
                    htConditions.Add("POS_CD", cbGrade.EditValue);
                    htConditions.Add("USER_TEL", txtPhone.Text.ToString());
                    htConditions.Add("EDT_ID", txtID.Text.ToString());
                    htConditions.Add("USE_YN", "Y");
                    htConditions.Add("DEL_YN", "N");

                    //work.Update_SYS_USER_INFO(htConditions);
                    htConditions.Add("sqlId", "Update_SYS_USER_INFO");
                    BizUtil.Update(htConditions);

                    MessageBox.Show("성공적으로 저장하였습니다.");
                    this.Close();

                    if (radioblue.IsChecked == true)
                    {
                        mainWin.Cmblue_Click(null, null);
                    }
                    else if (radionavy.IsChecked == true)
                    {
                        mainWin.Cmnavy_Click(null, null);
                    }
                }
            }
            catch (Exception ex)
            {
                Messages.ShowErrMsgBoxLog(ex);
            }
        }