private void GetListInfo(int PagePerData, int CurrentPage, int intIdx) { Board_NTx_Dac oWS = new Board_NTx_Dac(); if (IntegerUtil.intValid(this.ParamPageViewRow.Value, 10) > 10) { PagePerData = IntegerUtil.intValid(this.ParamPageViewRow.Value, 10); } List <BoardReplyBean> GetList = oWS.TOTALBBS_BOARD_REPLY_INFO_SEL(PagePerData, CurrentPage, "L", intIdx); int BoardTotalCnt = oWS.TOTALBBS_BOARD_REPLY_INFO_COUNT_SEL(PagePerData, CurrentPage, "T", intIdx); NoDataTotalCnt = BoardTotalCnt; TotalCnt = BoardTotalCnt - ((CurrentPage - 1) * PagePerData); this.ltTotalCnt.Text = String.Format(CultureInfo.InvariantCulture, "{0:0,0}", BoardTotalCnt) + "개"; //Repeater 바인딩 if (NoDataTotalCnt == 0) { this.rptGetList.DataSource = GetList; this.rptGetList.DataBind(); } else { this.rptGetList.DataSource = GetList; this.rptGetList.DataBind(); } PagingHelper1.VirtualItemCount = NoDataTotalCnt; ParamPage.Value = CurrentPage.ToString(); }
private int DeleteBoard() { try { Board_Tx_Dac oWS = new Board_Tx_Dac(); Board_NTx_Dac oWSN = new Board_NTx_Dac(); int RemoveIdx = IntegerUtil.intValid(WebUtil.SCRequestFormString("hdfIdx", string.Empty), 0); int ReturnValue = 0; DataSet ds = oWSN.TOTALBBS_BOARD_VIEW_FILE_INFO_SEL(RemoveIdx); int FileDelCnt = ds.Tables[0].Rows.Count; ReturnValue = oWS.TOTALBBS_BOARD_FILE_INFO_VIEW_DEL(RemoveIdx, FileDelCnt); if (ReturnValue > 0) { DataTable dt = ds.Tables[0]; foreach (DataRow dr in dt.Rows) { LocalFileControls.FileDelete(FileUploadPath, dr["strFileName"].ToString()); } } return(ReturnValue); } catch (Exception ex) { #region [Error Logger] 로그인을 한경우 //ErrorLogger_Tx_Dac.GetErrorLogger_Tx_Dac().TB_TOTABBS_ERROR_LOGGER_INFO_INS_SP(ex, admin.MemberId, admin.MemberNm); #endregion return(0); } }
private void GetPageInfoSetting(string ParamBoardCategory, string ParamField, string ParamKey, int Idx, int PageNo, string CMD) { //페이지 HTML 언어 세팅 this.ltThBoardCategory.Text = "게시판 카테고리"; this.ltThWriteCategory.Text = "게시글 카테고리"; this.ltThUserId.Text = "작성자 아이디"; this.ltThWriter.Text = "작성자 이름"; this.ltThSubject.Text = "제목"; this.ltThContent.Text = "내용"; this.ltRegiDate.Text = "등록일"; this.ltViewCnt.Text = "조회수"; DataSet ds = null; if (CMD.Equals("V")) { Board_NTx_Dac oWS = new Board_NTx_Dac(); ds = oWS.TOTALBBS_BOARD_VIEW_SEL(Idx); } else { this.trVisible_2.Attributes.Add("style", "display:none"); this.trVisible_2.Visible = false; } this.GetPageSetting(Idx, ds, CMD); }
private void GetListInfo(int PagePerData, int CurrentPage, string BoardCategory, string ORDERBY, string FIELD, string KEY) { Board_NTx_Dac oWS = new Board_NTx_Dac(); string strKey = TextControl.TextCutString(HttpUtility.HtmlEncode(KEY), 20, ""); if (IntegerUtil.intValid(this.ParamPageViewRow.Value, 10) > 10) { PagePerData = IntegerUtil.intValid(this.ParamPageViewRow.Value, 10); } List <BoardBean> GetNotiList = oWS.TOTALBBS_BOARD_NOTICE_INFO_SEL(PagePerData, "L"); List <BoardBean> GetList = oWS.TOTALBBS_BOARD_INFO_SEL(PagePerData, CurrentPage, BoardCategory, "L", "IDX", FIELD, strKey); GetNotiList.AddRange(GetList); int BoardTotalCnt = oWS.TOTALBBS_BOARD_INFO_COUNT_SEL(PagePerData, CurrentPage, BoardCategory, "T", ORDERBY, FIELD, strKey); NoDataTotalCnt = BoardTotalCnt; TotalCnt = BoardTotalCnt - ((CurrentPage - 1) * PagePerData); this.ltTotalCnt.Text = String.Format(CultureInfo.InvariantCulture, "{0:0,0}", BoardTotalCnt) + "개"; //Repeater 바인딩 if (NoDataTotalCnt == 0) { this.rptGetList.DataSource = GetNotiList; this.rptGetList.DataBind(); } else { this.rptGetList.DataSource = GetNotiList; this.rptGetList.DataBind(); } PagingHelper1.VirtualItemCount = NoDataTotalCnt; ParamPage.Value = CurrentPage.ToString(); }
private void GetPageInfoSetting(string ParamBoardCategory, string ParamField, string ParamKey, int Idx, int PageNo, string CMD) { //페이지 HTML 언어 세팅 this.ltBoardCategory.Text = "게시판 카테고리"; this.ltWriteCategory.Text = "게시글 카테고리"; this.ltUserId.Text = "작성자 아이디"; this.ltWriter.Text = "작성자 이름"; this.ltSubject.Text = "제목"; this.ltContent.Text = "내용"; this.ltRegiDate.Text = "등록일"; this.ltViewCnt.Text = "조회수"; #region [DropDownList 설정] Common_NTx_Dac ddlSet = new Common_NTx_Dac(); // 게시판 카테고리 필드 DataTable BoardCategorydt = null; BoardCategorydt = ddlSet.TOTALBBS_BOARD_CATEGORY_INFO_SEL(-1); int ddlBoardCategorySeletedValue = IntegerUtil.intValid(this.ddlBoardCategory.SelectedValue, -1); // 게시판 카테고리 필드 - DropDownList if (BoardCategorydt.Rows.Count == 0) { this.ddlWriteCategory.Items.Clear(); this.ddlBoardCategory.Items.Add(new ListItem("등록된 카테고리가 없습니다.", "")); this.ddlBoardCategory.Enabled = false; } else { this.ddlBoardCategory.Items.Clear(); DropDownListUtil.SetDropDownListValue(BoardCategorydt, this.ddlBoardCategory, this.ddlBoardCategory.SelectedValue, DropDownListUtil.DropDownFlag.Select); } // 게시글 카테고리 필드 DataTable WriteCategorydt = null; WriteCategorydt = ddlSet.TOTALBBS_WRITE_CATEGORY_INFO_SEL(ddlBoardCategorySeletedValue); // 게시글 카테고리 필드 - DropDownList if (WriteCategorydt.Rows.Count == 0) { this.ddlWriteCategory.Items.Clear(); this.ddlWriteCategory.Items.Add(new ListItem("등록된 카테고리가 없습니다.", "")); this.ddlWriteCategory.Enabled = false; } else { this.ddlWriteCategory.Items.Clear(); DropDownListUtil.SetDropDownListValue(WriteCategorydt, this.ddlWriteCategory, this.ddlWriteCategory.SelectedValue, DropDownListUtil.DropDownFlag.Select); } #endregion DataSet ds = null; if (CMD.Equals("M")) { Board_NTx_Dac oWS = new Board_NTx_Dac(); ds = oWS.TOTALBBS_BOARD_VIEW_SEL(Idx); } else { this.trVisible_2.Attributes.Add("style", "display:none"); this.trVisible_2.Visible = false; } this.GetPageSetting(Idx, ds, CMD); }
private int UpdateBoard() { try { Board_Tx_Dac oWS = new Board_Tx_Dac(); Board_NTx_Dac oWSN = new Board_NTx_Dac(); int ModIdx = IntegerUtil.intValid(WebUtil.SCRequestFormString("hdfIdx", string.Empty), 0); int intBoardCategory = Convert.ToInt32(WebUtil.SCRequestFormString("ddlBoardCategory", "1")); int intWriteCategory = Convert.ToInt32(WebUtil.SCRequestFormString("ddlWriteCategory", "1")); string strUserId = WebUtil.SCRequestFormString("txtUserId", string.Empty); string strWriter = WebUtil.SCRequestFormString("txtWriter", string.Empty); string strSubject = WebUtil.SCRequestFormString("txtSubject", string.Empty); string strContent = WebUtil.SCRequestFormString("txtContent", string.Empty); string ChkBoxListData = string.Empty; DataSet ds = null; DataTable dt = null; // 삭제할 목록 조회 DataTable dt1 = null; // 삭제하지 않는 목록 조회 int NoDeleteFileCnt = 0; // 삭제하지 않는 파일 수 //파일 리스트 조회(삭제할 목록과 삭제 하지 않을 목록 분리하여 가져옴) //체크박스 선택 여부 if (ModIdx > 0 && Request.Form["chkAttached_" + ModIdx + ""] != null) { ChkBoxListData = Request.Form["chkAttached_" + ModIdx + ""].ToString(); ds = oWSN.TOTALBBS_BOARD_FILE_INFO_SEL(ModIdx, ChkBoxListData); } else { ChkBoxListData = "0"; ds = oWSN.TOTALBBS_BOARD_FILE_INFO_SEL(ModIdx, ChkBoxListData); } string OldFileName = string.Empty; string NewFileName = string.Empty; string FileUploadPath = string.Empty; if (ds != null) { dt = ds.Tables[0]; // 삭제할 목록 조회 dt1 = ds.Tables[1]; // 삭제하지 않는 목록 조회 if (dt1.Rows.Count > 0) { NoDeleteFileCnt = dt1.Rows.Count; } } int iData = 0; List <FileBean> GecAttachedList = new List <FileBean>(); if (ds != null) { //삭제 하지 않을 목록을 조회 하여 처리 foreach (DataRow dr in dt1.Rows) { if (iData == 0) { OldFileName = dr["strRealFileName"].ToString(); NewFileName = dr["strFileName"].ToString(); FileUploadPath = dr["strFilePath"].ToString(); } iData = iData + 1; FileBean AFBean = new FileBean(); AFBean.strRealFileName = dr["strRealFileName"].ToString(); // 파일 원본 이름 AFBean.strFileName = dr["strFileName"].ToString(); // 파일 업로드후 생성된 새이름 AFBean.strFilePath = dr["strFilePath"].ToString(); // 파일 업로드 경로 디비에 넣지 않는경우 /FileUpload/ + FileUploadPath경로 수동 입력 해도됨 AFBean.intFileSort = iData; GecAttachedList.Add(AFBean); } if (dt.Rows.Count > 0) { foreach (DataRow dr in dt.Rows) { for (int i = 0; i < 1; i++) { FileUploadPath = dr["strFilePath"].ToString(); } } } } HttpFileCollection files = HttpContext.Current.Request.Files; int FileTotalCnt = files.Count; int FileSort = 0; // 웹 취약성 추가 파일 첨부시 aspx 에서 검사 후 cs 단에서 한번 더 검사 string[] ContentType = null; // 첨부파일 타입 구분배열 변수 #region [파일 업로드 정보를 조회] if (FileTotalCnt > 0) { for (int i = 0; i < FileTotalCnt; i++) { HttpPostedFile postedFile = files[i]; FileBean AFBean = new FileBean(); FileSort = iData + i; string[] FilesInfo1 = new string[3]; ContentType = postedFile.ContentType.Split('/'); //빈파일일때 if (postedFile.ContentLength > 1) { FilesInfo1 = FileName(postedFile); if (FilesInfo1 != null) { if (FileSort == 0) { OldFileName = FilesInfo1[0]; NewFileName = FilesInfo1[1]; FileUploadPath = FilesInfo1[2]; } AFBean.strRealFileName = FilesInfo1[0]; // 파일 원본 이름 AFBean.strFileName = FilesInfo1[1]; // 파일 업로드후 생성된 새이름 AFBean.strFilePath = FilesInfo1[2]; // 파일 업로드 경로 디비에 넣지 않는경우 /FileUpload/ + FileUploadPath경로 수동 입력 해도됨 AFBean.intFileSort = FileSort + 1; GecAttachedList.Add(AFBean); } else { FileTotalCnt = 0; } } else { FileTotalCnt = 0; } } } #endregion int MasterReturnValue = 0; int ReturnValue = 0; MasterReturnValue = oWS.TOTALBBS_BOARD_INFO_UPD(ModIdx, intBoardCategory, intWriteCategory, strUserId, strWriter, strSubject, strContent); if (MasterReturnValue > 0) { if (GecAttachedList.Count > 0) { foreach (FileBean Item in GecAttachedList) { ReturnValue = oWS.TOTALBBS_BOARD_FILE_INFO_UPD(ModIdx, Item.strRealFileName, Item.strFileName, Item.strFilePath, Item.intFileSort); } } else { //전체 제크 및 한개만 있을때 체크 했을때 ReturnValue = oWS.TOTALBBS_BOARD_FILE_INFO_DEL_SELECTED(ChkBoxListData); } } //첨부파일 등록이 하나도 없을시 if (GecAttachedList.Count.Equals(0)) { ReturnValue = -10; } //체크박스 선택 파일 삭제 시키기 if (!ChkBoxListData.Equals("0")) { //삭제 foreach (DataRow dr in dt.Rows) { //경로를 넘기는데 \\ 수가 맞지 않아 메서드 추가함 수정시 삭제에 사용 LocalFileControls.FileDelete_New(FileUploadPath, dr["strFileName"].ToString()); } } return(ReturnValue); } catch (Exception ex) { #region [Error Logger] 로그인을 한경우 //ErrorLogger_Tx_Dac.GetErrorLogger_Tx_Dac().TB_TOTABBS_ERROR_LOGGER_INFO_INS_SP(ex, admin.MemberId, admin.MemberNm); #endregion return(0); } }