예제 #1
0
        private int AddToSerialNumber(string itemnumber, string lot, string serialnumber, string expdate, string scan)
        {
            IObjectSpace objectspace = this.ObjectSpace.CreateNestedObjectSpace();

            // InventoryItemBatchItems iiBi = this.ObjectSpace.GetObject<InventoryItemBatchItems>();

            ItemInventoryBatch iib = objectToShow;

            // Find the item in the item list
            // bool found = false;
            Session session;

            session = objectToShow.Session;
            CriteriaOperator op = GroupOperator.Combine(GroupOperatorType.And,
                                                        new BinaryOperator("ItemInventoryBatch", iib.Oid),
                                                        new BinaryOperator("NDC", itemnumber),
                                                        new BinaryOperator("Lot", lot),
                                                        new BinaryOperator("SerialNumber", serialnumber));

            ItemInventoryBatchSerialNo itemToUpdate = (ItemInventoryBatchSerialNo)session.FindObject(typeof(ItemInventoryBatchSerialNo),
                                                                                                     op, true);


            if (itemToUpdate != null)
            {
                return(-1);
            }
            else
            {
                ItemInventoryBatchSerialNo iibi;

                iibi = objectspace.CreateObject <ItemInventoryBatchSerialNo>();


                iibi.ItemInventoryBatch = objectspace.GetObject <ItemInventoryBatch>((ItemInventoryBatch)this.View.CurrentObject);


                iibi.NDC          = itemnumber;
                iibi.Lot          = lot;
                iibi.Barcode      = scan;
                iibi.SerialNumber = serialnumber;
                DateTime result;
                if (DateTime.TryParse(expdate, out result))
                {
                    iibi.ExpDate = result;
                }
                iibi.Save();
                objectspace.CommitChanges();
                //  objectspace.Refresh();
            }
            objectToShow.Item.Reload();
            //jectSpace.ReloadObject();

            this.View.ObjectSpace.CommitChanges();
            this.View.ObjectSpace.Refresh();


            return(1);
        }
예제 #2
0
        private void AddToItemSerial(ItemInventoryBatch itemInventoryBatch, string e)
        {
            IObjectSpace objectSpace = View.ObjectSpace.CreateNestedObjectSpace();
            ItemInventoryBatchSerialNo itemSerials = objectSpace.CreateObject <ItemInventoryBatchSerialNo>();

            itemSerials.ItemInventoryBatch = itemInventoryBatch;
            itemSerials.NDC          = "123456";
            itemSerials.SerialNumber = "ssn123456";
            itemSerials.Lot          = "lot123";
            itemSerials.ExpDate      = DateTime.Now;
        }