示例#1
0
        public void loginHis(CommLoginLog model)
        {
            string errorStr      = "";
            string login_his_str = "INSERT INTO comm_login_log (ESE_CODE, EMAIL, IPADDR, TYPE) values ('" + model.ESE_CODE + "', '" + model.EMAIL + "', '" + model.IPADDR + "', 'ese') ";

            exeQuery(login_his_str, out errorStr);
        }
示例#2
0
        public EsmLoginHisModels GetEsmLoginHisList(EsmLoginHisModels model)
        {
            string errorStr = "";

            string listQuery = " SELECT SEQNO , EST_CODE, ESE_CODE, EMAIL, LOGDATETIME, IPADDR, TYPE  ";
            string cntQuery  = " SELECT count(*) as cnt ";

            string baseQuery = " FROM comm_login_log WHERE 1=1 ";

            if (!String.IsNullOrEmpty(model.schType))              //관리자 ID
            {
                baseQuery += " AND  EMAIL = '" + model.schType.Trim() + "'";
            }

            if (!String.IsNullOrEmpty(model.schSdt))                  //등록일자 (시작일)
            {
                baseQuery += " AND  LOGDATETIME >= '" + model.schSdt.Trim() + "'";
            }

            if (!String.IsNullOrEmpty(model.schEdt))                  //등록일자 (종료일)
            {
                baseQuery += " AND  LOGDATETIME <= '" + model.schEdt.Trim() + "'";
            }

            string endQuery = " ORDER BY " + model.sortKey.ToString().Trim() + " DESC limit " + ((model.Paging.page - 1) * model.Paging.pageNum) + " , " + model.Paging.pageNum; //정렬

            cntQuery  += baseQuery;                                                                                                                                              //토탈 카운트 쿼리
            listQuery += baseQuery + endQuery;                                                                                                                                   //리스트 쿼리

            int totCnt = getQueryCnt(cntQuery, out errorStr);                                                                                                                    //전체 리스트 갯수 구하기

            model.Paging.pageTotNum = (totCnt / model.Paging.pageNum) + 1;                                                                                                       //총 페이징 갯수 구하기

            DataTable listDt = getQueryResult(listQuery, out errorStr);

            if (listDt != null && listDt.Rows.Count != 0)
            {
                for (int i = 0; i < listDt.Rows.Count; i++)
                {
                    CommLoginLog temp = new CommLoginLog();
                    temp.SEQNO       = int.Parse(listDt.Rows[i]["SEQNO"].ToString().Trim());
                    temp.EST_CODE    = listDt.Rows[i]["EST_CODE"].ToString().Trim();
                    temp.ESE_CODE    = listDt.Rows[i]["ESE_CODE"].ToString().Trim();
                    temp.EMAIL       = listDt.Rows[i]["EMAIL"].ToString().Trim();
                    temp.LOGDATETIME = listDt.Rows[i]["LOGDATETIME"].ToString().Trim();
                    temp.IPADDR      = listDt.Rows[i]["IPADDR"].ToString().Trim();
                    temp.TYPE        = listDt.Rows[i]["TYPE"].ToString().Trim();
                    model.Items.Add(temp);
                }
            }

            return(model);
        }
示例#3
0
        public ActionResult Login(AccountLoginModel viewModel)
        {
            if (!ModelState.IsValid)
            {
                return(View(viewModel));
            }

            string          resultStr = "";
            AccountDbModels act       = new AccountDbModels();
            EsmUser         model     = new EsmUser();

            model = act.loginChk(viewModel);                //로그인 체크



            if (model == null)                          //아이디 페스워드 체크
            {
                resultStr         = "이메일 또는 비밀번호를 확인해 주시기 바랍니다.";
                ViewBag.PublicMsg = resultStr;
                return(View(viewModel));
            }

            if (model.STATUS == 0)              //사용 여부 체크
            {
                resultStr         = "사용이 정지된 계정입니다.";
                ViewBag.PublicMsg = resultStr;
                return(View(viewModel));
            }


            FormsAuthentication.SetAuthCookie(viewModel.Email, false);

            Session["MANAGE_NO"]           = model.SEQNO;
            Session["MANAGE_GRADE"]        = model.GROUP_ID;
            Session["CURRENT_LOGIN_EMAIL"] = model.EMAIL;

            //로그인 기록 데이터 세팅
            CommLoginLog clh = new CommLoginLog();

            clh.EMAIL  = viewModel.Email;
            clh.IPADDR = Request.UserHostAddress;

            act.loginHis(clh);                //로그인 로그 기록

            return(RedirectToAction("Index", "Home"));
        }
