private static void PerformPhotoSaving(User destination, UserDTO source, IRepository<File> fileRepository)
 {
     var photoInDTO = source.Photo;
     if (photoInDTO != null)
     {
         var photoInDb = fileRepository.GetByID(source.Photo.Id);
         if (photoInDb == null)
         {
             throw new Exception("Database doesn't contains such entity");
         }
         if (photoInDTO.ShouldBeRemoved())
         {
             fileRepository.Delete(photoInDb.Id);
         }
         else
         {
             photoInDb.Update(photoInDTO);
             destination.Photo = photoInDb;
         }
     }
 }
Beispiel #2
0
        public IActionResult Delete(int stateid, int slang)
        {
            int i = 0;

            if (slang > 0)
            {
                var slanguages = _slangrepo.GetByID(slang);
                i = _slangrepo.Delete(slanguages);
            }
            else if (stateid > 0)
            {
                var s = _staterepo.GetByID(stateid);
                i = _staterepo.Delete(s);
            }
            if (i > 0)
            {
                return(RedirectToAction("Index"));
            }

            return(View());
        }
Beispiel #3
0
        public ServiceModel.Task GetTask(string TaskId, string userId)
        {
            var task      = repository.GetByID(TaskId).Map();
            var userStory = userStoryRepository.GetByID(task.UserStoryId).Map();

            if (userStory.SprintId != null)
            {
                var member = projectRepository.GetByID(userStory.ProjectId).ProjectTeam.FirstOrDefault(m => m.UserId == userId);
                if (member != null && (member.HasRole(Role.ScrumMaster) || member.HasRole(Role.Developer)))
                {
                    var sprint = sprintRepository.GetByID(userStory.SprintId);
                    task.InSprintTeam            = sprint.SprintTeam.FirstOrDefault(m => m.ProjectTeamMemberId == member.Id) != null;
                    task.IsDeveloperInSprintTeam = task.InSprintTeam && member.HasRole(Role.Developer);
                }
            }
            if (!string.IsNullOrEmpty(task.UserIdAssignedTo))
            {
                task.AssignedTo = UserManager.GetUserNameById(task.UserIdAssignedTo);
            }
            return(task);
        }
        private void UpdateRoles(ApplicationUser user, IEnumerable <string> roleIds)
        {
            user.Roles.Clear();
            if (roleIds == null)
            {
                return;
            }

            foreach (var id in roleIds)
            {
                var role = _rolesRepository.GetByID(id);
                if (role == null)
                {
                    throw new Exception(string.Format(Resources.Common.DoesNotExist + " Id: {1}", "Role", id));
                }

                user.Roles.Add(new IdentityUserRole {
                    RoleId = id, UserId = user.Id
                });
            }
        }
Beispiel #5
0
 private static void PerformPhotoSaving(Candidate destination, CandidateDTO source, IRepository<File> fileRepository)
 {
     var photoInDTO = source.Photo;
     if (photoInDTO != null)
     {
         var photoInDb = fileRepository.GetByID(source.Photo.Id);
         if (photoInDb == null)
         {
             throw new Exception("Database doesn't contains such entity");
         }
         if (photoInDTO.ShouldBeRemoved())
         {
             fileRepository.Delete(photoInDb.Id);
         }
         else
         {
             photoInDb.Update(photoInDTO);
             destination.Photo = photoInDb;
         }
     }
 }
