// On crée le groupe principal par défaut public int CreateInitialGroupe(int projectIdIn) { Groupes groupe = new Groupes { GroupSupId = 0, Name = "SuperGroupe", ProjectId = projectIdIn }; _context.Groupes.Add(groupe); _context.SaveChanges(); return(groupe.Id); }
public IActionResult InsertGroup(string params1, int params2, int params3) { var groupName = params1; var groupSupId = params2; var groupProjectId = params3; Groupes groupe = new Groupes { Name = groupName, GroupSupId = groupSupId, ProjectId = groupProjectId }; _context.Groupes.Add(groupe); _context.SaveChanges(); return(StatusCode(201)); }
public IActionResult CreateInitialEquipment() { var equipment = new Equipments { IdtNumber = "A0002", Description = "Une simple Description 2", Revision = "Revision B", SuiviAsm = "Ajout", ProjectId = 7 }; _context.Equipments.Add(equipment); _context.SaveChanges(); var _equipmentId = equipment.Id; var area = new Areas { PIDReference = "Initial Reference 2", NumeroZone = "Initial Zone", File = " ", ZoneProcess = " ", Atelier = "Initial Atelier", SousAtelier = "Initial Sous Atelier", EquipmentId = _equipmentId }; var operatinInformation = new OperatingInformations { MoteurImerge = false, Atex = "2", Package = false, BackupGenset = false, Vfd = false, BackupInverter = false, Etat = "En cours", PackageTypique = "Initial Package Typique", EquipmentId = _equipmentId }; var electricalDistribution = new ElectricalDistributions { Transfo = "Initial Transfo 2", TgbtLocation = "Initial TgbtLocation", MccLocation = "Initial MccLocation", DepartType = 1, AlimentationElectrique = 1, Intensite = 1, CosPhi = 1, EquipmentId = _equipmentId }; var powerFeature = new PowerFeatures { NominalInstalledPower = 1, MechanicalPowerDemand = 1, MotorEfficiency = 1, MotorEfficiencyClass = "E1", InstalledAbsorbedPowerDp = 1, DutyAbsorbedPower = 1, EquipmentId = _equipmentId }; var cable = new Cables { TypeCablePuissance = "Initial Type Cable Puissance 2", SectionCable = 1, NombreCable = 1, TypeProtection = "Initial TypeProtection", TypeCableProtection = "Initial Type Cable Protection", TypeCableCommande = "Initial Type Cable commande", LongueurCable = 1, EquipmentId = _equipmentId }; var thermalDissipation = new ThermalDissipations { HeatDissipation = 2, HVAC = 1, EquipmentId = _equipmentId }; _context.Areas.Add(area); _context.OperaOperatingInformations.Add(operatinInformation); _context.ElectricalDistributions.Add(electricalDistribution); _context.PowerFeatures.Add(powerFeature); _context.Cables.Add(cable); _context.ThermalDissipations.Add(thermalDissipation); _context.SaveChanges(); return(StatusCode(201)); }
public SaveResult CancelRequest(JObject saveBundle) { var transactionSettings = new TransactionSettings() { TransactionType = TransactionType.DbTransaction }; _context.BeforeSaveEntitiesDelegate = (saveMap) => { var entityInfos = saveMap.Where(e => e.Key == typeof(Request)).Select(e => e.Value).FirstOrDefault(); if (entityInfos != null) { foreach (EntityInfo entityInfo in entityInfos) { entityInfo.EntityState = EntityState.Modified; Request request = (Request)entityInfo.Entity; request.StatusId = _context.Session.Query <Status>().Where(p => p.Code == (string)_context.SaveOptions.Tag).Select(p => p.Id).First(); request.IsFirstAssessmentDone = null; request.IsSecondAssessmentDone = null; RequestBL requestBL = new RequestBL(_context.Session, _logger); requestBL.CancelRunningWorkflows(request); requestBL.ResetAllVolumes(request); //add modified jobs to savemap IQueryable <Job> sourceMaterialJobs = _context.Session.Query <SourceMaterial>().Where(sm => sm.Request == request).SelectMany(sm => sm.Jobs); foreach (Job job in sourceMaterialJobs) { job.LTSVolume = 0; saveMap.AddCustomEntity(job, _context); } } } return(saveMap); }; _context.AfterSaveEntitiesDelegate = (saveMap, result) => { }; return(_context.SaveChanges(saveBundle, transactionSettings)); }