Example #1
0
        protected void btnWrite_Click(object sender, EventArgs e)
        {
            // 보안 문자를 정확히 입력했거나, 로그인된 상태라면
            if (IsImageTextCorrect())
            {
                UploadProcess(); // 파일 업로드 관련 코드 분리

                // 폼의 값들을 모델 클래스에 담기
                var model = new ArticleBase();
                model.Id       = Convert.ToInt32(_Id);
                model.Category = ddlCategoryList.SelectedValue; // 카테고리
                model.Name     = HtmlUtility.Encode(txtName.Text);
                model.Email    = HtmlUtility.Encode(txtEmail.Text);
                model.Homepage = txtHomepage.Text;
                model.Title    = HtmlUtility.Encode(txtTitle.Text);
                model.Content  = txtContent.Text;
                model.FileName = _FileName;
                model.FileSize = _FileSize;
                model.Password = txtPassword.Text;
                model.PostIp   = Request.UserHostAddress;
                model.Encoding = rdoEncoding.SelectedValue;



                // 데이터베이스에 저장
                switch (FormType)
                {
                case BoardWriteFormType.Modify:
                    model.ModifyIp = Request.UserHostAddress;
                    model.FileName = ViewState["FileName"].ToString();
                    model.FileSize = Convert.ToInt32(ViewState["FileSize"]);
                    int r = _repository.UpdateModel(model);
                    if (r > 0)     // 업데이트 완료
                    {
                        Response.Redirect($"AnswerDetails.aspx?Id={_Id}");
                    }
                    else
                    {
                        lblError.Text = "업데이트가 되지 않았습니다. 암호를 확인하세요.";
                    }
                    break;

                case BoardWriteFormType.Reply:
                    model.ParentNum = Convert.ToInt32(_Id);
                    _repository.ReplyModel(model);
                    Response.Redirect("AnswerIndex.aspx");
                    break;

                default:
                    Console.WriteLine(_repository + "/" + model);
                    _repository.Add(model);
                    Response.Redirect("AnswerIndex.aspx");
                    break;
                }
            }
            else
            {
                lblError.Text = "보안 코드가 틀립니다. 다시 입력하세요.";
            }
        }
Example #2
0
        /// <summary>
        /// 저장 버튼 클릭스 해당 정보를 Note 객채로 변환해 DB에 저장
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnWrite_Click(object sender, EventArgs e)
        {
            if (IsImageTextCorrect())
            {
                UploadProcess(); // 파일 업로드 프로세스 구현

                Note note = new Note();
                note.Name     = txtName.Text;
                note.Email    = HtmlUtility.Encode(txtEmail.Text);
                note.Homepage = txtHomepage.Text;
                note.Title    = txtTitle.Text;

                note.Content  = HtmlUtility.Encode(txtContent.Text);
                note.FileName = _FileName;
                note.FileSize = _FileSize;
                note.Password = txtPassword.Text;
                note.PostIp   = Request.UserHostAddress;
                note.Encoding = rdoEncoding.SelectedValue;

                NoteRepository repo = new NoteRepository();
                repo.Add(note);


                Response.Redirect("BoardList.aspx");
            }
            else
            {
                lblError.Text = "보안코드가 틀립니다. 다시 입력하세요.";
            }
        }
Example #3
0
        public static string Translate(EditType type)
        {
            switch (type)
            {
            case EditType.WebEdit:
                return(HtmlUtility.Encode(SR.StudyDetails_WebEdit_Description));

            case EditType.WebServiceEdit:
                return(HtmlUtility.Encode(SR.StudyDetails_WebServiceEdit_Description));
            }

            return(HtmlUtility.Encode(HtmlUtility.GetEnumInfo(type).LongDescription));
        }
Example #4
0
        public static string Translate(StudyReconcileAction action)
        {
            switch (action)
            {
            case StudyReconcileAction.CreateNewStudy:
                return(HtmlUtility.Encode(SR.StudyDetails_Reconcile_NewStudy_Description));

            case StudyReconcileAction.Discard:
                return(HtmlUtility.Encode(SR.StudyDetails_Reconcile_Discard_Description));

            case StudyReconcileAction.Merge:
                return(HtmlUtility.Encode(SR.StudyDetails_Reconcile_Merge_Description));

            case StudyReconcileAction.ProcessAsIs:
                return(HtmlUtility.Encode(SR.StudyDetails_Reconcile_ProcessAsIs_Description));
            }

            return(HtmlUtility.Encode(HtmlUtility.GetEnumInfo(action).LongDescription));
        }
Example #5
0
        protected void btnWrite_Click(object sender, EventArgs e)
        {
            //보안 문자를 정확히 입력햇거나, 로그인이 된 상태라면...
            if (IsImageTextCorrect())
            {
                UploadProcess(); //파일 업로드 관련 코드 분리

                Note note = new Note();

                note.Id = Convert.ToInt32(_Id);

                note.Name     = txtName.Text;
                note.Email    = HtmlUtility.Encode(txtEmail.Text);
                note.Homepage = txtHomepage.Text;
                note.Title    = HtmlUtility.Encode(txtTitle.Text);
                note.Content  = txtContent.Text;
                note.FileName = _FileName;
                note.FileSize = _FileSize;
                note.Password = txtPassword.Text;
                note.PostIp   = Request.UserHostAddress;
                note.Encoding = rdoEncoding.SelectedValue;

                NoteRepository repository = new NoteRepository();

                switch (FormType)
                {
                case BoardWriteFormType.Write:
                    repository.Add(note);
                    Response.Redirect("BoardList.aspx");
                    break;

                case BoardWriteFormType.Modify:
                    note.ModifyIp = Request.UserHostAddress;
                    note.FileName = ViewState["FileName"].ToString();
                    note.FileSize = Convert.ToInt32(ViewState["FileSize"]);
                    int r = repository.UpdateNote(note);
                    if (r > 0)     //업데이트 완료
                    {
                        Response.Redirect($"BoardView.aspx?Id={_Id}");
                    }
                    else
                    {
                        lblError.Text = "업데이트가 되지 않았습니다. 암호를 확인하세요.";
                    }
                    break;

                case BoardWriteFormType.Reply:
                    note.ParentNum = Convert.ToInt32(_Id);
                    repository.ReplyNote(note);
                    Response.Redirect("BoardList.aspx");
                    break;

                default:
                    repository.Add(note);
                    Response.Redirect("BoardList.aspx");
                    break;
                }
            }
            else
            {
                lblError.Text = "보안코드가 틀립니다. 다시 입력하세요.";
            }
        }