Пример #1
0
        internal void RemoveShiftExc(ShiftException shiftException)
        {
            string excID = shiftException.Tag.ToString();

            MiscRequests.DeleteItem("Shift Exception", "Shift Exception ID", excID, true);
            IEnumerable <Panel> panels = stpShiftExc.Children.OfType <Panel>();

            foreach (Panel p in panels)
            {
                p.Children.Remove(shiftException);
            }
            shiftException = null;
        }
Пример #2
0
        private void OnMouseUp()
        {
            resizeDir = 0;
            mouseDown = false;
            if (currentlySelected is null)
            {
                return;
            }

            Panel parent = (Panel)currentlySelected.Parent;

            if (parent == grd)
            {
                parent.Children.Remove(currentlySelected);
                if (currentlySelected.Tag is string id)
                {
                    MiscRequests.DeleteItem("Shift", "Shift ID", id);
                }
                currentlySelected = null;
                return;
            }

            bool isNew = false;

            // If this is a new shift
            if (currentlySelected.Tag is string sTag && sTag == "")
            {
                string id = MiscRequests.GetMinKeyNotUsed("Shift", "Shift ID");
                currentlySelected.Tag = id;
                isNew = true;
            }

            string[] data = GetDataFromShift(currentlySelected);
            DBAccess.UpdateTable("Shift", shiftColumns.Select(c => c.Name).ToArray(), data, isNew);

            currentlySelected.IsHitTestVisible = true;
            currentlySelected.Children.OfType <Rectangle>().Where(r => r.Name == "rctBase").First().IsHitTestVisible = true;
        }