Exemplo n.º 1
0
    //------------------------------------
    public void SwapGroupsOrder(string groupName, Reorder direction)
    {
        var index = groups.FindIndex(x => x.GroupName.Equals(groupName));

        if (index == -1)
        {
            throw new ArgumentException("group was not found!");
        }

        switch (direction)
        {
        case Reorder.MoveUp:
            if (index == 0)
            {
                return;
            }
            var temp = groups[index - 1];
            groups[index - 1] = groups[index];
            groups[index]     = temp;
            break;

        case Reorder.MoveDown:
            if (index == groups.Count - 1)
            {
                return;
            }
            var temp2 = groups[index + 1];
            groups[index + 1] = groups[index];
            groups[index]     = temp2;
            break;

        default:
            throw new ArgumentOutOfRangeException("direction", direction, null);
        }
    }
        //AutoReorderCreate
        public async Task <IActionResult> AutoReorderCreate(BookReorder bo, int?bookId, int intReorderQuantity)
        {
            Reorder neworder = new Reorder();


            //Stores newly created order into order detail
            bo.Reorder = neworder;

            bo.Reorder.IsPending = true;

            //Stores most recently updated book price into order detail price
            //TODO: Check if we need to do this lol
            bo.Price = bo.Book.BookPrice;

            //Stores order quantity and necessary order details
            bo.ReorderQuantity = intReorderQuantity;

            if (ModelState.IsValid)
            {
                _context.Add(neworder);
                _context.BookReorders.Add(bo);
                await _context.SaveChangesAsync();

                ViewBag.AddedOrder  = "Your order has been added!";
                ViewBag.CartMessage = "View your cart below";

                return(RedirectToAction("Details", new { id = bo.Reorder.ReorderID }));
            }

            return(RedirectToAction("Details", "Books", new { id = bookId }));
        }
Exemplo n.º 3
0
    public void SwapGroupMethod(string groupName, EventMethodInfo method, Reorder direction)
    {
        var group = groups.Find(x => x.GroupName.Equals(groupName));

        if (group == null)
        {
            throw new ArgumentException("group was not found!");
        }

        if (!group.ContainsMethod(method))
        {
            throw new ArgumentException("method was not found in the group!");
        }

        var indexOfMethod = group.IndexOfMethod(x => x.Equals(method));

        var nextIndex = indexOfMethod;

        if (direction == Reorder.MoveUp)
        {
            nextIndex--;
        }
        else if (direction == Reorder.MoveDown)
        {
            nextIndex++;
        }

        if (group.Methods.IndexInRange(nextIndex))
        {
            group.SwapMethods(indexOfMethod, nextIndex);
        }
    }
Exemplo n.º 4
0
        } // end OrderReorders()

        private Boolean UpdateOrderInCollection(Reorder reorder)
        {
            if (reorder == null)
            {
                throw new ArgumentNullException("Reorder item cannot be null");
            }
            if (_reorders.Count == 0)
            {
                throw new ApplicationException("There are no reorder objects in the collection");
            }
            //if (!_reorders.Contains(reorder))
            //{
            //    throw new ApplicationException("No reorder found in reorders collection");
            //}
            foreach (var reorderI in _reorders)
            {
                if (reorderI == reorder)
                {
                    reorderI.CasesToOrder  = reorder.CasesToOrder;
                    reorderI.ShouldReorder = reorder.ShouldReorder;
                    //reorderI.Product = reorder.Product;
                    reorderI.VendorSourceItem = reorder.VendorSourceItem;

                    return(true);
                }
            }
            return(false);
        } //end UpdateOrderInCollection(.)
Exemplo n.º 5
0
        public async Task <IActionResult> Edit(int id, [Bind("ReorderID,ReorderType")] Reorder reorder)
        {
            if (id != reorder.ReorderID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(reorder);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ReorderExists(reorder.ReorderID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(reorder));
        }
Exemplo n.º 6
0
        } //end UpdateOrderInCollection(.)

        private Double GetReorderRowTotal(Reorder reorder)
        {
            try
            {
                return((Double)(reorder.CasesToOrder * reorder.VendorSourceItem.UnitCost * reorder.VendorSourceItem.ItemsPerCase));
            }
            catch (Exception ex)
            {
                throw new ArithmeticException("Calculating row total threw an exception." + ex.Message);
            }
        } //end GetReorderRowTotal(.)
