public ActionResult DeleteBeautyServicePackageDetail(int pkid, int packageId) { var isSuccess = false; var msg = string.Empty; var package = BeautyServicePackageManager.GetBeautyServicePackage(packageId); if (package != null && package.IsPackageCodeGenerated) { msg = "已经生成兑换码的不允许删除"; } else if (package == null) { msg = "兑换码配置不存在"; } else { var packageDetail = BeautyServicePackageManager.GetBeautyServicePackageDetail(pkid); if (packageDetail != null && !packageDetail.IsServiceCodeGenerated) { var user = HttpContext.User.Identity.Name; isSuccess = BeautyServicePackageManager.DeleteBeautyServicePackageDetail(pkid, packageDetail, user); } else if (packageDetail == null) { msg = "不存在"; } else { msg = "已经生成服务码的不允许删除"; } } return(Json(new { IsSuccess = isSuccess, Msg = msg }, JsonRequestBehavior.AllowGet)); }
public ActionResult GetBeautyServicePackage(int pageIndex, int pageSize, string packageType = "", string packageName = "", string vipCompanyName = "", string settleMentMethod = "", int cooperateId = 0) { var result = BeautyServicePackageManager.GetBeautyServicePackage(pageIndex, pageSize, packageType, packageName, vipCompanyName, settleMentMethod, cooperateId); var status = result != null && result.Item1 != null && result.Item1.Any() ? "Success" : "fail"; if (string.Equals(status, "Success")) { var manager = new BankMRManager(); var allCooperateUsers = manager.GetAllMrCooperateUserConfigs(); if (allCooperateUsers != null && allCooperateUsers.Any()) { result.Item1.ForEach(u => { u.CooperateName = allCooperateUsers.FirstOrDefault(t => t.PKID == u.CooperateId)?.CooperateName; }); } } return(Json(new { Status = status, Data = result.Item1, TotalCount = result.Item2 }, JsonRequestBehavior.AllowGet)); }
public ActionResult UpsertBeautyServicePackageDetail(BeautyServicePackageDetail packageDetail) { var isSuccess = false; var msg = string.Empty; var rawPackage = BeautyServicePackageManager.GetBeautyServicePackage(packageDetail.PackageId); if (rawPackage != null && rawPackage.IsPackageCodeGenerated) { if (packageDetail.PKID <= 0) { msg = "已生成兑换码不允许添加产品!"; return(Json(new { IsSuccess = false, Msg = msg }, JsonRequestBehavior.AllowGet)); } var rawPackageDetail = BeautyServicePackageManager.GetBeautyServicePackageDetails(packageDetail.PackageId).FirstOrDefault(); if (rawPackageDetail != null && (rawPackageDetail.ShopCommission != packageDetail.ShopCommission || rawPackageDetail.VipSettlementPrice != packageDetail.VipSettlementPrice || rawPackageDetail.ServiceCodeNum != packageDetail.ServiceCodeNum || rawPackageDetail.ServiceCodeStartTime != packageDetail.ServiceCodeStartTime || rawPackageDetail.ServiceCodeEndTime != packageDetail.ServiceCodeEndTime || rawPackageDetail.EffectiveDayAfterExchange != packageDetail.EffectiveDayAfterExchange || rawPackageDetail.Num != packageDetail.Num)) { msg = "已生成兑换码只允许修改名称!"; return(Json(new { IsSuccess = false, Msg = msg }, JsonRequestBehavior.AllowGet)); } } var user = HttpContext.User.Identity.Name; if (packageDetail != null && !string.IsNullOrEmpty(packageDetail.Name) && !string.IsNullOrEmpty(packageDetail.PID)) { if (packageDetail.Num > 20 || packageDetail.Num < 0) { msg = "兑换码包含的服务数量介于0~20之间"; return(Json(new { IsSuccess = false, Msg = msg }, JsonRequestBehavior.AllowGet)); } if (packageDetail.CooperateId <= 0)//兑换码的合作用户配置在外层 { var package = BeautyServicePackageManager.GetBeautyServicePackage(packageDetail.PackageId); packageDetail.CooperateId = package?.CooperateId ?? 0; } if (packageDetail.PKID > 0) { packageDetail.UpdateUser = user; var updateResult = BeautyServicePackageManager.UpdateBeautyServicePackageDetail(packageDetail); isSuccess = updateResult.Item1; msg = updateResult.Item2; } else { packageDetail.CreateUser = user; isSuccess = BeautyServicePackageManager.InsertBeautyServicePackageDetail(packageDetail); if (!isSuccess) { msg = "更新失败"; } } } else { msg = "信息不完善"; } return(Json(new { IsSuccess = isSuccess, Msg = msg }, JsonRequestBehavior.AllowGet)); }