public ViewContracts()
 {
     InitializeComponent();
     _mode = ContractViewMode.ViewContracts;
     _autocon = new AutoContractor();
     UserAccount.Settings.GetFormSizeLoc(this);
     contractsGrid.Tag = "Contracts Data";
     if (Globals.calculator != null)
     {
         Globals.calculator.BindGrid(contractsGrid);
     }
 }
Пример #2
0
        private void btnAuto_Click(object sender, EventArgs e)
        {
            this.Cursor = Cursors.WaitCursor;

            try
            {
                Diagnostics.ResetAllTimers();
                Diagnostics.StartTimer("CourierCalc.Auto");
                _contract.Items = new ContractItemList();

                AutoContractor autoCon = new AutoContractor();
                ContractList list = autoCon.GenerateContracts(_contract.OwnerID, _contract.PickupStationID,
                    _contract.DestinationStationID, false);
                if (list.Count > 0)
                {
                    _contract = list[0];
                }

                Diagnostics.StartTimer("CourierCalc.CalcValues");
                CalcValues();
                Diagnostics.StopTimer("CourierCalc.CalcValues");
                Diagnostics.StopTimer("CourierCalc.Auto");

                Diagnostics.DisplayDiag("Total time: " +
                    Diagnostics.GetRunningTime("CourierCalc.Auto").ToString() +
                    "\r\n\tLoad assets: " + Diagnostics.GetRunningTime("GenerateContract.Part1").ToString() +
                    "\r\n\tGet sell prices: " + Diagnostics.GetRunningTime("GenerateContract.Part2").ToString() +
                    "\r\n\tGet buy prices: " + Diagnostics.GetRunningTime("GenerateContract.Part6").ToString() +
                    "\r\n\tCalc collateral: " + Diagnostics.GetRunningTime("GenerateContract.Part3").ToString() +
                    "\r\n\tRoute length: " + Diagnostics.GetRunningTime("GenerateContract.Part4").ToString() +
                    "\r\n\tClearing up: " + Diagnostics.GetRunningTime("GenerateContract.Part5").ToString() +
                    "\r\n\tRecalc values: " + Diagnostics.GetRunningTime("CourierCalc.CalcValues").ToString());
            }
            finally
            {
                this.Cursor = Cursors.Default;
            }
        }