Exemplo n.º 7
0
        public async Task <IActionResult> Create([Bind("ReorderID,ReorderType")] Reorder reorder)
        {
            if (ModelState.IsValid)
            {
                _context.Add(reorder);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(reorder));
        }
Exemplo n.º 8
0
 public Double UpdateReorderAmount(Reorder reorder, int amt)
 {
     reorder.CasesToOrder = amt;
     if (UpdateOrderInCollection(reorder))
     {
         return(GetReorderRowTotal(reorder));
     }
     else
     {
         throw new ApplicationException("Never should happen, Houston We Have A Problem");
     }
 } //end UpdateReorderAmount(..)
        //GET method to get order id for order
        public IActionResult RemoveFromReorder(int?id)
        {
            //Storing order into new order instance including relational data
            Reorder order = _context.Reorders.Include(r => r.BookReorders).ThenInclude(r => r.Book).FirstOrDefault(r => r.ReorderID == id);

            if (order == null || order.BookReorders.Count == 0)//order is not found
            {
                return(RedirectToAction("Details", new { id = id }));
            }

            return(View(order.BookReorders)); //Passes list of orderdetails for matching order id
        }
        //This action displays details of completed orders
        //Has order id as parameter
        public async Task <IActionResult> CompletedReorderDetails(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            //Finding current logged in user to match user to order id
            string userid = User.Identity.Name;
            User   user   = _context.Users.FirstOrDefault(us => us.UserName == userid);

            //Finds order (including relational data) of the order matched in the order id
            Reorder order = _context.Reorders
                            .Include(or => or.BookReorders).ThenInclude(bo => bo.Book)
                            .Where(or => or.User == user).FirstOrDefault(or => or.ReorderID == id);


            if (ModelState.IsValid)
            {
                Book bookUpdate = new Book();

                //Iterates thr
                foreach (BookReorder bo in order.BookReorders)
                {
                    //Matching book object with book for that specific book order detail
                    bookUpdate = _context.Books.Find(bo.Book.BookID);

                    //Subtracts book order quantity from current copies on hand value for this book
                    bookUpdate.CopiesOnHand = bookUpdate.CopiesOnHand + bo.ReorderQuantity;

                    //Update changes in database
                    _context.Update(bookUpdate);
                    await _context.SaveChangesAsync();
                }

                //Closes order so cannot show up in shopping cart anymore
                order.IsPending = false;

                _context.Update(order);
                await _context.SaveChangesAsync();



                //pass matched order to view
                return(View(order));
            }
            else
            {
                return(RedirectToAction("Details", new { id = id }));
            }
        }
Exemplo n.º 11
0
 public void DeleteReorderByReorderID(ReorderInfo Reoinfo)
 {
     try
     {
         using (RMSDataContext db = new RMSDataContext())
         {
             var obj = (from a in db.Reorders where a.ReorderID == Reoinfo.ReorderID select a).First();
             {
                 db.Reorders.DeleteOnSubmit(obj);
                 db.SubmitChanges();
             }
         }
     }
     catch (Exception ex)
     {
         Reorder Reo = new Reorder();
     }
 }
Exemplo n.º 12
0
        public static void SolveKeypads(ref KeypadModule moduleData)
        {
            HashSet <int> otherOptions = new HashSet <int>();

            Reorder[] order = new Reorder[4];
            int       setTarget = moduleData.Selected.Count(x => x != -1);
            int       i, j, k, l = 0;
            var       Layouts = KeypadModule.Layouts;

            for (i = 0; i < Layouts.GetLength(0); i++)
            {
                for (j = 0; j < Layouts.GetLength(1); j++)
                {
                    //Search for potential direct matches
                    k = Layouts[i, j];
                    if (k == moduleData.Selected[l])
                    {
                        order[l] = new Reorder {
                            Position = j, Value = k
                        };
                        l++;
                        //Break out on a full match
                        if (l > 3)
                        {
                            moduleData.SetSolution(order.OrderBy(x => x.Position).Select(x => x.Value).ToArray());
                            return;
                        }
                        //Loop current set again for next entry
                        j = -1;
                    }
                }
                //Add to potential list if every matching element accounted for
                if (l == setTarget)
                {
                    for (j = 0; j < Layouts.GetLength(1); j++)
                    {
                        otherOptions.Add(Layouts[i, j]);
                    }
                }
                l = 0;
            }
            moduleData.OtherOptions = otherOptions;
            moduleData.SetSolution(null);
        }
