protected void btnRegistrationExcel_Click(object sender, EventArgs e) { // 서포트 리스트 엑셀 다운로드 var registationRepo = new SupportRegistrationRepository(); // 현재 게시판의 번호에 해당하는 등록자 리스트 가져오기 var registrations = registationRepo.GetAll(BoardName, BoardNum); for (int i = 0; i < registrations.Count; i++) { registrations[i].Product = registrations[i].Product .Replace("\r\n", ",").Replace("\n", ","); } // 엑셀로 다운로드 ExcelDownUtility.ExcelDownloadWithTabSeparatedValues( registrations, Response.Output); }
protected void btnSave_Click(object sender, EventArgs e) { // sender 개체를 버튼으로 변환 후 현재 클릭 이벤트를 발생시킨 ID 가져오기 Button btn = sender as Button; SupportRegistration model = new SupportRegistration(); model.SupportSettingId = -1; model.BoardName = hdnBoardName.Value; model.BoardNum = Convert.ToInt32(hdnNum.Value); model.BoardTitle = "제목"; model.CreationDate = DateTime.Now; model.UserId = Convert.ToInt32(-1); model.Username = "******"; model.NickName = "닉네임"; model.Name = txtName.Text; model.Mobile = txtMobile.Text; model.Company = txtCompany.Text; model.Homepage = txtHomepage.Text; model.SupportDate = txtDateTime.Text; model.Recipient = txtRecipient.Text; model.Product = txtProduct.Text; // 서버측 유효성 검사 진행 if (model.Name == "") { Page.ClientScript.RegisterClientScriptBlock( this.GetType(), "NoValidate", "<script>이름을 입력하세요.</script>"); } else { var repository = new SupportRegistrationRepository(); // 어떤 버튼이 클릭되었는지 확인 후 해당 기능(저장, 수정, 삭제) 수행 if (btn.ID == "btnSave") { // 체크박스 2개와 등록자 서명(이름) 기입하면 저장 가능 if (chkNecessary.Checked && chkOption.Checked && txtAgreementName.Text != "") { // 입력 repository.Add(model); } else { lblError.Visible = true; return; } } else if (btn.ID == "btnModify") { // 수정 repository.Update(model); } else if (btn.ID == "btnDelete") { repository.Remove(BoardName, BoardNum, Username); } Response.Redirect(Request.RawUrl); } }
public SupportSettingViewUserControl() { _respository = new SupportRegistrationRepository(); }
public SupportRegistrationFormUserControl() { _repository = new SupportRegistrationRepository(); Username = "******"; // TODO: 여기는 변경할 것 }