public List <Education_MovementStepAgent> LoadAllStepsOfAgent(long agentId, long mvtTypeId) { db = new CFNEducation_FormationEntities(); return(db.Education_MovementStepAgent .Where(x => x.MovementStepAgent_Agent == agentId && x.Education_MovementStep.MovementStep_Type == mvtTypeId) .ToList()); }
public Education_MovementAgent LoadSingleMvtAgent(long agentId, long mvtTypeId) { db = new CFNEducation_FormationEntities(); return(db.Education_MovementAgent .Where(x => x.MovementAgent_Type == mvtTypeId && x.MovementAgent_Agent == agentId) .FirstOrDefault()); }
public async Task <List <Education_Formation> > LoadAllEducation_FormationsAsync() { try { using (var dbFormation = new CFNEducation_FormationEntities()) { return(await dbFormation.Education_Formation.ToListAsync()); } } catch (Exception ex) { throw ex; } }
private async Task <IPagedList <Education_Agent> > LoadDatagriUsers(string selectedEducation_FormationSAP, int pagNumber = 1, int pageSize = 100) { try { return(await Task.Factory.StartNew(() => { using (CFNEducation_FormationEntities dbList = new CFNEducation_FormationEntities()) { List <Education_Agent> tempUserList = new List <Education_Agent>(); var selectedEducation_FormationId = dbList.Education_Formation.Where(x => x.Formation_SAP.Equals(selectedEducation_FormationSAP)).FirstOrDefault(); var listUsersEducation_Formation = dbList.Education_Agent_Formation .Where(p => p.AgentFormation_Formation == selectedEducation_FormationId.Formation_Id).ToList(); foreach (var itemUserEducation_Formation in listUsersEducation_Formation) { tempUserList.Add(dbList.Education_Agent .Include("Education_Equipe") .Include("Education_Function") .Include("Education_Habilitation") .Include("Education_GroupLearner_Agent") .Include("Education_Matrice_Agent") .Include("Education_MovementAgent") .Include("Education_MovementAgent1") .Include("Education_Role") .Include("Education_RoleAstreinte") .Include("Education_RoleEPI") //.Include("User1") //.Include("User2") .Include("Education_AgentStatus") .Include("Education_Agent_Formation") .Where(w => w.Agent_Id == itemUserEducation_Formation.AgentFormation_Agent).FirstOrDefault()); } return tempUserList.OrderByDescending(p => p.Agent_Id).ToPagedList(pagNumber, pageSize); //dG_Education_Formations.DataSource = lEducation_Formations.ToPagedList(1, 100); ; } }).ConfigureAwait(true)); } catch (Exception ex) { Logger.LogError(ex, "UC Education_Formation"); throw; } LoadCbListColumnsToFilter(dG_Education_Formations.Columns, dG_Education_Formations); //dG_Education_Formations.AutoGenerateColumns = false; //StylingDatagrid(dG_Education_Formations); }
public static void LogError(string messageException, string source) { CFNEducation_FormationEntities db = new CFNEducation_FormationEntities(); Education_Log logInfo = new Education_Log { Log_Date = DateTime.Now, Log_Message = messageException, Log_Source = source }; db.Education_Log.Add(logInfo); db.SaveChanges(); }
public static void LogError(Exception ex, string source) { CFNEducation_FormationEntities db = new CFNEducation_FormationEntities(); Education_Log logError = new Education_Log { Log_Date = DateTime.Now, Log_Message = ex.Message, Log_Stacktrace = ex.StackTrace, Log_Source = source }; db.Education_Log.Add(logError); db.SaveChanges(); }
public List <Education_Agent> LoadAllAgentsExcepted(Education_Matrice matriceSelected) { db = new CFNEducation_FormationEntities(); List <Education_Agent> listAgentInGrp = db.Education_Agent .Where(w => w.Education_Matrice_Agent.Any(x => x.Education_Matrice_Formation.MatriceFormation_Matrice == matriceSelected.Matrice_Id)) .ToList(); List <Education_Agent> listAgent = db.Education_Agent .ToList(); List <Education_Agent> listIntersect = listAgent.Except(listAgentInGrp).ToList(); return(listIntersect); }
public List <Education_GroupLearner> LoadAllGrpAgentsExcepted(Education_Matrice matriceSelected) { db = new CFNEducation_FormationEntities(); List <Education_GroupLearner> listAgentInGrp = db.Education_GroupLearner .Where(w => w.Education_Matrice_GrLearner.Any(x => x.MatriceGrLearner_Matrice == matriceSelected.Matrice_Id && x.MatriceGrLearner_Actif == true)) .ToList(); List <Education_GroupLearner> listAgent = db.Education_GroupLearner.Where(x => x.GroupLearner_Actif == true) .ToList(); List <Education_GroupLearner> listIntersect = listAgent.Except(listAgentInGrp).ToList(); return(listIntersect); }
internal void SaveStepAgent(List <Education_MovementStepAgent> currentMovementAgentSteps) { db = new CFNEducation_FormationEntities(); foreach (Education_MovementStepAgent item in currentMovementAgentSteps) { var itemDB = db.Education_MovementStepAgent.Where(x => x.MovementStepAgent_Id == item.MovementStepAgent_Id).FirstOrDefault(); itemDB.MovementStepAgent_Status = item.MovementStepAgent_Status; itemDB.MovementStepAgent_Remarks = item.MovementStepAgent_Remarks; db.SaveChanges(); } ObjectResult result = db.UpdateStatutMovementAgent(currentMovementAgentSteps[0].MovementStepAgent_Agent, currentMovementAgentSteps[0].Education_MovementStep.MovementStep_Type); }
public async void SaveEducation_FormationAsync(Education_Formation currentEducation_Formation) { using (CFNEducation_FormationEntities dbSaveSet = new CFNEducation_FormationEntities()) { if (currentEducation_Formation != null) { var Education_Formation = dbSaveSet.Education_Formation.Where(x => x.Formation_SAP == currentEducation_Formation.Formation_SAP).FirstOrDefault(); Education_Formation = currentEducation_Formation; await dbSaveSet.SaveChangesAsync(); } else { dbSaveSet.Education_Formation.Add(currentEducation_Formation); await dbSaveSet.SaveChangesAsync(); } } }
private async Task <IPagedList <Education_Provider> > LoadDatagriEducation_Providers(int pagNumber = 1, int pageSize = 100) { try { return(await Task.Factory.StartNew(() => { using (CFNEducation_FormationEntities dbList = new CFNEducation_FormationEntities()) { pageSize = Int32.Parse(tbNbrRowsProviders.Text); if (MainWindow.globalListProviders == null) { return dbList.Education_Provider .Include("Education_FormationProvider") //.Include("Education_FormationProvider") //.Include("Education_FormationResultat") //.Include("Education_FormationSession") //.Include("Education_Matrice_Formation") //.Include("Education_UnitePrice") .OrderBy(p => p.Provider_Id).ToPagedList(pagNumber, pageSize); //dG_Education_Formations.DataSource = lEducation_Formations.ToPagedList(1, 100); ; } else { return MainWindow.globalListProviders.ToPagedList(pagNumber, pageSize);; //dG_Education_Formations.DataSource = MainWindow.globalListEducation_Formations.ToPagedList(1, 100); } } }).ConfigureAwait(true)); } catch (Exception ex) { Logger.LogError(ex, "UC Provider"); throw; } //dG_Education_Formations.AutoGenerateColumns = false; //StylingDatagrid(dG_Education_Formations); }
public List <Education_MovementAgent> LoadAllMovements() { db = new CFNEducation_FormationEntities(); return(db.Education_MovementAgent .ToList()); }
public RepositoryBase() { Db = new CFNEducation_FormationEntities(); Db.SwicthEFAppRole(EducationHelper.GetApplicationRole()); }