Example #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;
            }
        }
Example #2
0
        public int UpdateDataSetSftpDetailsByDataSetID(DatasetFileDetails datasetFileDetails)
        {
            try
            {
                using (_dbContext = string.IsNullOrEmpty(_connectionString) ? _dbContext : new ZionContext(_connectionString))
                {
                    DatasetFileDetails record = _dbContext.DatasetFileDetails.Where(i => i.DatasetId == datasetFileDetails.DatasetId).FirstOrDefault();
                    if (record != null)
                    {
                        record.FullFileName        = datasetFileDetails.FullFileName;
                        record.DeltaFileName       = datasetFileDetails.DeltaFileName;
                        record.FolderLocation      = datasetFileDetails.FolderLocation;
                        record.FileExtension       = datasetFileDetails.FileExtension;
                        record.FileDelimiter       = datasetFileDetails.FileDelimiter;
                        record.UpdatedDate         = datasetFileDetails.UpdatedDate;
                        record.UpdatedBy           = datasetFileDetails.UpdatedBy;
                        record.ArchiveLocation     = datasetFileDetails.ArchiveLocation;
                        record.ContainsHeader      = datasetFileDetails.ContainsHeader;
                        record.ContainsTrailer     = datasetFileDetails.ContainsTrailer;
                        record.ArchiveOutboundFile = datasetFileDetails.ArchiveOutboundFile;
                    }
                    _dbContext.Entry(record).State = EntityState.Modified;
                    _dbContext.SaveChanges();

                    return(1);
                }
            }
            catch
            {
                throw;
            }
        }
Example #3
0
        public int UpdateInterfaceSftpDetailsByInterfaceId(InterfaceSftpDetails interfaceSftpDetails)
        {
            try
            {
                using (_dbContext = string.IsNullOrEmpty(_connectionString) ? _dbContext : new ZionContext(_connectionString))
                {
                    InterfaceSftpDetails record = _dbContext.InterfaceSftpDetails.Where(i => i.InterfaceId == interfaceSftpDetails.InterfaceId).FirstOrDefault();
                    if (record != null)
                    {
                        record.HostName    = interfaceSftpDetails.HostName;
                        record.UserName    = interfaceSftpDetails.UserName;
                        record.Password    = interfaceSftpDetails.Password;
                        record.Port        = interfaceSftpDetails.Port;
                        record.SshKey      = interfaceSftpDetails.SshKey;
                        record.Passphrase  = interfaceSftpDetails.Passphrase;
                        record.UpdatedDate = interfaceSftpDetails.UpdatedDate;
                        record.UpdatedBy   = interfaceSftpDetails.UpdatedBy;
                    }
                    _dbContext.Entry(record).State = EntityState.Modified;
                    _dbContext.SaveChanges();

                    return(1);
                }
            }
            catch
            {
                throw;
            }
        }
Example #4
0
        public int UpdateDataSetDBDetailsByDataSetID(DatasetTableDetails datasetTableDetails)
        {
            try
            {
                using (_dbContext = string.IsNullOrEmpty(_connectionString) ? _dbContext : new ZionContext(_connectionString))
                {
                    DatasetTableDetails record = _dbContext.DatasetTableDetails.Where(i => i.DatasetId == datasetTableDetails.DatasetId).FirstOrDefault();
                    if (record != null)
                    {
                        record.FullLoadQuery  = datasetTableDetails.FullLoadQuery;
                        record.DeltaLoadQuery = datasetTableDetails.DeltaLoadQuery;
                        record.UpdatedDate    = datasetTableDetails.UpdatedDate;
                        record.UpdatedBy      = datasetTableDetails.UpdatedBy;
                    }
                    _dbContext.Entry(record).State = EntityState.Modified;
                    _dbContext.SaveChanges();

                    return(1);
                }
            }
            catch
            {
                throw;
            }
        }
