예제 #1
0
 public bool updateControlData(CONTROL_DATA new_control_data)
 {
     try
     {
         using (sc.Data.DBConnection_EF con = sc.Data.DBConnection_EF.GetUContext())
         {
             con.CONTROL_DATA.Attach(new_control_data);
             con.Entry(new_control_data).Property(p => p.T1).IsModified = true;
             con.Entry(new_control_data).Property(p => p.T2).IsModified = true;
             con.Entry(new_control_data).Property(p => p.T3).IsModified = true;
             con.Entry(new_control_data).Property(p => p.T4).IsModified = true;
             con.Entry(new_control_data).Property(p => p.T5).IsModified = true;
             con.Entry(new_control_data).Property(p => p.T6).IsModified = true;
             con.Entry(new_control_data).Property(p => p.T7).IsModified = true;
             con.Entry(new_control_data).Property(p => p.T8).IsModified = true;
             con.Entry(new_control_data).Property(p => p.BLOCK_REQ_TIME_OUT).IsModified = true;
             ControlDataDao.update(con, new_control_data);
         }
         return(true);
     }
     catch (Exception ex)
     {
         NLog.LogManager.GetCurrentClassLogger().Error(ex, "Exception:");
         return(false);
     }
 }
예제 #2
0
        public void start(IVehicleDataSetting _dataSetting)
        {
            dataSetting  = _dataSetting;
            Control_Data = dataSetting.getReleaseCONTROL_DATA();

            setValue2UI();

            uc_bt_Save1.MyClick += Uc_bt_Save1_MyClick;
        }
        public CONTROL_DATA getReleaseCONTROL_DATA()
        {
            CONTROL_DATA data = null;

            using (DBConnection_EF con = DBConnection_EF.GetUContext())
            {
                data = ControlDataDao.getReleaseData(con);
            }
            return(data);
        }
예제 #4
0
 /// <summary>
 /// Updates the alarm.
 /// </summary>
 /// <param name="conn">The connection.</param>
 /// <param name="alarm">The alarm.</param>
 public void update(DBConnection_EF conn, CONTROL_DATA entity)
 {
     try
     {
         conn.SaveChanges();
     }
     catch (Exception ex)
     {
         logger.Warn(ex);
         throw;
     }
 }
예제 #5
0
 /// <summary>
 /// Inserts the alarm.
 /// </summary>
 /// <param name="conn">The connection.</param>
 /// <param name="entity">The alarm.</param>
 public void insert(DBConnection_EF conn, CONTROL_DATA entity)
 {
     try
     {
         conn.CONTROL_DATA.Add(entity);
         conn.SaveChanges();
     }
     catch (Exception ex)
     {
         logger.Warn(ex);
         throw;
     }
 }
예제 #6
0
        private async void Uc_bt_Save1_MyClick(object sender, EventArgs e)
        {
            int t1         = (int)(numic_TimeoutOfT1_Value.Value * TIMEOUT_SCALE);
            int t2         = (int)(numic_TimeoutOfT2_Value.Value * TIMEOUT_SCALE);
            int t3         = (int)(numic_TimeoutOfT3_Value.Value * TIMEOUT_SCALE);
            int t4         = (int)(numic_TimeoutOfT4_Value.Value * TIMEOUT_SCALE);
            int t5         = (int)(numic_TimeoutOfT5_Value.Value * TIMEOUT_SCALE);
            int t6         = (int)(numic_TimeoutOfT6_Value.Value * TIMEOUT_SCALE);
            int t7         = (int)(numic_TimeoutOfT7_Value.Value * TIMEOUT_SCALE);
            int t8         = (int)(numic_TimeoutOfT8_Value.Value * TIMEOUT_SCALE);
            int block_time = (int)(numic_TimeoutOfBlockingResponse_Value.Value * TIMEOUT_SCALE);


            CONTROL_DATA new_control_cata = new CONTROL_DATA()
            {
                T1 = t1,
                T2 = t2,
                T3 = t3,
                T4 = t4,
                T5 = t5,
                T6 = t6,
                T7 = t7,
                T8 = t8,
                BLOCK_REQ_TIME_OUT = block_time,

                SUB_VER = Control_Data.SUB_VER
            };
            bool isSuccess = false;
            await Task.Run(() => isSuccess = dataSetting.updateControlData(new_control_cata));

            if (isSuccess)
            {
                Control_Data = new_control_cata;
            }
            else
            {
                setValue2UI();
            }
        }