Ejemplo n.º 1
0
            public void History_write(string user_id, string _page, string _state)
            {
                db_e db = new db_e();

                string user_name       = UserData.user_get(user_id, "user_name");
                string department_id   = UserData.user_get(user_id, "department_id");
                string department_name = UserData.user_get(user_id, "department_name");
                string company_id      = UserData.user_get(user_id, "company_id");
                string company_name    = UserData.user_get(user_id, "company_name");
                string auth            = UserData.user_get(user_id, "auth");

                var _insert = new history
                {
                    user_id       = user_id,
                    company_id    = company_id,
                    department_id = department_id,
                    user_ip       = "",
                    pre_page      = "",
                    connect_agent = company_name,
                    connect_host  = auth,
                    connect_path  = user_name,
                    memo          = department_name,
                    connect_date  = DateTime.Now,
                    state         = _state,
                    page          = _page
                };

                db.history.Add(_insert);
                db.SaveChanges(); // 실제로 저장
            }
Ejemplo n.º 2
0
        public ActionResult hotel_action(hotel_ask doc)
        {
            string msg = "호텔 단체 요금 견적이 접수되었습니다.";

            doc.write_date = DateTime.Now;
            doc.state      = "접수";
            db2.hotel_ask.Add(doc);
            db2.SaveChanges(); // 실제로 저장

            return
                (Content("<html><script>alert('" + msg +
                         "'); window.top.location.href ='/Shop/producthotel_ko';</script></html>"));
        }
Ejemplo n.º 3
0
        public ActionResult code_nationality_action(code_nationality doc, string mode_type, string idx)
        {
            string msg = "";


            if (string.IsNullOrEmpty(idx))
            {
                #region 저장

                doc.write_date  = DateTime.Now;
                doc.writer_id   = User.Identity.Name;
                doc.index_order = 9;
                doc.use_yn      = "Y";
                db.code_nationality.Add(doc);
                db.SaveChanges(); // 실제로 저장


                msg = Util.msg.msg_insert;

                #endregion
            }
            else
            {
                if (mode_type == "D")
                {
                    #region 삭제

                    code_nationality doc_del = db.code_nationality.Single(x => x.code_id == idx);
                    db.code_nationality.Remove(doc_del);
                    db.SaveChanges();

                    msg = Util.msg.msg_del;

                    #endregion
                }
                else
                {
                    #region 수정

                    doc.writer_id       = User.Identity.Name;
                    doc.write_date      = DateTime.Now;
                    doc.index_order     = 9;
                    doc.use_yn          = "Y";
                    db.Entry(doc).State = EntityState.Modified;
                    db.SaveChanges();

                    msg = Util.msg.msg_edit;

                    #endregion
                }
            }

            return(Redirect("/code/code_nationality_list"));
        }
Ejemplo n.º 4
0
        public ActionResult BoardView(int idx, int?cate)
        {
            if (idx == 0)
            {
                //0번 게시글은 임시글로써, DB에 존재하지 않는 글임
                return(NotFound());
            }

            //권한 시작==============================================================================================
            BoardAuth(idx, cate);
            //권한 끝================================================================================================

            BoardList data = db.BoardList.Find(idx);

            #region  일 가져오기
            //파일 가져오기=====================================================================================================================

            var _list = (from a in db.BoardFile where a.Md_id == data.fileId && a.use_yn != "N" select a).OrderByDescending(p => p.id).ToList();

            ViewBag.이미지리스트    = _list;
            ViewBag.이미지리스트카운트 = _list.Count();

            //파일 끝============================================================================================================================
            #endregion

            #region 조회수 증가

            data.hit = data.hit + 1;;

            db.SaveChanges(); // 실제로 저장


            #endregion

            #region 읽은 사용자 저장

            int _readCount = (from a in db.BoardRread where a.board_idx == idx && a.user_id == User.Identity.Name select a.idx).Count();

            if (_readCount == 0)
            {
                var _insert = new BoardRread
                {
                    user_id   = User.Identity.Name,
                    user_name = (from a in db.user where a.user_id == User.Identity.Name select a.user_name).FirstOrDefault(),
                    read_date = DateTime.Now,
                    board_idx = idx
                };

                db.BoardRread.Add(_insert);
                db.SaveChanges(); // 실제로 저장
            }


            var _read = (from a in db.BoardRread where a.board_idx == idx select a).ToList();

            ViewBag.읽은사람 = _read;

            #endregion

            #region 코멘트 가져오기

            IQueryable <BoardComment> _listComent = Enumerable.Empty <BoardComment>().AsQueryable();

            _listComent = db.BoardComment.Where(p => p.BD_idx == idx && p.use_yn == "Y").OrderByDescending(o => o.idx);

            ViewBag.댓글  = _listComent;
            ViewBag.댓글수 = _listComent.Count();
            #endregion

            return(View(data));
        }
