예제 #1
0
 public override OPResult AddOrUpdate(VIPUpTactic kind)
 {
     if (kind.OnceConsume == 0 && (kind.DateSpan == 0 || kind.SpanConsume == 0))
     {
         return(new OPResult {
             IsSucceed = false, Message = "单次消费和累计消费至少设置其中一个.\n即单次消费金额不能设为0,或者累计消费时间和消费金额不能设为0."
         });
     }
     if (kind.ID == default(int))
     {
         if (LinqOP.Any <VIPUpTactic>(o => o.BrandID == kind.BrandID && o.FormerKindID == kind.FormerKindID && o.AfterKindID == kind.AfterKindID && o.IsEnabled))
         {
             return(new OPResult {
                 IsSucceed = false, Message = "已经设置了相应VIP卡类型升级策略"
             });
         }
     }
     else
     {
         if (LinqOP.Any <VIPUpTactic>(o => o.BrandID == kind.BrandID && o.FormerKindID == kind.FormerKindID && o.AfterKindID == kind.AfterKindID && o.IsEnabled && o.ID != kind.ID && kind.IsEnabled))
         {
             return(new OPResult {
                 IsSucceed = false, Message = "已经设置了相应VIP卡类型升级策略"
             });
         }
     }
     return(base.AddOrUpdate(kind));
 }
예제 #2
0
        public override OPResult AddOrUpdate(OrganizationContractDiscount entity)
        {
            OrganizationContractDiscountBO contractdiscount = (OrganizationContractDiscountBO)entity;
            var byq = ProductLogic.GetBYQ(contractdiscount.BrandID, contractdiscount.Year, contractdiscount.Quarter);

            if (byq == null)
            {
                return(new OPResult {
                    IsSucceed = false, Message = "未找到相应的品牌年份季度信息"
                });
            }
            contractdiscount.BYQID = byq.ID;
            bool isAdd = contractdiscount.ID == default(int);

            if (isAdd)
            {
                if (LinqOP.Any <OrganizationContractDiscount>(o => o.OrganizationID == contractdiscount.OrganizationID && o.BYQID == contractdiscount.BYQID))
                {
                    return(new OPResult {
                        IsSucceed = false, Message = "已为该机构指定了对应款式的合同折扣"
                    });
                }
            }
            else
            {
                if (LinqOP.Any <OrganizationContractDiscount>(o => o.OrganizationID == contractdiscount.OrganizationID && o.ID != contractdiscount.ID && o.BYQID == contractdiscount.BYQID))
                {
                    return(new OPResult {
                        IsSucceed = false, Message = "已为该机构指定了对应款式的合同折扣"
                    });
                }
            }
            return(base.AddOrUpdate(entity));
        }
        public override OPResult AddOrUpdate(OrganizationAllocationGrade entity)
        {
            if (!VMGlobal.SysProcessQuery.LinqOP.Any <OrganizationBrand>(o => o.OrganizationID == entity.OrganizationID && o.BrandID == entity.BrandID))
            {
                return(new OPResult {
                    IsSucceed = false, Message = "选定的机构和品牌没有对应关系"
                });
            }
            bool isAdd = entity.ID == default(int);

            if (isAdd)
            {
                if (LinqOP.Any <OrganizationAllocationGrade>(o => o.OrganizationID == entity.OrganizationID && o.BrandID == entity.BrandID))
                {
                    return(new OPResult {
                        IsSucceed = false, Message = "已为该机构指定了对应品牌的等级"
                    });
                }
            }
            else
            {
                if (LinqOP.Any <OrganizationAllocationGrade>(o => o.OrganizationID == entity.OrganizationID && o.ID != entity.ID && o.BrandID == entity.BrandID))
                {
                    return(new OPResult {
                        IsSucceed = false, Message = "已为该机构指定了对应品牌的等级"
                    });
                }
            }
            return(base.AddOrUpdate(entity));
        }
