コード例 #1
0
        public IActionResult Sub40()
        {
            Boolean checkLogin = CheckLogin();

            if (!checkLogin)
            {
                return(RedirectToAction("Login", "Account"));
            }

            ViewBag.menulist = menulist;
            //_logger.LogInformation("sub40(): " + LoginUser.BizNum + " / " + LoginUser.StaffId);

            List <문서함> mySign = null;

            _db.LoadStoredProc("dbo.file_getSignature").AddParam("BizNum", LoginUser.BizNum).AddParam("StaffId", LoginUser.StaffId)
            .AddParam("Dname", LoginUser.Dname).Exec(r => mySign = r.ToList <문서함>());

            if (mySign.Count > 0)
            {
                // 2020년 7월 15일 부터 개인서명 저장방식 변경되어 convert
                if (mySign[0].Regdate > Convert.ToDateTime("2020-07-15"))
                {
                    var stringify_byte = Convert.ToBase64String(mySign[0].FileBlob);
                    //Console.WriteLine("tobase64 : " + stringify_byte);
                    string result = "data:image/png;base64," + stringify_byte;
                    ViewBag.mySign = result;
                }
                else
                {   // 기존 서명 저장방식에서 불러오기
                    var stringify_byte = Convert.ToBase64String(mySign[0].FileBlob);
                    System.Text.UTF8Encoding encoder    = new System.Text.UTF8Encoding();
                    System.Text.Decoder      utf8Decode = encoder.GetDecoder();
                    byte[] todecode_byte = Convert.FromBase64String(stringify_byte);
                    //Console.WriteLine("byte: " + todecode_byte);
                    int    charCount    = utf8Decode.GetCharCount(todecode_byte, 0, todecode_byte.Length);
                    char[] decoded_char = new char[charCount];
                    utf8Decode.GetChars(todecode_byte, 0, todecode_byte.Length, decoded_char, 0);
                    string result = new String(decoded_char);
                    //Console.WriteLine("result: " + result);
                    ViewBag.mySign = result;
                }
                ViewBag.SEQID = mySign[0].SeqId;

                return(View());
            }

            return(View());
        }
コード例 #2
0
        public FileContentResult FileDownload(int id)
        {
            //_logger.LogInformation("FileDownload() :" + id);

            List <문서함> fileInfo = null;

            _db.LoadStoredProc("file_data").AddParam("SeqID", id).Exec(r => fileInfo = r.ToList <문서함>());
            //_logger.LogInformation("FileDownload() " + fileInfo[0].FileName);

            var fileRes = new FileContentResult(fileInfo[0].FileBlob.ToArray(), "application/octet-stream")
            {
                FileDownloadName = fileInfo[0].FileName
            };

            return(fileRes);
        }
コード例 #3
0
        public IActionResult Index()
        {
            Boolean checkLogin = CheckLogin();

            if (!checkLogin)
            {
                return(RedirectToAction("Login", "Account"));
            }

            //ViewBag.LoginUser = LoginUser;
            //_logger.LogInformation("Index(): " + LoginUser.BizNum + " / " + LoginUser.StaffId);
            //Console.WriteLine("Index");
            //List<공지사항> noticeList = _db.공지사항.Where(r => r.LoginId == LoginUser.StaffId || r.VacId == 0).ToList<공지사항>();
            List <공지사항> noticeList = null;

            _db.LoadStoredProc("dbo.notice_getList").AddParam("StaffId", LoginUser.StaffId).AddParam("BizNum", LoginUser.BizNum)
            .AddParam("Dname", LoginUser.Dname).Exec(r => noticeList = r.ToList <공지사항>());

            ViewBag.menulist = menulist;

            return(View(noticeList));
        }
コード例 #4
0
        public IActionResult Sub20(string secondTab, string dateYear)
        {
            Boolean checkLogin = CheckLogin();

            if (!checkLogin)
            {
                return(RedirectToAction("Login", "Account"));
            }

            ViewBag.menulist = menulist;
            //_logger.LogInformation("sub2(): " + LoginUser.BizNum + " / " + LoginUser.StaffId);

            if (secondTab == null)
            {
                secondTab = "";
            }

            List <AddTimeList> Years = null;

            if (dateYear == null)
            {
                _db.LoadStoredProc("dbo.last_Year").AddParam("Type", "OT")
                .AddParam("BizNum", LoginUser.BizNum).AddParam("StaffId", LoginUser.StaffId).AddParam("Dname", LoginUser.Dname)
                .Exec(r => Years = r.ToList <AddTimeList>());
                if (Years.Count() == 0)
                {
                    dateYear = DateTime.Now.ToString("yyyy");
                }
                else
                {
                    dateYear = Years[0].년;
                }
                ViewBag.택년    = dateYear;
                ViewBag.Years = Years;
            }
            else
            {
                _db.LoadStoredProc("dbo.last_Year").AddParam("Type", "OT")
                .AddParam("BizNum", LoginUser.BizNum).AddParam("StaffId", LoginUser.StaffId).AddParam("Dname", LoginUser.Dname)
                .Exec(r => Years = r.ToList <AddTimeList>());
                ViewBag.택년       = dateYear;
                ViewBag.Years    = Years;
            }

            //var yearParam = new DateTime(int.Parse(dateYear), 01, 01);
            // OT 신청내역
            List <AddTimeList> OTlist = null;

            _db.LoadStoredProc("dbo.apply_getApplication_Year").AddParam("Type", "OT").AddParam("Year", dateYear)
            .AddParam("BizNum", LoginUser.BizNum).AddParam("StaffId", LoginUser.StaffId).AddParam("Dname", LoginUser.Dname)
            .Exec(r => OTlist = r.ToList <AddTimeList>());

            ViewBag.secondTab = secondTab;
            if (OTlist.Count > 0)
            {
                return(View(OTlist));
            }

            return(View());
        }
