Ejemplo n.º 1
0
        public MapDB.Item save()
        {
            if (oldItem == null)
            {
                newItem.creation_date = DateTime.Now;
                DBconnection.DBCONNECTION.Item.InsertOnSubmit(newItem);
            }
            else
            {
                newItem.modify_date = DateTime.Now;
            }
            if (!itemsSame(oldItem))
            {
                DBconnection.DBCONNECTION.SubmitChanges();
                Panels.refreshPanelStartGrid();
                Panels.refreshPanelBinGrid();
                MessageBox.Show(Utils.GetEnumDescription(Messages.ok.SAVE), "OK", MessageBoxButtons.OK, MessageBoxIcon.Information);

                var hisotry = new HistoryLogic();
                if (oldItem == null)
                {
                    hisotry.addItem(newItem);
                }
                else
                {
                    hisotry.addItem(newItem, oldItem);
                }
                hisotry.save();
            }

            return(newItem);
        }
Ejemplo n.º 2
0
        public MapDB.Item revertHistory(int historyId)
        {
            var history = queries.getHistoryById(historyId);

            if (!itemsSame(history))
            {
                newItem.deleted     = history.deleted;
                newItem.id_status   = history.id_status;
                newItem.id_shelf    = history.id_shelf;
                newItem.description = history.description;
                newItem.id_category = history.id_category;
                newItem.size        = history.size;
                newItem.name        = history.name;
                newItem.id_item     = history.id_item;
                newItem.image       = history.image;
                newItem.modify_date = DateTime.Now;

                DBconnection.DBCONNECTION.SubmitChanges();

                var his = new HistoryLogic();
                his.addItem(newItem);
                his.save("przywrócenie historii");
            }


            return(newItem);
        }