Beispiel #1
0
 public bool updateScaleBaseData(SCALE_BASE_DATA new_scale_base_data)
 {
     try
     {
         using (sc.Data.DBConnection_EF con = sc.Data.DBConnection_EF.GetUContext())
         {
             con.SCALE_BASE_DATA.Attach(new_scale_base_data);
             con.Entry(new_scale_base_data).Property(p => p.RESOLUTION).IsModified             = true;
             con.Entry(new_scale_base_data).Property(p => p.INPOSITION_AREA).IsModified        = true;
             con.Entry(new_scale_base_data).Property(p => p.INPOSITION_STABLE_TIME).IsModified = true;
             con.Entry(new_scale_base_data).Property(p => p.TOTAL_SCALE_PULSE).IsModified      = true;
             con.Entry(new_scale_base_data).Property(p => p.SCALE_OFFSET).IsModified           = true;
             con.Entry(new_scale_base_data).Property(p => p.SCALE_RESE_DIST).IsModified        = true;
             con.Entry(new_scale_base_data).Property(p => p.READ_DIR).IsModified = true;
             con.Entry(new_scale_base_data).Property(p => p.SUB_VER).IsModified  = true;
             con.Entry(new_scale_base_data).Property(p => p.ADD_TIME).IsModified = true;
             con.Entry(new_scale_base_data).Property(p => p.ADD_USER).IsModified = true;
             con.Entry(new_scale_base_data).Property(p => p.UPD_TIME).IsModified = true;
             con.Entry(new_scale_base_data).Property(p => p.UPD_USER).IsModified = true;
             ScaleBaseDataDao.update(con, new_scale_base_data);
         }
         return(true);
     }
     catch (Exception ex)
     {
         NLog.LogManager.GetCurrentClassLogger().Error(ex, "Exception:");
         return(false);
     }
 }
        public SCALE_BASE_DATA getReleaseSCALE_BASE_DATA()
        {
            SCALE_BASE_DATA data = null;

            using (DBConnection_EF con = DBConnection_EF.GetUContext())
            {
                data = ScaleBaseDataDao.getReleaseData(con);
            }
            return(data);
        }
Beispiel #3
0
 /// <summary>
 /// Updates the alarm.
 /// </summary>
 /// <param name="conn">The connection.</param>
 /// <param name="alarm">The alarm.</param>
 public void update(DBConnection_EF conn, SCALE_BASE_DATA entity)
 {
     try
     {
         conn.SaveChanges();
     }
     catch (Exception ex)
     {
         logger.Warn(ex);
         throw;
     }
 }
        private async void Uc_bt_Save1_MyClick(object sender, EventArgs e)
        {
            int         resolution                = (int)(numic_Resolution_Value.Value * SCALE_100);
            int         inposition_area           = (int)(numic_InpositionArea_Value.Value * SCALE_10000);
            int         Inposition_Stability_Time = (int)(numic_InpositionStabilityTime_Value.Value * SCALE_10);
            int         Total_Pulse_Of_One_Scale  = (int)(numic_TotalPulseOfOneScale_Value.Value);
            int         scale_offset              = (int)(numic_ScaleOffset_Value.Value * SCALE_10000);
            int         Scale_Reset_Distance      = (int)(numic_ScaleResetDistance_Value.Value * SCALE_10000);
            E_DIRC_DRIV Direction_of_Read         = (E_DIRC_DRIV)cmbo_dirc_of_read.SelectedItem;

            sc.SCALE_BASE_DATA new_scale_base_data = new SCALE_BASE_DATA();
            new_scale_base_data.RESOLUTION             = resolution;
            new_scale_base_data.INPOSITION_AREA        = inposition_area;
            new_scale_base_data.INPOSITION_STABLE_TIME = Inposition_Stability_Time;
            new_scale_base_data.TOTAL_SCALE_PULSE      = Total_Pulse_Of_One_Scale;
            new_scale_base_data.SCALE_OFFSET           = scale_offset;
            new_scale_base_data.SCALE_RESE_DIST        = Scale_Reset_Distance;
            new_scale_base_data.READ_DIR = Direction_of_Read;
            new_scale_base_data.SUB_VER  = scale_base_data.SUB_VER;
            new_scale_base_data.ADD_TIME = scale_base_data.ADD_TIME;
            new_scale_base_data.ADD_USER = scale_base_data.ADD_USER;
            new_scale_base_data.UPD_TIME = scale_base_data.UPD_TIME;
            new_scale_base_data.UPD_USER = scale_base_data.UPD_USER;
            bool isSuccess = false;

            await Task.Run(() => isSuccess = dataSetting.updateScaleBaseData(new_scale_base_data));

            if (isSuccess)
            {
                scale_base_data.RESOLUTION             = resolution;
                scale_base_data.INPOSITION_AREA        = inposition_area;
                scale_base_data.INPOSITION_STABLE_TIME = Inposition_Stability_Time;
                scale_base_data.TOTAL_SCALE_PULSE      = Total_Pulse_Of_One_Scale;
                scale_base_data.SCALE_OFFSET           = scale_offset;
                scale_base_data.SCALE_RESE_DIST        = Scale_Reset_Distance;
                scale_base_data.READ_DIR = Direction_of_Read;
            }
            else
            {
                set2UI(scale_base_data);
            }
        }