Exemplo n.º 1
0
        public int UpdateParty(PartyAcctDetails party)
        {
            try
            {
                using (_dbContext = string.IsNullOrEmpty(_connectionString) ? _dbContext : new ZionContext(_connectionString))
                {
                    _dbContext.Entry(party).State = EntityState.Modified;

                    if (party.Status == "Inactive") //Deactivate all the dependent objects
                    {
                        InterfaceMasterDataAccess interfaceDAL = new InterfaceMasterDataAccess(_connectionString);
                        List <InterfaceMaster>    interfaces   = _dbContext.InterfaceMaster.Where(intf => intf.PartyId == party.PartyId && intf.Status != "Inactive").ToList();

                        if (interfaces != null && interfaces.Count > 0)
                        {
                            _dbContext.AttachRange(interfaces);
                            interfaces.ForEach(intf =>
                            {
                                intf.Status = party.Status;
                                interfaceDAL.UpdateInterfaceHeirarchyStatus(_dbContext, intf.InterfaceId, "Inactive");
                            });
                        }
                    }

                    _dbContext.SaveChanges();

                    return(1);
                }
            }
            catch
            {
                throw;
            }
        }
Exemplo n.º 2
0
        public void TempMappingStatusUpdateForDatasetId(ZionContext dbContext, int datasetId, bool status)
        {
            List <LandingToCoreTempDetails> tempMaps = (from tempRecord in dbContext.LandingToCoreTempDetails
                                                        where (tempRecord.DatasetId == datasetId)
                                                        select tempRecord
                                                        ).ToList();

            if (tempMaps != null && tempMaps.Count > 0)
            {
                dbContext.AttachRange(tempMaps);
                tempMaps.ForEach(m => m.Status = status);
            }
        }
Exemplo n.º 3
0
        public void MappingStatusUpdateForDatasetId(ZionContext dbContext, int datasetId, bool status)
        {
            List <LandingToCoreMapDetails> mappings = (from record in dbContext.LandingToCoreMapDetails
                                                       where (record.DatasetId == datasetId)
                                                       select record
                                                       ).ToList();

            //dbContext.Entry(mappings).State = Microsoft.EntityFrameworkCore.EntityState.Modified;
            if (mappings != null && mappings.Count > 0)
            {
                dbContext.AttachRange(mappings);
                mappings.ForEach(m => m.Status = status); //Save is handled at the dataset level to maintain a single tran
            }
        }