Beispiel #1
0
 public void LogItem(string message)
 {
     _logRepository.Add(new Log
     {
         Message   = message,
         CreatedOn = DateTime.Now,
         Logger    = _sessionId
     });
 }
        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);
        }
Beispiel #3
0
 //public List<Profile> GetProfileByFileID(int DelFileID)
 //{
 //    List<Profile> lst = null;
 //    try
 //    {
 //        using (var Context = new Cubicle_EntityEntities())
 //        {
 //            lst = Context.Profiles.Where(a => a.ProfileID == DelFileID).ToList<Profile>();
 //        }
 //    }
 //    catch (Exception ex)
 //    {
 //        //bool false = BusinessLogicExceptionHandler.HandleException(ref ex);
 //        if (false)
 //        {
 //            throw ex;
 //        }
 //    }
 //    return lst;
 //}
 public void AddCheckerAttachmentFile(params CheckerAttachmentFile[] attachmentFile)
 {
     try
     {
         _checkerAttachmentFile.Add(attachmentFile);
     }
     catch (Exception ex)
     {
         //bool false = BusinessLogicExceptionHandler.HandleException(ref ex);
         throw new Exception("Record not added.");
     }
 }
        private ImageFolder EnsureImageFolderExists(string folderName)
        {
            var folder = GetImageFolder(folderName);

            if (folder == null)
            {
                folder = new ImageFolder
                {
                    FolderName = folderName
                };

                _folderRepository.Add(folder);
            }
            return(folder);
        }
        public bool SaveStudent(Student student)
        {
            IGenericDataRepository <Student> studentRepo = _uow.RepositoryFor <Student>();

            studentRepo.Add(student);
            return(true);
        }
