public ActionResult Edit(short type, int id = 0)
        {
            ViewBag.ProvinceList = MeiRongAcitivityConfigManager.GetRegion(0);

            if (id == 0)
            {
                BeautyHomePageConfig model = new BeautyHomePageConfig();
                model.StartTime = DateTime.Now;
                model.EndTime   = DateTime.Now.AddDays(30);
                model.Status    = true;
                model.Channel   = "ios";
                model.Type      = type;
                return(View(model));
            }
            else
            {
                BeautyHomePageConfig model = BeautyHomePageConfigManager.GetBeautyHomePageConfigById(id);
                model.RegionList = MeiRongAcitivityConfigManager.GetRegionRelation(model.Id, 2);
                return(View(model));
            }
        }
Beispiel #2
0
        public ActionResult Export(MDBeautyApplyConfig model)
        {
            using (var stream = new MemoryStream(System.IO.File.ReadAllBytes(Server.MapPath(@"~/Content/Export/门店美容活动退出审核列表.xlsx"))))
            {
                int count        = 0;
                var list         = MDBeautyApplyConfigManager.GetMDBeautyApplyConfigList(model, int.MaxValue, 1, "Exit", out count);
                var xssfWorkbook = new XSSFWorkbook(stream); //创建Workbook对象  2007+
                                                             // var hssfWorkbook = new HSSFWorkbook(stream)://2003
                if (list.Count > 0)
                {
                    var i     = 0;
                    var sheet = xssfWorkbook.GetSheetAt(0);

                    foreach (var item in list)
                    {
                        MeiRongAcitivityConfigManager manager = new MeiRongAcitivityConfigManager();

                        model.RegionList = manager.GetRegionRelation(item.Id, 1);
                        string region = string.Empty;
                        if (model.RegionList != null && model.RegionList.Count > 0)
                        {
                            foreach (var regionItem in model.RegionList)
                            {
                                region += regionItem.ProvinceName + ":" + regionItem.CityName + ";";
                            }
                        }
                        string apply = string.Empty;
                        switch (item.ApplyAuditStatus)
                        {
                        case 1:
                            apply = "待审核";
                            break;

                        case 2:
                            apply = "不通过";
                            break;

                        case 3:
                            apply = "通过";
                            break;

                        default:
                            break;
                        }
                        string exit = string.Empty;
                        switch (item.ExitAuditStatus)
                        {
                        case 1:
                            exit = "待审核";
                            break;

                        case 2:
                            exit = "不通过";
                            break;

                        case 3:
                            exit = "通过";
                            break;

                        default:
                            break;
                        }
                        var row = sheet.CreateRow((i++) + 1);
                        row.CreateCell(0).SetCellValue(item.BeautyAcitivityId);
                        row.CreateCell(1).SetCellValue(item.Name);
                        row.CreateCell(2).SetCellValue(region);
                        row.CreateCell(3).SetCellValue(item.CategoryName);
                        row.CreateCell(4).SetCellValue(item.MinShopQuantity);
                        row.CreateCell(5).SetCellValue(item.SignUpStartTime?.ToString() + "—" + item.SignUpEndTime?.ToString());
                        row.CreateCell(6).SetCellValue(item.PlanStartTime?.ToString() + "—" + item.ActivityEndTime?.ToString());
                        row.CreateCell(7).SetCellValue(item.MinPrice + "—" + item.MaxPrice);
                        row.CreateCell(8).SetCellValue(item.Status == 1 ? "启用" : "禁用");
                        row.CreateCell(9).SetCellValue(item.ShopId);
                        row.CreateCell(10).SetCellValue(item.ShopName);
                        row.CreateCell(11).SetCellValue(item.ProductId);
                        row.CreateCell(12).SetCellValue(item.ProductName);
                        row.CreateCell(13).SetCellValue(apply);
                        row.CreateCell(13).SetCellValue(exit);
                    }
                    Response.AppendHeader("Content-Disposition", "attachment;fileName=门店美容活动退出审核列表" + ".xlsx");
                    xssfWorkbook.Write(Response.OutputStream);
                    Response.End();
                }
            }
            return(Json(true, JsonRequestBehavior.AllowGet));
        }