private static tblDatawareHouseMigrationLog SaveDataMigrationLog(ElementDTO element, DateTime default_from_dt) { InnonAnalyticsEngineEntities _dbcontext2 = new InnonAnalyticsEngineEntities(); tblDatawareHouseMigrationLog tblDataMigration = _dbcontext2.tblDatawareHouseMigrationLogs.Add( new tblDatawareHouseMigrationLog { Element_ID = element.ID, Last_Run_Start = System.DateTime.Now, Total_Record_Fetch = 0, Timestamp_From = default_from_dt, }); _dbcontext2.SaveChanges(); return(tblDataMigration); }
private static tblDatawareHouseMigrationLog UpdateDataMigrationLog(tblDatawareHouseMigrationLog tblDataMigration, int totalrecords, DateTime last_record_datetime) { try { IInnonAnalyticsEngineEntities _dbcontext = new InnonAnalyticsEngineEntities(); tblDatawareHouseMigrationLog tbl_DataMigration = _dbcontext.tblDatawareHouseMigrationLogs.Find(tblDataMigration.ID); tbl_DataMigration.Last_Run_End = System.DateTime.Now; tbl_DataMigration.Total_Record_Fetch = totalrecords; tbl_DataMigration.Timestamp_To = last_record_datetime; _dbcontext.Entry(tbl_DataMigration).State = EntityState.Modified; _dbcontext.SaveChanges(); } catch (Exception ex) { Helper.WriteToFile("Error in update UpdateDataMigrationLog: " + tblDataMigration.ID + ex + "---" + ex.InnerException); } return(tblDataMigration); }
protected void SaveAduit(string user_id, string row_id, string table_name, string old_values, string new_values, string comments) { try { _dbcontext = new InnonAnalyticsEngineEntities(); Audit_DTO audit_dto = new Audit_DTO(); audit_dto.Comments = comments; audit_dto.New_Values = new_values; audit_dto.Old_Values = old_values; audit_dto.Table_Name = table_name; audit_dto.Table_Row_Id = row_id; audit_dto.User_Id = user_id; tblAudit tbl_audit = Convert_Aduit.Convert(audit_dto); _dbcontext.tblAudits.Add(tbl_audit); _dbcontext.SaveChanges(); _dbcontext.Dispose(); } catch (Exception ex) { } }