Пример #1
0
        static void Main(string[] args)
        {
            // instances des classes JsonRpcService
            MiscRequests = new MiscRequests();
            DataRequests = new DataRequests();
            //

            var rpcResultHandler = new AsyncCallback(
                state =>
            {
                var async  = ((JsonRpcStateAsync)state);
                var result = async.Result;
                var writer = ((StreamWriter)async.AsyncState);

                writer.WriteLine(result);
                writer.FlushAsync();
            });

            SocketListener.start(3333, (writer, line) =>
            {
                var async = new JsonRpcStateAsync(rpcResultHandler, writer)
                {
                    JsonRpc = line
                };
                JsonRpcProcessor.Process(async, writer);
            });
        }
Пример #2
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;
        }
Пример #3
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;
        }
Пример #4
0
        private async void BtnConfirmNewEx_Click(object sender, RoutedEventArgs e)
        {
            Button   btnConfirmNewEx = (Button)sender;
            ComboBox cbxNewExStaff   = stpNewExc.Children.OfType <ComboBox>().First();

            ValidatedDatePicker[] dates = stpNewExc.Children.OfType <ValidatedDatePicker>().ToArray();

            if (dates[0].IsValid && dates[1].IsValid && dates[0].SelectedDate <= dates[1].SelectedDate)
            {
                btnConfirmNewEx.Content = " Submitted! ";
                string[] newData = new string[4];
                newData[0] = MiscRequests.GetMinKeyNotUsed("Shift Exception", "Shift Exception ID");
                newData[1] = cbxNewExStaff.SelectedIndex.ToString();
                newData[2] = dates[0].SelectedDate.ToString("dd-MM-yyyy");
                newData[3] = dates[1].SelectedDate.ToString("dd-MM-yyyy");

                DBAccess.UpdateTable("Shift Exception", shiftExcColumns.Select(c => c.Name).ToArray(), newData, true);

                UpdateShiftExcs();
                await Task.Delay(2000);

                btnConfirmNewEx.Content = " Submit ";
            }
        }