Ejemplo n.º 1
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="strProfileID"></param>
        /// <param name="objProfileCore"></param>
        /// <param name="objLoggedIn"></param>
        /// <param name="boolAddAllEntities">Optional argument to add all profile entities to the prfoilecore object -- added to consider performance optimization</param>
        /// <returns></returns>
        public int GetByProfileID(string strProfileID, out ProfileCore objProfileCore, Mugurtham.Core.Login.LoggedInUser objLoggedIn = null, bool boolAddAllEntities = false)
        {
            objProfileCore = null;
            try
            {
                objProfileCore = new ProfileCore();
                if (string.IsNullOrWhiteSpace(strProfileID))
                    return -1;
                //Adding all entities to Profile object
                using (objProfileCore as IDisposable)
                {
                    // Assign the user object for this profileID
                    objProfileCore.UserCoreEntity = getUserEntity(strProfileID);
                    validateUserAccessToThisProfile(strProfileID, ref objProfileCore, objLoggedIn);
                    if (objProfileCore.validateFullViewAccess)
                    {
                        BasicInfoCore objBICore = new BasicInfoCore();
                        using (objBICore as IDisposable)
                        {
                            //Check profile restrictions
                            // if allowed then process the rest of the code
                            // else return error code
                            IUnitOfWork objIUnitOfWork = new UnitOfWork();
                            using (objIUnitOfWork as IDisposable)
                            {
                                BasicInfoCoreEntity objBasicInfoCoreEntity = new BasicInfo.BasicInfoCoreEntity();
                                using (objBasicInfoCoreEntity as IDisposable)
                                {
                                    if (objIUnitOfWork.RepositoryBasicInfo.getByProfileID(strProfileID) != null)
                                    {
                                        objProfileCore.BasicInfoCoreEntity = objBasicInfoCoreEntity;
                                        objBICore.AssignEntityFromDTO(objProfileCore.BasicInfoCoreEntity, objIUnitOfWork.RepositoryBasicInfo.getByProfileID(strProfileID));
                                    }
                                    else
                                    {
                                        return -1; // Error Code
                                    }
                                }
                                objBasicInfoCoreEntity = null;
                            }
                            objIUnitOfWork = null;
                            objProfileCore.SangamID = objProfileCore.BasicInfoCoreEntity.SangamID;
                            objProfileCore.Gender = objProfileCore.BasicInfoCoreEntity.Gender;
                            objProfileCore.Star = objProfileCore.BasicInfoCoreEntity.Star;
                            objProfileCore.SubCaste = objProfileCore.BasicInfoCoreEntity.SubCaste;
                            objProfileCore.Age = objProfileCore.BasicInfoCoreEntity.Age;
                            objProfileCore.profileDOB = objProfileCore.BasicInfoCoreEntity.DOB.ToString();
                            objProfileCore.MugurthamProfileID = objProfileCore.BasicInfoCoreEntity.ProfileID;
                            objProfileCore.SangamProfiledID = objProfileCore.BasicInfoCoreEntity.SangamProfileID;
                        }
                        objBICore = null;

                        Photo.PhotoCore objPhotoCore = new Photo.PhotoCore();
                        using (objPhotoCore as IDisposable)
                        {
                            List<Mugurtham.Core.Profile.Photo.PhotoCoreEntity> objPhotoCoreEntityList = new List<Mugurtham.Core.Profile.Photo.PhotoCoreEntity>();
                            objProfileCore.GetProfilePhotos(ref objPhotoCoreEntityList, strProfileID);
                            objProfileCore.PhotoCoreEntityList = objPhotoCoreEntityList;
                        }
                        objPhotoCore = null;
                        CareerCore objCareerCore = new CareerCore();
                        using (objCareerCore as IDisposable)
                            objProfileCore.CareerCoreEntity = objCareerCore.GetByProfileID(strProfileID);
                        objCareerCore = null;
                        LocationCore objLocationCore = new LocationCore();
                        using (objLocationCore as IDisposable)
                            objProfileCore.LocationCoreEntity = objLocationCore.GetByProfileID(strProfileID);
                        objLocationCore = null;
                        ContactCore objContactCore = new ContactCore();
                        using (objContactCore as IDisposable)
                            objProfileCore.ContactCoreEntity = objContactCore.GetByProfileID(strProfileID);
                        objContactCore = null;
                        FamilyCore objFamilyCore = new FamilyCore();
                        using (objFamilyCore as IDisposable)
                            objProfileCore.FamilyCoreEntity = objFamilyCore.GetByProfileID(strProfileID);
                        objFamilyCore = null;
                        ReferenceCore objReferenceCore = new ReferenceCore();
                        using (objReferenceCore as IDisposable)
                            objProfileCore.ReferenceCoreEntity = objReferenceCore.GetByProfileID(strProfileID);
                        objReferenceCore = null;
                        SangamCore objSangamCore = new SangamCore();
                        using (objSangamCore as IDisposable)
                            objProfileCore.SangamCoreEntity = objSangamCore.GetByID(objProfileCore.BasicInfoCoreEntity.SangamID);
                        objReferenceCore = null;
                        RaasiCore objRaasiCore = new RaasiCore();
                        using (objRaasiCore as IDisposable)
                            objProfileCore.RaasiCoreEntity = objRaasiCore.GetByProfileID(strProfileID);
                        objRaasiCore = null;
                        AmsamCore objAmsamCore = new AmsamCore();
                        using (objAmsamCore as IDisposable)
                            objProfileCore.AmsamCoreEntity = objAmsamCore.GetByProfileID(strProfileID);
                        objRaasiCore = null;
                        HoroscopeCore objHoroscopeCore = new HoroscopeCore();
                        using (objHoroscopeCore as IDisposable)
                            objProfileCore.HoroscopeCoreEntity = objHoroscopeCore.GetByProfileID(strProfileID);
                        objHoroscopeCore = null;
                    }

                }
            }
            catch (Exception objEx)
            {
                Helpers.LogExceptionInFlatFile(objEx);
            }
            return 0;
        }
