public void Put([FromBody]CareerCoreEntity objCareerCoreEntity) { CareerCore objCareerCore = new CareerCore(); using (objCareerCore as IDisposable) { objCareerCore.Edit(ref objCareerCoreEntity); } objCareerCore = null; }
/// <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; }
/// <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; }