Exemplo n.º 1
0
        //EST STATION EST 정보 관리 -> 계정 관리
        public EstUserModels GetEstUserList(EstUserModels model)
        {
            string errorStr = "";

            //string listQuery = " SELECT SEQNO, EST_CODE, EMAIL, PASSWD, USERNAME, TELNO, GROUP_ID, CREATETIME, DEPARTMENT, POSITION, MEMO, STATUS FROM est_user order by SEQNO ";
            string    listQuery = "  SELECT SEQNO, EMAIL,PASSWD,USERNAME,TELNO,eu.GROUP_ID,eg.GROUP_NAME,CREATETIME,DEPARTMENT,POSITION,MEMO,STATUS FROM est_user eu left outer join est_group eg on eu.GROUP_ID = eg.GROUP_ID ORDER BY SEQNO  ";
            DataTable listDt    = getQueryResult(listQuery, out errorStr);


            if (listDt != null && listDt.Rows.Count != 0)
            {
                for (int i = 0; i < listDt.Rows.Count; i++)
                {
                    EstUser temp = new EstUser();
                    temp.SEQNO = int.Parse(listDt.Rows[i]["SEQNO"].ToString().Trim());
                    //temp.EST_CODE = listDt.Rows[i]["EST_CODE"].ToString().Trim();
                    temp.EMAIL      = listDt.Rows[i]["EMAIL"].ToString().Trim();
                    temp.PASSWD     = listDt.Rows[i]["PASSWD"].ToString().Trim();
                    temp.USERNAME   = listDt.Rows[i]["USERNAME"].ToString().Trim();
                    temp.TELNO      = listDt.Rows[i]["TELNO"].ToString().Trim();
                    temp.GROUP_ID   = int.Parse(listDt.Rows[i]["GROUP_ID"].ToString().Trim());
                    temp.GROUP_NAME = listDt.Rows[i]["GROUP_NAME"].ToString().Trim();
                    temp.CREATETIME = listDt.Rows[i]["CREATETIME"].ToString().Trim();
                    temp.DEPARTMENT = listDt.Rows[i]["DEPARTMENT"].ToString().Trim();
                    temp.POSITION   = listDt.Rows[i]["POSITION"].ToString().Trim();
                    temp.MEMO       = listDt.Rows[i]["MEMO"].ToString().Trim();
                    temp.STATUS     = int.Parse(listDt.Rows[i]["STATUS"].ToString().Trim());


                    model.Items.Add(temp);
                }
            }

            return(model);
        }
Exemplo n.º 2
0
        public EstUser GetEstUserView(EstUserModels getModel)
        {
            string errorStr = "";

            EstUser model = new EstUser();

            string listQuery = " SELECT SEQNO, EST_CODE, EMAIL, PASSWD, USERNAME, TELNO, GROUP_ID, CREATETIME, DEPARTMENT, POSITION, MEMO, STATUS  FROM est_user WHERE SEQNO = " + getModel.act_key;

            DataTable listDt = getQueryResult(listQuery, out errorStr);


            if (listDt != null && listDt.Rows.Count != 0)
            {
                model.SEQNO      = int.Parse(listDt.Rows[0]["SEQNO"].ToString().Trim());
                model.EST_CODE   = listDt.Rows[0]["EST_CODE"].ToString().Trim();
                model.EMAIL      = listDt.Rows[0]["EMAIL"].ToString().Trim();
                model.PASSWD     = listDt.Rows[0]["PASSWD"].ToString().Trim();
                model.USERNAME   = listDt.Rows[0]["USERNAME"].ToString().Trim();
                model.TELNO      = listDt.Rows[0]["TELNO"].ToString().Trim();
                model.GROUP_ID   = int.Parse(listDt.Rows[0]["GROUP_ID"].ToString().Trim());
                model.CREATETIME = listDt.Rows[0]["CREATETIME"].ToString().Trim();
                model.DEPARTMENT = listDt.Rows[0]["DEPARTMENT"].ToString().Trim();
                model.POSITION   = listDt.Rows[0]["POSITION"].ToString().Trim();
                model.MEMO       = listDt.Rows[0]["MEMO"].ToString().Trim();
                model.STATUS     = int.Parse(listDt.Rows[0]["STATUS"].ToString().Trim());
            }

            return(model);
        }
