Example #1
0
        public int Edit(ref HoroscopeCoreEntity objHoroscopeCoreEntity)
        {
            try
            {
                IUnitOfWork objIUnitOfWork = new UnitOfWork();
                using (objIUnitOfWork as IDisposable)
                {
                    // Save Data to Raasi
                    RaasiCoreEntity objRaasiCoreEntity = new RaasiCoreEntity();
                    using (objRaasiCoreEntity as IDisposable)
                    {
                        objRaasiCoreEntity.ProfileID = objHoroscopeCoreEntity.ProfileID;
                        objRaasiCoreEntity.Kattam1 = objHoroscopeCoreEntity.RaasiKattam1;
                        objRaasiCoreEntity.Kattam2 = objHoroscopeCoreEntity.RaasiKattam2;
                        objRaasiCoreEntity.Kattam3 = objHoroscopeCoreEntity.RaasiKattam3;
                        objRaasiCoreEntity.Kattam4 = objHoroscopeCoreEntity.RaasiKattam4;
                        objRaasiCoreEntity.Kattam5 = objHoroscopeCoreEntity.RaasiKattam5;
                        objRaasiCoreEntity.Kattam6 = objHoroscopeCoreEntity.RaasiKattam6;
                        objRaasiCoreEntity.Kattam7 = objHoroscopeCoreEntity.RaasiKattam7;
                        objRaasiCoreEntity.Kattam8 = objHoroscopeCoreEntity.RaasiKattam8;
                        objRaasiCoreEntity.Kattam9 = objHoroscopeCoreEntity.RaasiKattam9;
                        objRaasiCoreEntity.Kattam10 = objHoroscopeCoreEntity.RaasiKattam10;
                        objRaasiCoreEntity.Kattam11 = objHoroscopeCoreEntity.RaasiKattam11;
                        objRaasiCoreEntity.Kattam12 = objHoroscopeCoreEntity.RaasiKattam12;
                        Mugurtham.DTO.Profile.Raasi objDTORaasi = new DTO.Profile.Raasi();
                        using (objDTORaasi as IDisposable)
                        {
                            RaasiCore objRaasiCore = new RaasiCore();
                            using (objRaasiCore as IDisposable)
                                objRaasiCore.AssignDTOFromEntity(ref objDTORaasi, ref objRaasiCoreEntity);
                            objRaasiCore = null;
                        }
                        objIUnitOfWork.RepositoryRaasi.Edit(objDTORaasi);
                        objDTORaasi = null;
                    }
                    objRaasiCoreEntity = null;
                    // Save data to Amsam
                    AmsamCoreEntity objAmsamCoreEntity = new AmsamCoreEntity();
                    using (objAmsamCoreEntity as IDisposable)
                    {
                        objAmsamCoreEntity.ProfileID = objHoroscopeCoreEntity.ProfileID;
                        objAmsamCoreEntity.Kattam1 = objHoroscopeCoreEntity.AmsamKattam1;
                        objAmsamCoreEntity.Kattam2 = objHoroscopeCoreEntity.AmsamKattam2;
                        objAmsamCoreEntity.Kattam3 = objHoroscopeCoreEntity.AmsamKattam3;
                        objAmsamCoreEntity.Kattam4 = objHoroscopeCoreEntity.AmsamKattam4;
                        objAmsamCoreEntity.Kattam5 = objHoroscopeCoreEntity.AmsamKattam5;
                        objAmsamCoreEntity.Kattam6 = objHoroscopeCoreEntity.AmsamKattam6;
                        objAmsamCoreEntity.Kattam7 = objHoroscopeCoreEntity.AmsamKattam7;
                        objAmsamCoreEntity.Kattam8 = objHoroscopeCoreEntity.AmsamKattam8;
                        objAmsamCoreEntity.Kattam9 = objHoroscopeCoreEntity.AmsamKattam9;
                        objAmsamCoreEntity.Kattam10 = objHoroscopeCoreEntity.AmsamKattam10;
                        objAmsamCoreEntity.Kattam11 = objHoroscopeCoreEntity.AmsamKattam11;
                        objAmsamCoreEntity.Kattam12 = objHoroscopeCoreEntity.AmsamKattam12;
                        Mugurtham.DTO.Profile.Amsam objDTOAmsam = new DTO.Profile.Amsam();
                        using (objDTOAmsam as IDisposable)
                        {
                            AmsamCore objAmsamCore = new AmsamCore();
                            using (objAmsamCore as IDisposable)
                                objAmsamCore.AssignDTOFromEntity(ref objDTOAmsam, ref objAmsamCoreEntity);
                            objAmsamCore = null;
                        }
                        objIUnitOfWork.RepositoryAmsam.Edit(objDTOAmsam);
                        objDTOAmsam = null;
                    }
                    objAmsamCoreEntity = null;
                    objHoroscopeCoreEntity.Path = GetByProfileID(objHoroscopeCoreEntity.ProfileID).Path;
                    updateHoroscope(ref objHoroscopeCoreEntity);
                    objIUnitOfWork.commit();
                    objIUnitOfWork = null;

                }
                objHoroscopeCoreEntity = null;

            }
            catch (Exception objEx)
            {
                Helpers.LogExceptionInFlatFile(objEx);
            }
            return 0;
        }
