public Boolean CheckDuplicate(RoleRight roleRight,Boolean IsInsert) { Boolean Result = true; try { var c = _roleRightRepository.GetSingle(p => p.RoleRightsID == roleRight.RoleRightsID); if (!IsInsert) { if (c == null) Result = true; else if (c.RoleRightsID == roleRight.RoleRightsID) Result = true; else Result = false; } else { if (c == null) Result = true; else Result = false; } } catch (Exception ex) { //bool false = BusinessLogicExceptionHandler.HandleException(ref ex); if (false) { throw ex; } } return Result; }
public QrImageSaveStatus GenerateQrImage(int orderNumber, string ticketId, byte[] imageChartBytes, string micrositeId) { var folder = EnsureImageFolderExists(micrositeId); //check qrcodes folder, if it doesn't exist, create it. var qrFolder = EnsureImageFolderExistsWithParent(QrFolderName, folder.Id); //check if barcode exist. var barcode = _ecrBarcodeRepository.GetSingle(x => x.OrderNumber == orderNumber && x.TicketId.Equals(ticketId)); //create image first var newImageMetaData = SaveImage(imageChartBytes); //*** persist barcode image physically //then create meta data if (newImageMetaData == null || newImageMetaData.ImageId == null) { //***Log(string.Format("Image Create failed ordernumber {0} metadata {1}")); return(QrImageSaveStatus.ImageDataCreationFailed); } var imageName = string.Format(QrImageNameFormat, orderNumber, ticketId); newImageMetaData.AltText = imageName; newImageMetaData.ImageFolderId = qrFolder.Id; newImageMetaData.Tags = string.Empty; newImageMetaData.Name = imageName; newImageMetaData.DateCreated = DateTime.Now; newImageMetaData.Id = new Guid(); _metaDataRepository.Add(newImageMetaData); if (barcode != null) { return(QrImageSaveStatus.Success); } barcode = new EcrOrderLineBarcode { DateCreated = DateTime.Now, OrderNumber = orderNumber, TicketId = ticketId, ImageId = newImageMetaData.ImageId.Value //Add orderId here }; _ecrBarcodeRepository.Add(barcode); return(QrImageSaveStatus.Success); }
public ApiResponse <DTODerechohabiente> GetDerechohabienteByNoIssste(string noIssste) { ApiResponse <DTODerechohabiente> apiResponse = new ApiResponse <DTODerechohabiente>(); try { MapperConfiguration mapperConfiguration = new MapperConfiguration(x => { x.CreateMap <Derechohabiente, DTODerechohabiente>(); }); IMapper mapper = mapperConfiguration.CreateMapper(); Derechohabiente derechohabiente = _repository.GetSingle(x => x.NoIssste == noIssste); if (derechohabiente != null) { GenericDataRepository <CatEstados> estadosRepository = new GenericDataRepository <CatEstados>(); DTODerechohabiente derechohabienteDto = mapper.Map <Derechohabiente, DTODerechohabiente>(derechohabiente); if (derechohabienteDto != null) { derechohabienteDto.TipoDerechohabiente = derechohabienteDto.TipoDerechohabiente == "T" ? "TRABAJADOR" : "PENSIONADO"; derechohabienteDto.NombreCompleto = string.Join(" ", new[] { derechohabienteDto.Nombre, derechohabienteDto.ApellidoPaterno, derechohabienteDto.ApellidoMaterno }); derechohabienteDto.Genero = derechohabienteDto.IdGenero == 1 ? "MUJER" : "HOMBRE"; derechohabienteDto.Edad = DateTime.Now.Year - derechohabienteDto.FechaNacimiento.Year; derechohabienteDto.Estado = estadosRepository.GetSingle(x => x.IdEstado == derechohabienteDto.IdEstado).Nombre.ToUpper(); apiResponse.Data = derechohabienteDto; apiResponse.Result = (int)ApiResult.Success; apiResponse.Message = Resources.ConsultaExitosa; } else { apiResponse.Result = (int)ApiResult.Failure; apiResponse.Message = Resources.ConsultaFallida; } } else if (derechohabiente == null) { apiResponse.Result = (int)ApiResult.Success; } } catch (Exception ex) { apiResponse.Result = (int)ApiResult.Exception; apiResponse.Message = ex.Message; } return(apiResponse); }
public virtual Ticket GetTicketBySku(string sku, int ecrVersionId) { switch (ecrVersionId) { case (int)EcrVersion.Two: return (_ticketRepository.GetSingle(x => !string.IsNullOrEmpty(x.EcrProductCode) && x.EcrProductCode.Trim().Equals(sku.Trim(), StringComparison.CurrentCultureIgnoreCase))); default: //by default we use NcEcrProductcode return (_ticketRepository.GetSingle(x => !string.IsNullOrEmpty(x.NcEcrProductCode) && x.NcEcrProductCode.Trim().Equals(sku.Trim(), StringComparison.CurrentCultureIgnoreCase))); } }
public ApiResponse <Configuracion> GetConfigurationByKey(string llave) { ApiResponse <Configuracion> apiResponse = new ApiResponse <Configuracion>(); try { apiResponse.Data = _repository.GetSingle(x => x.Llave == llave); if (apiResponse.Data != null) { apiResponse.Result = (int)ApiResult.Success; apiResponse.Message = Resources.RegistroExitoso; } else { apiResponse.Result = (int)ApiResult.Failure; apiResponse.Message = Resources.RegistroFallido; } } catch (Exception ex) { apiResponse.Result = (int)ApiResult.Exception; apiResponse.Message = ex.Message; } return(apiResponse); }
public virtual IGenericWebApiResult GetSingle(string keyValues) { try { using (var result = new GenericWebApiResult <T>()) { result.Data = repo.GetSingle(keyValues); if (result.Data != null) { result.Success = true; } else { throw new Exception(BaseConstants.MESSAGE_DATA_IS_NOT_EXIST); } return(result); } } catch (Exception ex) { using (var result = new GenericWebApiResult <T>(ex)) { result.Success = false; dynamic more = new ExpandoObject(); more.Errors = ex.Message; result.More = more; return(result); } } }
public Department GetDepartmentByCode(string code) { IGenericDataRepository <Department> courseRepo = _uow.RepositoryFor <Department>(); var department = courseRepo.GetSingle(p => p.DepartmentCode.Equals(code)); return(department); }
public Course GetCourseByCode(string code) { IGenericDataRepository <Course> courseRepo = _uow.RepositoryFor <Course>(); var course = courseRepo.GetSingle(p => p.CourseCode.Equals(code)); return(course); }
public Student GetStudentByCode(string code) { SCContext context = new SCContext(_contextName); IUnitOfWork uow = new UnitOfWork(context); IGenericDataRepository <Student> studentRepo = uow.RepositoryFor <Student>(); var student = studentRepo.GetSingle(p => p.StudentCode.Equals(code)); uow.Dispose(); return(student); }
public ProgressLevelNotification GetProgressLevelNotificationByProjectMilestonesDocID(int ProjectMilestonesDocID) { try { return(_roleRepository.GetSingle(d => d.ProjectMilestonesDocID == ProjectMilestonesDocID)); } catch (Exception ex) { //bool false = BusinessLogicExceptionHandler.HandleException(ref ex); throw new Exception("Record not added."); } }
public string TranslateTerm(string key, string language) { //***get from cache //check original translation in DB var translation = _phraseLanguageRepository.GetSingle(x => !string.IsNullOrEmpty(x.PhraseId) && x.PhraseId.Equals(key, System.StringComparison.CurrentCultureIgnoreCase) && !string.IsNullOrEmpty(x.LanguageId) && x.LanguageId.Equals(language, System.StringComparison.CurrentCultureIgnoreCase)); //if translation not found in that language, lets check default language in case they are different if (translation == null && !language.Equals(_defaultLanguageId, System.StringComparison.CurrentCultureIgnoreCase)) { translation = _phraseLanguageRepository.GetSingle(x => !string.IsNullOrEmpty(x.PhraseId) && x.PhraseId.Equals(key, System.StringComparison.CurrentCultureIgnoreCase) && !string.IsNullOrEmpty(x.LanguageId) && x.LanguageId.Equals(_defaultLanguageId, System.StringComparison.CurrentCultureIgnoreCase)); } return((translation != null)? translation.Translation : key); }
public ApiResponse <CatPaquetesTuristicos> GetPaqueteTuristicoPorDerechohabiente(long idDerechohabiente) { ApiResponse <CatPaquetesTuristicos> apiResponse = new ApiResponse <CatPaquetesTuristicos>(); try { GenericDataRepository <Encuesta> encuestaRepository = new GenericDataRepository <Encuesta>(); Encuesta encuesta = encuestaRepository.GetSingle(x => x.IdDerechohabiente == idDerechohabiente && x.FechaAplicacion.Year == DateTime.Now.Year); apiResponse.Data = _repository.GetSingle(x => x.IdTipoDestino == encuesta.IdTipoDestino && x.Promocionado == false); if (apiResponse.Data != null) { apiResponse.Result = (int)ApiResult.Success; apiResponse.Message = Resources.ConsultaExitosa; } else if (apiResponse.Data == null) { apiResponse.Result = (int)ApiResult.Initial; apiResponse.Message = Resources.ConsultaSinResultados; } else { apiResponse.Result = (int)ApiResult.Failure; apiResponse.Message = Resources.ConsultaFallida; } } catch (Exception ex) { apiResponse.Result = (int)ApiResult.Exception; apiResponse.Message = ex.Message; } return(apiResponse); }
public void LogBornBasket(string json, string externalCookieValue) { var existingBasket = _bornLogRepository.GetSingle( x => !string.IsNullOrEmpty(x.ExternalCookieValue) && x.ExternalCookieValue.Equals(externalCookieValue, StringComparison.CurrentCultureIgnoreCase)); if (existingBasket == null) { _bornLogRepository.Add(new BornBasketDump { DateCreated = DateTime.Now, BasketJsonDump = json, ExternalCookieValue = externalCookieValue }); } else { existingBasket.BasketJsonDump = json; _bornLogRepository.Update(existingBasket); } }
public ApiResponse <bool> EncuestaExist(int idDerechohabiente) { ApiResponse <bool> apiResponse = new ApiResponse <bool>(); try { Encuesta encuesta = _repository.GetSingle(x => x.IdDerechohabiente == idDerechohabiente && x.FechaAplicacion.Year == DateTime.Now.Year); apiResponse.Data = encuesta != null ? true : false; if (apiResponse.Data) { apiResponse.Result = (int)ApiResult.Success; apiResponse.Message = Resources.ConsultaExitosa; } else if (!apiResponse.Data && encuesta == null) { apiResponse.Result = (int)ApiResult.Success; apiResponse.Message = Resources.ConsultaExitosa; } else { apiResponse.Result = (int)ApiResult.Failure; apiResponse.Message = Resources.ConsultaFallida; } } catch (Exception ex) { apiResponse.Result = (int)ApiResult.Exception; apiResponse.Message = ex.Message; } return(apiResponse); }
public MicroSite GetMicroSiteById(string id) { return(_micrositeRepository.GetSingle(x => x.Id.Equals(id, StringComparison.InvariantCultureIgnoreCase))); }
public AssentUniqueNumber GetClientByID(Int32 AssentUniqueNumberID) { //Func<T, bool> where, params Expression<Func<T, object>>[] navigationProperties return(_assentUniqueNumberRepository.GetSingle(d => d.AssentUniqueNumber1 == AssentUniqueNumberID)); //include related employees }
public RemindMeProgressLevel GetReminderByID(Int32 RemindMeProgressLevelID) { //Func<T, bool> where, params Expression<Func<T, object>>[] navigationProperties return(_remindRepository.GetSingle(d => d.RemindMeProgressLevelID == RemindMeProgressLevelID)); //include related employees }
public TaskListColorCell GetTaskListColorCellByID(Int32 projectTaskColorCellID) { //Func<T, bool> where, params Expression<Func<T, object>>[] navigationProperties return(_taskListColorCellRepository.GetSingle(d => d.ProjectTaskColorCellID == projectTaskColorCellID)); //include related employees }
public CompanyProfile GetByProfileID(int ProfileId) { return(_profile.GetSingle(d => d.ProfileID == ProfileId)); }
public SelfApprovalComment GetSelfApprovalCommentID(int Id) { return(_selfApprovalComment.GetSingle(d => d.CommentID == Id)); }
public ScopeChangeType GetScopeChangeTypeByID(Int32 scopeID) { //Func<T, bool> where, params Expression<Func<T, object>>[] navigationProperties return(_scopeRepository.GetSingle(d => d.ScopeChangeTypeID == scopeID)); //include related employees }
//public System.Data.DataTable LINQToDataTable(IEnumerable<ProjectType> enumerable) //{ // return _projecttypeRepository.LINQToDataTable(enumerable); //} public ProjectTypes GetProjectTypeByID(Int32 projecttypeID) { //Func<T, bool> where, params Expression<Func<T, object>>[] navigationProperties return(_projecttypeRepository.GetSingle(d => d.ProjectTypeID == projecttypeID)); //include related employees }
public FileCheckerEmailDetail GetFileCheckerByID(int FileCheckerID) { return(_fileChecker.GetSingle(d => d.FileCheckerID == FileCheckerID)); }
public WBSTemplate GetWBSTemplateByID(int wbsTemplateID) { return(_wbsTemplate.GetSingle(d => d.WBSTemplateID == wbsTemplateID)); }
public DocumentFilter GetDocumentFilterByID(Int32 documentFiltersRepositoryID) { return(_documentFiltersRepository.GetSingle(d => d.DocumentFiltersID == documentFiltersRepositoryID)); }
public Dropdown7 GetDropDown7ByID(int Id) { return(_dropdown7.GetSingle(d => d.ItemId == Id)); }
public Department GetDepartmentByID(Int32 departmentID) { //Func<T, bool> where, params Expression<Func<T, object>>[] navigationProperties return(_departmentRepository.GetSingle(d => d.DepartmentID == departmentID)); //include related employees }
public TaskStartEndJustification GetTaskStartEndJustificationByID(Int32 TaskStartEndJustificationID) { return(_taskStartEndJustification.GetSingle(d => d.ID == TaskStartEndJustificationID)); }
public ActivityLog GetActivityLogByID(int ActivityLogID) { return(_ActivityLog.GetSingle(d => d.ActivityLogID == ActivityLogID)); }
public TaskProgressReminder GetTaskProgressReminderByID(int TaskProgressReminderID) { return(_taskProgressReminder.GetSingle(d => d.ID == TaskProgressReminderID)); }