public int GetAll(ref List <RoleCoreEntity> objSangamCoreEntityList) { try { IUnitOfWork objIUnitOfWork = new UnitOfWork(_objLoggedInUser.ConnectionStringAppKey); using (objIUnitOfWork as IDisposable) { foreach (Mugurtham.DTO.Role.Role objSangam in objIUnitOfWork.RepositoryRole.GetAll().ToList().OrderBy(x => x.Name)) { Mugurtham.DTO.Role.Role _objSangam = objSangam; using (_objSangam as IDisposable) { RoleCoreEntity objRoleCoreEntity = new RoleCoreEntity(); using (objRoleCoreEntity as IDisposable) { AssignEntityFromDTO(ref _objSangam, ref objRoleCoreEntity); objSangamCoreEntityList.Add(objRoleCoreEntity); } objRoleCoreEntity = null; } _objSangam = null; } } } catch (Exception objEx) { Helpers.LogExceptionInFlatFile(objEx); } return(0); }
public RoleCoreEntity GetByID(string strID) { RoleCoreEntity objRoleCoreEntity = new RoleCoreEntity(); try { Mugurtham.DTO.Role.Role objSangam = new Mugurtham.DTO.Role.Role(); IUnitOfWork objUOW = new UnitOfWork(_objLoggedInUser.ConnectionStringAppKey); using (objUOW as IDisposable) objSangam = objUOW.RepositoryRole.GetAll().ToList().Where(p => p.ID.Trim().ToLower() == strID.Trim().ToLower()).FirstOrDefault(); objUOW = null; if (objSangam != null) { using (objSangam as IDisposable) { AssignEntityFromDTO(ref objSangam, ref objRoleCoreEntity); } } objSangam = null; } catch (Exception objEx) { Helpers.LogExceptionInFlatFile(objEx); } return(objRoleCoreEntity); }
private int AssignEntityFromDTO(ref Mugurtham.DTO.Role.Role objDTORole, ref Mugurtham.Core.Role.RoleCoreEntity objRoleCoreEntity) { try { objRoleCoreEntity.CreatedBy = objDTORole.CreatedBy; objRoleCoreEntity.CreatedDate = DateTime.Now; objRoleCoreEntity.Description = objDTORole.Description; objRoleCoreEntity.ID = objDTORole.ID; objRoleCoreEntity.ModifiedBy = objDTORole.ModifiedBy; objRoleCoreEntity.ModifiedDate = DateTime.Now; objRoleCoreEntity.Name = objDTORole.Name; } catch (Exception objEx) { Helpers.LogExceptionInFlatFile(objEx); } return(0); }
public RoleCoreEntity GetByID(string strID) { RoleCoreEntity objRoleCoreEntity = new RoleCoreEntity(); try { Mugurtham.DTO.Role.Role objSangam = new Mugurtham.DTO.Role.Role(); IUnitOfWork objUOW = new UnitOfWork(); using (objUOW as IDisposable) objSangam = objUOW.RepositoryRole.GetAll().ToList().Where(p => p.ID.Trim().ToLower() == strID.Trim().ToLower()).FirstOrDefault(); objUOW = null; if (objSangam != null) { using (objSangam as IDisposable) { AssignEntityFromDTO(ref objSangam, ref objRoleCoreEntity); } } objSangam = null; } catch (Exception objEx) { Helpers.LogExceptionInFlatFile(objEx); } return objRoleCoreEntity; }