public void DeleteLoggerHistory(t_Logger_Histories history)
 {
     try
     {
         loggerHistoryRepository.DeleteLoggerHistory(history);
     }
     catch (Exception ex)
     {
         //
         throw ex;
     }
 }
 public void UpdateLoggerHistory(t_Logger_Histories loggerHistory, t_Logger_Histories orgiLoggerHistory)
 {
     try
     {
         loggerHistoryRepository.UpdateLoggerHistory(loggerHistory, orgiLoggerHistory);
     }
     catch (Exception ex)
     {
         //
         throw ex;
     }
 }
 public void InsertLoggerHistory(t_Logger_Histories loggerHistory)
 {
     try
     {
         loggerHistoryRepository.InsertLoggerHistory(loggerHistory);
     }
     catch (Exception ex)
     {
         //
         throw ex;
     }
 }
    private void SetControlValues(t_Logger_Histories loggerHistory)
    {
        var site = _siteBL.GetSite(loggerHistory.SiteID);

        cboSiteID.Text = site.SiteAliasName;

        dtmChange.SelectedDate      = loggerHistory.DateChanged;
        cboOldSerials.SelectedValue = loggerHistory.OldLoggerSerial;
        cboNewSerials.SelectedValue = loggerHistory.NewLoggerSerial;
        nmrOldIndex.Value           = loggerHistory.Index;
        txtDescription.Text         = loggerHistory.Description;
    }
 public void InsertLoggerHistory(t_Logger_Histories LoggerHistory)
 {
     try
     {
         context.t_Logger_Histories.Add(LoggerHistory);
         context.SaveChanges();
     }
     catch (Exception ex)
     {
         //
         throw ex;
     }
 }
    private t_Logger_Histories GetControlValues()
    {
        t_Logger_Histories loggerHistory = new t_Logger_Histories();

        loggerHistory.DateChanged     = (DateTime)dtmChange.SelectedDate;
        loggerHistory.Description     = txtDescription.Text;
        loggerHistory.NewLoggerSerial = cboNewSerials.SelectedValue;
        loggerHistory.OldLoggerSerial = cboOldSerials.SelectedValue;
        loggerHistory.Index           = nmrOldIndex.Value;
        loggerHistory.SiteID          = cboSiteID.SelectedValue;
        var oldLogger = _loggerBL.GetLogger(loggerHistory.OldLoggerSerial);
        var newLogger = _loggerBL.GetLogger(loggerHistory.NewLoggerSerial);

        return(loggerHistory);
    }
 public void DeleteLoggerHistory(t_Logger_Histories history)
 {
     try
     {
         //context.t_Logger_Histories.Attach(history);
         //context.t_Logger_Histories.Remove(history);
         var dbHistory = context.t_Logger_Histories.FirstOrDefault(lh => history.SiteID == history.SiteID && history.DateChanged == history.DateChanged);
         if (dbHistory != null)
         {
             context.t_Logger_Histories.Remove(dbHistory);
         }
         context.SaveChanges();
     }
     catch (Exception ex)
     {
         //
         throw ex;
     }
 }
 public void UpdateLoggerHistory(t_Logger_Histories LoggerHistory, t_Logger_Histories orgiLoggerHistory)
 {
     try
     {
         context.t_Logger_Histories.Attach(orgiLoggerHistory);
         orgiLoggerHistory.DateChanged     = LoggerHistory.DateChanged;
         orgiLoggerHistory.Description     = LoggerHistory.Description;
         orgiLoggerHistory.Index           = LoggerHistory.Index;
         orgiLoggerHistory.NewLoggerSerial = LoggerHistory.NewLoggerSerial;
         orgiLoggerHistory.OldLoggerSerial = LoggerHistory.OldLoggerSerial;
         orgiLoggerHistory.SiteID          = LoggerHistory.SiteID;
         context.SaveChanges();
     }
     catch (Exception ex)
     {
         //
         throw ex;
     }
 }