示例#1
0
 public ImportController(VERPSDBContext context, ILogger <ImportController> logger)
 {
     _logger      = logger;
     _context     = context;
     _dbHelper    = new DBHelper();
     _exactHelper = new ExactHelper();
 }
 public ConfigurationController(VERPSDBContext context, IHtmlLocalizer <ConfigurationController> loc)
 {
     _context     = context;
     _exactHelper = new ExactHelper();
     _dbHelper    = new DBHelper();
     _loc         = loc;
 }
示例#3
0
        public ExactSupplier CreateOrGetSupplier(VERPSDBContext context, Account supplier, string exactUserId, ILogger logger)
        {
            var dbSupplier = context.ExactSuppliers
                             .FirstOrDefault(x => x.ExactUser.ToString() == exactUserId && x.ExactId == supplier.ID);

            // Create new
            if (dbSupplier == null)
            {
                logger.LogInformation($"New supplier with GUID: {supplier.ID} created for User: {exactUserId}");
                return(new ExactSupplier
                {
                    Name = supplier.Name,
                    Currency = supplier.Currency,
                    Email = supplier.Email,
                    Phone = supplier.Phone,
                    VATNumber = supplier.VATNumber,
                    ExactId = supplier.ID,
                    Website = supplier.Website,
                    Zipcode = supplier.Postcode,
                    ExactUser = new Guid(exactUserId),
                });
            }
            else
            {
                return(dbSupplier);
            }
        }
 public ExternalLoginModel(
     SignInManager <User> signInManager,
     UserManager <User> userManager,
     ILogger <ExternalLoginModel> logger,
     VERPSDBContext context)
 {
     _signInManager = signInManager;
     _userManager   = userManager;
     _logger        = logger;
     _context       = context;
 }
示例#5
0
 public ExactConfigurationVM GetExactConfig(VERPSDBContext context, int id)
 {
     return(context.ExactConfigurations
            .Where(x => x.Id == id)
            .Select(x => new ExactConfigurationVM
     {
         Id = x.Id,
         ItemGroupId = x.ItemGroupId,
         SupplierId = new Guid(x.SupplierId),
         PaymentConditionId = x.PaymentConditionId,
         UserId = x.BuyerId,
         ConfigType = x.ConfigType,
     })
            .FirstOrDefault());
 }
示例#6
0
 public UserVM GetUser(VERPSDBContext context, string userName)
 {
     return(context.Users
            .Where(x => x.UserName == userName)
            .Select(x => new UserVM
     {
         Id = x.Id,
         CompanyName = x.CompanyName,
         ConfigID = x.ExactConfiguration.Id,
         DivisionId = x.ExactConfiguration.DivsionId,
         CreatorId = x.UserID,
         UserName = x.UserName,
         ItemGroupId = x.ExactConfiguration.ItemGroupId.ToString(),
         SupplierId = x.ExactConfiguration.SupplierId.ToString(),
         Token = x.ExactToken.Token,
     })
            .FirstOrDefault());
 }
 public DashboardController(VERPSDBContext context)
 {
     _context     = context;
     _exactHelper = new ExactHelper();
     _dbHelper    = new DBHelper();
 }
 public OrderManagementController(VERPSDBContext context)
 {
     _context     = context;
     _dbHelper    = new DBHelper();
     _exactHelper = new ExactHelper();
 }
示例#9
0
        public ExactOrderVM GetExactOrderByIdToVM(VERPSDBContext context, int Id)
        {
            var order = context.ExactOrders
                        //.Include(nameof(ExactOrder.Lines) + "." + nameof(ExactOrderLine.Item))
                        //.Include(nameof(ExactOrder.DBUser))
                        .Where(x => x.Id == Id)
                        .Select(x => new
            {
                x.Id,
                x.Description,
                x.Created,
                x.Currency,
                x.Project,
                x.OrderNumber,
                x.YourRef,
                x.Document,
                x.OrderDate,
                x.PaymentCondition,
                UserGuid     = x.User,
                supplierName = x.Supplier.Name,
                x.CreatorId,
                Lines = x.Lines
                        .Select(y => new
                {
                    Id   = y.Id,
                    Item = new
                    {
                        y.Item.Id,
                        y.Item.ExactID,
                        y.Item.Name,
                        y.Item.Description,
                        y.Item.Code,
                        y.Item.IsComplete,
                        y.Item.MessageSeen,
                    },
                    Description   = y.Description,
                    Quantity      = y.Quantity,
                    Unit          = y.Unit,
                    NetPrice      = y.NetPrice,
                    ReceiptDate   = y.ReceiptDate,
                    VATCode       = y.VATCode,
                    VATPercentage = y.VATPercentage,
                    AmountDC      = y.AmountDC,
                    VATAmount     = y.VATAmount,
                    Project       = y.Project,
                })
                        .ToList(),
                x.IsStoredInExact,
                x.ItemsAreInExact,
                User = new
                {
                    Id    = x.DBUser.Id,
                    Email = x.DBUser.Email
                },
                x.TimeSend,
            })
                        .ToList();


            var result = order.Select(x => new ExactOrderVM
            {
                Id                 = x.Id,
                Description        = x.Description,
                Created            = x.Created,
                Currency           = x.Currency,
                Project            = x.Project,
                OrderNumber        = x.OrderNumber,
                YourRef            = x.YourRef,
                Document           = x.Document,
                OrderDate          = x.OrderDate,
                PaymentConditionId = x.PaymentCondition,
                CreatorId          = x.User.Id,
                SupplierName       = x.supplierName,
                Lines              = x.Lines
                                     .Select(y => new OrderLineVM
                {
                    Id   = y.Id,
                    Item = new ItemVM
                    {
                        Id          = y.Item.Id,
                        ExactId     = y.Item.ExactID,
                        Code        = y.Item.Code,
                        Description = y.Item.Description,
                        Name        = y.Item.Name,
                        MessageSeen = y.Item.MessageSeen,
                        IsComplete  = y.Item.IsComplete,
                    },
                    Description   = y.Description,
                    Quantity      = y.Quantity,
                    Unit          = y.Unit,
                    NetPrice      = y.NetPrice,
                    ReceiptDate   = y.ReceiptDate,
                    VATCode       = y.VATCode,
                    VATPercentage = y.VATPercentage,
                    AmountDC      = y.AmountDC,
                    VATAmount     = y.VATAmount,
                    Project       = y.Project,
                })
                                     .ToList(),
                IsStoredInExact = x.IsStoredInExact,
                ItemsAreInExact = x.ItemsAreInExact,
                DBUser          = new DBUserVM
                {
                    Id    = x.User.Id,
                    Email = x.User.Email,
                },
                TimeSend = x.TimeSend,
            })
                         .FirstOrDefault();

            return(result);
        }
示例#10
0
 public List <ExactSupplierConfig> GetExactSupplierConfigs(VERPSDBContext context, string userId)
 {
     return(context.ExactSupplierConfigurations
            .Where(x => x.User.Id == userId)
            .ToList());
 }
 public HomeController(IHtmlLocalizer <HomeController> loc, VERPSDBContext context)
 {
     _loc     = loc;
     _context = context;
 }
 public SupplierConfigController(VERPSDBContext context)
 {
     _context     = context;
     _exactHelper = new ExactHelper();
     _dbHelper    = new DBHelper();
 }