Exemplo n.º 3
0
        //계정 관리 ====================================================================================================

        // GET: Est EST STATION Est 정보 관리-> 계정 관리
        public ActionResult EstIframeUser(string msg, string estCode)
        {
            //권한 체크===================================================
            if (!chk.chkPermission("EstInfo", "PER_SELECT"))
            {
                return(RedirectToAction("Index", "Home", new { msg = chk.alertStr }));
            }
            //===========================================================

            TempData["PublicMsg"] = null;
            if (!string.IsNullOrEmpty(msg))
            {
                TempData["PublicMsg"] = msg;
            }

            EstUserModels model = new EstUserModels();

            //model.Item.EST_CODE = estCode;
            model.viewEstCode = estCode;

            model = act.GetEstUserList(model, estCode);


            return(View(model));
        }
Exemplo n.º 4
0
        public string SetEstUser(EstUserModels model)
        {
            string errorStr    = "";
            string result      = "";
            string exeQueryStr = "";

            if (model.act_type != null && model.act_type == "ins")
            {
                exeQueryStr  = " INSERT INTO est_user ( EMAIL, EST_CODE, PASSWD, USERNAME, TELNO, GROUP_ID, DEPARTMENT, POSITION, MEMO, STATUS )VALUES(  ";
                exeQueryStr += " '" + model.Item.EMAIL + "'";
                exeQueryStr += " , '" + model.Item.EST_CODE + "'";
                exeQueryStr += " , '" + model.Item.PASSWD + "'";
                exeQueryStr += " , '" + model.Item.USERNAME + "'";
                exeQueryStr += " , '" + model.Item.TELNO + "'";
                exeQueryStr += " , " + model.Item.GROUP_ID;
                exeQueryStr += " , '" + model.Item.DEPARTMENT + "'";
                exeQueryStr += " , '" + model.Item.POSITION + "'";
                exeQueryStr += " , '" + model.Item.MEMO + "'";
                exeQueryStr += " , " + model.Item.STATUS;
                exeQueryStr += " ) ";
            }
            else if (model.act_type != null && model.act_type == "updt")
            {
                exeQueryStr  = " UPDATE est_user SET ";
                exeQueryStr += " EMAIL = '" + model.Item.EMAIL + "'";
                exeQueryStr += " ,EST_CODE = '" + model.Item.EST_CODE + "'";
                //exeQueryStr += " ,PASSWD = '" + model.Item.PASSWD + "'";
                exeQueryStr += " ,USERNAME = '******'";
                exeQueryStr += " ,TELNO = '" + model.Item.TELNO + "'";
                exeQueryStr += " ,GROUP_ID = " + model.Item.GROUP_ID;
                exeQueryStr += " ,DEPARTMENT = '" + model.Item.DEPARTMENT + "'";
                exeQueryStr += " ,POSITION = '" + model.Item.POSITION + "'";
                exeQueryStr += " ,MEMO = '" + model.Item.MEMO + "'";
                exeQueryStr += " ,STATUS = " + model.Item.STATUS;
                exeQueryStr += " WHERE SEQNO = " + model.Item.SEQNO;
            }
            else
            {
                result = "잘못된 접근입니다.";
                return(result);
            }

            if (exeQuery(exeQueryStr, out errorStr))
            {
                result = "성공.";
            }
            else
            {
                result = "실패.";
            }

            return(result);
        }