Beispiel #6
0
        public ApiResponse <long> AddDerechohabiente(Derechohabiente derechohabiente)
        {
            ApiResponse <long> apiResponse = new ApiResponse <long>();

            try
            {
                int result = _repository.Add(derechohabiente);

                if (result == (int)EntityFrameworkResult.Success)
                {
                    apiResponse.Data    = derechohabiente.IdDerechohabiente;
                    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 bool SaveDepartment(Department department)
        {
            IGenericDataRepository <Department> departmentRepo = _uow.RepositoryFor <Department>();

            departmentRepo.Add(department);
            return(true);
        }
Beispiel #8
0
        private void AddGameToOrder(Order order, string gamekey)
        {
            var game = _gameRepository.First(x => x.Key == gamekey);

            var gameDetails = order.OrderDetails.FirstOrDefault(x => string.Equals(x.Game.Key, gamekey, StringComparison.OrdinalIgnoreCase));

            if (gameDetails != null)
            {
                gameDetails.Quantity++;
                gameDetails.Price = gameDetails.Game.Price;
                gameDetails.Order = null;
                gameDetails.Game  = null;
                _orderDetailsRepository.Update(gameDetails);
            }
            else
            {
                _orderDetailsRepository.Add(new OrderDetails()
                {
                    Id       = Guid.NewGuid().ToString(),
                    OrderId  = order.Id,
                    GameId   = game.Id,
                    Quantity = 1,
                    Price    = game.Price
                });
            }

            UnitOfWork.Save();
            Logger.Write(Operation.Insert, order);
        }
        public bool SaveCourse(Course course)
        {
            IGenericDataRepository <Course> courseRepo = _uow.RepositoryFor <Course>();

            courseRepo.Add(course);
            return(true);
        }
        public ApiResponse <int> AddEncuesta(Encuesta encuesta)
        {
            ApiResponse <int> apiResponse = new ApiResponse <int>();

            try
            {
                apiResponse.Data = _repository.Add(encuesta);

                if (apiResponse.Data == (int)EntityFrameworkResult.Success)
                {
                    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);
        }
Beispiel #11
0
 public virtual void Add(TDomain item, string cultureCode)
 {
     AssignIdIfEmpty(item);
     _genericRepository.Add(item);
     UnitOfWork.Save();
     Logger.Write(Operation.Insert, item);
 }
Beispiel #12
0
        private GameEntity InitGame(Game game)
        {
            var gameEntity = _mapper.Map <Game, GameEntity>(game);

            if (game.Genres != null)
            {
                IEnumerable <GenreEntity> sqlGenres    = _genreRepository.GetGenres(game.Genres);
                IEnumerable <Genre>       notSqlGenres = game.Genres.Except(_mapper.Map <IEnumerable <GenreEntity>, IEnumerable <Genre> >(sqlGenres), new IdDomainComparer <Genre>());
                foreach (var genre in notSqlGenres)
                {
                    _genreRepository.Add(genre);
                }

                _context.SaveChanges();

                gameEntity.Genres = _genreRepository.GetGenres(game.Genres).ToList();
            }
            if (game.PlatformTypes != null)
            {
                gameEntity.PlatformTypes = _platformRepository.GetPlatformTypes(game.PlatformTypes).ToList();
            }
            if (game.Publisher != null)
            {
                gameEntity.Publisher = _context.Publishers.FirstOrDefault(x => x.CompanyName == game.Publisher.CompanyName);

                if (gameEntity.Publisher == null)
                {
                    _publisherRepository.Add(game.Publisher);
                    _context.SaveChanges();
                    gameEntity.Publisher = _context.Publishers.FirstOrDefault(x => x.CompanyName == game.Publisher.CompanyName);
                }
            }

            return(gameEntity);
        }
        /// <summary>
        /// Create
        /// </summary>
        /// <param name="entity"></param>
        public virtual void Create(T entity)
        {
            if (entity == null)
            {
                throw new ArgumentNullException("entity");
            }

            _repository.Add(entity);
            _unitOfWork.Commit();
        }
Beispiel #14
0
 public virtual void CreateTicket(Ticket ticket)
 {
     try
     {
         _ticketRepository.Add(ticket);
     }
     catch (Exception ex)
     {
         Log("TicketService => CreateTicket() sysid" + ticket.NcEcrProductCode + ex.Message);
     }
 }
Beispiel #15
0
 public void AddGanttSetting(params GanntChartSetting[] ganntChartSetting)
 {
     try
     {
         _ganttSetting.Add(ganntChartSetting);
     }
     catch (Exception ex)
     {
         //bool false = BusinessLogicExceptionHandler.HandleException(ref ex);
         throw new Exception("Record not added.");
     }
 }
 public void AddCustomReport(params CustomReport[] CustomReport)
 {
     try
     {
         _customReport.Add(CustomReport);
     }
     catch (Exception ex)
     {
         //bool false = BusinessLogicExceptionHandler.HandleException(ref ex);
         throw new Exception("Record not added.");
     }
 }
 public void AddSelfApprovalComment(params SelfApprovalComment[] SelfApprovalComment)
 {
     try
     {
         _selfApprovalComment.Add(SelfApprovalComment);
     }
     catch (Exception ex)
     {
         //bool false = BusinessLogicExceptionHandler.HandleException(ref ex);
         throw new Exception("Record not added.");
     }
 }
        public void AddWBSTemplate(params WBSTemplate[] wbsTemplate)
        {
            try
            {
                _wbsTemplate.Add(wbsTemplate);
            }
            catch (Exception ex)
            {
                // //bool false = BusinessLogicExceptionHandler.HandleException(ref ex);
//throw new Exception("Record not added.");
            }
        }
Beispiel #19
0
 public void AddUploadDeliverableFile(params FileCheckerEmailDetail[] fileChecker)
 {
     try
     {
         _fileChecker.Add(fileChecker);
     }
     catch (Exception ex)
     {
         //bool false = BusinessLogicExceptionHandler.HandleException(ref ex);
         throw new Exception("Record not added.");
     }
 }
 public void AddExUsers(params ExUsers[] ExUsers)
 {
     try
     {
         _exUsers.Add(ExUsers);
     }
     catch (Exception ex)
     {
         //bool false = BusinessLogicExceptionHandler.HandleException(ref ex);
         throw new Exception("Record not added.");
     }
 }
 public void AddTaskProgressReminder(params TaskProgressReminder[] TaskProgressReminder)
 {
     try
     {
         _taskProgressReminder.Add(TaskProgressReminder);
     }
     catch (Exception ex)
     {
         //bool false = BusinessLogicExceptionHandler.HandleException(ref ex);
         throw new Exception("Record not added.");
     }
 }
Beispiel #22
0
 public void AddMessageTemplate(params MessageTemplate[] MessageTemplate)
 {
     try
     {
         _MessageTemplate.Add(MessageTemplate);
     }
     catch (Exception ex)
     {
         //bool false = BusinessLogicExceptionHandler.HandleException(ref ex);
         throw new Exception("Record not added.");
     }
 }
Beispiel #23
0
 public void AddEstimationTaskList(params EstimationTaskList[] EstimationTaskList)
 {
     try
     {
         _estimationTaskList.Add(EstimationTaskList);
     }
     catch (Exception ex)
     {
         //bool false = BusinessLogicExceptionHandler.HandleException(ref ex);
         throw new Exception("Record not added.");
     }
 }
 public void AddDropDown7(params Dropdown7[] Dropdown7)
 {
     try
     {
         _dropdown7.Add(Dropdown7);
     }
     catch (Exception ex)
     {
         //bool false = BusinessLogicExceptionHandler.HandleException(ref ex);
         throw new Exception("Record not added.");
     }
 }
Beispiel #25
0
 public void AddBufferField(params BufferField[] BufferField)
 {
     try
     {
         _bufferField.Add(BufferField);
     }
     catch (Exception ex)
     {
         ////bool false = BusinessLogicExceptionHandler.HandleException(ref ex);
         throw new Exception("Record not added.");
     }
 }
 public void AddNormsColumnsMasters(params NormsColumnsMaster[] NormsColumnsMaster)
 {
     try
     {
         _NormsColumnsMaster.Add(NormsColumnsMaster);
     }
     catch (Exception ex)
     {
         //bool false = BusinessLogicExceptionHandler.HandleException(ref ex);
         throw new Exception("Record not added.");
     }
 }
 public void AddProjectsAdmin(params ProjectsAdmin[] ProjectsAdmins)
 {
     try
     {
         _projectsAdmin.Add(ProjectsAdmins);
     }
     catch (Exception ex)
     {
         //bool false = BusinessLogicExceptionHandler.HandleException(ref ex);
         throw new Exception("Record not added.");
     }
 }
Beispiel #28
0
 public void AddProjectlevelTaskDependency(params ProjectlevelTaskDependency[] ProjectlevelTaskDependency)
 {
     try
     {
         _projectlevelTaskDependency.Add(ProjectlevelTaskDependency);
     }
     catch (Exception ex)
     {
         //bool false = BusinessLogicExceptionHandler.HandleException(ref ex);
         throw new Exception("Record not added.");
     }
 }
 public void AddActivityLog(params ActivityLog[] ActivityLog)
 {
     try
     {
         _ActivityLog.Add(ActivityLog);
     }
     catch (Exception ex)
     {
         ////bool false = BusinessLogicExceptionHandler.HandleException(ref ex);
         //throw new Exception("Record not added.");
     }
 }
Beispiel #30
0
 public void AddMileStoneTaskType(MileStoneTaskType[] mileStoneTaskType)
 {
     try
     {
         _mileStoneTaskTypeRepository.Add(mileStoneTaskType);
     }
     catch (Exception ex)
     {
         //bool false = BusinessLogicExceptionHandler.HandleException(ref ex);
         throw new Exception("Record not added.");
     }
 }