예제 #4
0
        public override OPResult AddOrUpdate(OrganizationPriceFloat entity)
        {
            OrganizationPriceFloatBO pricefloat = (OrganizationPriceFloatBO)entity;
            var byq = ProductLogic.GetBYQ(pricefloat.BrandID, pricefloat.Year, pricefloat.Quarter);

            if (byq == null)
            {
                return(new OPResult {
                    IsSucceed = false, Message = "未找到相应的品牌年份季度信息."
                });
            }
            pricefloat.BYQID = byq.ID;
            if (pricefloat.ID == default(int))
            {
                if (IsSetted(pricefloat.OrganizationID, byq.ID))
                {
                    return(new OPResult {
                        IsSucceed = false, Message = "已为该机构指定了对应款式的价格上浮策略."
                    });
                }
            }
            else
            {
                if (LinqOP.Any <OrganizationPriceFloat>(o => o.OrganizationID == pricefloat.OrganizationID && o.ID != pricefloat.ID && o.BYQID == byq.ID))
                {
                    return(new OPResult {
                        IsSucceed = false, Message = "已为该机构指定了对应款式的价格上浮策略."
                    });
                }
            }
            return(base.AddOrUpdate(entity));
        }
예제 #5
0
 public override OPResult Delete(VIPKind kind)
 {
     if (LinqOP.Any <VIPCardKindMapping>(o => o.KindID == kind.ID))
     {
         return(new OPResult {
             IsSucceed = false, Message = "该VIP类型已使用,不能被删除."
         });
     }
     return(base.Delete(kind));
 }
예제 #6
0
 public override OPResult Delete(RetailShoppingGuide guide)
 {
     if (LinqOP.Any <BillRetail>(o => o.GuideID == guide.ID))
     {
         return(new OPResult {
             IsSucceed = false, Message = "该导购已经有销售记录,不可删除,\n若以后不再使用,请将状态置为禁用。"
         });
     }
     return(base.Delete(guide));
 }
예제 #7
0
 public override OPResult Delete(ShopExpenseKind entity)
 {
     if (LinqOP.Any <ShopExpense>(o => o.ExpenseKindID == entity.ID))
     {
         return(new OPResult {
             IsSucceed = false, Message = "该费用类别已经被使用,\n若以后不再使用,请将状态置为禁用。"
         });
     }
     return(base.Delete(entity));
 }
예제 #8
0
 public override OPResult Delete(RetailShift shift)
 {
     if (LinqOP.Any <RetailShoppingGuide>(o => o.ShiftID == shift.ID) || LinqOP.Any <BillRetail>(o => o.ShiftID == shift.ID))
     {
         return(new OPResult {
             IsSucceed = false, Message = "该班次信息已使用,不能被删除,\n若以后不使用,请将状态置为禁用."
         });
     }
     return(base.Delete(shift));
 }
예제 #9
0
 public override OPResult Delete(Factory factory)
 {
     if (LinqOP.Any <BillSubcontract>(p => p.OuterFactoryID == factory.ID))
     {
         return(new OPResult {
             IsSucceed = false, Message = "该工厂已经被使用,无法删除。\n若以后不使用,请将状态置为禁用。"
         });
     }
     return(base.Delete(factory));
 }
 private bool RateIsExist(OrganizationGoodReturnRatePerQuarter rate)
 {
     if (rate.ID == default(int))
     {
         return(LinqOP.Any <OrganizationGoodReturnRatePerQuarter>(oc => oc.RateID == rate.RateID && oc.Year == rate.Year && oc.Quarter == rate.Quarter));
     }
     else
     {
         return(LinqOP.Any <OrganizationGoodReturnRatePerQuarter>(oc => oc.ID != rate.ID && oc.RateID == rate.RateID && oc.Year == rate.Year && oc.Quarter == rate.Quarter));
     }
 }
 private bool RateIsExist(OrganizationGoodReturnRate rate)
 {
     if (rate.ID == default(int))
     {
         return(LinqOP.Any <OrganizationGoodReturnRate>(oc => oc.OrganizationID == rate.OrganizationID && oc.BrandID == rate.BrandID));
     }
     else
     {
         return(LinqOP.Any <OrganizationGoodReturnRate>(oc => oc.ID != rate.ID && oc.OrganizationID == rate.OrganizationID && oc.BrandID == rate.BrandID));
     }
 }
예제 #12
0
 /// <summary>
 /// 查看机构特定品牌的资信是否已设置过
 /// </summary>
 private bool CreditIsExist(OrganizationCredit credit)
 {
     if (credit.ID == default(int))
     {
         return(LinqOP.Any <OrganizationCredit>(oc => oc.OrganizationID == credit.OrganizationID && oc.BrandID == credit.BrandID));
     }
     else
     {
         return(LinqOP.Any <OrganizationCredit>(oc => oc.ID != credit.ID && oc.OrganizationID == credit.OrganizationID && oc.BrandID == credit.BrandID));
     }
 }
