public virtual ActionResult NotUnique(string SINumber, int GiftCertificateID) { GiftCertificate gift = _giftCertificateService.FindBySINumber(SINumber); BLL.UserProfile user = _userProfileService.GetUser(User.Identity.Name); bool inReceiptAllocation = _receiptAllocationService.FindBySINumber(SINumber).Any(p => p.CommoditySourceID == BLL.CommoditySource.Constants.LOCALPURCHASE); if ((gift == null || (gift.GiftCertificateID == GiftCertificateID)) && !(inReceiptAllocation))// new one or edit no problem { return(Json(true, JsonRequestBehavior.AllowGet)); } else { return(Json(string.Format("{0} is invalid, there is an existing record with the same SI Number ", SINumber), JsonRequestBehavior.AllowGet)); } }
public virtual ActionResult NotUnique(string SINumber, int GiftCertificateID) { var shippingInstruction = _shippingInstructionService.FindBy(t => t.Value == SINumber).FirstOrDefault(); var gift = new Cats.Models.Hubs.GiftCertificate(); if (shippingInstruction != null) { gift = _giftCertificateService.FindBySINumber(shippingInstruction.ShippingInstructionID); } UserProfile user = _userProfileService.GetUser(User.Identity.Name); bool inReceiptAllocation = _receiptAllocationService.FindBySINumber(SINumber).Any(p => p.CommoditySourceID == CommoditySource.Constants.LOCALPURCHASE); if ((gift == null || (gift.GiftCertificateID == GiftCertificateID)) && !(inReceiptAllocation))// new one or edit no problem { return(Json(true, JsonRequestBehavior.AllowGet)); } else { return(Json(string.Format("{0} is invalid, there is an existing record with the same SI Number ", SINumber), JsonRequestBehavior.AllowGet)); } }