Exemple #1
0
        private bool CheckPackValid()
        {
            bool result       = true;
            int  count        = GetTotalBooksForModel();
            int  currentPacks = 0;
            var  packageTypes = new BusinessLogicLayer.Components.PPM.PackagingTypeLogic().GetAll();

            foreach (var item in BookPackItemOperationList)
            {
                var ptype = packageTypes.Where(c => c.PackagingTypeID == item.PackagingTypeID).FirstOrDefault();
                currentPacks += item.PackageTotal.Value * ptype.BooksPerPackage.Value;
            }
            if (currentPacks != count)
            {
                result = false;
            }


            foreach (var item in BookRepackPackageItemList)
            {
                if (item.PackageTypeExamModelCount == 1)
                {
                    var tempList = BookRepackPackageItemList.Where(c => c.PackSerial == item.PackSerial);
                    if (tempList.Count() != item.TotalExamModels)
                    {
                        result = false;
                    }
                }
            }


            return(result);
        }
Exemple #2
0
        public ActionResult CheckItem(string item)
        {
            var itemPack = new BusinessLogicLayer.Entity.PPM.BookPackItem(item);

            if (itemPack == null || !itemPack.HasObject)
            {
                PackID = 0;
                PrintingOperationID = 0;
                return(Json("notexists"));
            }

            if (itemPack.ParentID != null)
            {
                PackID = 0;
                PrintingOperationID = 0;
                return(Json("notexists"));
            }
            PackID = itemPack.BookPackItemID;
            BusinessLogicLayer.Entity.PPM.BookPackingOperation  operation = new BusinessLogicLayer.Entity.PPM.BookPackingOperation(itemPack.BookPackingOperationID.Value);
            BusinessLogicLayer.Entity.PPM.BookPrintingOperation printing  = new BusinessLogicLayer.Entity.PPM.BookPrintingOperation(operation.BookPrintingOperationID.Value);
            PrintingOperationID = operation.BookPrintingOperationID.Value;

            int countExams = new BusinessLogicLayer.Components.PPM.ExamLogic().GetExamModelCount(printing.ExamID.Value);

            if (countExams > ExamCount)
            {
                ExamCount = countExams;
            }
            var addedItem = repackItemLogic.GetBookRepackItem(item);
            var exItem    = BookRepackPackageItemList.Where(c => c.ExamID == addedItem.ExamID).FirstOrDefault();

            if (BookRepackPackageItemList.Count > 0 && exItem == null)
            {
                return(Json("notexists"));
            }
            BookRepackPackageItemList.Add(addedItem);
            if (itemPack.HasObject)
            {
                return(Json("exists"));
            }
            else
            {
                return(Json("notexists"));
            }

            //var model = new BusinessLogicLayer.Entity.PPM.BookPrintingOperation(PrintingOperationID);
            //model.OperationStatusID = 2;
            //model.Save();
            //ViewBag.HasError = false;
            //ViewBag.NotifyMessage = Resources.MainResource.SaveSuccess;
        }