Ejemplo n.º 5
0
        public async Task <IActionResult> person_set_action(person doc, int?idx, string mode_type, List <IFormFile> ImageFile)
        {
            string file_id = "";

            #region 기본 사용자 정보
            string user_id        = User.Identity.Name;
            int    department_idx = Convert.ToInt32(UserData.user_get(user_id, "department_idx"));
            int    company_idx    = Convert.ToInt32(UserData.user_get(user_id, "company_idx"));
            int    auth           = Convert.ToInt32(UserData.user_get(user_id, "auth"));
            #endregion

            string msg = "";



            if (doc.use_yn == "on")
            {
                doc.use_yn = "Y";
            }
            else
            {
                doc.use_yn = "N";
            }


            if (idx == null)
            {
                #region 저장
                msg     = "입력";
                file_id = user_id + DateTime.Now.ToShortDateString() + DateTime.Now.Hour.ToString() + DateTime.Now.Minute.ToString() + DateTime.Now.Second.ToString() + DateTime.Now.Millisecond.ToString();

                doc.write_date = DateTime.Now;
                doc.fileId     = file_id;
                db.person.Add(doc);
                db.SaveChanges(); // 실제로 저장


                msg = Util.msg.msg_insert;

                #endregion
            }
            else
            {
                if (mode_type == "D")
                {
                    #region 삭제



                    person _update =
                        (from a in db.person where a.idx == idx select a).Single();
                    _update.use_yn = "N";


                    db.SaveChanges(); // 실제로 저장



                    #endregion
                }
                else
                {
                    #region 수정
                    msg     = "수정";
                    file_id = doc.fileId;

                    if (string.IsNullOrEmpty(file_id))
                    {
                        file_id = user_id + DateTime.Now.ToShortDateString() + DateTime.Now.Hour.ToString() + DateTime.Now.Minute.ToString() + DateTime.Now.Second.ToString() + DateTime.Now.Millisecond.ToString();

                        doc.fileId = file_id;
                    }

                    doc.edit_date = DateTime.Now;


                    db.Entry(doc).State = EntityState.Modified;

                    //idx 제외 업데이트=================================
                    db.Entry(doc).Property("write_date").IsModified    = false;
                    db.Entry(doc).Property("work_end_date").IsModified = false;
                    //==================================================


                    db.SaveChanges();

                    msg = Util.msg.msg_edit;

                    #endregion
                }
            }
            #region  일 올리기


            var builder = new ConfigurationBuilder().SetBasePath(Directory.GetCurrentDirectory()).AddJsonFile("appsettings.json");
            Configuration = builder.Build();
            string Models_photo = Configuration["user_app:file_list_url"];
            string company_id   = UserData.user_get(user_id, "company_id");


            int s = 1;
            foreach (var formFile in ImageFile)
            {
                double file_size = formFile.Length;
                if (file_size < _fileSizeLimit)
                {
                    var formFileContent =
                        await FileHelpers
                        .ProcessFormFile <IFormFile>(
                            formFile, ModelState, _permittedExtensions,
                            _fileSizeLimit);


                    #region 변수
                    // 변수 =========================================================================================================================
                    string only = user_id + DateTime.Today.ToShortDateString().Replace("-", "") + DateTime.Now.Hour.ToString() + DateTime.Now.Minute.ToString() + DateTime.Now.Second.ToString() + DateTime.Now.Millisecond.ToString();
                    //  var trustedFileNameForFileStorage = Path.GetRandomFileName();   //랜덤이름

                    string file_ex = ""; // 확장자

                    try { file_ex = Path.GetFileName(formFile.FileName).Split('.').Last(); }
                    catch
                    {
                    }
                    var _fileName = only + "." + file_ex;     // 신규 파일 이름



                    var    _local_path      = _targetFilePath + company_id + "/";   // 신규 파일 경로
                    var    filePath         = Path.Combine(_local_path, _fileName); // 전체 경로
                    string desiredThumbPath = _local_path + "s/";                   // 작은 이미지 전체 경로

                    string ore_fileName = Path.GetFileName(formFile.FileName);
                    #endregion



                    //경로에 폴더가 없으면 만들어준다.=============================================
                    var dInfo   = new DirectoryInfo(_local_path);
                    var dInfo_s = new DirectoryInfo(desiredThumbPath);
                    if (!dInfo.Exists)
                    {
                        dInfo.Create();
                    }
                    if (!dInfo_s.Exists)
                    {
                        dInfo_s.Create();
                    }
                    //=================================================================================



                    using (var fileStream = System.IO.File.Create(filePath))
                    {
                        await fileStream.WriteAsync(formFileContent);
                    }

                    if (get_word.img_check(file_ex) == "img")
                    {
                        // 세로 기준
                        ResizeImage(desiredThumbPath, formFile, _fileName, 300, 0);
                    }


                    var _insert = new Md_Image()
                    {
                        Md_id      = file_id,
                        ImagePath  = Models_photo + company_id + "/" + _fileName,
                        fileName   = ore_fileName,
                        use_yn     = "Y",
                        file_ex    = file_ex,
                        file_size  = file_size,
                        r_date     = DateTime.Now,
                        write_id   = User.Identity.Name,
                        sImagePath = Models_photo + company_id + "/s/" + _fileName,
                    };

                    db.Md_Image.Add(_insert);
                    db.SaveChanges();
                }
                s++;
            }


            #endregion
            return(Redirect("/person/person_set_list"));
        }