Exemplo n.º 13
0
        public void InsertReorder(ReorderInfo rinfo)
        {
            try
            {
                using (RMSDataContext db = new RMSDataContext())
                {
                    Reorder reo = new Reorder();
                    Guid    rid = Guid.NewGuid();
                    reo.ReorderID   = rid.ToString();
                    reo.InventoryID = rinfo.InventoryID;
                    reo.ProductID   = rinfo.ProductID;
                    reo.ReorderUnit = rinfo.ReorderUnit;

                    db.Reorders.InsertOnSubmit(reo);
                    db.SubmitChanges();
                }
            }
            catch (Exception ex) { }
        }
Exemplo n.º 14
0
 public void UpdateReorderByReorderID(ReorderInfo Reoinfo)
 {
     try
     {
         using (RMSDataContext db = new RMSDataContext())
         {
             var obj = (from a in db.Reorders where a.ReorderID == Reoinfo.ReorderID select a).First();
             {
                 obj.ReorderID   = Reoinfo.ReorderID;
                 obj.ProductID   = Reoinfo.ProductID;
                 obj.InventoryID = Reoinfo.InventoryID;
                 obj.ReorderUnit = Reoinfo.ReorderUnit;
                 db.SubmitChanges();
             }
         }
     }
     catch (Exception ex) {
         Reorder Reo = new Reorder();
     }
 }
Exemplo n.º 15
0
        public Boolean AddNewLineItem(Product product, VendorSourceItem vendorSrcItem, int caseAmt)
        {
            if (product == null)
            {
                throw new ArgumentNullException("Product is null");
            }
            if (vendorSrcItem == null)
            {
                throw new ArgumentNullException("VendorSourceItem is null");
            }
            Reorder addOrder = new Reorder();

            addOrder.Product          = product;
            addOrder.VendorSourceItem = vendorSrcItem;
            addOrder.ShouldReorder    = true;
            addOrder.CasesToOrder     = caseAmt;
            addOrder.ReorderTotal     = GetReorderRowTotal(addOrder);
            return(true);
            //throw new NotImplementedException();
        }
        //GET: Orders/Details
        //For the navbar and anytime you can't route an id
        public IActionResult CartDetails()
        {
            string id   = User.Identity.Name;
            User   user = _context.Users.Include(us => us.Reorders).FirstOrDefault(u => u.UserName == id);

            if (user.Reorders == null || user.Reorders.Exists(o => o.IsPending == false))
            {
                ViewBag.EmptyMessage = "Looks like your order is empty! Search for books to add.";
                return(View("EmptyCart"));
            }
            else
            {
                if (user.Reorders.Exists(o => o.IsPending == true))
                {
                    //Finds order in db matching user
                    Reorder order = _context.Reorders.Include(us => us.User).Include(o => o.BookReorders).ThenInclude(o => o.Book).FirstOrDefault(u => u.User.UserName == user.UserName && u.IsPending == true);

                    return(RedirectToAction("Details", new { id = order.ReorderID }));
                }
            }
            ViewBag.EmptyMessage = "Looks like your order is empty! Search for books to add.";
            return(View("EmptyCart"));
        }