Exemplo n.º 5
0
        public ActionResult EstIframeUserView(EstUserModels model)
        {
            if (model.act_type == "ins")
            {
                //권한 체크===================================================
                if (!chk.chkPermission("EstInfo", "PER_INSERT"))
                {
                    return(RedirectToAction("EstIframeUserView", new { msg = chk.alertStr }));
                }
                //===========================================================
            }

            if (model.act_type == "updt")
            {
                //권한 체크===================================================
                if (!chk.chkPermission("EstInfo", "PER_UPDATE"))
                {
                    return(RedirectToAction("EstIframeUserView", new { msg = chk.alertStr }));
                }
                //===========================================================
            }


            //if (!ModelState.IsValid)
            //return View(model);

            //라디오버튼 쓰기
            if (model.RadioBoxPop == true)
            {
                model.Item.STATUS = 1;
            }
            else
            {
                model.Item.STATUS = 0;
            }

            model.Item.GROUP_ID = model.GroupId;

            model.RadioBoxPop = false;
            if (model.Item.STATUS == 1)
            {
                model.RadioBoxPop = true;
            }

            //SELECT BOX ARRAY 데이터 설정
            model.GroupIdArray = comF.GroupIdSelectBox();


            string PublicPopupMsg = act.SetEstUser(model);

            return(RedirectToAction("EstIframeUser", new { seqNo = model.act_key, Msg = PublicPopupMsg }));
        }
Exemplo n.º 6
0
        // GET: Est EST STATION Est 정보 관리 -> 계정 관리 상세
        public ActionResult EstIframeUserView(string seqNo, string Msg)
        {
            //권한 체크===================================================
            if (!chk.chkPermission("EstInfo", "PER_SELECT"))
            {
                return(RedirectToAction("Index", "Home", new { msg = chk.alertStr }));
            }
            //===========================================================

            EstUserModels model  = new EstUserModels();
            int           pSeqNo = 0;

            if (int.TryParse(seqNo, out pSeqNo))
            {
                model.act_type = "updt";
                model.act_key  = pSeqNo;
            }
            else
            {
                model.act_type      = "ins";
                model.Item.GROUP_ID = 0;
            }

            if (!String.IsNullOrEmpty(Msg))
            {
                ViewBag.PublicPopupMsg = Msg;
            }

            model.Item        = act.GetEstUserView(model);
            model.RadioBoxPop = false;
            if (model.Item.STATUS == 1)
            {
                model.RadioBoxPop = true;
            }

            //SELECT BOX ARRAY 데이터 설정 comF에 그룹 id 추가해야한다.
            model.GroupIdArray = comF.GroupIdSelectBox();

            return(View(model));
        }
Exemplo n.º 7
0
        public ActionResult EstIframeUser(EstUserModels model, string estCode)
        {
            //권한 체크===================================================
            if (!chk.chkPermission("EstInfo", "PER_SELECT"))
            {
                return(RedirectToAction("Index", "Home", new { msg = chk.alertStr }));
            }
            //===========================================================


            //삭제일 경우
            if (model.act_type == "del")
            {
                //권한 체크===================================================
                if (!chk.chkPermission("EstInfo", "PER_DELETE"))
                {
                    return(RedirectToAction("EstIframeUser", new { msg = chk.alertStr }));
                }
                //===========================================================

                TempData["PublicMsg"] = act.DelEstUser(model.act_key);                 //삭제
                model.act_type        = "list";
                model.act_key         = 0;
                return(RedirectToAction("EstIframeUser", model));
            }

            model = act.GetEstUserList(model, estCode);

            if (TempData["PublicMsg"] != null)
            {
                ViewBag.PublicMsg = TempData["PublicMsg"].ToString();
            }

            model.viewEstCode = estCode;

            return(View(model));
        }