예제 #13
0
 public override OPResult AddOrUpdate(VIPBirthdayTactic entity)
 {
     if (entity.ID == default(int))
     {
         if (LinqOP.Any <VIPBirthdayTactic>(o => o.OrganizationID == VMGlobal.CurrentUser.OrganizationID))
         {
             return(new OPResult {
                 IsSucceed = false, Message = "一个机构职能设置一个VIP生日消费策略."
             });
         }
         entity.OrganizationID = VMGlobal.CurrentUser.OrganizationID;
     }
     return(base.AddOrUpdate(entity));
 }
예제 #14
0
     public override OPResult Delete(CertGrade entity)
     {
         if (entity.ID != default(int))
         {
             if (LinqOP.Any <Certification>(o => o.Grade == entity.ID))
             {
                 return new OPResult {
                            IsSucceed = false, Message = "该质量等级已被使用,若不再使用请将状态置为禁用。"
                 }
             }
             ;
         }
         return(base.Delete(entity));
     }
 }
예제 #15
0
     public override OPResult Delete(CertCarriedStandard entity)
     {
         if (entity.ID != default(int))
         {
             if (LinqOP.Any <Certification>(o => o.CarriedStandard == entity.ID))
             {
                 return new OPResult {
                            IsSucceed = false, Message = "该执行标准已被使用,若不再使用请将状态置为禁用。"
                 }
             }
             ;
         }
         return(base.Delete(entity));
     }
 }
예제 #16
0
     public override OPResult Delete(CertSafetyTech entity)
     {
         if (entity.ID != default(int))
         {
             if (LinqOP.Any <Certification>(o => o.SafetyTechnique == entity.ID))
             {
                 return new OPResult {
                            IsSucceed = false, Message = "该安全技术类别已被使用,若不再使用请将状态置为禁用。"
                 }
             }
             ;
         }
         return(base.Delete(entity));
     }
 }
예제 #17
0
        public override OPResult Delete(SysOrganizationType type)
        {
            if (LinqOP.Any <SysOrganization>(o => o.ParentID == VMGlobal.CurrentUser.OrganizationID && o.TypeId == type.ID))
            {
                return(new OPResult {
                    IsSucceed = false, Message = "该类型已被使用,不能被删除,\n若以后不使用,请将状态置为禁用。"
                });
            }
            var result = base.Delete(type);

            if (result.IsSucceed)
            {
                VMGlobal.OrganizationTypes.RemoveAll(o => o.ID == type.ID);
            }
            return(result);
        }
예제 #18
0
        public override OPResult Delete(ProBoduan boduan)
        {
            if (LinqOP.Any <ProStyle>(o => o.BoduanID == boduan.ID))
            {
                return(new OPResult {
                    IsSucceed = false, Message = "该波段已被使用,不能被删除,\n若以后不使用,请将状态置为禁用。"
                });
            }
            var result = base.Delete(boduan);

            if (result.IsSucceed)
            {
                VMGlobal.Boduans.RemoveAll(o => o.ID == boduan.ID);
            }
            return(result);
        }
예제 #19
0
        public override OPResult Delete(ProColor color)
        {
            if (LinqOP.Any <Product>(p => p.ColorID == color.ID))
            {
                return(new OPResult {
                    IsSucceed = false, Message = "该颜色已经被使用,无法删除。"
                });
            }
            var result = base.Delete(color);

            if (result.IsSucceed)
            {
                VMGlobal.Colors.RemoveAll(o => o.ID == color.ID);
            }
            return(result);
        }
예제 #20
0
        public override OPResult Delete(ProUnit unit)
        {
            if (LinqOP.Any <ProStyle>(o => o.UnitID == unit.ID))
            {
                return(new OPResult {
                    IsSucceed = false, Message = "该单位已被使用,不能被删除,\n若以后不使用,请将状态置为禁用。"
                });
            }
            var result = base.Delete(unit);

            if (result.IsSucceed)
            {
                VMGlobal.Units.RemoveAll(o => o.ID == unit.ID);
            }
            return(result);
        }
예제 #21
0
        public override OPResult Delete(ProQuarter quarter)
        {
            if (LinqOP.Any <ProBYQ>(o => o.Quarter == quarter.ID))
            {
                return(new OPResult {
                    IsSucceed = false, Message = "该季度已被使用,不能被删除,\n若以后不使用,请将状态置为禁用。"
                });
            }
            var result = base.Delete(quarter);

            if (result.IsSucceed)
            {
                VMGlobal.Quarters.RemoveAll(o => o.ID == quarter.ID);
            }
            return(result);
        }