Exemplo n.º 17
0
 private Boolean UpdateOrderList(Reorder reorder, Boolean remove)
 {
     reorder.ShouldReorder = !remove;
     return(UpdateOrderInCollection(reorder));
 } //end UpdateOrderList(..)
        public async Task <IActionResult> AddToReorder(BookReorder bo, int?bookId, int intReorderQuantity)
        {
            if (bookId == null)
            {
                return(NotFound());
            }

            if (intReorderQuantity < 1)
            {
                return(RedirectToAction("Details", "Books", new { id = bookId }));
            }

            //Finding book matching book id passed from book details page
            Book book = _context.Books.Find(bookId);

            //Stores book in book order detail
            bo.Book            = book;
            bo.ReorderQuantity = intReorderQuantity;

            //Finds if user already has an order pending
            //Assigning user to user id
            //get user info
            String id   = User.Identity.Name;
            User   user = _context.Users.Include(o => o.Reorders).ToList().FirstOrDefault(u => u.UserName == id); //NOTE: Relational data

            //If user has an order already
            if (user.Reorders.Count != 0)
            {
                if (user.Reorders.Exists(o => o.IsPending == true))
                {
                    //TODO

                    //Finds current pending order for this user and stores it in order
                    Reorder order = _context.Reorders.Include(us => us.User).Include(o => o.BookReorders).ThenInclude(o => o.Book).FirstOrDefault(u => u.User.UserName == user.UserName && u.IsPending == true);


                    BookReorder bookOrderToUpdate = new BookReorder();


                    //This is the path for updating a book already in the cart
                    try
                    {
                        //Iterating through list of book orders to add book order quantity instead of
                        //just adding a new book instance
                        foreach (BookReorder bookOrder in order.BookReorders)
                        {
                            if (bookOrder.Book == bo.Book)
                            {
                                bookOrder.ReorderQuantity = bookOrder.ReorderQuantity + bo.ReorderQuantity;
                                bookOrder.Price           = bookOrder.Book.BookPrice;


                                bookOrderToUpdate         = bookOrder;
                                bookOrderToUpdate.Reorder = order;


                                _context.Update(bookOrderToUpdate);
                                await _context.SaveChangesAsync();

                                ViewBag.AddedOrder  = "Your order has been added!";
                                ViewBag.CartMessage = "View your cart below";

                                return(RedirectToAction("Details", new { id = bookOrderToUpdate.Reorder.ReorderID }));
                            }
                        }
                    }
                    catch
                    {
                        throw;
                    }

                    //This is the path for adding a new book to the cart
                    //Stores matched order in order detail order property
                    bo.Reorder         = order;
                    bo.Price           = bo.Book.BookPrice;
                    bo.ReorderQuantity = intReorderQuantity;

                    _context.Add(bo);
                    await _context.SaveChangesAsync();

                    ViewBag.AddedOrder  = "Your order has been added!";
                    ViewBag.CartMessage = "View your cart below";

                    return(RedirectToAction("Details", new { id = bo.Reorder.ReorderID }));
                }


                //This is the path if user does not have a pending order
                Reorder neworder = new Reorder();

                neworder.User = user;

                //Stores newly created order into order detail
                bo.Reorder = neworder;

                bo.Reorder.IsPending = true;

                //Stores most recently updated book price into order detail price
                //TODO: Check if we need to do this lol
                bo.Price = bo.Book.BookPrice;

                //Stores order quantity and necessary order details
                bo.ReorderQuantity = intReorderQuantity;

                if (ModelState.IsValid)
                {
                    _context.Add(neworder);
                    _context.BookReorders.Add(bo);
                    await _context.SaveChangesAsync();

                    ViewBag.AddedOrder  = "Your order has been added!";
                    ViewBag.CartMessage = "View your cart below";

                    return(RedirectToAction("Details", new { id = bo.Reorder.ReorderID }));
                }

                return(RedirectToAction("Details", "Books", new { id = bookId }));
            }


            //This is the path if this is the user's first order
            Reorder firstorder = new Reorder();

            //Assigns user to order
            firstorder.User = user;

            //Stores order to order detail order navigational property
            bo.Reorder = firstorder;

            //Sets order to is pending so cart can persist
            bo.Reorder.IsPending = true;

            //Sets order quantity
            bo.ReorderQuantity = intReorderQuantity;

            //Stores most recently updated book price into order detail price & other stuff
            bo.Price = bo.Book.BookPrice;

            _context.Add(bo);
            await _context.SaveChangesAsync();

            ViewBag.AddedOrder  = "Your order has been added!";
            ViewBag.CartMessage = "View your cart below";

            return(RedirectToAction("Details", new { id = bo.Reorder.ReorderID }));
        }
Exemplo n.º 19
0
 public frmReorderChangeLevels(Reorder _product, AccessToken _myAccessToken)
 {
     InitializeComponent();
     _curProduct = _product;
     var RoleAccess = new RoleAccess(_myAccessToken, this);
 }
