Пример #1
0
 private void addOrRemoveSelection(int i)
 {
     //try
     //{
     if (view.isVagForManSelected(i))
     {
         if (!view.isVagForManColored(i))
         {
             view.addVagOnManFromVagsForMan(i);
             view.setVagForManColor(i, Color.Yellow);
         }
     }
     else
     {
         if (view.listVagOnMan[view.listVagOnMan.Count - 1] == view.listVagForMan[i])
         {
             VagManeuver vagon = view.listVagForMan[i];
             view.removeFromVagOnMan(vagon);
             view.setVagForManColor(i, Color.Empty);
             vagon.dt_from_way = null;
             //vagManeuverDB.cancelVagOnMan(vagon.id_oper);
             maneuvers.CancelManeuverCar(vagon.id_oper);
         }
     }
     //}
     //catch (Exception ex)
     //{
     //    main.showErrorMessage(ex.Message);
     //}
 }
Пример #2
0
        /// <summary>
        /// Добавить вагон в список для маневра !
        /// </summary>
        /// <param name="vagManeuver"></param>
        /// <param name="order"></param>
        /// <returns></returns>
        private bool addOnManuever(VagManeuver vagManeuver, int order)
        {
            try
            {
                vagManeuver.Lock_id_way = view.selectedWayTo.ID;
            }
            catch (NullReferenceException)
            {
                vagManeuver.Lock_id_way = -1;
            }

            vagManeuver.Lock_side = view.selectedSide;

            try
            {
                vagManeuver.Lock_id_locom = Int32.Parse(view.selectedLocom.ID.ToString());
            }
            catch (NullReferenceException)
            {
                /*if (cbLocom.Text.Trim() != "" && cbLocom.Text.Trim() != "ВЫБЕРИТЕ")
                 *  vagManeuver.Lock_id_locom = qJournalBUS.addDevice(_newElement.device, (Shop)cbShop.SelectedItem).id;
                 * else*/
                vagManeuver.Lock_id_locom = -1;
            }

            vagManeuver.Lock_order  = order;
            vagManeuver.dt_from_way = DateTime.Now;
            //try
            //{

            int res = maneuvers.AddCancelManeuverCar(vagManeuver.id_oper, vagManeuver.Lock_id_way, vagManeuver.Lock_order, (int)vagManeuver.Lock_side, vagManeuver.Lock_id_locom, vagManeuver.dt_from_way);

            if (res > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
            //return vagManeuverDB.addOnManeuver(vagManeuver);
            //}
            //catch (Exception ex)
            //{
            //    main.showErrorMessage(ex.Message);
            //    return false;
            //}
        }
Пример #3
0
 public void onRemoveVagFromMan()
 {
     try
     {
         int         srCount = view.selVagOnManCount;
         VagManeuver vagon   = view.firstSelVagOnMan;
         for (int i = 0; i <= srCount - 1; i++)
         {
             //if (vagManeuverDB.cancelVagOnMan(vagon.id_oper))
             if (maneuvers.CancelManeuverCar(vagon.id_oper) > 0)
             {
                 // убрать выделение цветом
                 view.setVagForManColor(vagon.num_vag_on_way - 1, Color.Empty);
                 // убрать дату снятия с пути
                 view.listVagForMan[vagon.num_vag_on_way - 1].dt_from_way = null;
                 view.removeFromVagOnMan(vagon);
             }
         }
     }
     catch (Exception ex)
     {
         main.showErrorMessage(ex.Message);
     }
 }