Beispiel #6
0
        private void Execute_UpdatePass(object obj)
        {
            var p = (RePass)obj;

            if (!p.validate())
            {
                System.Windows.Forms.MessageBox.Show("Empty", "Warning",
                                                     MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            var curAcc   = accountRepository.GetByID(UID);
            var password = curAcc.Password;

            if (password != p.curpass)
            {
                System.Windows.Forms.MessageBox.Show("Wrong Password", "Warning",
                                                     MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else
            {
                if (p.newpass != p.repass)
                {
                    System.Windows.Forms.MessageBox.Show("New-Password and Re-Password don't match", "Warning",
                                                         MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                else
                {
                    curAcc.Password = p.newpass;
                    accountRepository.Update(curAcc);
                    accountRepository.Save();
                    System.Windows.Forms.MessageBox.Show("Successfully updated", "Info", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    RePass.clear();
                    var ProfilePage = App.Current.Windows.OfType <Profile>().FirstOrDefault();
                    if (ProfilePage != null)
                    {
                        ProfilePage.Close();
                    }
                }
            }
        }
Beispiel #7
0
        public ProfileViewModel()
        {
            accountRepository = new BaseRepository <account>();
            staffRepository   = new BaseRepository <staff>();
            _rePass           = new RePass();
            session           = Session.GetCurrentSingleton();
            UID        = (int)session.AccountID;
            _roleName  = session.Role.ToString();
            _myProfile = staffRepository.GetByID(UID);
            _name      = _myProfile.Name;

            /*
             * Not much point in this case, but for the record, you can have
             * different data depending on if you're in design or runtime like this:
             */


            // This will register our method with the Messenger class for incoming
            // messages of type RefreshPeople.
            //Messenger.Default.Register<RefreshPeople>(this, (msg) => Execute_RefreshPeople(msg.PeopleToFetch));
            //Messenger.Default.Register<Parameter>(this, res => Function(res.param));
        }
Beispiel #8
0
        public IActionResult FluxoCaixaAddEdit(int?idFluxoCaixa)
        {
            if (idFluxoCaixa != null)
            {
                var fluxoCaixa = _fluxoCaixaRepository.GetByID(idFluxoCaixa ?? 0);

                var fluxoCaixaVM = new FluxoCaixaVM()
                {
                    IDFluxoCaixa   = fluxoCaixa.IDFluxoCaixa,
                    DataLancamento = fluxoCaixa.DataLancamento,
                    TipoLancamento = fluxoCaixa.TipoLancamento,
                    Origem         = fluxoCaixa.Origem,
                    Chave          = fluxoCaixa.Chave,
                    Valor          = fluxoCaixa.Valor,
                    Observacao     = fluxoCaixa.Observacao
                };

                return(View(fluxoCaixaVM));
            }

            return(View());
        }
Beispiel #9
0
        public IHttpActionResult LookupItem(int id)
        {
            try
            {
                var result = _repository.GetByID(id);

                return(ApiResult <T> .Success(result));
            }
            catch (Exception ex)
            {
                _logger.Log($"Error: {nameof(LookupItem)}", $"{nameof(LookupItem)} Throws Exception: {ex.Message} ", ex, true);
                _logger.LogToElmah(ex);

                return(ApiResult <ListModel <T> > .ServerError(ex, new BaseApiResponse()
                {
                    StatusCode = HttpStatusCode.InternalServerError,
                    BusinessStatusCode = ErrorCodes.GET_LOOKUPSITEM_ERROR.ToString(),
                    MessageAr = ArabicMessages.GET_LOOKUPSITEM_ERROR,
                    MessageEn = EnglishMessages.GET_LOOKUPSITEM_ERROR + Environment.NewLine + ex.Message,
                }));
            }
        }
Beispiel #10
0
        public void Save(int parCodigo, bool parEsconderValorPagamentoSumula, string parCaminhoFotos, int parTamanhoFotos, string parExtensaoFotos, string parCaminhoFotosAtletas, int parTamanhoAlturaFotos, int parTamanhoLarguraFotos, int tipCodigo)
        {
            ParametrosEN parametrosEN = _repositoryParametrosEN.GetByID(parCodigo);

            if (parametrosEN != null)
            {
                parametrosEN.UpdateProperties
                (
                    parEsconderValorPagamentoSumula,
                    parCaminhoFotos,
                    parTamanhoFotos,
                    parExtensaoFotos,
                    parCaminhoFotosAtletas,
                    parTamanhoAlturaFotos,
                    parTamanhoLarguraFotos,
                    tipCodigo
                );

                _repositoryParametrosEN.Edit(parametrosEN);
            }
            else
            {
                parametrosEN = new ParametrosEN
                               (
                    parEsconderValorPagamentoSumula,
                    parCaminhoFotos,
                    parTamanhoFotos,
                    parExtensaoFotos,
                    parCaminhoFotosAtletas,
                    parTamanhoAlturaFotos,
                    parTamanhoLarguraFotos,
                    tipCodigo
                               );

                _repositoryParametrosEN.Save(parametrosEN);
            }

            _unitOfWork.Commit();
        }
Beispiel #11
0
        public async Task <TableResponseModel> Get(Guid id)
        {
            Log.Logger = new LoggerConfiguration()
                         .WriteTo.Console()
                         .WriteTo.File("C:\\test\\log.txt")
                         .CreateLogger();

            Table table;

            try
            {
                table = await _repository.GetByID(id);
            }
            catch (Exception e)
            {
                Log.Debug("Tried to find a table with id {Id}. Error message: {Error}", id, e.Message);
                return(new TableResponseModel()
                {
                    ErrorMessage = e.Message, Success = false, Tables = null
                });
            }

            if (table == null)
            {
                Log.Information("Failed to find table with id {Id}", id);
                return(new TableResponseModel()
                {
                    ErrorMessage = $"Unable to find table with Id {id}", Success = false, Tables = null
                });
            }
            Log.Information("Got table with id {Id}", id);
            return(new TableResponseModel()
            {
                ErrorMessage = null, Success = true, Tables = new List <Table>()
                {
                    table
                }
            });
        }
Beispiel #12
0
        public List <ProductoDTO> GetAllProductosSegunListaAsociada(int clienteID)
        {
            var cliente       = clienteRP.GetByID(clienteID);
            var listaAsociada = cliente.ListaId;

            //List<ListaPrecio> productosSegunLista = listaPrecioRP.GetAll()
            //    .Include(p => p.Producto)
            //    //.Include(p => p.Producto.Categoria)
            //    //.Include(p => p.Producto.Marca)
            //    .Where(p => p.ListaID == listaAsociada)
            //    .ToList();

            ApplicationDbContext db = new ApplicationDbContext();

            db.Configuration.LazyLoadingEnabled   = false;
            db.Configuration.ProxyCreationEnabled = false;

            var prods = (from lp in db.ListaPrecios
                         join p in db.Productos on lp.ProductoID equals p.ID
                         where lp.ListaID == listaAsociada
                         select new ProductoDTO {
                ID = p.ID,
                Nombre = p.Nombre,
                NombreAuxiliar = p.NombreAuxiliar
            }).ToList();



            //List<Producto> listaProductos = new List<Producto>();

            //foreach (var prod in productosSegunLista)
            //{
            //    listaProductos.Add(prod.Producto);
            //}

            return(prods);
            //return listaProductos;
        }
        public void BookAppoint(NewAppointmentViewModel model)
        {
            var customerId = _customerRepo.Gets().Where(p => p.AccountId == model.AccountId).Select(x => x.CustomerId).FirstOrDefault();
            var startTime  = DateTime.Parse(model.StartTime);

            model.CustomerId = customerId;
            var bookedServices = _salonServiceRepo.Gets()
                                 .Where(s => model.Services.Contains(s.Id))
                                 .Select(x => new ServiceAppointment
            {
                Price     = x.Price ?? 0,
                ServiceId = x.Id,
            }).ToList();

            var apm = new Appointment
            {
                BookedDate         = DateTime.Now,
                CustomerId         = model.CustomerId,
                PromotionId        = model.PromotionId,
                Duration           = model.Duration,
                Status             = AppointmentStatusConstant.NOTAPPROVE,
                StartTime          = startTime,
                ServiceAppointment = bookedServices
            };
            // UPDATE SLOTS TO SLOT TIME
            var slot = _slotTimeRepo.GetByID(model.SlotId);

            foreach (var index in model.Indexes)
            {
                var  capacity = slot.GetType().GetProperty($"Slot{index}").GetValue(slot);
                byte cap      = Convert.ToByte(capacity);
                cap += 1;
                slot.GetType().GetProperty($"Slot{index}").SetValue(slot, cap);
            }
            _slotTimeRepo.Edit(slot);
            _apmRepo.Insert(apm);
            _unitOfWork.SaveChanges();
        }
        public static ProductListModel Get(IRepository <Product> ProductRepository, IRepository <ProductCategory> ProductCategoryRepository, IRepository <ProductImage> productImageRepository, Guid userid)
        {
            var model = new ProductListModel
            {
                Products = ProductRepository.GetAll()
                           .OrderBy(u => u.ID).Where(x => x.UserID == userid)
                           .Select(u => new ListItem
                {
                    ID    = u.ID,
                    Name  = u.Name,
                    Price = u.Price,

                    Image        = productImageRepository.GetAll().Where(x => x.ProductID == u.ID).FirstOrDefault(),
                    categoryName = ProductCategoryRepository.GetByID(u.categoryID).Name
                }).ToList()
            };

            return(model);

            //var products = ProductRepository.GetAll();
            //IEnumerable<ProductListModel> model = from a in ProductRepository.Query("SELECT * from Product")
            //                                      join b in ProductCategoryRepository.Query("SELECT * from ProductCategory") on a.categoryID equals b.ID
            //                                      select new ProductListModel()
            //                                      {
            //                                          Products = new Product(new ListItem { });
            //                                      };
            //var model = new ProductListModel
            //{
            //    Products = products.OrderBy(p => p.Name).Select(p => new ListItem
            //    {
            //        ID = p.ID,
            //        Name = p.Name,
            //        categoryNames = p.ProductInCategories.Select(x => x.ProductCategory.Name).ToList(),
            //    }).ToList()
            //};

            //return model;
        }
        public List <SlotDateViewModel> SearchTimeSlot(int salonId, int duration)
        {
            var salon        = _salonRepo.GetByID(salonId);
            var slotDateList = new List <SlotDateViewModel>();

            if (salon != null)
            {
                int salonCapacity = salon.Capacity ?? 0;
                int numberOfSlot  = (int)Math.Ceiling((double)duration / 15); // Require Slots for appointment
                var date          = DateTime.Now;
                var endDate       = date.AddDays(7).Date;
                var currTime      = date.TimeOfDay;
                int currSlot      = (int)Math.Ceiling(currTime.TotalMinutes / 15);
                var timeMask      = TimeSpan.FromMinutes(currSlot * 15);

                var salonSlots = _slotRepo.GetsAsNoTracking()
                                 .Where(s => s.SlotDate >= date.Date && s.SlotDate <= endDate)
                                 .AsQueryable()
                                 .ToList();
                salonSlots = salonSlots.Where(s => s.SalonId == salonId).OrderBy(s => s.SlotDate).ToList();

                foreach (var slotdate in salonSlots)
                {
                    var convertedSlots = ParseToSlotList(slotdate);
                    var availableSlots = GetAvailableSlot(convertedSlots, numberOfSlot, salonCapacity);
                    availableSlots = availableSlots
                                     .Where(s => s.SlotDate > date.Date || (s.SlotDate == date.Date && s.Time >= date.TimeOfDay))
                                     .ToList();

                    slotDateList.Add(new SlotDateViewModel
                    {
                        date  = slotdate.SlotDate,
                        slots = availableSlots
                    });
                }
            }
            return(slotDateList);
        }
Beispiel #16
0
        public void UpdateSalonService(UpdateServiceViewModel model)
        {
            var salonId = _salonRepo.Gets().Where(s => s.AccountId == model.AccountId).Select(s => s.Id).FirstOrDefault();

            var foundedService = _salonServiceRepo.Gets()
                                 .Where(s => s.SalonId == salonId && s.ServiceId == model.ServiceId)
                                 .FirstOrDefault();

            if (foundedService != null)
            {
                foundedService.Price       = model.Price;
                foundedService.AvarageTime = model.Duration;
                _salonServiceRepo.Edit(foundedService);
                _unitOfWork.SaveChanges();
            }
            else
            {
                var salon   = _salonRepo.GetByID(salonId);
                var service = _serviceRepo.GetByID(model.ServiceId);
                if (salon != null && service != null)
                {
                    SalonService newService = new SalonService
                    {
                        Salon       = salon,
                        Service     = service,
                        Price       = model.Price,
                        AvarageTime = model.Duration,
                        Disabled    = false
                    };
                    _salonServiceRepo.Insert(newService);
                    _unitOfWork.SaveChanges();
                }
                else
                {
                    throw new Exception("Salon Not Found");
                }
            }
        }
Beispiel #17
0
        public IActionResult MovimentoEstoqueAddEdit(int?idMovimentoEstoque)
        {
            if (idMovimentoEstoque != null)
            {
                var movimentoEstoque = _movimentoEstoqueRepository.GetByID(idMovimentoEstoque ?? 0);

                var movimentoEstoqueVM = new MovimentoEstoqueVM()
                {
                    IDMovimento   = movimentoEstoque.IDMovimento,
                    DataMovimento = movimentoEstoque.DataMovimento,
                    Origem        = movimentoEstoque.Origem,
                    Chave         = movimentoEstoque.Chave,
                    IDProduto     = movimentoEstoque.IDProduto,
                    Tipo          = movimentoEstoque.Tipo,
                    Qtde          = movimentoEstoque.Qtde,
                    Observacao    = movimentoEstoque.Observacao
                };

                return(View(movimentoEstoqueVM));
            }

            return(View());
        }
Beispiel #18
0
        public static ProductEditModel GetById(IRepository <Product> ProductRepository, IRepository <ProductCategory> ProductCategoryRepository, IRepository <ProductImage> ProductImageRepository, int id)
        {
            var product             = ProductRepository.GetByID(id);
            var getproductImages    = ProductImageRepository.GetAll().Where(x => x.ProductID == product.ID).ToList();
            var getProductImagePath = ProductImageRepository.GetAll().Where(x => x.ProductID == product.ID).Select(x => x.ImagePath).ToList();

            if (product != null)
            {
                var model = new ProductEditModel
                {
                    Product          = product,
                    ProductCategorys = ProductCategoryRepository.GetAll().OrderBy(r => r.ID).ToList(),
                    ProductImages    = getproductImages,
                    ProductImagePath = getProductImagePath
                };

                var Productcate = ProductCategoryRepository.GetByID(product.categoryID).Name;
                model.SelectedProductCategory = Productcate;
                return(model);
            }

            return(null);
        }
        public void UpdateVersion(FullProductDto combined)
        {
            var productId = _productVersionRepository.GetAll().ToList();
            var sameNameProductVersion = _productVersionRepository.GetMany(x => x.Name.Equals(combined.Name) && x.SoftDelete == false && !Guid.Equals(x.Id, combined.ProductVersionId));

            if (sameNameProductVersion.Count() != 0)
            {
                throw new BusinessException(ExceptionCode.DuplicateProductNames);
            }

            var oldProductVersion = _productVersionRepository.GetByID(combined.ProductVersionId);

            if (oldProductVersion != null)
            {
                var oldProduct = _productRepository.GetByID(oldProductVersion.ProductId);
                oldProduct.IsInStore   = combined.IsInStore;
                oldProduct.Quantity    = combined.Quantity;
                oldProduct.IsOrderable = combined.IsOrderable;
                _productRepository.Update(oldProduct);

                if (IsNewProductVersionNeeded(combined, oldProductVersion))
                {
                    oldProductVersion.SoftDelete = true;
                    ProductVersion newProductVersion = new ProductVersion();
                    newProductVersion.Description = combined.Description;
                    newProductVersion.Cost        = combined.Cost;
                    newProductVersion.Created     = DateTime.Now;
                    newProductVersion.Name        = combined.Name;
                    newProductVersion.ProductId   = oldProduct.Id;
                    newProductVersion.UrlImg      = combined.UrlImg;
                    newProductVersion.SoftDelete  = false;

                    _productVersionRepository.Update(oldProductVersion);
                    _productVersionRepository.Create(newProductVersion);
                }
            }
        }
Beispiel #20
0
 private static void PerformFilesSaving(Candidate destination, CandidateDTO source, IRepository <File> fileRepository)
 {
     source.Files.ToList().ForEach(file =>
     {
         var fileInCandidate = destination.Files.FirstOrDefault(x => x.Id == file.Id);
         var dbFile          = fileRepository.GetByID(file.Id);
         if (dbFile == null)
         {
             throw new Exception("Database doesn't contains such entity");
         }
         if (file.ShouldBeRemoved())
         {
             fileRepository.Delete(file.Id);
         }
         else
         {
             dbFile.Update(file);
             if (fileInCandidate == null)
             {
                 destination.Files.Add(dbFile);
             }
         }
     });
 }
        public static ProductEditModel GetById(IRepository <Product> ProductRepository, IRepository <ProductCategory> ProductCategoryRepository, IRepository <ProductImage> ProductImageRepository, IRepository <Province> ProvinceRepository, IRepository <District> DistrictRepository, IRepository <State> StateRepository, int id)
        {
            var product       = ProductRepository.GetByID(id);
            var productImages = ProductImageRepository.GetAll().Where(x => x.ProductID == product.ID).ToList();

            if (product != null)
            {
                var model = new ProductEditModel
                {
                    Product          = product,
                    ProductCategorys = ProductCategoryRepository.GetAll().OrderBy(r => r.ID).ToList(),
                    ProductImages    = productImages,
                    Provinces        = ProvinceRepository.GetAll().ToList(),
                    Districts        = DistrictRepository.GetAll().ToList(),
                    States           = StateRepository.GetAll().ToList()
                };

                var Productcate = ProductCategoryRepository.GetByID(product.categoryID).Name;
                model.SelectedProductCategory = Productcate;
                return(model);
            }

            return(null);
        }
Beispiel #22
0
        public TaskDTO Handle(GetTaskByIdQuery query)
        {
            var task = _repository.GetByID(query.Id);

            return(DomainTaskToDTOMapper.Transform(task));
        }
Beispiel #23
0
 public static PERSON GetById(string id)
 {
     return(reps.GetByID(id));
 }
Beispiel #24
0
 public FeatureFlag GetFeatureFlagByID(Guid id)
 {
     return(repository.GetByID <FeatureFlag>(id));
 }
Beispiel #25
0
 public TipoCliente GetTipoClienteById(int id)
 {
     return(tipoClienteRP.GetByID(id));
 }
Beispiel #26
0
 public CondicionIVA GetCondicionIVAById(int id)
 {
     return(condicionIVARP.GetByID(id));
 }
Beispiel #27
0
 public Clasificacion GetClasificacionById(int id)
 {
     return(clasificacionRP.GetByID(id));
 }
Beispiel #28
0
 public Models.DbModels.Jobs getJobById(int id)
 {
     return(_jobRepository.GetByID(id));
 }
Beispiel #29
0
        public ViewResult Details(int id)
        {
            var model = productRepo.GetByID(id);

            return(View(model));
        }
 private static void PerformSkillsSaving(Candidate destination, CandidateDTO source, IRepository<Skill> skillRepository)
 {
     destination.Skills.Clear();
     source.SkillIds.ToList().ForEach(skillId =>
     {
         destination.Skills.Add(skillRepository.GetByID(skillId));
     });
 }
 private static void RefreshExistingVacanciesProgress(Candidate destination, CandidateDTO source, IRepository<VacancyStageInfo> vacancyStageInfoRepository, IRepository<Vacancy> vacancyRepo)
 {
     source.VacanciesProgress.Where(x => !x.IsNew()).ToList().ForEach(updatedVacanciesStageInfo =>
     {
         var domainVacancyStageInfo = destination.VacanciesProgress.FirstOrDefault(x => x.Id == updatedVacanciesStageInfo.Id);
         if (domainVacancyStageInfo == null)
         {
             throw new ArgumentNullException("You trying to update vacancy stage info which is actually doesn't exists in database");
         }
         if (updatedVacanciesStageInfo.ShouldBeRemoved())
         {
             vacancyStageInfoRepository.Delete(updatedVacanciesStageInfo.Id);
         }
         else
         {
             domainVacancyStageInfo.Update(vacancyRepo.GetByID(domainVacancyStageInfo.VacancyId), updatedVacanciesStageInfo);
         }
     });
 }
 private static void PerformTagsSaving(Candidate destination, CandidateDTO source, IRepository<Tag> tagRepository)
 {
     destination.Tags.Clear();
     source.TagIds.ToList().ForEach(tagId =>
     {
         destination.Tags.Add(tagRepository.GetByID(tagId));
     });
 }
Beispiel #33
0
        public int Save(int IDContasReceber, int IDCompany, int IDUser, int IDEmpresa, string NumeroTitulo, int Seq, DateTime DataVencimento, decimal Valor, decimal ValorPago, OrigemContasReceberEnum Origem, string linkFatura, int Chave, string Observaca)
        {
            ContasReceberEN contasReceberEN = null;

            if (Origem == OrigemContasReceberEnum.ContasReceber)
            {
                contasReceberEN = _repositoryContasReceber.GetByID(IDContasReceber);
            }
            else
            {
                contasReceberEN = _repositoryContasReceber.Where(obj => obj.Chave == Chave && obj.Seq == Seq).FirstOrDefault();
            }

            if (contasReceberEN != null)
            {
                contasReceberEN.UpdateProperties
                (
                    IDCompany,
                    IDUser,
                    IDEmpresa,
                    NumeroTitulo,
                    Seq,
                    DataVencimento,
                    Valor,
                    ValorPago,
                    Origem,
                    Chave,
                    linkFatura,
                    contasReceberEN.Status,
                    Observaca
                );

                _repositoryContasReceber.Edit(contasReceberEN);
            }
            else
            {
                contasReceberEN = new ContasReceberEN
                                  (
                    IDCompany,
                    IDUser,
                    IDEmpresa,
                    NumeroTitulo,
                    Seq,
                    DataVencimento,
                    Valor,
                    ValorPago,
                    Origem,
                    Chave,
                    linkFatura,
                    ContasReceberStatusEnum.EmAberto,
                    Observaca
                                  );
                contasReceberEN.DataCadastro = DateTime.Now.ToLocalTime();

                _repositoryContasReceber.Save(contasReceberEN);
            }

            _unitOfWork.Commit();

            return(contasReceberEN.IDContasReceber);
        }
 private static void CreateNewVacanciesProgress(Candidate destination, CandidateDTO source, IRepository<Vacancy> vacancyRepo)
 {
     source.VacanciesProgress.Where(x => x.IsNew()).ToList().ForEach(newVacancyStageInfo =>
     {
         var toDomain = new VacancyStageInfo();
         toDomain.Update(vacancyRepo.GetByID(newVacancyStageInfo.VacancyId.Value), newVacancyStageInfo);
         destination.VacanciesProgress.Add(toDomain);
     });
 }
Beispiel #35
0
 public FavouriteFeeds GetFavouriteFeed(int ID)
 {
     return(favFeedRepository.GetByID(ID));
 }
 private static void PerformFilesSaving(Candidate destination, CandidateDTO source, IRepository<File> fileRepository)
 {
     source.Files.ToList().ForEach(file =>
     {
         var fileInCandidate = destination.Files.FirstOrDefault(x => x.Id == file.Id);
         var dbFile = fileRepository.GetByID(file.Id);
         if (dbFile == null)
         {
             throw new Exception("Database doesn't contains such entity");
         }
         if (file.ShouldBeRemoved())
         {
             fileRepository.Delete(file.Id);
         }
         else
         {
             dbFile.Update(file);
             if (fileInCandidate == null)
             {
                 destination.Files.Add(dbFile);
             }
         }
     });
 }