private void ShowSalesmanPopup()
        {
            SelectedSalesman = null;
            using (var container = NestedContainer)
            {
                var selected = Using<IItemsLookUp>(container).SelectDistributrSalesman();

                SelectedSalesman = selected as DistributorSalesman;
                if (selected == null)
                {
                    SelectedSalesman = new DistributorSalesman(Guid.Empty) { Name = "ALL" };
                }
            }

            
        }
        private void ClearViewModel()
        {
            
            SalemanSupplierItems.Clear();
            SelectedSalesman = new DistributorSalesman(Guid.Empty)
            {
                Name = "---Select Salesman---"
            };

        }
Exemplo n.º 3
0
        private bool HasChanged(DistributorSalesman import)
        {
            using (var context = ObjectFactory.Container.GetNestedContainer())
            {
                var salesman = context.GetInstance<ICostCentreRepository>().GetByCode(import.CostCentreCode, CostCentreType.DistributorSalesman, true) as DistributorSalesman;

                return salesman == null ||
                       salesman.CostCentreCode.Trim().ToLower() == import.CostCentreCode.Trim().ToLower()
                       && (salesman.Name.Trim().ToLower() !=
                           import.Name.Trim().ToLower());
            }


        }
Exemplo n.º 4
0
        private bool HasSalesmanChanged(DistributorSalesman import)
        {
            using (var context =new CokeDataContext(Con))
            {
                var salesman =
                    context.tblCostCentre.FirstOrDefault(
                        p =>
                        p.Cost_Centre_Code == import.CostCentreCode && p.CostCentreType == (int) import.CostCentreType);

                return salesman == null ||
                       salesman.Cost_Centre_Code.Trim().ToLower() == import.CostCentreCode.Trim().ToLower()
                       && (salesman.Name.Trim().ToLower() !=import.Name.Trim().ToLower());
            }


        }
        private MasterEntity GetDistributorSalesmanEntity(MasterBaseDTO masterBase)
        {
            DistributorSalesmanDTO dto = masterBase as DistributorSalesmanDTO;
            DistributorSalesman entity = new DistributorSalesman(masterBase.MasterId, masterBase.DateCreated, masterBase.DateLastUpdated, (EntityStatus)masterBase.StatusId);
            entity.CostCentreCode = dto.CostCentreCode;
            entity.CostCentreType = CostCentreType.DistributorSalesman;
            entity.Name = dto.Name;
            entity.ParentCostCentre = new CostCentreRef {Id = dto.ParentCostCentreId};
            //entity.Routes 

            return entity;
        }
Exemplo n.º 6
0
 public DistributorSalesmanDTO Map(DistributorSalesman distributorSalesman)
 {
     if (distributorSalesman == null) return null;
     return Mapper.Map<DistributorSalesman, DistributorSalesmanDTO>(distributorSalesman);
 }
        private async Task<ImportValidationResultInfo> ValidateEntityAsync(DistributorSalesman user)
        {
            return await Task.Run(() =>
            {
                var res = _costCentreRepository.Validate(user);
                return new ImportValidationResultInfo()
                {
                    Results = res.Results,
                    Entity = user,
                    Description = user.CostCentreCode

                };
            });
        }
        protected DistributorSalesman Map(DistributorSalesmanImport distributorSalesmanImport, List<string> mappingvalidationList)
        {
            var exists = Queryable.FirstOrDefault(_context.tblCostCentre, p => p.Cost_Centre_Code == distributorSalesmanImport.Code && p.CostCentreType == (int)CostCentreType.DistributorSalesman);
            Guid id = exists != null ? exists.Id : Guid.NewGuid();

            var distributor =
                Queryable.FirstOrDefault(_context.tblCostCentre, p =>
                    p.Cost_Centre_Code == distributorSalesmanImport.DistributorCode &&
                    p.CostCentreType == (int) CostCentreType.Distributor) ;
            if (distributor == null) { mappingvalidationList.Add(string.Format((string) "Invalid Distributor Code {0}", (object) distributorSalesmanImport.DistributorCode)); }
            var distributorId = distributor != null ? distributor.Id : Guid.Empty;

            var distributorSalesman = new DistributorSalesman(id);
            distributorSalesman.Name = distributorSalesmanImport.Name;
            distributorSalesman.CostCentreCode = distributorSalesmanImport.Code;
            distributorSalesman.CostCentreType = CostCentreType.DistributorSalesman;
            distributorSalesman.ParentCostCentre=new CostCentreRef(){Id = distributorId};
            return distributorSalesman;

        }
 protected ValidationResultInfo Validate(DistributorSalesman distributorSalesman)
 {
     return _salesmanRepository.Validate(distributorSalesman);
 }