コード例 #5
0
        public IActionResult Sub30(string secondTab, string Snal, string Enal)
        {
            Boolean checkLogin = CheckLogin();

            if (!checkLogin)
            {
                return(RedirectToAction("Login", "Account"));
            }

            ViewBag.menulist = menulist;
            //_logger.LogInformation("sub30(): " + LoginUser.BizNum + " / " + LoginUser.StaffId + " / " + LoginUser.Dname);

            if (secondTab == null)
            {
                secondTab = "";
            }
            ViewBag.secondTab = secondTab;

            if (Snal == null && Enal == null)
            {
                Snal         = DateTime.Now.AddMonths(-1).ToString("yyyy-MM-dd");
                Enal         = DateTime.Now.AddMonths(+2).ToString("yyyy-MM-dd");
                ViewBag.Snal = Snal;
                ViewBag.Enal = Enal;
            }
            else
            {
                ViewBag.Snal = Snal;
                ViewBag.Enal = Enal;
            }
            //Console.WriteLine("sub30(): " + Snal);

            List <ApproveList> Alist = null;

            _db.LoadStoredProc("dbo.approvalList_yyyyMM").AddParam("Type", "OT").AddParam("Snal", Snal).AddParam("Enal", Enal)
            .AddParam("BizNum", LoginUser.BizNum).AddParam("StaffId", LoginUser.StaffId).AddParam("Dname", LoginUser.Dname)
            .Exec(r => Alist = r.ToList <ApproveList>());
            if (Alist != null)
            {
                return(View(Alist));
            }

            return(View());
        }
コード例 #6
0
        public string Login(string userID, string userPWD, string autoSave)
        {
            //Console.WriteLine("login() autoSave: "+ autoSave);
            LoginInfor _LoginUser = new LoginInfor();

            _db.LoadStoredProc("dbo.login_Process").AddParam("loginID", userID).AddParam("passW", userPWD)
            .Exec(r => _LoginUser = r.SingleOrDefault <LoginInfor>());
            LoginUser             = _LoginUser;
            string rs;

            if (LoginUser != null)
            {
                menulist = _db.회사별메뉴.Where(r => r.BizNum == LoginUser.BizNum && r.DName == LoginUser.Dname).ToList();
                var claims          = BuildClaims(LoginUser);
                var claimsIdentity  = new ClaimsIdentity(claims, CookieAuthenticationDefaults.AuthenticationScheme);
                var claimsPrincipal = new ClaimsPrincipal(claimsIdentity);

                if (autoSave.Equals("not_save"))
                {
                    //Console.WriteLine("------auto_save NONONONONO------");
                    HttpContext.SignInAsync(CookieAuthenticationDefaults.AuthenticationScheme, claimsPrincipal,
                                            new AuthenticationProperties {
                        IsPersistent = false
                    });
                }
                else
                {
                    //Console.WriteLine("------auto_save------");
                    HttpContext.SignInAsync(CookieAuthenticationDefaults.AuthenticationScheme, claimsPrincipal,
                                            new AuthenticationProperties {
                        IsPersistent = true, ExpiresUtc = DateTime.UtcNow.AddDays(50)
                    });
                    //new AuthenticationProperties { IsPersistent = true, ExpiresUtc = DateTime.UtcNow.AddSeconds(10)});
                }

                IPAddress ip;
                var       headers = Request.Headers.ToList();
                if (headers.Exists((kvp) => kvp.Key == "X-Forwarded-For"))
                {
                    // when running behind a load balancer you can expect this header
                    var header = headers.First((kvp) => kvp.Key == "X-Forwarded-For").Value.ToString();
                    ip = IPAddress.Parse(header);
                }
                else
                {
                    // this will always have a value (running locally in development won't have the header)
                    ip = Request.HttpContext.Connection.RemoteIpAddress;
                }



                // 로그인 기록 남기기
                int a = _db.LoadStoredProc("dbo.login_insert_Record_IP").AddParam("Dname", LoginUser.Dname).AddParam("BizNum", LoginUser.BizNum)
                        .AddParam("CompanyName", LoginUser.CompanyName).AddParam("StaffID", LoginUser.StaffId).AddParam("IP", ip.ToString())
                        .ExecNonQuery();
                if (a <= 0)
                {
                    return(rs = "fail");
                }

                rs = "success";
            }
            else
            {
                rs = "fail";
            }
            return(rs);
        }