Ejemplo n.º 2
0
 public int GetAll(ref List<ProfileCore> objProfileCoreList, string strGender, string strSangamID)
 {
     try
     {
         BasicInfoCore objBasicInfoCore = new BasicInfoCore();
         using (objBasicInfoCore as IDisposable)
         {
             List<BasicInfoCoreEntity> objBasicInfoCoreEntityList = new List<BasicInfoCoreEntity>();
             IUnitOfWork objIUnitOfWork = new UnitOfWork();
             using (objIUnitOfWork as IDisposable)
             {
                 if ((objIUnitOfWork.RepositoryBasicInfo.getAllProfiles(strGender, strSangamID) != null) &&
                     (objIUnitOfWork.RepositoryBasicInfo.getAllProfiles(strGender, strSangamID).Count > 0))
                 {
                     List<Mugurtham.DTO.Profile.BasicInfo> objListBasicInfo = new List<Mugurtham.DTO.Profile.BasicInfo>();
                     objListBasicInfo = objIUnitOfWork.RepositoryBasicInfo.getAllProfiles(strGender, strSangamID);
                     if (objListBasicInfo != null && objListBasicInfo.Count > 0)
                     {
                         foreach (Mugurtham.DTO.Profile.BasicInfo objBasicInfo in objListBasicInfo)
                         {
                             using (objBasicInfo as IDisposable)
                             {
                                 BasicInfoCoreEntity objBasicInfoCoreEntity = new BasicInfoCoreEntity();
                                 using (objBasicInfoCoreEntity as IDisposable)
                                 {
                                     objBasicInfoCore.AssignEntityFromDTO(objBasicInfoCoreEntity, objBasicInfo);
                                     objBasicInfoCoreEntityList.Add(objBasicInfoCoreEntity);
                                 }
                                 objBasicInfoCoreEntity = null;
                             }
                         }
                     }
                 }
             }
             objIUnitOfWork = null;
             foreach (BasicInfoCoreEntity objBasicInfoCoreEntity in objBasicInfoCoreEntityList)
             {
                 ProfileCore objProfileCore = null;
                 GetByProfileID(objBasicInfoCoreEntity.ProfileID, out objProfileCore);
                 objProfileCoreList.Add(objProfileCore);
                 using (objProfileCore as IDisposable) { }
                 objProfileCore = null;
             }
         }
         objBasicInfoCore = null;
     }
     catch (Exception objEx)
     {
         Helpers.LogExceptionInFlatFile(objEx);
     }
     return 0;
 }