using LHDN.CRM.Web.Controllers;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.IO;

namespace LHDN.CRM.Web.Areas.Outbound.Controllers
{
    public class HCLEmailBlastListingController : BaseController
    {
        public HCLEmailBlastListingController()
        {
            ViewBag.IsHCLEmailBlast = true;
        }

        // GET: Outbound/HCLEmailBlastListing
        public ActionResult Index()
        {
            AddAntiforgeryToken();
            return View();
        }

        public ActionResult EmailBlastBatch()
        {
            ViewBag.IsShowReMSBatchTab = true;

            AddAntiforgeryToken();

            return View("Index");
        }

        public ActionResult SegmentiseList()
        {
            ViewBag.isShowSegTab = true;

            AddAntiforgeryToken();

            return View("Index");
        }

        public void HCLDownloadExcelFormat()
        {
            string fileName = "HCL Email Blast Excel Template.xlsx";
            string path = AppDomain.CurrentDomain.BaseDirectory + "Content\\EmailTemplate\\" + fileName;
            System.IO.FileInfo file = new System.IO.FileInfo(path);
            string Outgoingfile = fileName;
            if (file.Exists)
            {
                Response.Clear();
                Response.AddHeader("Content-Disposition", "attachment; filename=" + Outgoingfile);
                Response.AddHeader("Content-Length", file.Length.ToString());
                Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
                Response.WriteFile(file.FullName);
                Response.End();
            }
            else
            {
                Response.Write("This file does not exist.");
            }
        }
    }
}