Example #2
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;
        }
Example #3
0
        public HoroscopeCoreEntity GetByProfileID(string strProfileID)
        {
            HoroscopeCoreEntity objHoroscopeCoreEntity = new HoroscopeCoreEntity();
            Mugurtham.DTO.Profile.Raasi objRaasi = new Mugurtham.DTO.Profile.Raasi();
            Mugurtham.DTO.Profile.Amsam objAmsam = new Mugurtham.DTO.Profile.Amsam();
            Mugurtham.DTO.Profile.Horoscope objHoroscope = new Mugurtham.DTO.Profile.Horoscope();
            try
            {

                IUnitOfWork objUOW = new UnitOfWork();
                using (objUOW as IDisposable)
                {
                    objRaasi = objUOW.RepositoryRaasi.GetAll().ToList().Where(p => p.ProfileID.Trim().ToLower() == strProfileID.Trim().ToLower()).FirstOrDefault();
                    objAmsam = objUOW.RepositoryAmsam.GetAll().ToList().Where(p => p.ProfileID.Trim().ToLower() == strProfileID.Trim().ToLower()).FirstOrDefault();
                    objHoroscope = objUOW.RepositoryHoroscope.GetAll().ToList().Where(p => p.ProfileID.Trim().ToLower() == strProfileID.Trim().ToLower()).FirstOrDefault();
                }
                objUOW = null;
                //Getting Raasi Data
                if (objRaasi != null)
                {
                    using (objRaasi as IDisposable)
                    {
                        RaasiCoreEntity objRaasiCoreEntity = new RaasiCoreEntity();
                        using (objRaasiCoreEntity as IDisposable)
                        {
                            RaasiCore objRaasiCore = new RaasiCore();
                            using (objRaasiCore as IDisposable)
                                objRaasiCore.AssignEntityFromDTO(ref objRaasi, ref objRaasiCoreEntity);
                            objRaasiCore = null;
                        }
                        objHoroscopeCoreEntity.ProfileID = objRaasiCoreEntity.ProfileID;
                        objHoroscopeCoreEntity.RaasiKattam1 = objRaasiCoreEntity.Kattam1;
                        objHoroscopeCoreEntity.RaasiKattam2 = objRaasiCoreEntity.Kattam2;
                        objHoroscopeCoreEntity.RaasiKattam3 = objRaasiCoreEntity.Kattam3;
                        objHoroscopeCoreEntity.RaasiKattam4 = objRaasiCoreEntity.Kattam4;
                        objHoroscopeCoreEntity.RaasiKattam5 = objRaasiCoreEntity.Kattam5;
                        objHoroscopeCoreEntity.RaasiKattam6 = objRaasiCoreEntity.Kattam6;
                        objHoroscopeCoreEntity.RaasiKattam7 = objRaasiCoreEntity.Kattam7;
                        objHoroscopeCoreEntity.RaasiKattam8 = objRaasiCoreEntity.Kattam8;
                        objHoroscopeCoreEntity.RaasiKattam9 = objRaasiCoreEntity.Kattam9;
                        objHoroscopeCoreEntity.RaasiKattam10 = objRaasiCoreEntity.Kattam10;
                        objHoroscopeCoreEntity.RaasiKattam11 = objRaasiCoreEntity.Kattam11;
                        objHoroscopeCoreEntity.RaasiKattam12 = objRaasiCoreEntity.Kattam12;
                        objRaasiCoreEntity = null;
                    }
                }
                objRaasi = null;
                // Getting Amsam Data
                if (objAmsam != null)
                {
                    using (objAmsam as IDisposable)
                    {
                        AmsamCoreEntity objAmsamCoreEntity = new AmsamCoreEntity();
                        using (objAmsamCoreEntity as IDisposable)
                        {
                            AmsamCore objAmsamCore = new AmsamCore();
                            using (objAmsamCore as IDisposable)
                                objAmsamCore.AssignEntityFromDTO(ref objAmsam, ref objAmsamCoreEntity);
                            objAmsamCore = null;
                        }
                        objHoroscopeCoreEntity.ProfileID = objAmsamCoreEntity.ProfileID;
                        objHoroscopeCoreEntity.AmsamKattam1 = objAmsamCoreEntity.Kattam1;
                        objHoroscopeCoreEntity.AmsamKattam2 = objAmsamCoreEntity.Kattam2;
                        objHoroscopeCoreEntity.AmsamKattam3 = objAmsamCoreEntity.Kattam3;
                        objHoroscopeCoreEntity.AmsamKattam4 = objAmsamCoreEntity.Kattam4;
                        objHoroscopeCoreEntity.AmsamKattam5 = objAmsamCoreEntity.Kattam5;
                        objHoroscopeCoreEntity.AmsamKattam6 = objAmsamCoreEntity.Kattam6;
                        objHoroscopeCoreEntity.AmsamKattam7 = objAmsamCoreEntity.Kattam7;
                        objHoroscopeCoreEntity.AmsamKattam8 = objAmsamCoreEntity.Kattam8;
                        objHoroscopeCoreEntity.AmsamKattam9 = objAmsamCoreEntity.Kattam9;
                        objHoroscopeCoreEntity.AmsamKattam10 = objAmsamCoreEntity.Kattam10;
                        objHoroscopeCoreEntity.AmsamKattam11 = objAmsamCoreEntity.Kattam11;
                        objHoroscopeCoreEntity.AmsamKattam12 = objAmsamCoreEntity.Kattam12;
                        objAmsamCoreEntity = null;
                    }
                }
                objAmsam = null;

                objHoroscopeCoreEntity.DasaBalance = objHoroscope.DasaBalance;
                objHoroscopeCoreEntity.Year = objHoroscope.Year;
                objHoroscopeCoreEntity.Month = objHoroscope.Month;
                objHoroscopeCoreEntity.Day = objHoroscope.Day;
                objHoroscopeCoreEntity.Path = objHoroscope.Path;

            }
            catch (Exception objEx)
            {
                Helpers.LogExceptionInFlatFile(objEx);
            }
            finally
            {
                /*objHoroscopeCoreEntity = null;
                objRaasi = null;
                objAmsam = null;
                objHoroscope = null;*/
            }
            return objHoroscopeCoreEntity;
        }