Exemplo n.º 20
0
        }  // end GetReorderReportData(.)

        public static Reorder GetProductToReorder(string productName)
        {
            // List<Reorder> reorders = new List<Reorder>();
            Reorder       order = new Reorder();
            SqlConnection conn  = GetInventoryDbConnection();

            try
            {
                conn.Open();
                SqlCommand sqlCmd = new SqlCommand("proc_GetProductToReorder", conn);
                sqlCmd.CommandType = CommandType.StoredProcedure;
                sqlCmd.Parameters.AddWithValue("@shortDesc", productName);
                SqlDataReader reader = sqlCmd.ExecuteReader();

                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        var product = new Product(reader.GetInt32(0))
                        {
                            Name = reader.GetString(reader.GetOrdinal("ShortDesc")),
                            _reorderThreshold = reader.GetInt32(reader.GetOrdinal("ReorderThreshold")),
                            _reorderAmount    = reader.GetInt32(reader.GetOrdinal("ReorderAmount")),
                            Active            = true
                        };
                        order.Product = product;
                        var vendorSrcItem = new VendorSourceItem(reader.GetInt32(reader.GetOrdinal("ProductID")), reader.GetInt32(reader.GetOrdinal("VendorID")))
                        {
                            UnitCost      = (Decimal)reader.GetSqlMoney(reader.GetOrdinal("UnitCost")),
                            MinQtyToOrder = reader.GetInt32(reader.GetOrdinal("MinQtyToOrder")),
                            ItemsPerCase  = reader.GetInt32(reader.GetOrdinal("ItemsPerCase")),
                            Active        = true
                        };
                        order.CasesToOrder     = (int)product._reorderAmount / vendorSrcItem.ItemsPerCase + (product._reorderAmount % vendorSrcItem.ItemsPerCase == 0 ? 0 : 1);
                        order.ReorderTotal     = (double)order.CasesToOrder * (double)vendorSrcItem.ItemsPerCase * (double)vendorSrcItem.UnitCost;
                        order.ShouldReorder    = true;
                        order.VendorSourceItem = vendorSrcItem;
                    }
                }
                reader.Close();
            }
            catch (DataException ex)
            {
                Console.WriteLine(ex.Message);
                throw new ApplicationException(Messeges.GetMessage("DatabaseException"), ex);
            }
            catch (SqlException ex)
            {
                Console.WriteLine(ex.Message);
                throw new ApplicationException(Messeges.GetMessage("SqlException"), ex);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                throw new ApplicationException(Messeges.GetMessage("Exception"), ex);
            }
            finally
            {
                conn.Close();
            }
            return(order);
        }
