Beispiel #1
0
        public ActionResult AuditMDBeautyApplyConfig(MDBeautyApplyConfig model, string type)
        {
            try
            {
                if (MDBeautyApplyConfigManager.AuditMDBeautyApplyConfig(model, type))
                {
                    CleanCache(model.ShopId, model.ProductId);
                    if (type == "Apply")
                    {
                        AddOprLog(model.Id, model.ApplyAuditStatus.ToString(), "", "Apply", "审核申请报名数据");
                    }
                    else
                    {
                        AddOprLog(model.Id, model.ExitAuditStatus.ToString(), "", "Exit", "审核退出申请数据");
                    }
                }

                return(Json(true));
            }
            catch
            {
                return(Json(false));

                throw;
            }
        }
Beispiel #2
0
        public ActionResult Edit(int status, string type, string look, int id = 0)
        {
            MDBeautyApplyConfig model = MDBeautyApplyConfigManager.GetMDBeautyApplyConfigById(id);

            ViewData["status"] = status;
            ViewData["type"]   = type;
            ViewData["look"]   = look;
            return(View(model));
        }
Beispiel #3
0
 public bool AuditMDBeautyApplyConfig(MDBeautyApplyConfig model, string type)
 {
     try
     {
         return(DALMDBeautyApplyConfig.AuditMDBeautyApplyConfig(model, type));
     }
     catch (Exception ex)
     {
         Logger.Log(Level.Error, ex, "AuditMDBeautyApplyConfig");
         throw ex;
     }
 }
Beispiel #4
0
 public List <MDBeautyApplyConfig> GetMDBeautyApplyConfigList(MDBeautyApplyConfig model, int pageSize, int pageIndex, string type, out int recordCount)
 {
     try
     {
         return(DALMDBeautyApplyConfig.GetMDBeautyApplyConfig(model, pageSize, pageIndex, type, out recordCount));
     }
     catch (Exception ex)
     {
         Logger.Log(Level.Error, ex, "GetMDBeautyApplyConfigList");
         throw ex;
     }
 }
Beispiel #5
0
        public ActionResult List(MDBeautyApplyConfig model, int pageIndex = 1, int pageSize = 15)
        {
            int    count  = 0;
            string strSql = string.Empty;

            var lists = MDBeautyApplyConfigManager.GetMDBeautyApplyConfigList(model, pageSize, pageIndex, "Exit", out count);

            var list  = new OutData <List <MDBeautyApplyConfig>, int>(lists, count);
            var pager = new PagerModel(pageIndex, pageSize)
            {
                TotalItem = count
            };

            return(View(new ListModel <MDBeautyApplyConfig>(list.ReturnValue, pager)));
        }
        public static bool UpdateMDBeautyApplyConfig(MDBeautyApplyConfig model, string type)
        {
            string sql1 = @"UPDATE Tuhu_Groupon.dbo.[ShopBeautyAcitivityApply] SET                                      
                                           [ApplyAuditStatus]=@ApplyAuditStatus                                     
                                          ,[AuditReason]=@AuditReason                                                                      
                                          ,[UpdateTime]=GETDATE()                                                                           
                                 WHERE Id=@Id";

            string sql2 = @"UPDATE Tuhu_Groupon.dbo.[ShopBeautyAcitivityApply] SET 
                                           ExitAuditStatus=@ExitAuditStatus
                                          ,ExitReason=@ExitReason                                         
                                          ,UpdateTime=GETDATE()                                    
                                 WHERE Id=@Id";


            if (!string.IsNullOrWhiteSpace(type))
            {
                if (type == "Apply")
                {
                    var sqlParameter = new SqlParameter[]
                    {
                        new SqlParameter("@ApplyAuditStatus", model.ApplyAuditStatus),
                        new SqlParameter("@AuditReason", model.AuditReason),
                        new SqlParameter("@Id", model.Id),
                    };
                    return(SqlHelper.ExecuteNonQuery(conn, CommandType.Text, sql1, sqlParameter) > 0);
                }
                else if (type == "Exit")
                {
                    var sqlParameter = new SqlParameter[]
                    {
                        new SqlParameter("@ExitAuditStatus", model.ExitAuditStatus),
                        new SqlParameter("@ExitReason", model.ExitReason),
                        new SqlParameter("@Id", model.Id),
                    };
                    return(SqlHelper.ExecuteNonQuery(conn, CommandType.Text, sql2, sqlParameter) > 0);
                }
            }

            return(false);
        }