Example #4
0
        /// <summary>
        /// Creates a new row in all profile registration table for the passed profileID
        /// </summary>
        /// <param name="strProfileID">New ProfileID to create in all registration tables</param>
        /// <returns></returns>
        public int Add(ref BasicInfoCoreEntity objBasicInfoCoreEntity, out string strProfileID, Mugurtham.Core.Login.LoggedInUser objLoggedIn)
        {
            strProfileID = string.Empty;
            string strUserID = string.Empty;
            SangamCore objSangamCore = new SangamCore();
            try
            {
                using (objSangamCore as IDisposable)
                {
                    objSangamCore.GetNewProfileID(out strProfileID, objLoggedIn);
                    Mugurtham.Core.Sangam.SangamCoreEntity objSangamCoreEntity = new SangamCoreEntity();
                    using (objSangamCoreEntity as IDisposable)
                    {
                        objSangamCoreEntity = objSangamCore.GetByID(objLoggedIn.sangamID);
                        if (string.IsNullOrEmpty(objSangamCoreEntity.LastProfileIDNo.ToString()))
                            return -1;
                        objSangamCoreEntity.LastProfileIDNo += 1;
                        objSangamCore.Edit(ref objSangamCoreEntity);
                    }
                    objSangamCoreEntity = null;
                }
                objSangamCore = null;

                User.UserCore objUserCore = new User.UserCore();
                using (objUserCore as IDisposable)
                {
                    User.UserCoreEntity objUserCoreEntity = new User.UserCoreEntity();
                    using (objUserCoreEntity as IDisposable)
                    {
                        objUserCoreEntity.ID = Helpers.primaryKey;
                        objUserCoreEntity.Name = objBasicInfoCoreEntity.Name;
                        objUserCoreEntity.LoginID = strProfileID;
                        objUserCoreEntity.Password = strProfileID; // Helpers.passwordGenerator();
                        objUserCoreEntity.SangamID = objLoggedIn.sangamID;
                        objUserCoreEntity.RoleID = Constants.RoleIDForUserProfile;
                        objUserCoreEntity.ThemeID = Constants.ThemeBootstrap;
                        objUserCoreEntity.LocaleID = Constants.LocaleUSEnglish;
                        objUserCoreEntity.IsActivated = "1"; // Activated by default
                        objUserCoreEntity.HomePagePath = Constants.HomePagePathForProfileUser;
                        objUserCore.Add(ref objUserCoreEntity, out strUserID);
                    }
                    objUserCoreEntity = null;
                }
                objUserCore = null;

                BasicInfoCore objBasicInfoCore = new BasicInfoCore();
                using (objBasicInfoCore as IDisposable)
                {
                    objBasicInfoCoreEntity.ProfileID = strProfileID;
                    objBasicInfoCoreEntity.ElanUserID = strUserID;
                    objBasicInfoCoreEntity.SangamID = objLoggedIn.sangamID;
                    objBasicInfoCore.Add(ref objBasicInfoCoreEntity, objLoggedIn.LoginID);
                }
                objBasicInfoCore = null;

                CareerCore objCareerCore = new CareerCore();
                using (objCareerCore as IDisposable)
                {
                    CareerCoreEntity objCareerCoreEntity = new CareerCoreEntity();
                    using (objCareerCoreEntity as IDisposable)
                    {
                        objCareerCoreEntity.ProfileID = strProfileID;
                        objCareerCore.Add(ref objCareerCoreEntity);
                    }
                    objCareerCoreEntity = null;
                }
                objCareerCore = null;

                ContactCore objContactCore = new ContactCore();
                using (objContactCore as IDisposable)
                {
                    ContactCoreEntity objContactCoreEntity = new ContactCoreEntity();
                    using (objContactCoreEntity as IDisposable)
                    {
                        objContactCoreEntity.ProfileID = strProfileID;
                        objContactCore.Add(ref objContactCoreEntity);
                    }
                    objContactCoreEntity = null;
                }
                objContactCore = null;

                FamilyCore objFamilyCore = new FamilyCore();
                using (objFamilyCore as IDisposable)
                {
                    FamilyCoreEntity objFamilyCoreEntity = new FamilyCoreEntity();
                    using (objFamilyCoreEntity as IDisposable)
                    {
                        objFamilyCoreEntity.ProfileID = strProfileID;
                        objFamilyCore.Add(ref objFamilyCoreEntity);
                    }
                    objFamilyCoreEntity = null;
                }
                objFamilyCore = null;

                LocationCore objLocationCore = new LocationCore();
                using (objLocationCore as IDisposable)
                {
                    LocationCoreEntity objLocationCoreEntity = new LocationCoreEntity();
                    using (objLocationCoreEntity as IDisposable)
                    {
                        objLocationCoreEntity.ProfileID = strProfileID;
                        objLocationCore.Add(ref objLocationCoreEntity);
                    }
                    objLocationCoreEntity = null;
                }
                objLocationCore = null;

                ReferenceCore objReferenceCore = new ReferenceCore();
                using (objReferenceCore as IDisposable)
                {
                    ReferenceCoreEntity objReferenceCoreEntity = new ReferenceCoreEntity();
                    using (objReferenceCoreEntity as IDisposable)
                    {
                        objReferenceCoreEntity.ProfileID = strProfileID;
                        objReferenceCore.Add(ref objReferenceCoreEntity);
                    }
                    objReferenceCoreEntity = null;
                }
                objReferenceCore = null;
                RaasiCore objRaasiCore = new RaasiCore();
                using (objRaasiCore as IDisposable)
                {
                    RaasiCoreEntity objRaasiCoreEntity = new RaasiCoreEntity();
                    using (objRaasiCoreEntity as IDisposable)
                    {
                        objRaasiCoreEntity.ProfileID = strProfileID;
                        objRaasiCore.Add(ref objRaasiCoreEntity);
                    }
                    objRaasiCoreEntity = null;
                }
                objRaasiCore = null;
                AmsamCore objAmsamCore = new AmsamCore();
                using (objAmsamCore as IDisposable)
                {
                    AmsamCoreEntity objAmsamCoreEntity = new AmsamCoreEntity();
                    using (objAmsamCoreEntity as IDisposable)
                    {
                        objAmsamCoreEntity.ProfileID = strProfileID;
                        objAmsamCore.Add(ref objAmsamCoreEntity);
                    }
                    objAmsamCoreEntity = null;
                }
                objAmsamCore = null;
            }
            catch (Exception objEx)
            {
                Helpers.LogExceptionInFlatFile(objEx);
            }
            return 0;
        }