예제 #22
0
        public override OPResult Delete(ProSize size)
        {
            if (LinqOP.Any <Product>(o => o.SizeID == size.ID))
            {
                return(new OPResult {
                    IsSucceed = false, Message = "该尺码已被使用,不能被删除,\n若以后不使用,请将状态置为禁用。"
                });
            }
            var result = base.Delete(size);

            if (result.IsSucceed)
            {
                VMGlobal.Sizes.RemoveAll(o => o.ID == size.ID);
            }
            return(result);
        }
예제 #23
0
        public override OPResult Delete(ProName name)
        {
            if (LinqOP.Any <ProStyle>(o => o.NameID == name.ID))
            {
                return(new OPResult {
                    IsSucceed = false, Message = "该品名已被使用,不能被删除,\n若以后不使用,请将状态置为禁用。"
                });
            }
            var result = base.Delete(name);

            if (result.IsSucceed)
            {
                VMGlobal.ProNames.RemoveAll(o => o.ID == name.ID);
            }
            return(result);
        }
예제 #24
0
 public override OPResult AddOrUpdate(RetailMonthTaget target)
 {
     if (target.ID == default(int))
     {
         if (LinqOP.Any <RetailMonthTaget>(o => o.OrganizationID == target.OrganizationID && o.Year == target.Year && o.Month == target.Month))
         {
             return(new OPResult {
                 IsSucceed = false, Message = "已为该机构设置了该月指标."
             });
         }
     }
     else if (LinqOP.Any <RetailMonthTaget>(o => o.OrganizationID == target.OrganizationID && o.ID != target.ID && o.Year == target.Year && o.Month == target.Month))
     {
         return(new OPResult {
             IsSucceed = false, Message = "已为该机构设置了该月指标."
         });
     }
     return(base.AddOrUpdate(target));
 }
예제 #25
0
 public override OPResult Delete(VoucherItemKind entity)
 {
     if (_kind == 1)
     {
         if (LinqOP.Any <VoucherDeductMoney>(o => o.ItemKindID == entity.ID))
         {
             return(new OPResult {
                 IsSucceed = false, Message = "该扣款项目已经被使用,\n若以后不再使用,请将状态置为禁用。"
             });
         }
     }
     else if (_kind == 2)
     {
         if (LinqOP.Any <VoucherReceiveMoney>(o => o.ReceiveKindID == entity.ID))
         {
             return(new OPResult {
                 IsSucceed = false, Message = "该收款项目已经被使用,\n若以后不再使用,请将状态置为禁用。"
             });
         }
     }
     return(base.Delete(entity));
 }
예제 #26
0
        public override OPResult Delete(VIPCard vip)
        {
            if (!DownHierarchyOrganizationIDArray.Contains(vip.OrganizationID))
            {
                return(new OPResult {
                    IsSucceed = false, Message = "只能删除本级或下级机构创建的VIP信息."
                });
            }
            if (LinqOP.Any <BillRetail>(o => o.VIPID == vip.ID))
            {
                return(new OPResult {
                    IsSucceed = false, Message = "该VIP存在消费记录,不可删除."
                });
            }

            using (TransactionScope scope = new TransactionScope())
            {
                try
                {
                    LinqOP.Delete <VIPCard>(c => c.ID == vip.ID);
                    LinqOP.Delete <VIPCardKindMapping>(c => c.CardID == vip.ID);
                    LinqOP.Delete <VIPPointTrack>(c => c.VIPID == vip.ID);
                    LinqOP.Delete <VIPPredepositTrack>(c => c.VIPID == vip.ID);
                    scope.Complete();
                }
                catch (Exception e)
                {
                    return(new OPResult {
                        IsSucceed = false, Message = "删除失败,失败原因:\n" + e.Message
                    });
                }
            }
            return(new OPResult {
                IsSucceed = true, Message = "删除成功!"
            });
        }
예제 #27
0
 /// <summary>
 /// 判断是否已经设置过相应的价格上浮策略
 /// </summary>
 private bool IsSetted(int organizationID, int byqID)
 {
     return(LinqOP.Any <OrganizationPriceFloat>(o => o.OrganizationID == organizationID && o.BYQID == byqID));
 }