Example #1
0
 private void addOrRemoveSelection(int i)
 {
     //try
     //{
     if (view.isVagForSendSelected(i))
     {
         if (!view.isVagForSendColored(i))
         {
             view.addVagToSendFromVagsForSend(i);
             view.setVagForSendColor(i, Color.Yellow);
         }
     }
     else
     {
         if (view.listToSend[view.listToSend.Count - 1] == view.listForSending[i])
         {
             VagSendOthSt vagon = view.listForSending[i];
             view.removeFromVagToSend(vagon);
             view.setVagForSendColor(i, Color.Empty);
             vagon.dt_from_way = null;
             vagSendOthStDB.cancelVagToSend(vagon.id_oper);
         }
     }
     //}
     //catch (Exception ex)
     //{
     //    main.showErrorMessage(ex.Message);
     //}
 }
Example #2
0
        public bool addToSend(VagSendOthSt vagSendOthSt)
        {
            string query = string.Format("update VAGON_OPERATIONS set st_lock_id_stat = @id_stat, st_lock_order = @order, " +
                                         "st_lock_train = @lock_train, st_lock_side = @lock_side, st_gruz_front = " +
                                         "@gruz_front, st_shop = @st_shop, st_lock_locom1 = @locom1, st_lock_locom2 = @locom2 where id_oper = @id_oper");

            SqlParameter[] sqlParameters = new SqlParameter[9];
            if (vagSendOthSt.St_lock_id_stat == -1)
            {
                sqlParameters[0] = new SqlParameter("@id_stat", DBNull.Value);
            }
            else
            {
                sqlParameters[0] = new SqlParameter("@id_stat", vagSendOthSt.St_lock_id_stat);
            }
            sqlParameters[1] = new SqlParameter("@order", vagSendOthSt.St_lock_order);
            sqlParameters[2] = new SqlParameter("@lock_train", vagSendOthSt.St_lock_train);
            sqlParameters[3] = new SqlParameter("@id_oper", vagSendOthSt.id_oper);
            sqlParameters[4] = new SqlParameter("@lock_side", (int)vagSendOthSt.St_lock_side);
            sqlParameters[5] = new SqlParameter("@gruz_front", vagSendOthSt.St_gruz_front);
            sqlParameters[6] = new SqlParameter("@st_shop", vagSendOthSt.St_shop);
            sqlParameters[7] = new SqlParameter("@locom1", vagSendOthSt.St_lock_locom1);
            sqlParameters[8] = new SqlParameter("@locom2", vagSendOthSt.St_lock_locom2);
            return(Conn.executeNonQueryCommand(query, sqlParameters));
        }
Example #3
0
        /// <summary>
        /// Пересылка на другую станцию функция "транзит"
        /// </summary>
        public void performAccSend()
        {
            if (!view.hasSelFromStatVag)
            {
                return;
            }
            try
            {
                if (view.getDialogTransitResult(main.selectedStation))
                {
                    List <VagWaitAdmiss> list = view.listWaitAdmiss;
                    string mess_transit       = String.Format("Пользователь выполнил транзит состава на станцию {0} через станцию  {1}, путь {2}", view.statPerformTransit.Name, main.selectedStation.Name, view.wayPerformTransit.NumName);
                    string status             = "";
                    foreach (VagWaitAdmiss item in list)
                    {
                        item.num_vag_on_way = list.IndexOf(item) + 1;

                        //принятие на станцию транзита
                        object ins_result = vagWaitAdmissDB.execAdmissOthStat(item, main.selectedStation,
                                                                              view.wayPerformTransit, view.dtArriveTransit, view.getSelTrain(false, false).St_lock_locom1, view.getSelTrain(false, false).St_lock_locom2);
                        if (ins_result != null)
                        {
                            view.listWaitAdmiss[view.listWaitAdmiss.IndexOf(item)].id_oper = Convert.ToInt32(ins_result);
                        }
                        else
                        {
                            return;
                        }

                        //данные о след. станции, на кот. отправл.
                        VagSendOthSt vagSendOthSt = new VagSendOthSt(item);
                        vagSendOthSt.St_lock_id_stat = view.statPerformTransit.ID;
                        vagSendOthSt.St_lock_order   = item.num_vag_on_way;
                        vagSendOthSt.St_lock_train   = view.getSelTrain(false, false).Num;
                        vagSendOthSt.St_lock_side    = neighbourStationsDB.getSendSide(main.selectedStation, view.statPerformTransit);
                        vagSendOthStDB.addToSend(vagSendOthSt);

                        //отправление со станции транзита
                        vagSendOthStDB.send(item.id_oper, item.cond.Id, view.dtArriveTransit, view.dtArriveTransit);
                        status += String.Format("[состав:{0}, №:{1}, дата АМКР:{2}]; ", item.id_sostav, item.num_vag, item.dt_amkr);
                    }

                    //удаляем строку поезда
                    view.removeTrain(false, false, view.getSelTrain(false, false));
                    loadVagWaitAdmiss(false, false);
                    mess_transit.SaveLogEvents(status, service.DesktopRailCars);
                }
            }
            catch (Exception ex)
            {
                main.showErrorMessage(ex.Message);
            }
        }