Exemplo n.º 21
0
 public Boolean RemoveFromOrder(Reorder reorder)
 {
     return(UpdateOrderList(reorder, true));
 }
        public ReorderableCollection(SerializedProperty property, SerializedProperty collection)
        {
            bool   allowDrag     = true;
            object pathReference = SerializationReflection.GetPathReference(property);

            if (pathReference != null)
            {
                Type sortedType = SerializationReflection.GetPathReference(property).GetType();

                while (sortedType != null)
                {
                    if (sortedType.GetInterface("SortedCollection`1") != null)
                    {
                        allowDrag = false;
                        break;
                    }
                    sortedType = sortedType.BaseType;
                }
            }

            string collectionPath = CollectionDisplay.GetFullPath(collection);

            DisplayState listState;

            if (ListStates.ContainsKey(collectionPath))
            {
                ListStates.Remove(collectionPath);
            }

            listState = new DisplayState();
            ListStates.Add(collectionPath, listState);
            listState.Collection = collection;
            listState.List       = this;

            DrawerState drawerState = CollectionDisplay.GetDrawerState(property);
            var         newList     = new ReorderableList(collection.serializedObject, collection)
            {
                draggable = allowDrag,
            };

            newList.showDefaultBackground = false;

            newList.onReorderCallbackWithDetails = (ReorderableList list, int oldIndex, int newIndex) =>
            {
                Reorder?.Invoke(drawerState.Property, listState.Collection, oldIndex, newIndex);
            };

            newList.drawHeaderCallback = (Rect position) =>
            {
                SerializedProperty hasLostValue = drawerState.Property.FindPropertyRelative("hasLostValue");
                if (hasLostValue != null && hasLostValue.boolValue == true)
                {
                    EditorUtility.DisplayDialog("Collection Error", "You've attempted to change an element in a way that prevents it from being added to the collection. The element will be moved to the Add Element area of the list so you can change the element and add it back in.", "Okay");
                    ListStates[CollectionDisplay.GetFullPath(listState.Collection)].AddingElement = true;
                    hasLostValue.boolValue = false;
                }

                Rect startPosition = position;

                DrawHeaderBackground(position, drawerState.Property, listState.Collection);
                DrawSettingsButton(position, drawerState.Property, listState.Collection);
                position.y += DrawSettings(position, drawerState.Property, listState.Collection);

                for (var i = 0; i < DrawHeaderAreaHandlers.Count; i++)
                {
                    position.y += DrawHeaderAreaHandlers[i].Invoke(position, drawerState.Property, listState.Collection);
                }

                listState.LastHeaderHeight = position.y - startPosition.y;
                newList.headerHeight       = listState.LastHeaderHeight;
            };

            newList.drawElementCallback += (Rect position, int index, bool isActive, bool isFocused) =>
            {
                position.y += 2;

                var pageRange = GetPageDisplayRange(listState.Collection);
                if (index >= pageRange.x && index < pageRange.y)
                {
                    EditorGUI.BeginDisabledGroup(listState.AddingElement);
                    DrawElement?.Invoke(position, index, drawerState.Property, listState.Collection);
                    EditorGUI.EndDisabledGroup();
                }
            };

            newList.drawElementBackgroundCallback = (Rect position, int index, bool isActive, bool isFocused) =>
            {
                if (Mathf.Approximately(position.height, 0))
                {
                    return;
                }

                Rect backgroundPos = position;
                backgroundPos.yMin       -= 2;
                backgroundPos.yMax       += 2;
                boxBackground.fixedHeight = backgroundPos.height;
                boxBackground.fixedWidth  = backgroundPos.width;
                Color guiColor = UnityEngine.GUI.color;

                if (isActive)
                {
                    UnityEngine.GUI.color = UnityEngine.GUI.skin.settings.selectionColor;
                }

                if (index % 2 == 0)
                {
                    UnityEngine.GUI.color = Color.Lerp(UnityEngine.GUI.color, Color.black, .1f);
                }

                if (Event.current.type == EventType.Repaint)
                {
                    boxBackground.Draw(position, false, isActive, true, false);
                }

                UnityEngine.GUI.color = guiColor;

                position.xMin += 2;
                position.xMax -= 3;
            };

            newList.elementHeightCallback += (int index) =>
            {
                int pageSize       = GetItemsPerPage(listState.Collection);
                int pageStartIndex = (listState.CurrentPageSet * listState.PageSetSize * pageSize) + (listState.CurrentPage * pageSize);
                int pageEndIndex   = pageStartIndex + pageSize;

                if (index >= pageStartIndex && index < pageEndIndex && (GetElementHeight != null))
                {
                    return(GetElementHeight(index, drawerState.Property, listState.Collection) + 2);
                }

                return(0);
            };

            newList.drawFooterCallback = (Rect position) =>
            {
                DrawFooterBackground(position, drawerState.Property, listState.Collection);
                DrawAddRemoveButtons(position, drawerState.Property, listState.Collection);

                Rect startPosition = position;
                for (var i = 0; i < DrawFooterAreaHandlers.Count; i++)
                {
                    position.y += DrawFooterAreaHandlers[i].Invoke(position, drawerState.Property, listState.Collection);
                }

                position.y += DrawPageSelection(position, drawerState.Property, listState.Collection);
                if (listState.List.DrawCustomAdd)
                {
                    position.y += DrawAddArea(position, property, collection);
                }

                listState.LastFooterHeight  = position.y - startPosition.y;
                listState.LastFooterHeight += 4;
                List.footerHeight           = listState.LastFooterHeight;
            };

            newList.onRemoveCallback += (ReorderableList targetList) =>
            {
                if (targetList.index > -1)
                {
                    int pageSize       = GetItemsPerPage(listState.Collection);
                    int pageStartIndex = GetPageDisplayRange(listState.Collection).x;
                    listState.Collection.DeleteArrayElementAtIndex(pageStartIndex + targetList.index);
                }
            };

            newList.onAddCallback += (ReorderableList targetList) =>
            {
                if (DrawCustomAdd)
                {
                    ListStates[collectionPath].AddingElement = !ListStates[collectionPath].AddingElement;
                    if (ListStates[collectionPath].AddingElement)
                    {
                        SerializationReflection.CallPrivateMethod(property, "ClearTemp");
                    }
                }
                else
                {
                    listState.Collection.InsertArrayElementAtIndex(listState.Collection.arraySize);
                }
            };

            List = newList;
        }
Exemplo n.º 23
0
 public Boolean AddToOrder(Reorder reorder)
 {
     _reorders.Add(reorder);
     return(UpdateOrderList(reorder, false));
 }