public ActionResult Preview(ImportMasterListViewModel model)
        {
            AlertMessage alert = new AlertMessage();

            if (!ModelState.IsValid)
            {
                alert.Text = string.Join(System.Environment.NewLine, ModelState.Values
                                         .SelectMany(v => v.Errors)
                                         .Select(e => e.ErrorMessage));
            }
            else
            {
                MasterListBusiness business = new MasterListBusiness();
                business.SetUserAuth(ViewBag.UserAuth);

                alert = business.PreviewSales(model);
            }

            TempData["AlertMessage"] = alert;

            if (alert.Data != null)
            {
                TempData["ImportMasterList"] = alert.Data;

                return(View(alert.Data));
            }
            else
            {
                return(RedirectToAction("Import"));
            }
        }
        public ActionResult Import(ImportMasterListViewModel model)
        {
            AlertMessage alert = new AlertMessage();

            model = null;

            if (TempData["ImportMasterList"] != null)
            {
                model = TempData["ImportMasterList"] as ImportMasterListViewModel;
            }

            if (model != null)
            {
                MasterListBusiness business = new MasterListBusiness();
                business.SetUserAuth(ViewBag.UserAuth);

                alert = business.ImportTagih(model);
            }

            else
            {
                alert.Text = StaticMessage.ERR_INVALID_INPUT;
            }

            TempData["AlertMessage"] = alert;

            return(RedirectToAction("Index"));
        }
        public async Task <ActionResult> Import(ImportMasterListViewModel model)
        {
            AlertMessage alert = new AlertMessage();

            model = null;

            if (TempData["ImportMasterList"] != null)
            {
                model = TempData["ImportMasterList"] as ImportMasterListViewModel;
            }

            if (model != null)
            {
                MasterListBusiness business = new MasterListBusiness(new SmtpService());
                business.SetUserAuth(ViewBag.UserAuth);

                alert = await business.ImportSales(model);
            }
            else
            {
                alert.Text = StaticMessage.ERR_INVALID_INPUT;
            }

            TempData["AlertMessage"] = alert;

            if (alert.Data != null)
            {
                TempData["DoubleMasterList"] = alert.Data;

                return(View("Double", alert.Data));
            }
            else if (alert.Status == 1)
            {
                return(RedirectToAction("Index"));
            }
            else
            {
                return(RedirectToAction("Import"));
            }
        }