Example #1
0
 public IList <SourceViewModel> GetSourcesList(int daId)
 {
     try
     {
         SourceViewModel sourceViewModel = new SourceViewModel();
         return(sourceViewModel.GetSourceDetails(daId));
     }
     catch (Exception)
     {
         throw;
     }
 }
Example #2
0
        public void DeleteSource(SourceViewModel sourceViewModel)
        {
            try
            {
                tbl_Source tblSource = new tbl_Source();
                tblSource.SourceID    = sourceViewModel.sourceID;
                tblSource.daId        = sourceViewModel.DAID;
                tblSource.EntityState = DA.DomainModel.EntityState.Deleted;

                SourceManager sourceManager = new SourceManager();
                sourceManager.DeleteSource(tblSource);
            }
            catch (Exception)
            {
                throw;
            }
        }
Example #3
0
        public void AddSource(SourceViewModel sourceViewModel)
        {
            try
            {
                tbl_Source tblSource = new tbl_Source();

                tblSource.SourceDesc = sourceViewModel.sourceDesc;
                tblSource.daId       = sourceViewModel.DAID;//1

                tblSource.EntityState = DA.DomainModel.EntityState.Added;

                SourceManager sourceManager = new SourceManager();
                sourceManager.AddSource(tblSource);
            }
            catch (Exception)
            {
                throw;
            }
        }
Example #4
0
        public bool CheckDuplicate(SourceViewModel sourceviewmodel)
        {
            try
            {
                SourceManager sourceManager = new SourceManager();

                var source = sourceManager.FindSourceName(sourceviewmodel.sourceDesc, sourceviewmodel.DAID);

                if (source != null && source.SourceID != sourceviewmodel.sourceID && source.SourceDesc.ToUpper() == sourceviewmodel.sourceDesc.ToUpper())
                {
                    return(true);
                }
                return(false);
            }
            catch (Exception)
            {
                throw;
            }
        }
Example #5
0
        public SourceViewModel FindSource(int?sourceID)
        {
            try
            {
                SourceViewModel sourceViewModel = new SourceViewModel();

                SourceManager sourceManager = new SourceManager();
                var           source        = sourceManager.FindSource(sourceID);

                sourceViewModel.sourceID   = source.SourceID;
                sourceViewModel.sourceDesc = source.SourceDesc;
                sourceViewModel.DAID       = source.daId;

                return(sourceViewModel);
            }
            catch (Exception)
            {
                throw;
            }
        }
Example #6
0
        public IList <SourceViewModel> GetSourceDetails(int daId)
        {
            try
            {
                SourceManager sourceManager = new SourceManager();
                var           sourceList    = sourceManager.GetSourceDetails(daId);

                SourceList = new List <SourceViewModel>();
                foreach (var item in sourceList)
                {
                    SourceViewModel sourceViewModel = new SourceViewModel();
                    sourceViewModel.sourceID   = item.SourceID;
                    sourceViewModel.sourceDesc = item.SourceDesc;
                    sourceViewModel.DAID       = item.daId;//1;

                    SourceList.Add(sourceViewModel);
                }
                return(SourceList);
            }
            catch (Exception)
            {
                throw;
            }
        }