Beispiel #7
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));
        }
        public static List <MDBeautyApplyConfig> GetMDBeautyApplyConfig(MDBeautyApplyConfig model, int pageSize, int pageIndex, string type, out int recordCount)
        {
            string sql      = @"SELECT  *
                            FROM    ( SELECT DISTINCT   M.[Id] ,
                                                M.[ActivityId] ,
                                                A.Id AS ActivityPKID,
                                                [ShopId] ,
                                                [ShopName] ,
                                                [ProductId] ,
                                                [ProductName] ,
                                                [Quantity] ,
                                                [Price] ,
                                                [ApplyAuditStatus] ,
                                                [ExitAuditStatus] ,
                                                [AuditReason] ,
                                                [ExitReason] ,
                                                M.[CreateTime] ,
                                                M.[UpdateTime] ,
                                                A.Id AS BeautyAcitivityId,
                                                [Name] ,
                                                [SignUpStartTime] ,
                                                [SignUpEndTime] ,
                                                [ActivityStartTime] ,
                                                [ActivityEndTime] ,
                                                [CategoryId] ,                                           
                                                [MinPrice] ,
                                                [MaxPrice] ,
                                                [EverydayQuantity] ,
                                                [MinShopQuantity] ,
                                                [VehicleGrade] ,
                                                [ApplicationVehicle] ,
                                                [ShopType] ,
                                                [ShopGrade] ,
                                                [MeiRongAppraise] ,
                                                [ActivityRequire] ,
                                                [ActivityNotification] ,
                                                [Status] ,
                                                [CategoryName] ,
                                                [ShowName],PlanStartTime,ExitActivityReason                                            
                                        FROM    [Tuhu_Groupon].[dbo].[ShopBeautyAcitivityApply] AS M WITH ( NOLOCK )
                                                LEFT JOIN [Tuhu_Groupon].[dbo].[ShopBeautyAcitivity] AS A WITH ( NOLOCK ) ON A.ActivityId = M.ActivityId
                                                LEFT JOIN Tuhu_Groupon.dbo.SE_MDBeautyCategoryConfig AS B WITH ( NOLOCK ) ON B.Id = A.CategoryId  
                                                LEFT JOIN Tuhu_Groupon.dbo.RegionRelation AS C WITH ( NOLOCK ) ON C.ActivityId = A.Id
                                              
		                              WHERE 
                                        ( @Id = 0
                                            OR ( @Id <> 0
                                                AND A.Id = @Id
                                                )
                                        )AND
                                        ( @Name = ''
                                            OR ( @Name <> ''
                                                AND Name = @Name
                                                )
                                        )AND                                       
                                        ( @CategoryId = -1
                                            OR ( @CategoryId <> -1
                                                AND CategoryId = @CategoryId
                                                )
                                        )AND
                                        ( @StrProvince =-1
                                            OR ( @StrProvince <> -1
                                                AND C.ProvinceId=@StrProvince
                                                )
                                        )AND
                                        ( @StrCity =-1
                                            OR ( @StrCity <> -1
                                                AND C.CityId=@StrCity
                                                )
                                        )AND
                                        ( @Status = -1
                                            OR ( @Status <> -1
                                                AND Status = @Status
                                                )
                                        )
                                        AND
                                        ( @ApplyAuditStatus = 0
                                            OR ( @ApplyAuditStatus <> 0
                                                AND ApplyAuditStatus = @ApplyAuditStatus
                                                )
                                        )
                                        AND
                                        ( @ExitAuditStatus = 0
                                            OR ( @ExitAuditStatus <> 0
                                                AND ExitAuditStatus = @ExitAuditStatus
                                                )
                                        )
                                        AND
                                        ( @Type = ''
                                            OR ( @Type = 'Apply'
                                                AND ExitAuditStatus  =0
                                                )
                                            OR ( @Type = 'Exit'
                                                AND ApplyAuditStatus =3 AND ExitAuditStatus <>0
                                                )
                                        )
                                    ) AS PG
                            ORDER BY PG.[UpdateTime] DESC
                                    OFFSET ( @PageIndex - 1 ) * @PageSize ROWS  FETCH NEXT @PageSize ROWS
                                    ONLY 
                                ";
            string sqlCount = @"SELECT Count(0)
                                FROM    [Tuhu_Groupon].[dbo].[ShopBeautyAcitivityApply] AS M WITH ( NOLOCK )
                                        LEFT JOIN [Tuhu_Groupon].[dbo].[ShopBeautyAcitivity] AS A WITH ( NOLOCK ) ON A.ActivityId = M.ActivityId
                                        LEFT JOIN Tuhu_Groupon.dbo.SE_MDBeautyCategoryConfig AS B WITH ( NOLOCK ) ON B.Id = A.CategoryId  
                                        LEFT JOIN Tuhu_Groupon.dbo.RegionRelation  AS C WITH ( NOLOCK ) ON C.ActivityId = A.Id                                
                                WHERE  ( @Id = 0
                                            OR ( @Id <> 0
                                                AND A.Id = @Id
                                                )
                                        )AND
                                        ( @Name = ''
                                            OR ( @Name <> ''
                                                AND Name = @Name
                                                )
                                        )AND                                       
                                        ( @CategoryId = -1
                                            OR ( @CategoryId <> -1
                                                AND CategoryId = @CategoryId
                                                )
                                        )AND
                                        ( @StrProvince = -1
                                            OR ( @StrProvince <> -1
                                                AND C.ProvinceId=@StrProvince
                                                )
                                        )AND
                                        ( @StrCity = -1
                                            OR ( @StrCity <> -1
                                                AND C.CityId=@StrCity
                                                )
                                        )
                                        AND
                                        ( @Status = -1
                                            OR ( @Status <> -1
                                                AND Status = @Status
                                                )
                                        )AND
                                        ( @ApplyAuditStatus = 0
                                            OR ( @ApplyAuditStatus <> 0
                                                AND ApplyAuditStatus = @ApplyAuditStatus
                                                )
                                        )
                                        AND
                                        ( @ExitAuditStatus = 0
                                            OR ( @ExitAuditStatus <> 0
                                                AND ExitAuditStatus = @ExitAuditStatus
                                                )
                                        )AND
                                        ( @Type = ''
                                            OR ( @Type = 'Apply'
                                                AND ExitAuditStatus  =0
                                                )
                                            OR ( @Type = 'Exit'
                                                AND ApplyAuditStatus =3 AND ExitAuditStatus <>0
                                                )
                                        )";

            var sqlParameters = new SqlParameter[]
            {
                new SqlParameter("@PageSize", pageSize),
                new SqlParameter("@PageIndex", pageIndex),
                new SqlParameter("@Id", model.Id),
                new SqlParameter("@Status", model.Status),
                new SqlParameter("@StrProvince", model.StrProvince ?? "-1"),
                new SqlParameter("@StrCity", model.StrCity ?? "-1"),
                new SqlParameter("@CategoryId", model.CategoryId),
                new SqlParameter("@Name", model.Name ?? string.Empty),
                new SqlParameter("@type", type ?? string.Empty),
                new SqlParameter("@ApplyAuditStatus", model.ApplyAuditStatus),
                new SqlParameter("@ExitAuditStatus", model.ExitAuditStatus),
            };

            recordCount = (int)SqlHelper.ExecuteScalar(connOnRead, CommandType.Text, sqlCount, sqlParameters);
            return(SqlHelper.ExecuteDataTable(connOnRead, CommandType.Text, sql, sqlParameters).ConvertTo <MDBeautyApplyConfig>().ToList());
        }