Exemplo n.º 8
0
        public ActionResult Login(AccountLoginModel viewModel)
        {
            // Ensure we have a valid viewModel to work with
            if (!ModelState.IsValid)
            {
                return(View(viewModel));
            }

            //// Verify if a user exists with the provided identity information
            //var user = await _manager.FindByEmailAsync(viewModel.Email);

            //// If a user was found
            //if (user != null)
            //{
            //    // Then create an identity for it and sign it in
            //    await SignInAsync(user, viewModel.RememberMe);

            //    // If the user came from a specific page, redirect back to it
            //    return RedirectToLocal(viewModel.ReturnUrl);
            //}

            //// No existing user was found that matched the given criteria
            //ModelState.AddModelError("", "Invalid username or password.");

            //// If we got this far, something failed, redisplay form
            //return View(viewModel);



            // E-Mail 유효성 체크
            if (!GlobalFunction.EMailValidCheck(viewModel.Email))
            {
                ModelState.AddModelError("", "이메일 주소가 유효하지 않습니다.");
                return(View(viewModel));
            }

            // 사용자 정보를 가져온다
            EstUserModels EstUser = EstUserDatabase.GetUserData(viewModel.Email, viewModel.Password);

            if (EstUser == null)
            {
                ModelState.AddModelError("", "DB 연결 에러입니다. 잠시후 다시 시도하십시요.");
                return(View(viewModel));
            }
            if (EstUser.EMAIL.Length == 0)
            {
                ModelState.AddModelError("", "이메일 또는 비밀번호가 일치하지 않습니다.");
                return(View(viewModel));
            }

            // 사용자 상태 체크
            if (EstUser.STATUS != 0)  // 상태(0=사용중, 1=중지됨)
            {
                ModelState.AddModelError("", "사용자 로그인이 거부되었습니다. 관리자에게 문의하시기 바랍니다.");
                return(View(viewModel));
            }



            // STATION 정보를 가져온다
            EsmStationModels StationInfo = EsmStationDatabase.GetStationData(EstUser.EST_CODE);

            if (StationInfo == null)
            {
                ModelState.AddModelError("", "DB 연결 에러입니다. 잠시후 다시 시도하십시요.");
                return(View(viewModel));
            }
            if (StationInfo.EST_CODE.Length == 0)
            {
                ModelState.AddModelError("", "STATION 정보를 가져올수 없습니다.");
                return(View(viewModel));
            }

            // STATION 상태 체크
            if (StationInfo.STATUS != 0)  // 상태(0 = 사용중, 1 = 중지됨)
            {
                ModelState.AddModelError("", "STATION 로그인이 거부되었습니다. 관리자에게 문의하시기 바랍니다.");
                return(View(viewModel));
            }



            // 로그인 처리
            FormsAuthentication.SetAuthCookie(viewModel.Email, false);

            // 로그인 정보 저장
            CommLoginLogModels LoginLog = new CommLoginLogModels();

            LoginLog.EST_CODE    = EstUser.EST_CODE;                                         //	varchar(5)			STATION 코드
            LoginLog.ESE_CODE    = "";                                                       //	varchar(8)			SENDER 코드
            LoginLog.EMAIL       = EstUser.EMAIL;                                            //	varchar(50)			사용자 이메일
            LoginLog.LOGDATETIME = "";                                                       //	datetime			로그인 시간
            LoginLog.IPADDR      = Request.ServerVariables["REMOTE_ADDR"].ToString().Trim(); //	varchar(20)			로그인 IP
            LoginLog.TYPE        = "est";                                                    //	varchar(10)			입력구분
            CommLoginLogDatabase.SaveLoginLog(LoginLog);

            // 세션 변수 저장
            Session["ESTCODE"]   = StationInfo.EST_CODE; // STATION CODE
            Session["ESTNAME"]   = StationInfo.EST_NAME; // STATION 이름
            Session["USERID"]    = EstUser.EMAIL;        // 사용자 ID (email 주소)
            Session["USERNAME"]  = EstUser.USERNAME;     // 사용자 이름
            Session["USERPOWER"] = 1;                    // 0=esm, 1=est

            // 시작페이지로 이동
            if (Url.IsLocalUrl(viewModel.ReturnUrl) && viewModel.ReturnUrl.Length > 1 && viewModel.ReturnUrl.StartsWith("/") &&
                !viewModel.ReturnUrl.StartsWith("//") && !viewModel.ReturnUrl.StartsWith("/\\"))
            {
                return(Redirect(viewModel.ReturnUrl));
            }

            return(RedirectToAction("Index", "Home"));
        }