Example #4
0
 public void onRemoveVagFromSend()
 {
     try
     {
         int          srCount = view.selVagToSendCount;
         VagSendOthSt vagon   = view.firstSelVagToSend;
         for (int i = 0; i <= srCount - 1; i++)
         {
             if (vagSendOthStDB.cancelVagToSend(vagon.id_oper))
             {
                 // убрать выделение цветом
                 view.setVagForSendColor(vagon.num_vag_on_way - 1, Color.Empty);
                 // убрать дату снятия с пути
                 view.listForSending[vagon.num_vag_on_way - 1].dt_from_way = null;
                 view.removeFromVagToSend(vagon);
             }
         }
     }
     catch (Exception ex)
     {
         main.showErrorMessage(ex.Message);
     }
 }
Example #5
0
        private bool addToSend(VagSendOthSt vagSendOthSt, int order)
        {
            vagSendOthSt.St_lock_side  = view.selectedSide;
            vagSendOthSt.St_lock_order = order;

            try
            {
                vagSendOthSt.St_gruz_front = view.selectedGF.ID;
            }
            catch (NullReferenceException)
            {
                vagSendOthSt.St_gruz_front = -1;
            }

            try
            {
                vagSendOthSt.St_shop = view.selectedShop.ID;
            }
            catch (NullReferenceException)
            {
                vagSendOthSt.St_shop = -1;
            }

            try
            {
                vagSendOthSt.St_lock_id_stat = view.selectedStatAccept.ID;
            }
            catch (NullReferenceException)
            {
                if (vagSendOthSt.St_gruz_front > -1 || vagSendOthSt.St_shop > -1)
                {
                    vagSendOthSt.St_lock_id_stat = main.selectedStation.ID;
                }
                else
                {
                    vagSendOthSt.St_lock_id_stat = -1;
                }
            }

            if (vagSendOthSt.St_gruz_front == -1 && vagSendOthSt.St_shop == -1)
            {
                if (view.trainNum == 0)
                {
                    vagSendOthSt.St_lock_train = vagSendOthStDB.getMaxTrainNum() + 1;
                    view.setTrainNum(vagSendOthSt.St_lock_train);
                }
                else
                {
                    vagSendOthSt.St_lock_train = view.trainNum;
                }
            }
            else
            {
                vagSendOthSt.St_lock_train = -1;
            }

            try
            {
                vagSendOthSt.St_lock_locom1 = view.locom1.ID;
            }
            catch (NullReferenceException)
            {
                vagSendOthSt.St_lock_locom1 = -1;
            }

            try
            {
                vagSendOthSt.St_lock_locom2 = view.locom2.ID;
            }
            catch (NullReferenceException)
            {
                vagSendOthSt.St_lock_locom2 = -1;
            }

            //try
            //{
            return(vagSendOthStDB.addToSend(vagSendOthSt));
            //}
            //catch (Exception ex)
            //{
            //    main.showErrorMessage(ex.Message);
            //    return false;
            //}
        }