示例#4
0
        public async Task <ActionResult> Login(AccountLoginModel viewModel)
        {
            if (!ModelState.IsValid)
            {
                return(View(viewModel));
            }

            string  resultStr = "";
            EseUser model     = new EseUser();

            model = act.loginChk(viewModel);                //로그인 체크



            if (model == null)                  //아이디 페스워드 체크
            {
                resultStr         = "이메일 또는 비밀번호를 확인해 주시기 바랍니다.";
                ViewBag.PublicMsg = resultStr;
                return(View(viewModel));
            }

            if (model.chkSTATUS == 1)              //사용 여부 체크
            {
                resultStr         = "사용이 정지된 계정입니다.";
                ViewBag.PublicMsg = resultStr;
                return(View(viewModel));
            }

            if (model.STATUS == 1)              //사용 여부 체크
            {
                resultStr         = "사용이 정지된 ESE 계정입니다.";
                ViewBag.PublicMsg = resultStr;
                return(View(viewModel));
            }

            if (model.STATUS == 2)              //사용 여부 체크
            {
                //resultStr = "[문구 수정 필요]승인되지 않은 사용자 입니다. 기본정보를 입력해주시면 빠른시일에 승인 처리 해드리겠습니다.";
                //ViewBag.PublicMsg = resultStr;
            }

            FormsAuthentication.SetAuthCookie(viewModel.Email, false);

            Session["MANAGE_NO"]           = model.SEQNO;
            Session["MANAGE_GRADE"]        = model.GROUP_ID;
            Session["CURRENT_LOGIN_EMAIL"] = model.EMAIL;
            Session["EST_CODE"]            = model.EST_CODE;
            Session["ESE_CODE"]            = model.ESE_CODE;
            Session["STATUS"] = model.STATUS;

            //로그인 유지 체크 시 쿠키 설정
            if (viewModel.RememberMe)
            {
                Response.Cookies["CHK_LOGIN_REMEMBER"].Value  = "CHK_LOGIN_REMEMBER";
                Response.Cookies["MANAGE_NO"].Value           = model.SEQNO.ToString();
                Response.Cookies["MANAGE_GRADE"].Value        = model.GROUP_ID.ToString();
                Response.Cookies["CURRENT_LOGIN_EMAIL"].Value = model.EMAIL;
                Response.Cookies["EST_CODE"].Value            = model.EST_CODE;
                Response.Cookies["ESE_CODE"].Value            = model.ESE_CODE;
                Response.Cookies["STATUS"].Value = model.STATUS.ToString();
            }
            else
            {
                //로그인 유지 체크 헤제 시 쿠키 삭제
                if (Request.Cookies["CHK_LOGIN_REMEMBER"] != null)
                {
                    Response.Cookies["CHK_LOGIN_REMEMBER"].Expires = DateTime.Now.AddDays(-1);
                }
                if (Request.Cookies["MANAGE_NO"] != null)
                {
                    Response.Cookies["MANAGE_NO"].Expires = DateTime.Now.AddDays(-1);
                }
                if (Request.Cookies["MANAGE_GRADE"] != null)
                {
                    Response.Cookies["MANAGE_GRADE"].Expires = DateTime.Now.AddDays(-1);
                }
                if (Request.Cookies["CURRENT_LOGIN_EMAIL"] != null)
                {
                    Response.Cookies["CURRENT_LOGIN_EMAIL"].Expires = DateTime.Now.AddDays(-1);
                }
                if (Request.Cookies["EST_CODE"] != null)
                {
                    Response.Cookies["EST_CODE"].Expires = DateTime.Now.AddDays(-1);
                }
                if (Request.Cookies["ESE_CODE"] != null)
                {
                    Response.Cookies["ESE_CODE"].Expires = DateTime.Now.AddDays(-1);
                }
                if (Request.Cookies["STATUS"] != null)
                {
                    Response.Cookies["STATUS"].Expires = DateTime.Now.AddDays(-1);
                }
            }



            //로그인 기록 데이터 세팅
            CommLoginLog clh = new CommLoginLog();

            clh.ESE_CODE = model.ESE_CODE;
            clh.EMAIL    = viewModel.Email;
            clh.IPADDR   = Request.UserHostAddress;

            act.loginHis(clh);                //로그인 로그 기록

            return(RedirectToLocal(viewModel.ReturnUrl));
            //return RedirectToAction("Index", "Home");
        }