Example #5
0
        public int UpdateDatasetMaster(DatasetMaster datasetMaster)
        {
            int    datasetId = datasetMaster.DatasetId;
            string status    = datasetMaster.Status;

            try
            {
                using (_dbContext = string.IsNullOrEmpty(_connectionString) ? _dbContext : new ZionContext(_connectionString))
                {
                    _dbContext.Entry(datasetMaster).State = EntityState.Modified;

                    //Update the status of heirarchy
                    IngestionDataAccess ingestionDAL = new IngestionDataAccess(_connectionString);
                    ingestionDAL.MappingStatusUpdateForDatasetId(_dbContext, datasetId, status == "Active"?true:false);
                    ingestionDAL.TempMappingStatusUpdateForDatasetId(_dbContext, datasetId, status == "Active" ? true : false);
                    OutgestionDataAccess outgestionDAL = new OutgestionDataAccess(_connectionString);
                    outgestionDAL.OutgestionStatusUpdateForDatasetId(_dbContext, datasetId, status == "Active" ? true : false);
                    _dbContext.SaveChanges();
                }

                return(1);
            }
            catch
            {
                throw;
            }
        }
Example #6
0
        public int UpdateDatasetFileDetails(DatasetFileDetails datasetFileDetails)
        {
            try
            {
                using (_dbContext = string.IsNullOrEmpty(_connectionString) ? _dbContext : new ZionContext(_connectionString))
                {
                    _dbContext.Entry(datasetFileDetails).State = EntityState.Modified;
                    _dbContext.SaveChanges();

                    return(1);
                }
            }
            catch
            {
                throw;
            }
        }
Example #7
0
        public int UpdateInterfaceDbDetails(InterfaceDbDetails interfaceDbDetails)
        {
            try
            {
                using (_dbContext = string.IsNullOrEmpty(_connectionString) ? _dbContext : new ZionContext(_connectionString))
                {
                    _dbContext.Entry(interfaceDbDetails).State = EntityState.Modified;
                    _dbContext.SaveChanges();
                }

                return(1);
            }
            catch
            {
                throw;
            }
        }
        public int UpdateInterfaceMaster(InterfaceMaster interfaceMaster)
        {
            try
            {
                using (_dbContext = string.IsNullOrEmpty(_connectionString) ? _dbContext : new ZionContext(_connectionString))
                {
                    _dbContext.Entry(interfaceMaster).State = EntityState.Modified;

                    if (interfaceMaster.Status.ToLower() == "inactive")
                    {
                        UpdateInterfaceHeirarchyStatus(_dbContext, interfaceMaster.InterfaceId, "Inactive");
                    }

                    _dbContext.SaveChanges();
                }

                return(1);
            }
            catch
            {
                throw;
            }
        }
Example #9
0
        public void UpdateDatasetSchedulingDetails(List <DatasetSchedulingDetails> schedulingDetails)
        {
            using (_dbContext = new ZionContext(_connectionString))
            { int counter = 0;
              foreach (DatasetSchedulingDetails s in schedulingDetails)
              {
                  counter++;
                  int datasetId = schedulingDetails.Where(x => x != null).Select(d => d.DatasetId).FirstOrDefault();

                  if (s != null && s.DatasetDetailsId != 0)
                  {
                      _dbContext.Entry(s).State = EntityState.Modified;
                  }
                  else if (s != null && s.DatasetDetailsId == 0)
                  {
                      _dbContext.DatasetSchedulingDetails.Add(s);
                  }
                  else if (s == null && counter == 1)
                  {
                      DatasetSchedulingDetails sDetails = _dbContext.DatasetSchedulingDetails.Where(d => d.DatasetId == datasetId && d.LoadType.ToLower() == "full").FirstOrDefault();
                      if (sDetails != null)
                      {
                          _dbContext.DatasetSchedulingDetails.Remove(sDetails);
                      }
                  }
                  else if (s == null && counter == 2)
                  {
                      DatasetSchedulingDetails sDetails = _dbContext.DatasetSchedulingDetails.Where(d => d.DatasetId == datasetId && d.LoadType.ToLower() == "delta").FirstOrDefault();
                      if (sDetails != null)
                      {
                          _dbContext.DatasetSchedulingDetails.Remove(sDetails);
                      }
                  }
              }
              _dbContext.SaveChanges(); }
        }