Пример #1
0
 public int Add(ref Mugurtham.Core.ProfileInterested.ProfileInterestedCoreEntity objProfileInterestedCoreEntity)
 {
     try
     {
         string      strMappingID      = string.Empty;
         string      strViewerID       = objProfileInterestedCoreEntity.ViewerID;
         string      strInterestedInID = objProfileInterestedCoreEntity.InterestedInID;
         IUnitOfWork objIUnitOfWork    = new UnitOfWork(_objLoggedInUser.ConnectionStringAppKey);
         using (objIUnitOfWork as IDisposable)
         {
             Mugurtham.DTO.ProfileInterested.ProfileInterested objDTOProfileInterested = new DTO.ProfileInterested.ProfileInterested();
             using (objDTOProfileInterested as IDisposable)
             {
                 objDTOProfileInterested.ID = Helpers.primaryKey;
                 AssignDTOFromEntity(ref objDTOProfileInterested, ref objProfileInterestedCoreEntity);
             }
             List <Mugurtham.DTO.ProfileInterested.ProfileInterested> objProfileInterested = new List <DTO.ProfileInterested.ProfileInterested>();
             using (objProfileInterested as IDisposable)
             {
                 objProfileInterested = objIUnitOfWork.RepositoryProfileInterested.GetAll().ToList().
                                        Where(p => p.ViewerID.Trim().ToLower() == strViewerID.Trim().ToLower() &&
                                              p.InterestedInID.Trim().ToLower() == strInterestedInID.Trim().ToLower()).ToList();
                 foreach (DTO.ProfileInterested.ProfileInterested objProfiles in objProfileInterested)
                 {
                     strMappingID = objProfiles.ID;
                 }
             }
             if (objProfileInterested.Count == 0)
             {
                 IUnitOfWork objIUnitOfWorkAdd = new UnitOfWork(_objLoggedInUser.ConnectionStringAppKey);
                 using (objIUnitOfWorkAdd as IDisposable)
                 {
                     objIUnitOfWorkAdd.RepositoryProfileInterested.Add(objDTOProfileInterested);
                     objIUnitOfWorkAdd.commit();
                     objDTOProfileInterested = null;
                 }
                 objIUnitOfWorkAdd = null;
             }
         }
         objIUnitOfWork = null;
     }
     catch (Exception objEx)
     {
         Helpers.LogExceptionInFlatFile(objEx);
     }
     return(0);
 }
Пример #2
0
 private int AssignDTOFromEntity(ref Mugurtham.DTO.ProfileInterested.ProfileInterested objDTOProfileInterested, ref Mugurtham.Core.ProfileInterested.ProfileInterestedCoreEntity objProfileInterestedCoreEntity)
 {
     try
     {
         objDTOProfileInterested.ViewerID       = objProfileInterestedCoreEntity.ViewerID;
         objDTOProfileInterested.InterestedInID = objProfileInterestedCoreEntity.InterestedInID;
         objDTOProfileInterested.InterestedDate = DateTime.Now;
     }
     catch (Exception objEx)
     {
         Helpers.LogExceptionInFlatFile(objEx);
     }
     return(0);
 }