Пример #1
0
        private bool SaveCurrentLists(out int parentID)
        {
            bool result = true;


            BusinessLogicLayer.Entity.PPM.BookRepackPackage repackPackage = new BusinessLogicLayer.Entity.PPM.BookRepackPackage();
            repackPackage.CreatedDate  = DateTime.Now;
            repackPackage.ModifiedDate = DateTime.Now;
            repackPackage.Save();
            parentID = repackPackage.BookRepackPackageID;
            foreach (var item in BookRepackPackageItemList)
            {
                item.BookRepackPackageID = repackPackage.BookRepackPackageID;
                item.Save();
                BusinessLogicLayer.Entity.PPM.BookPackItem packItem = new BusinessLogicLayer.Entity.PPM.BookPackItem(item.BookPackItemID.Value);
                if (packItem.OperationStatusID != 8)
                {
                    packItem.OperationStatusID = 8;
                    packItem.Save();
                }
            }

            foreach (var item in BookPackItemOperationList)
            {
                item.Save();
            }

            return(result);
        }
Пример #2
0
        public ActionResult PackageWeightGridViewPartialDelete(System.Int32 PackageWeightID)
        {
            //var model = new object[0];
            if (PackageWeightID >= 0)
            {
                try
                {
                    BusinessLogicLayer.Entity.PPM.PackageWeight package = new BusinessLogicLayer.Entity.PPM.PackageWeight(PackageWeightID);
                    var itemPack = new BusinessLogicLayer.Entity.PPM.BookPackItem(package.PackageCode.Value);
                    if (itemPack.OperationStatusID > 3)
                    {
                        ViewData["EditError"] = "لا يمكن حذف هذه الحزمة";
                    }
                    else
                    {
                        itemPack.Weight            = null;
                        itemPack.OperationStatusID = 2;
                        itemPack.Save();
                        package.Delete();
                    }
                }
                catch (Exception e)
                {
                    ViewData["EditError"] = e.Message;
                }
            }
            var model = new BusinessLogicLayer.Components.PPM.PackageWeightLogic().GetAllView();

            return(PartialView("_PackageWeightGridViewPartial", model));
        }
Пример #3
0
        public ActionResult SaveWeight(string item, decimal weight)
        {
            var itemPack = new BusinessLogicLayer.Entity.PPM.BookPackItem(item);

            //if (itemPack.OperationStatusID > 3)
            //    return Json("notsaved");
            if (itemPack.HasObject)
            {
                BusinessLogicLayer.Components.PPM.PackageWeightLogic logic = new BusinessLogicLayer.Components.PPM.PackageWeightLogic();
                var packageOperation = new BusinessLogicLayer.Entity.PPM.BookPackingOperation(itemPack.BookPackingOperationID.Value);
                if (itemPack.OperationStatusID == 2)
                {
                    itemPack.OperationStatusID = 3;
                }
                itemPack.Weight = weight;
                itemPack.Save();
                BusinessLogicLayer.Entity.PPM.PackageWeight package = new BusinessLogicLayer.Entity.PPM.PackageWeight(item);
                if (!package.HasObject)
                {
                    package             = new BusinessLogicLayer.Entity.PPM.PackageWeight();
                    package.CreatedDate = DateTime.Now;
                }
                package.ModifiedDate = DateTime.Now;
                package.PackageCode  = itemPack.BookPackItemID;
                package.Weight       = weight;
                package.Save();
                logic.CheckPackWeightCompleted(packageOperation.BookPrintingOperationID.Value);
                return(Json("saved"));
            }
            else
            {
                return(Json("notsaved"));
            }
        }