Ejemplo n.º 6
0
        public ActionResult m_photo_list_mainset()
        {
            string returnUrl = "/board/m_photo_list?cate=7";
            string m_id      = Request["m_id"] ?? "";
            int    idx       = Convert.ToInt32(Request["idx"]);

            if (!string.IsNullOrEmpty(m_id))
            {
                var _update =
                    (from a in db.BoardFile where a.machine_id == m_id select a).ToList();

                foreach (var item in _update)
                {
                    if (item.BF_idx == idx)
                    {
                        item.main_img = "Y";
                    }
                    else
                    {
                        item.main_img = "N";
                    }
                    db.SaveChanges(); // 실제로 저장
                }
            }

            return(Content("<script>alert('Set as representative image');location.href='/board/m_photo_list?search_type=" + m_id + "';</script>"));
        }
Ejemplo n.º 7
0
        public async Task <IActionResult> userinfo_action(user doc)
        {
            #region 사용자 정보 수정
            user _update =
                (from a in db.user where a.user_id == User.Identity.Name select a).Single();

            _update.user_tel = doc.user_tel;
            // _update.user_password = doc.user_password;
            _update.edit_date     = DateTime.Now;
            _update.main_bg_color = doc.main_bg_color;
            _update.language      = doc.language;
            _update.user_email    = doc.user_email;


            db.SaveChanges(); // 실제로 저장
            #endregion

            //==================================================================
            UserData UserData = new UserData();
            UserData.History_write(User.Identity.Name, "/sys/user_info", "수정");
            //===================================================================


            return(Redirect("/sys/user_info"));
        }