コード例 #1
0
 public PartialViewResult FilterData(SalesVolumeModel model)
 {
     model.Details           = GetData(model.SearchView);
     model.CurrentLogin      = CurrentUser;
     model.CurrentPageAccess = CurrentPageAccess;
     return(PartialView("_ListData", model));
 }
コード例 #2
0
        public ActionResult Upload(SalesVolumeModel Model)
        {
            if (ModelState.IsValid)
            {
                foreach (SalesVolumeItem data in Model.Details)
                {
                    try
                    {
                        data.CreatedDate  = DateTime.Now;
                        data.CreatedBy    = CurrentUser.USERNAME;
                        data.ModifiedBy   = null;
                        data.ModifiedDate = null;

                        var dto = Mapper.Map <SalesVolumeDto>(data);

                        _SalesVolumeBLL.CheckSalesVolume(data.Type, data.Region, data.Month, data.Year, CurrentUser.USERNAME);

                        _SalesVolumeBLL.Save(dto);

                        AddMessageInfo(Constans.SubmitMessage.Saved, Enums.MessageInfoType.Success);
                    }
                    catch (Exception exception)
                    {
                        AddMessageInfo(exception.Message, Enums.MessageInfoType.Error);
                        return(View(Model));
                    }
                }
            }
            return(RedirectToAction("Index", "MstSalesVolume"));
        }
コード例 #3
0
        public ActionResult Upload()
        {
            var model = new SalesVolumeModel();

            model.MainMenu     = _mainMenu;
            model.CurrentLogin = CurrentUser;
            return(View(model));
        }
コード例 #4
0
        //
        // GET: /SalesVolume/

        public ActionResult Index()
        {
            var model   = new SalesVolumeModel();
            var input   = Mapper.Map <SalesVolumeParamInput>(model.SearchView);
            var data    = _SalesVolumeBLL.GetSalesVolume(input);
            var allData = _SalesVolumeBLL.GetAllSalesVolume();

            model.Details                 = Mapper.Map <List <SalesVolumeItem> >(data);
            model.SearchView.TypeList     = new SelectList(allData.Select(x => new { x.Type }).Distinct().ToList(), "Type", "Type");
            model.SearchView.RegionalList = new SelectList(allData.Select(x => new { x.Region }).Distinct().ToList(), "Region", "Region");
            model.MainMenu                = _mainMenu;
            model.CurrentLogin            = CurrentUser;
            model.CurrentPageAccess       = CurrentPageAccess;
            return(View(model));
        }
コード例 #5
0
        public void ExportMasterSalesVolume(SalesVolumeModel model)
        {
            string pathFile = "";

            var input = Mapper.Map <SalesVolumeParamInput>(model.SearchViewExport);

            pathFile = CreateXlsMasterSalesVolume(input);

            var newFile = new FileInfo(pathFile);

            var fileName = Path.GetFileName(pathFile);

            string attachment = string.Format("attachment; filename={0}", fileName);

            Response.Clear();
            Response.AddHeader("content-disposition", attachment);
            Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
            Response.WriteFile(newFile.FullName);
            Response.Flush();
            newFile.Delete();
            Response.End();
        }