Exemple #1
0
        private void fuvarTörléseToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Auto activeVehicle;
            int  period = activePeriod;
            int  group;

            bool performedDelete = false;

            if (sender == null)
            {
                //szelekció és nem volt lezárva és HÓTMINDEGY a júzer mire kattintott
                if (actualWorkSet.Count == 0)
                {
                    return;
                }

                activeVehicle = (Auto)statview.Tag;
                WorkData wd;

                foreach (int id in actualWorkSet)
                {
                    wd = partialRepo[id];

                    wd.Processed = false;
                    browser.Document.InvokeScript("undo", new object[] { id });
                }
            }
            else
            {
                for (int col = 0; col < 3; col++)
                {
                    if (workTree.SelectedNode.BackColor == napszakColors[col])
                    {
                        period = col;
                        break;
                    }
                }

                activeVehicle = findByInfo(workTree.SelectedNode.Name);
                group         = (int)workTree.SelectedNode.Tag;

                WorkData[] delIds = activeVehicle.GetFuvarAt(period, group);

                foreach (WorkData ma in delIds)
                {
                    if (activeVehicle.RemoveFuvar(ma))
                    {
                        performedDelete = true;

                        if (ma.Kobmeter != WorkData.HatarKapacitas)
                        {
                            unfive[period]++;
                            smallM3        += ma.Kobmeter;
                            kism3Unmap.Text = smallM3.ToString();
                        }
                        else
                        {
                            unbig[period]++;
                            bigM3           += ma.Kobmeter;
                            nagym3Unmap.Text = bigM3.ToString();
                        }

                        browser.Document.InvokeScript("undo", new object[] { ma.Number });

                        RestoreJunction(ma.Number);
                    }
                }

                if (performedDelete)
                {
                    AppLogger.WriteUnmapping(activeVehicle.Rendszam, group);

                    if (leftTab.SelectedIndex == 0)
                    {
                        UpdateStat();
                    }
                    else
                    {
                        UpdateCimlista();
                    }

                    unFiveLabel[period].Text = unfive[period].ToString();
                    unBigLabel[period].Text  = unbig[period].ToString();

                    remaining          = activeVehicle.SzabadCimek(activePeriod);
                    aktualisMenet.Text = remaining.ToString();

                    FillSingleCarData();
                    savedState++;
                }
            }

            groupCapacity = activeVehicle.Kapacitas;
            actualWorkSet.Clear();
            clickedGroup.Items.Clear();
        }