protected void btnContribute_Click(object sender, System.EventArgs e) { if (!CheckPreContribute()) { return; } string 投稿タイトル = ""; if (string.IsNullOrEmpty(tbTitle.Text)) { 投稿タイトル = "無題"; // タイトルが入っていなかったら「無題」とする。 //MessageBox.Show("タイトルを入力して下さい。", "確認", MessageBoxButton.OK); //return; } else { 投稿タイトル = tbTitle.Text; } string convertEmail = ""; if (!string.IsNullOrEmpty(tbEMail.Text)) { convertEmail = "mailto:" + tbEMail.Text; } List <string> 添付画像パスリスト = new List <string>(); for (int i = 0; i < Request.Files.Count; i++) { HttpPostedFile uploadFile = Request.Files[i]; if (uploadFile.FileName != "") { 添付画像パスリスト.Add(uploadFile.FileName); } } string pass = null; if (tbPassword.Text == "") { pass = "******"; } else { pass = tbPassword.Text; } 文字色 文字色 = Check文字色(); FileWriterClient client = PharmacyToolMobile.Util.ServiceUtil.ReferenceCreater.GetFileWriterClient(); client.掲示板データ書込(ddlスレッド選択.SelectedValue, 投稿タイトル, tbName.Text, tbComment.Text, 掲示板書込タイプ.新規投稿, "", tbURL.Text, convertEmail, 添付画像パスリスト.ToArray(), pass, 文字色); #if DEBUG string UploadFolderPath = PharmacyToolMobile.Properties.Settings.Default.Upload掲示板FileRootPathDEBUG; #elif NAKAYAMA string UploadFolderPath = PharmacyToolMobile.Properties.Settings.Default.Upload掲示板FileRootPathNAKAYAMA; #else throw new Exception("実装していません"); #endif //UploadFolderPath = Path.Combine(UploadFolderPath,ddlスレッド選択.SelectedValue + "\\" + ); for (int i = 0; i < Request.Files.Count; i++) { HttpPostedFile uploadFile = Request.Files[i]; if (uploadFile.FileName != "") { uploadFile.SaveAs(UploadFolderPath + uploadFile.FileName); //Server.MapPath("./") + "file\" + System.IO.Path.GetFileName(uploadFile.FileName)) } } // Redirect用のセッション Session["IsRedirectFromContribute"] = 1; Session["ThreadName"] = Request.QueryString["ThreadName"]; //Session クリア Session["IsSearchData"] = null; //Session["fuList"] = null; // 掲示板画面へ遷移 Response.Redirect("BBS.aspx"); }
protected void btnContribute_Click(object sender, System.EventArgs e) { #region アップロード用スニペット //for (int i = 0; i < Request.Files.Count; i++) //{ // HttpPostedFile uploadFile = Request.Files[i]; // if (uploadFile.FileName != "") // { // uploadFile.SaveAs(@"c:\temptest\" + uploadFile.FileName); // //Server.MapPath("./") + "file\" + System.IO.Path.GetFileName(uploadFile.FileName)) // } //} ////Session クリア //Session["fuList"] = null; #endregion if (!CheckPreContribute()) { return; } string 投稿タイトル = ""; if (string.IsNullOrEmpty(tbTitle.Text)) { 投稿タイトル = "無題"; // タイトルが入っていなかったら「無題」とする。 //MessageBox.Show("タイトルを入力して下さい。", "確認", MessageBoxButton.OK); //return; } else { 投稿タイトル = tbTitle.Text; } string convertEmail = ""; if (!string.IsNullOrEmpty(tbEMail.Text)) { convertEmail = "mailto:" + tbEMail.Text; } List <string> 添付画像パスリスト = new List <string>(); //for (int i = 0; i < Request.Files.Count; i++) //{ // HttpPostedFile uploadFile = Request.Files[i]; // if (uploadFile.FileName != "") // { // 添付画像パスリスト.Add(uploadFile.FileName); // } //} string pass = null; if (tbPassword.Text == "") { pass = "******"; } else { pass = tbPassword.Text; } 文字色 文字色 = Check文字色(); FileWriterClient client = PharmacyToolMobile.Util.ServiceUtil.ReferenceCreater.GetFileWriterClient(); var Kubun = (string)Request.QueryString["Kubun"]; // 記事修正の場合 if (Kubun != null) { // Fileの追加、変更、削除は対応しないので、そのまま var ent = Session["修正用記事データ"] as 投稿Entity; if (ent != null) { client.掲示板データ書込(Request.QueryString["ThreadName"], tbTitle.Text, tbName.Text, tbComment.Text, 掲示板書込タイプ.記事修正, Request.QueryString["No"], tbURL.Text, tbEMail.Text, ent.添付ファイルlist, pass, 文字色); } } // 返信の場合 else { client.掲示板データ書込(Request.QueryString["ThreadName"], 投稿タイトル, tbName.Text, tbComment.Text, 掲示板書込タイプ.返信投稿, Request.QueryString["No"], tbURL.Text, convertEmail, 添付画像パスリスト.ToArray(), pass, 文字色); } // 投稿画面へ遷移 // IsRedirectFromContribute = 1 の時は BBS.aspxでそのThreadを読み込む Session["IsRedirectFromContribute"] = 1; Session["ThreadName"] = Request.QueryString["ThreadName"]; Session["IsSearchData"] = null; //検索キーワードからの返信の場合もSessionはnull Session["修正用記事データ"] = null; //修正用記事データもSessionはnull Response.Redirect("BBS.aspx"); }
//protected void btnAdd_Click(object sender, System.EventArgs e) //{ // List<FileUpload> fuList = new List<FileUpload>(); // fuList = Session["fuList"] as List<FileUpload>; // if (fuList == null) // { // fuList = new List<FileUpload>(); // } // FileUpload fu = new FileUpload(); // fuList.Add(fu); // Session["fuList"] = fuList; // foreach (var f in fuList) // { // Panel2.Controls.Add(f); // } //} protected void btn処理送信_Click(object sender, System.EventArgs e) { Button btn = sender as Button; if (btn == null) { return; } if (tb記事No.Text == "") { return; } if (tb処理暗証キー.Text == "") { return; } // 修正処理 if (ddl処理.SelectedIndex == 0) { // パスワード確認 FileReaderClient client = ReferenceCreater.GetFileReaderClient(); var rEnt = client.掲示板記事修正確認チェック(ddlスレッド選択.SelectedValue, tb記事No.Text, tb処理暗証キー.Text, false); if (!rEnt.暗証キーチェック成功 || rEnt.エラーメッセージ != null) { return; } Session["修正用記事データ"] = rEnt.記事データ; // Kubun = Mod : Modify Response.Redirect("Contributer.aspx?ThreadName=" + ddlスレッド選択.SelectedValue + "&No=" + tb記事No.Text + "&Kubun=Mod"); } // 削除処理 else if (ddl処理.SelectedIndex == 1) { FileWriterClient client2 = ReferenceCreater.GetFileWriterClient(); var 結果メッセージ = client2.掲示板データ削除(ddlスレッド選択.SelectedValue, tb記事No.Text, tb処理暗証キー.Text, false); //string script = // "<script language=javascript>" + // "window.alert('" + 結果メッセージ + "')" + // "</script>"; //Response.Write(script); // Redirect後のMessageShow MessageShowEntity mse = new MessageShowEntity(); mse.Message = 結果メッセージ; Session["ShowMessage"] = mse; } else { return; } // Redirect用のセッション Session["IsRedirectFromContribute"] = 1; Session["ThreadName"] = Request.QueryString["ThreadName"]; // 掲示板画面へ遷移 Response.Redirect("BBS.aspx"); }