Пример #4
0
        private void AddItemToPack(List <BusinessLogicLayer.Entity.PPM.BookPackItem> items, List <BusinessLogicLayer.Entity.PPM.PackagingType> packageTypes, List <BusinessLogicLayer.Entity.PPM.BookPackItemOperation> packing, List <BusinessLogicLayer.Entity.PPM.BookPackItemOperation> oldPacks, BusinessLogicLayer.Entity.PPM.BookPrintingOperation model, BusinessLogicLayer.Entity.PPM.Exam exam, ref int count, ref int serial, BusinessLogicLayer.Entity.PPM.BookPackItemOperation pack, BusinessLogicLayer.Entity.PPM.BookPackItem parentItem)
        {
            serial = 1;

            if (parentItem.OperationStatusID != 8)
            {
                parentItem.OperationStatusID = 8;
                parentItem.Save();
            }
            BusinessLogicLayer.Entity.PPM.BookPackingOperation packOperation = new BusinessLogicLayer.Entity.PPM.BookPackingOperation(parentItem.BookPackingOperationID.Value);
            var packType  = (from x in packageTypes where x.PackagingTypeID == pack.PackagingTypeID select x).FirstOrDefault();
            var exists    = (from x in oldPacks where x.BookPackItemOperationID == pack.BookPackItemOperationID select x).FirstOrDefault();
            int bookStart = 0;
            int bookLast  = 0;

            if (exists == null || !exists.HasObject)
            {
                for (int i = 0; i < pack.PackageTotal.Value; i++)
                {
                    BusinessLogicLayer.Entity.PPM.BookPackItem item = new BusinessLogicLayer.Entity.PPM.BookPackItem();
                    item.BookPackingOperationID  = packOperation.BookPackingOperationID;
                    item.BookPackItemOperationID = pack.BookPackItemOperationID;
                    item.BookPackItemID          = PackID;
                    item.OperationStatusID       = 7;

                    item.PackSerial = serial;

                    string modelCode = "";
                    List <BusinessLogicLayer.Entity.PPM.BookPackItemModel> itemModels = new List <BusinessLogicLayer.Entity.PPM.BookPackItemModel>();
                    bookStart = bookLast + 1;
                    bookLast += bookStart + (i + 1) * packType.BooksPerPackage.Value;
                    bool addModelsToCount = true;
                    foreach (BusinessLogicLayer.Entity.PPM.ExamModelItem examModel in exam.ExamModels)
                    {
                        if (packType.ExamModelCount > 1)
                        {
                            BusinessLogicLayer.Entity.PPM.BookPackItemModel newModel = new BusinessLogicLayer.Entity.PPM.BookPackItemModel();
                            newModel.BookPackItemID = item.BookPackItemID;
                            newModel.ExamModelID    = examModel.ExamModelID;
                            modelCode           += examModel.ExamModelID + "-";
                            item.StartBookSerial = bookStart;
                            item.LastBookSerial  = bookLast;


                            itemModels.Add(newModel);
                        }
                        else
                        {
                            itemModels = new List <BusinessLogicLayer.Entity.PPM.BookPackItemModel>();
                            BusinessLogicLayer.Entity.PPM.BookPackItem itemUnit = new BusinessLogicLayer.Entity.PPM.BookPackItem();
                            item.BookPackingOperationID  = packOperation.BookPackingOperationID;
                            item.BookPackItemOperationID = pack.BookPackItemOperationID;
                            item.BookPackItemID          = PackID;
                            itemUnit.OperationStatusID   = 7;

                            itemUnit.StartBookSerial = bookStart;
                            itemUnit.LastBookSerial  = bookLast;
                            itemUnit.PackSerial      = serial;
                            //itemUnit.PackCode = PrintingOperationID + "-" + pack.BookPackingOperationID + "-" + pack.PackagingTypeID + "-" + examModel.ExamModelID + "-" + serial;
                            itemUnit.PackCode = RandomString(12);
                            BusinessLogicLayer.Entity.PPM.BookPackItemModel newModel = new BusinessLogicLayer.Entity.PPM.BookPackItemModel();
                            newModel.BookPackItemID = item.BookPackItemID;
                            newModel.ExamModelID    = examModel.ExamModelID;
                            modelCode += examModel.ExamModelID + "-";
                            itemModels.Add(newModel);
                            itemUnit.ItemModels = itemModels;
                            items.Add(itemUnit);
                            if (addModelsToCount)
                            {
                                i += exam.ExamModels.Count - 1;
                                addModelsToCount = false;
                            }
                            //serial++;
                        }
                    }
                    if (packType.ExamModelCount > 1)
                    {
                        if (!string.IsNullOrEmpty(modelCode))
                        {
                            modelCode = modelCode.Remove(modelCode.Length - 1, 1);
                        }
                        //item.PackCode = PrintingOperationID + "-" + pack.BookPackingOperationID + "-" + pack.PackagingTypeID + "-" + modelCode + "-" + serial;
                        item.PackCode   = RandomString(12);
                        item.ItemModels = itemModels;
                        items.Add(item);
                    }
                    serial++;

                    ///TODO: Add Pack Items for Sub Packs
                }
            }
        }