Example #1
0
        /// <summary>
        /// 画面表示処理
        /// </summary>
        protected void initialDisp()
        {
            BuisinessLogic.BLFollow bLogic = new BuisinessLogic.BLFollow();

            DataTable result = null;

            // イベント期間内・FMC
            result = bLogic.GetFollowList(Const.Def.DefTYPE_FMC, Const.Def.DefTYPE_Now);

            ckBoxFmc.DataSource = result;
            ckBoxFmc.DataBind();

            // イベント期間内・mc
            result = bLogic.GetFollowList(Const.Def.DefTYPE_mc, Const.Def.DefTYPE_Now);

            ckBoxmc.DataSource = result;
            ckBoxmc.DataBind();

            // イベント期間外・FMC
            result = bLogic.GetFollowList(Const.Def.DefTYPE_FMC, Const.Def.DefTYPE_Old);

            ckBoxOverFmc.DataSource = result;
            ckBoxOverFmc.DataBind();

            // イベント期間外・mc
            result = bLogic.GetFollowList(Const.Def.DefTYPE_mc, Const.Def.DefTYPE_Old);

            ckBoxOvermc.DataSource = result;
            ckBoxOvermc.DataBind();
        }
Example #2
0
        // ダウンロードボタンクリック
        protected void btn_Download_Click(Object sender, EventArgs e)
        {
            CommonLogic bcom = new CommonLogic();

            try
            {
                string event_code = "";

                if (ckBoxFmc.SelectedIndex > -1)
                {
                    event_code = ckBoxFmc.SelectedItem.Value;
                }
                else
                {
                    if (ckBoxmc.SelectedIndex > -1)
                    {
                        event_code = ckBoxmc.SelectedItem.Value;
                    }
                    else
                    {
                        if (ckBoxOverFmc.SelectedIndex > -1)
                        {
                            event_code = ckBoxOverFmc.SelectedItem.Value;
                        }
                        else
                        {
                            if (ckBoxOvermc.SelectedIndex > -1)
                            {
                                event_code = ckBoxOvermc.SelectedItem.Value;
                            }
                        }
                    }
                }

                BuisinessLogic.BLFollow bLogic = new BuisinessLogic.BLFollow();

                DataTable followList = null;
                String    paraTitle  = "";
                String[]  strArrayData;

                strArrayData = event_code.Trim().Split(',');

                // 過去トラ一覧リスト取得
                followList = bLogic.GetDownloadList(strArrayData[0], strArrayData[1],
                                                    strArrayData[2], strArrayData[3], txtKacode.Text.Trim());

                paraTitle = "《 " + strArrayData[4] + " 》段階結果( " + txtKacode.Text.Trim() + " )";

                // TemplateのFileInfo EXCELテンプレートフルパス
                FileInfo template = new FileInfo(@bcom.GetExcelTemplate("F"));

                // 作成EXCELのFileInfo
                FileInfo newFile = new FileInfo(Const.Def.DefFollowExcelName + DateTime.Now.ToString("yyyyMMddHHmmss") + ".xlsx");

                // EXCEL作成
                using (ExcelPackage excelPkg = new ExcelPackage(newFile, template))
                {
                    ExcelWorksheet worksheet = null;
                    worksheet = excelPkg.Workbook.Worksheets.Where(s => s.Name == Const.Def.DefFollowWorksheetName).FirstOrDefault();

                    //処理を記述
                    bLogic.CreateFollowList(worksheet, paraTitle, strArrayData[5], followList);

                    // ダウンロード処理
                    String fn = Const.Def.DefFollowExcelName + DateTime.Now.ToString("yyyyMMddHHmmss") + ".xlsx";
                    Response.Clear();
                    Response.AddHeader("Content-Disposition", String.Format("attachment; filename=" + HttpUtility.UrlDecode(fn)));
                    Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
                    Response.BinaryWrite(excelPkg.GetAsByteArray());
                    Response.Flush();
                    Response.End();
                }
            }
            // システムエラー処理(ログ出力、エラー画面遷移)
            catch (Exception ex)
            {
                // システムエラー処理(ログ出力&エラーページ表示)
                bcom.ErrorProcess("frmFollow", "btn_Download_Click", ex, this.Response);
            }
        }