public async Task <IActionResult> Create([Bind("ID,make,model,gearGoal,gearMeso")] CharacterProgression characterProgression)
        {
            if (ModelState.IsValid)
            {
                _context.Add(characterProgression);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(characterProgression));
        }
Ejemplo n.º 2
0
        public async Task Add(HoaDon item)
        {
            item.MaHD = await GenerateCode();

            foreach (var linhkien in item.ChiTietHDs)
            {
                linhkien.LinhKien.SLTonKho = linhkien.LinhKien.SLTonKho - (int)linhkien.SoLuongBan;
            }
            _context.HoaDons.Add(item);
            await _context.SaveChangesAsync();
        }
Ejemplo n.º 3
0
        public static async Task SeedReportNotificationServices(GearContext context)
        {
            if (!await context.ServiceTimeCheckers.AnyAsync())
            {
                await context.ServiceTimeCheckers.AddRangeAsync(new List <ServiceTimeChecker>
                {
                    new ServiceTimeChecker
                    {
                        ServiceId = Guid.NewGuid(), ServiceName = "OverdueAdm", ExecutedLastTime = null
                    },
                    new ServiceTimeChecker
                    {
                        ServiceId = Guid.NewGuid(), ServiceName = "OverduePm", ExecutedLastTime = null
                    },
                    new ServiceTimeChecker
                    {
                        ServiceId = Guid.NewGuid(), ServiceName = "DailyLogsAdm", ExecutedLastTime = null
                    },
                    new ServiceTimeChecker
                    {
                        ServiceId = Guid.NewGuid(), ServiceName = "DailyLogsPm", ExecutedLastTime = null
                    },
                    new ServiceTimeChecker
                    {
                        ServiceId = Guid.NewGuid(), ServiceName = "YesterdayLogsAdm", ExecutedLastTime = null
                    },
                    new ServiceTimeChecker
                    {
                        ServiceId = Guid.NewGuid(), ServiceName = "YesterdayLogsPm", ExecutedLastTime = null
                    }
                });

                await context.SaveChangesAsync();
            }
        }
Ejemplo n.º 4
0
        public static async Task SeedUserDateFilters(GearContext context)
        {
            // The Due date currently is omitted intentionally.
            if (!await context.UserDateFilters.AnyAsync())
            {
                var employees = await context.ApplicationUsers.ToListAsync();

                var reports = await context.Reports.ToListAsync();

                var userDateFilters =
                    (from employe in employees
                     from report in reports
                     select new UserDateFilter <Guid>
                {
                    Id = Guid.NewGuid(),
                    UserId = employe.Id,
                    FilterType = FilterType.StartDate,
                    ReportId = report.Id,
                    Date = DateTime.Now.AddYears(-1)
                }).ToList();

                await context.UserDateFilters.AddRangeAsync(userDateFilters);

                await context.SaveChangesAsync();
            }
        }
Ejemplo n.º 5
0
        public static async Task SeedUserActivityStatusFilters(GearContext context)
        {
            if (!await context.UserActivityStatusFilters.AnyAsync())
            {
                var activityStatuses = new List <ActivityStatus>
                {
                    ActivityStatus.New,
                    ActivityStatus.InProgress,
                    ActivityStatus.Refused,
                    ActivityStatus.Developed,
                    ActivityStatus.Tested,
                    ActivityStatus.Completed
                };

                var employees = await context.ApplicationUsers.ToListAsync();

                var reports = await context.Reports.ToListAsync();

                var activityStatusFilters =
                    (from employee in employees
                     from report in reports
                     from activityStatus in activityStatuses
                     select new UserActivityStatusFilter <Guid>
                {
                    Id = Guid.NewGuid(), ReportId = report.Id, UserId = employee.Id, ActivityStatus = activityStatus
                })
                    .ToList();

                await context.UserActivityStatusFilters.AddRangeAsync(activityStatusFilters);

                await context.SaveChangesAsync();
            }
        }
Ejemplo n.º 6
0
        public static async Task SeedUserProjectStatusFilters(GearContext context)
        {
            if (!await context.UserProjectStatusFilters.AnyAsync())
            {
                var projectStatuses = new List <ProjectStatus>
                {
                    ProjectStatus.New,
                    ProjectStatus.InProgress,
                    ProjectStatus.OnHold,
                    ProjectStatus.Canceled,
                    ProjectStatus.Completed
                };

                var reports = await context.Reports.ToListAsync();

                var users = await context.ApplicationUsers.ToListAsync();

                var projectStatusFilters =
                    (from report in reports
                     from user in users
                     from projectStatus in projectStatuses
                     select new UserProjectStatusFilter <Guid>
                {
                    Id = Guid.NewGuid(), UserId = user.Id, ReportId = report.Id, ProjectStatus = projectStatus
                })
                    .ToList();

                await context.UserProjectStatusFilters.AddRangeAsync(projectStatusFilters);

                await context.SaveChangesAsync();
            }
        }
Ejemplo n.º 7
0
        public static async Task SeedReports(GearContext context)
        {
            if (!await context.Reports.AnyAsync())
            {
                await context.Reports.AddRangeAsync(new List <Report <Guid> >
                {
                    new Report <Guid> {
                        Id = Guid.NewGuid(), Name = "Employee logged time"
                    },
                    new Report <Guid> {
                        Id = Guid.NewGuid(), Name = "Employee logged time by period"
                    },
                    new Report <Guid> {
                        Id = Guid.NewGuid(), Name = "Project general"
                    },
                    new Report <Guid> {
                        Id = Guid.NewGuid(), Name = "Project group list"
                    },
                    new Report <Guid> {
                        Id = Guid.NewGuid(), Name = "Activity lists"
                    },
                    new Report <Guid> {
                        Id = Guid.NewGuid(), Name = "Sprint list"
                    },
                    new Report <Guid> {
                        Id = Guid.NewGuid(), Name = "Projects by filters"
                    },
                    new Report <Guid> {
                        Id = Guid.NewGuid(), Name = "Teams by filters"
                    },
                    new Report <Guid> {
                        Id = Guid.NewGuid(), Name = "Project groups by filters"
                    },
                    new Report <Guid> {
                        Id = Guid.NewGuid(), Name = "General filtered"
                    },
                    new Report <Guid> {
                        Id = Guid.NewGuid(), Name = "Overdue"
                    }
                });

                await context.SaveChangesAsync();
            }
        }
Ejemplo n.º 8
0
        public static async Task SeedAllowedFilters(GearContext context)
        {
            if (!await context.ReportFilters.AnyAsync())
            {
                var employees = await context.ApplicationUsers.ToListAsync();

                var reports = await context.Reports.ToListAsync();

                var filters = new List <FilterType>
                {
                    FilterType.Guid,
                    FilterType.StartDate,
                    FilterType.DueDate,
                    FilterType.ActivityStatus,
                    FilterType.ProjectStatus,
                    FilterType.ProjectGroupIds,
                    FilterType.ProjectIds,
                    FilterType.ActivityListIds,
                    FilterType.SprintIds,
                    FilterType.ActivityIds,
                    FilterType.ActivityTypeIds,
                    FilterType.EmployeeIds,
                };

                var reportFilters =
                    (from employee in employees
                     from report in reports
                     from filterType in filters.Distinct()
                     select new ReportFilter <Guid>
                {
                    Active = true,
                    ReportId = report.Id,
                    UserId = employee.Id,
                    FilterType = filterType
                })
                    .ToList();

                await context.ReportFilters.AddRangeAsync(reportFilters.Distinct());

                await context.SaveChangesAsync();
            }
        }
Ejemplo n.º 9
0
        public static async Task SeedUserReports(GearContext context)
        {
            if (!await context.UserReports.AnyAsync())
            {
                var employees = await context.ApplicationUsers.ToListAsync();

                var reports = await context.Reports.ToListAsync();

                var userReports =
                    (from employee in employees
                     from report in reports
                     select new UserReport <Guid> {
                    ReportId = report.Id, UserId = employee.Id
                }).ToList();

                await context.AddRangeAsync(userReports);

                await context.SaveChangesAsync();
            }
        }
Ejemplo n.º 10
0
        public static async Task SeedReportHeader(GearContext context)
        {
            if (!await context.ReportTableHeaders.AnyAsync())
            {
                var reports = await context.Reports.ToListAsync();

                var employees = await context.ApplicationUsers.ToListAsync();

                var tableHeaders = await context.TableHeaders.ToListAsync();

                var reportTableHeaders = (from report in reports
                                          from employee in employees
                                          from header in tableHeaders
                                          select new ReportTableHeader <Guid>
                {
                    UserId = employee.Id, ReportId = report.Id, TableHeaderId = header.Id, Active = true,
                }).ToList();

                await context.ReportTableHeaders.AddRangeAsync(reportTableHeaders);

                await context.SaveChangesAsync();
            }
        }
Ejemplo n.º 11
0
 public async Task Add(DonGia entity)
 {
     _context.DonGias.Add(entity);
     await _context.SaveChangesAsync();
 }
Ejemplo n.º 12
0
 public async Task Create(Catalog catalog)
 {
     _context.Catalogs.Add(catalog);
     await _context.SaveChangesAsync();
 }
Ejemplo n.º 13
0
 public async Task Add(GioHang item)
 {
     _context.GioHangs.Add(item);
     await _context.SaveChangesAsync();
 }
Ejemplo n.º 14
0
 public async Task Add(LinhKien item)
 {
     item.isDelete = 0;
     _context.LinhKiens.Add(item);
     await _context.SaveChangesAsync();
 }
Ejemplo n.º 15
0
 public async Task Create(Producer model)
 {
     _context.Producers.Add(model);
     await _context.SaveChangesAsync();
 }
Ejemplo n.º 16
0
        public static async Task SeedUserGuidFilters(GearContext context, UserManager <ApplicationUser> userManager)
        {
            if (!await context.UserGuidFilters.AnyAsync())
            {
                var projectGroupIds = await context.ProjectGroups.AnyAsync()
                    ? await context.ProjectGroups.Select(x => x.Id).ToListAsync()
                    : new List <Guid>();

                var projectIds = await context.Projects.AnyAsync()
                    ? await context.Projects.Select(x => x.Id).ToListAsync()
                    : new List <Guid>();

                var activityTypeIds = await context.ActivityTypes.AnyAsync()
                    ? await context.ActivityTypes.Select(x => x.Id).ToListAsync()
                    : new List <Guid>();

                var userIds = await context.ApplicationUsers
                              .Select(x => x.Id).ToListAsync();

                var owners = await userManager.GetUsersInRoleAsync("PM Owner");

                var admins = await userManager.GetUsersInRoleAsync("PM Admin");

                var employees = owners.Union(admins);

                var employeeIds = employees
                                  .Select(x => x.Id).ToList();

                var reportIds = await context.Reports.AnyAsync() ?
                                await context.Reports
                                .Where(x => x.Name == "Overdue" ||
                                       x.Name == "Projects by filters" ||
                                       x.Name == "teams by filters")
                                .Select(x => x.Id).ToListAsync()
                    : new List <Guid>();

                var guidFilters = new List <UserGuidFilter <Guid> >();
                foreach (var reportId in reportIds)
                {
                    foreach (var userId in employeeIds)
                    {
                        guidFilters.AddRange(projectGroupIds.Select(projectGroupId => new UserGuidFilter <Guid>
                        {
                            Id = Guid.NewGuid(), EntityId = projectGroupId, UserId = userId, ReportId = reportId, FilterType = FilterType.ProjectGroupIds
                        }));

                        guidFilters.AddRange(projectIds.Select(projectId => new UserGuidFilter <Guid>
                        {
                            Id = Guid.NewGuid(), EntityId = projectId, UserId = userId, ReportId = reportId, FilterType = FilterType.ProjectIds
                        }));

                        guidFilters.AddRange(activityTypeIds.Select(activityTypeId => new UserGuidFilter <Guid>
                        {
                            Id = Guid.NewGuid(), EntityId = activityTypeId, UserId = userId, ReportId = reportId, FilterType = FilterType.ActivityTypeIds
                        }));

                        guidFilters.AddRange(userIds.Select(employeeId => new UserGuidFilter <Guid>
                        {
                            Id = Guid.NewGuid(), EntityId = employeeId, UserId = userId, ReportId = reportId, FilterType = FilterType.EmployeeIds
                        }));
                    }
                }

                await context.UserGuidFilters.AddRangeAsync(guidFilters);

                await context.SaveChangesAsync();
            }
        }
Ejemplo n.º 17
0
        public static async Task SeedCatalog(GearContext context)
        {
            context.Database.EnsureCreated();



            if (!context.Catalogs.Any())
            {
                var catalogs = new List <Catalog>
                {
                    new Catalog {
                        Name = "Chuột", Description = "Các sản phẩm liên quan đến chuột: chuột chơi game, chuột văn phòng"
                    },
                    new Catalog {
                        Name = "Bàn Phím", Description = "Các sản phẩm bàn phím như bàn phím cơ, bàn phím văn phòng,..."
                    },
                    new Catalog {
                        Name = "Tai nghe", Description = "Nhiều thể loại tai nghe từ tai nghe gaming đến tai nghe chuyên về nghe nhạc"
                    },
                };
                await context.Catalogs.AddRangeAsync(catalogs);

                await context.SaveChangesAsync();
            }

            if (!context.Producers.Any())
            {
                var producers = new List <Producer>
                {
                    new Producer {
                        Name = "MSI", Description = "Một hãng nổi tiếng chuyên về các thể loại chuột, laptop gaming,..."
                    },
                    new Producer {
                        Name = "Logitech", Description = "Được biết là một hãng với các thiết bị gaming đạt chất lượng toàn cầu"
                    },
                    new Producer {
                        Name = "Sony", Description = "Hãng với nhiều thiết bị công nghệ đình đám của Nhật Bản"
                    },
                };
                await context.Producers.AddRangeAsync(producers);

                await context.SaveChangesAsync();
            }

            if (!context.Products.Any())
            {
                var products = new List <Product>
                {
                    new Product {
                        Name = "Product 1", Image = "aqua.jpg", SubImage = "aqua.jpg", Description = "<div>Hello</div>", Price = 4300000, Discount = 30, PriceDiscount = 299999, CatalogID = 1, ProducerID = 1, Stock = 20, Slug = "product-1"
                    },
                    new Product {
                        Name = "Product 2222222", Image = "aqua.jpg", SubImage = "aqua.jpg", Description = "abc", Price = 4800000, Discount = 30, PriceDiscount = 299999, CatalogID = 1, ProducerID = 1, Stock = 20, Slug = "product-2"
                    },
                    // new Product { Name = "Product 1", Image = "aqua.jpg", SubImage = "aqua.jpg", Description = "abc", Price = 4300000, Discount = 30, PriceDiscount = 1, CatalogID = 1,ProducerID = 1, Stock = 20, Slug = "product-1"},
                    // new Product { Name = "Product 1", Image = "aqua.jpg", SubImage = "aqua.jpg", Description = "abc", Price = 4300000, Discount = 30, PriceDiscount = 5, CatalogID = 1,ProducerID = 1, Stock = 20, Slug = "product-1"},
                    // new Product { Name = "Product 1", Image = "aqua.jpg", SubImage = "aqua.jpg", Description = "abc", Price = 4300000, Discount = 30, PriceDiscount = 299999, CatalogID = 1,ProducerID = 1, Stock = 20, Slug = "product-1"},
                    // new Product { Name = "Product 1", Image = "aqua.jpg", SubImage = "aqua.jpg", Description = "abc", Price = 4300000, Discount = 30, PriceDiscount = 1, CatalogID = 2,ProducerID = 1, Stock = 20, Slug = "product-1"},
                    // new Product { Name = "Product 1", Image = "aqua.jpg", SubImage = "aqua.jpg", Description = "abc", Price = 4300000, Discount = 30, PriceDiscount = 9, CatalogID = 1,ProducerID = 1, Stock = 20, Slug = "product-1"},
                    // new Product { Name = "Product 1", Image = "aqua.jpg", SubImage = "aqua.jpg", Description = "abc", Price = 4300000, Discount = 30, PriceDiscount = 299999, CatalogID = 2,ProducerID = 1, Stock = 20, Slug = "product-1"},
                    // new Product { Name = "Product 1", Image = "aqua.jpg", SubImage = "aqua.jpg", Description = "abc", Price = 4300000, Discount = 30, PriceDiscount = 299999, CatalogID = 1,ProducerID = 1, Stock = 20, Slug = "product-1"},
                    // new Product { Name = "Product 1", Image = "aqua.jpg", SubImage = "aqua.jpg", Description = "abc", Price = 4300000, Discount = 30, PriceDiscount = 3, CatalogID = 1,ProducerID = 1, Stock = 20, Slug = "product-1"},
                    // new Product { Name = "Product 1", Image = "aqua.jpg", SubImage = "aqua.jpg", Description = "abc", Price = 4300000, Discount = 30, PriceDiscount = 299999, CatalogID = 1,ProducerID = 1, Stock = 20, Slug = "product-1"},
                    // new Product { Name = "Product 1", Image = "aqua.jpg", SubImage = "aqua.jpg", Description = "abc", Price = 4300000, Discount = 30, PriceDiscount = 299999, CatalogID = 1,ProducerID = 1, Stock = 20, Slug = "product-1"},
                    // new Product { Name = "Product 1", Image = "aqua.jpg", SubImage = "aqua.jpg", Description = "abc", Price = 4300000, Discount = 30, PriceDiscount = 299999, CatalogID = 1,ProducerID = 1, Stock = 20, Slug = "product-1"},
                    // new Product { Name = "Product 1", Image = "aqua.jpg", SubImage = "aqua.jpg", Description = "abc", Price = 4300000, Discount = 30, PriceDiscount = 299999, CatalogID = 1,ProducerID = 1, Stock = 20, Slug = "product-1"},
                    // new Product { Name = "Product 1", Image = "aqua.jpg", SubImage = "aqua.jpg", Description = "abc", Price = 4300000, Discount = 30, PriceDiscount = 299999, CatalogID = 1,ProducerID = 1, Stock = 20, Slug = "product-1"},
                    // new Product { Name = "Product 1", Image = "aqua.jpg", SubImage = "aqua.jpg", Description = "abc", Price = 4300000, Discount = 30, PriceDiscount = 299999, CatalogID = 1,ProducerID = 1, Stock = 20, Slug = "product-1"},
                    // new Product { Name = "Product 1", Image = "aqua.jpg", SubImage = "aqua.jpg", Description = "abc", Price = 4300000, Discount = 30, PriceDiscount = 299999, CatalogID = 2,ProducerID = 1, Stock = 20, Slug = "product-1"},
                    // new Product { Name = "Product 1", Image = "aqua.jpg", SubImage = "aqua.jpg", Description = "abc", Price = 4300000, Discount = 30, PriceDiscount = 299999, CatalogID = 1,ProducerID = 1, Stock = 20, Slug = "product-1"},
                    // new Product { Name = "Product 1", Image = "aqua.jpg", SubImage = "aqua.jpg", Description = "abc", Price = 4300000, Discount = 30, PriceDiscount = 299999, CatalogID = 1,ProducerID = 1, Stock = 20, Slug = "product-1"},
                    // new Product { Name = "Product 1", Image = "aqua.jpg", SubImage = "aqua.jpg", Description = "abc", Price = 4300000, Discount = 30, PriceDiscount = 299999, CatalogID = 1,ProducerID = 1, Stock = 20, Slug = "product-1"},
                    // new Product { Name = "Product 1", Image = "aqua.jpg", SubImage = "aqua.jpg", Description = "abc", Price = 4300000, Discount = 30, PriceDiscount = 299999, CatalogID = 1,ProducerID = 1, Stock = 20, Slug = "product-1"},
                    // new Product { Name = "Product 1", Image = "aqua.jpg", SubImage = "aqua.jpg", Description = "abc", Price = 4300000, Discount = 30, PriceDiscount = 299999, CatalogID = 1,ProducerID = 1, Stock = 20, Slug = "product-1"},
                    // new Product { Name = "Product 1", Image = "aqua.jpg", SubImage = "aqua.jpg", Description = "abc", Price = 4300000, Discount = 30, PriceDiscount = 299999, CatalogID = 2,ProducerID = 1, Stock = 20, Slug = "product-1"},
                    // new Product { Name = "Product 1", Image = "aqua.jpg", SubImage = "aqua.jpg", Description = "abc", Price = 4300000, Discount = 30, PriceDiscount = 299999, CatalogID = 1,ProducerID = 1, Stock = 20, Slug = "product-1"},
                    // new Product { Name = "Product 1", Image = "aqua.jpg", SubImage = "aqua.jpg", Description = "abc", Price = 4300000, Discount = 30, PriceDiscount = 299999, CatalogID = 1,ProducerID = 1, Stock = 20, Slug = "product-1"},
                    // new Product { Name = "Product 1", Image = "aqua.jpg", SubImage = "aqua.jpg", Description = "abc", Price = 4300000, Discount = 30, PriceDiscount = 299999, CatalogID = 2,ProducerID = 1, Stock = 20, Slug = "product-1"},
                    // new Product { Name = "Product 1", Image = "aqua.jpg", SubImage = "aqua.jpg", Description = "abc", Price = 4300000, Discount = 30, PriceDiscount = 299999, CatalogID = 1,ProducerID = 1, Stock = 20, Slug = "product-1"},
                    // new Product { Name = "Product 1", Image = "aqua.jpg", SubImage = "aqua.jpg", Description = "abc", Price = 4300000, Discount = 30, PriceDiscount = 299999, CatalogID = 1,ProducerID = 1, Stock = 20, Slug = "product-1"},
                };
                await context.Products.AddRangeAsync(products);

                await context.SaveChangesAsync();
            }

            if (!context.CartItems.Any())
            {
                var cartItems = new List <CartItem>
                {
                    new CartItem {
                        UserId = "100", Product = context.Products.FirstOrDefault(), Quantity = 1
                    }
                };
                await context.CartItems.AddRangeAsync(cartItems);

                await context.SaveChangesAsync();
            }

            if (!context.Orders.Any())
            {
                var orders = new List <Order>
                {
                    new Order {
                        OrderId = "100", ShippingAddress = "aaa", ShippingPhone = "aaaa", ShippingReciver = "aaa", UserId = "f2de0d50-9fd5-45b3-aa4f-923b843f8b5d", CreateDT = DateTime.UtcNow.AddHours(7), TotalPrice = context.Products.FirstOrDefault().PriceDiscount, OrderStatus = "Đang giao"
                    },
                    new Order {
                        OrderId = "101", ShippingAddress = "aaa", ShippingPhone = "aaaa", ShippingReciver = "aaa", UserId = "f2de0d50-9fd5-45b3-aa4f-923b843f8b5d", CreateDT = DateTime.UtcNow.AddHours(15), TotalPrice = context.Products.FirstOrDefault().PriceDiscount, OrderStatus = "Đang giao"
                    },
                    new Order {
                        OrderId = "102", ShippingAddress = "aaa", ShippingPhone = "aaaa", ShippingReciver = "aaa", UserId = "f2de0d50-9fd5-45b3-aa4f-923b843f8b5d", CreateDT = DateTime.UtcNow.AddHours(10), TotalPrice = context.Products.FirstOrDefault().PriceDiscount, OrderStatus = "Đang giao"
                    },
                    new Order {
                        OrderId = "103", ShippingAddress = "aaa", ShippingPhone = "aaaa", ShippingReciver = "aaa", UserId = "f2de0d50-9fd5-45b3-aa4f-923b843f8b5d", CreateDT = DateTime.UtcNow.AddHours(18), TotalPrice = context.Products.FirstOrDefault().PriceDiscount, OrderStatus = "Đang giao"
                    },
                    new Order {
                        OrderId = "104", ShippingAddress = "aaa", ShippingPhone = "aaaa", ShippingReciver = "aaa", UserId = "f2de0d50-9fd5-45b3-aa4f-923b843f8b5d", CreateDT = DateTime.UtcNow.AddHours(15), TotalPrice = context.Products.FirstOrDefault().PriceDiscount, OrderStatus = "Đang giao"
                    },
                    new Order {
                        OrderId = "105", ShippingAddress = "aaa", ShippingPhone = "aaaa", ShippingReciver = "aaa", UserId = "f2de0d50-9fd5-45b3-aa4f-923b843f8b5d", CreateDT = DateTime.UtcNow.AddHours(15), TotalPrice = context.Products.FirstOrDefault().PriceDiscount, OrderStatus = "Đang giao"
                    },
                };
                await context.Orders.AddRangeAsync(orders);

                await context.SaveChangesAsync();
            }

            if (!context.OrderItems.Any())
            {
                var orderItems = new List <OrderItem>
                {
                    new OrderItem {
                        OrderId = 1, ProductId = 1, Quantity = 10
                    },
                    new OrderItem {
                        OrderId = 2, ProductId = 1, Quantity = 1
                    },
                    new OrderItem {
                        OrderId = 1, ProductId = 2, Quantity = 5
                    },
                };
                await context.OrderItems.AddRangeAsync(orderItems);

                await context.SaveChangesAsync();
            }
        }
Ejemplo n.º 18
0
        public static async Task SeedHeaders(GearContext context)
        {
            if (!await context.TableHeaders.AnyAsync())
            {
                var tableHeaders = new List <TableHeader <Guid> >();

                // Sprint List
                tableHeaders.AddRange(new List <TableHeader <Guid> >
                {
                    new TableHeader <Guid> {
                        Id = Guid.NewGuid(), Width = 10, Order = 1, Active = true, Deletable = false, Name = "#"
                    },
                    new TableHeader <Guid> {
                        Id = Guid.NewGuid(), Width = 15, Order = 2, Active = true, Deletable = true, Name = "ID"
                    },
                    new TableHeader <Guid> {
                        Id = Guid.NewGuid(), Width = 60, Order = 3, Active = true, Deletable = true, Name = "Activity name"
                    },
                    new TableHeader <Guid> {
                        Id = Guid.NewGuid(), Width = 60, Order = 4, Active = true, Deletable = true, Name = "Assignee"
                    },
                    new TableHeader <Guid> {
                        Id = Guid.NewGuid(), Width = 20, Order = 5, Active = true, Deletable = true, Name = "Status"
                    },
                    new TableHeader <Guid> {
                        Id = Guid.NewGuid(), Width = 20, Order = 6, Active = true, Deletable = false, Name = "Est. time (hours)"
                    },
                    new TableHeader <Guid> {
                        Id = Guid.NewGuid(), Width = 20, Order = 7, Active = true, Deletable = false, Name = "Log. time (hours)"
                    }
                });

                // Overdue Report
                tableHeaders.AddRange(new List <TableHeader <Guid> >
                {
                    new TableHeader <Guid> {
                        Id = Guid.NewGuid(), Width = 10, Order = 1, Active = true, Deletable = false, Name = "#"
                    },
                    new TableHeader <Guid> {
                        Id = Guid.NewGuid(), Width = 60, Order = 2, Active = true, Deletable = true, Name = "ProjectGroup"
                    },
                    new TableHeader <Guid> {
                        Id = Guid.NewGuid(), Width = 60, Order = 3, Active = true, Deletable = true, Name = "Project"
                    },
                    new TableHeader <Guid> {
                        Id = Guid.NewGuid(), Width = 60, Order = 4, Active = true, Deletable = true, Name = "Activity"
                    },
                    new TableHeader <Guid> {
                        Id = Guid.NewGuid(), Width = 60, Order = 5, Active = true, Deletable = true, Name = "Assignee"
                    },
                    new TableHeader <Guid> {
                        Id = Guid.NewGuid(), Width = 40, Order = 6, Active = true, Deletable = false, Name = "Deadline"
                    },
                    new TableHeader <Guid> {
                        Id = Guid.NewGuid(), Width = 30, Order = 7, Active = true, Deletable = false, Name = "Overdue (days)"
                    }
                });

                // General filtered
                tableHeaders.AddRange(new List <TableHeader <Guid> >
                {
                    new TableHeader <Guid> {
                        Id = Guid.NewGuid(), Width = 10, Order = 1, Active = true, Deletable = false, Name = "#"
                    },
                    new TableHeader <Guid> {
                        Id = Guid.NewGuid(), Width = 60, Order = 2, Active = true, Deletable = true, Name = "ProjectGroup"
                    },
                    new TableHeader <Guid> {
                        Id = Guid.NewGuid(), Width = 60, Order = 3, Active = true, Deletable = true, Name = "Project"
                    },
                    new TableHeader <Guid> {
                        Id = Guid.NewGuid(), Width = 60, Order = 4, Active = true, Deletable = true, Name = "Sprint"
                    },
                    new TableHeader <Guid> {
                        Id = Guid.NewGuid(), Width = 60, Order = 5, Active = true, Deletable = true, Name = "Activity"
                    },
                    new TableHeader <Guid> {
                        Id = Guid.NewGuid(), Width = 60, Order = 6, Active = true, Deletable = true, Name = "Assignee"
                    },
                    new TableHeader <Guid> {
                        Id = Guid.NewGuid(), Width = 20, Order = 7, Active = true, Deletable = false, Name = "Est. time (hours)"
                    },
                    new TableHeader <Guid> {
                        Id = Guid.NewGuid(), Width = 20, Order = 8, Active = true, Deletable = false, Name = "Log. time (hours)"
                    }
                });

                // Project group (History)
                tableHeaders.AddRange(new List <TableHeader <Guid> >
                {
                    new TableHeader <Guid> {
                        Id = Guid.NewGuid(), Width = 10, Order = 1, Active = true, Deletable = false, Name = "#"
                    },
                    new TableHeader <Guid> {
                        Id = Guid.NewGuid(), Width = 60, Order = 2, Active = true, Deletable = true, Name = "ProjectGroup"
                    },
                    new TableHeader <Guid> {
                        Id = Guid.NewGuid(), Width = 60, Order = 3, Active = true, Deletable = true, Name = "Project"
                    },
                    new TableHeader <Guid> {
                        Id = Guid.NewGuid(), Width = 60, Order = 4, Active = true, Deletable = true, Name = "Assignee"
                    },
                    new TableHeader <Guid> {
                        Id = Guid.NewGuid(), Width = 40, Order = 5, Active = true, Deletable = true, Name = "Period"
                    },
                    new TableHeader <Guid> {
                        Id = Guid.NewGuid(), Width = 40, Order = 6, Active = true, Deletable = true, Name = "Total Logged (hours)"
                    },
                });

                // Teams by filters
                tableHeaders.AddRange(new List <TableHeader <Guid> >
                {
                    new TableHeader <Guid> {
                        Id = Guid.NewGuid(), Width = 10, Order = 1, Active = true, Deletable = false, Name = "#"
                    },
                    new TableHeader <Guid> {
                        Id = Guid.NewGuid(), Width = 60, Order = 2, Active = true, Deletable = true, Name = "Assignee"
                    },
                    new TableHeader <Guid> {
                        Id = Guid.NewGuid(), Width = 60, Order = 3, Active = true, Deletable = true, Name = "Project"
                    },
                    new TableHeader <Guid> {
                        Id = Guid.NewGuid(), Width = 60, Order = 4, Active = true, Deletable = true, Name = "Activity"
                    },
                    new TableHeader <Guid> {
                        Id = Guid.NewGuid(), Width = 20, Order = 5, Active = true, Deletable = true, Name = "Activity status"
                    },
                    new TableHeader <Guid> {
                        Id = Guid.NewGuid(), Width = 20, Order = 7, Active = true, Deletable = false, Name = "Est. time (hours)"
                    },
                    new TableHeader <Guid> {
                        Id = Guid.NewGuid(), Width = 20, Order = 8, Active = true, Deletable = false, Name = "Log. time (hours)"
                    }
                });

                // Projects by filters
                tableHeaders.AddRange(new List <TableHeader <Guid> >
                {
                    new TableHeader <Guid> {
                        Id = Guid.NewGuid(), Width = 10, Order = 1, Active = true, Deletable = false, Name = "#"
                    },
                    new TableHeader <Guid> {
                        Id = Guid.NewGuid(), Width = 60, Order = 2, Active = true, Deletable = true, Name = "Project"
                    },
                    new TableHeader <Guid> {
                        Id = Guid.NewGuid(), Width = 60, Order = 3, Active = true, Deletable = true, Name = "Assignee"
                    },
                    new TableHeader <Guid> {
                        Id = Guid.NewGuid(), Width = 60, Order = 4, Active = true, Deletable = true, Name = "Activity name"
                    },
                    new TableHeader <Guid> {
                        Id = Guid.NewGuid(), Width = 20, Order = 5, Active = true, Deletable = true, Name = "Activity status"
                    },
                    new TableHeader <Guid> {
                        Id = Guid.NewGuid(), Width = 20, Order = 5, Active = true, Deletable = true, Name = "Activity type"
                    },
                    new TableHeader <Guid> {
                        Id = Guid.NewGuid(), Width = 20, Order = 7, Active = true, Deletable = false, Name = "Est. time (hours)"
                    },
                    new TableHeader <Guid> {
                        Id = Guid.NewGuid(), Width = 20, Order = 8, Active = true, Deletable = false, Name = "Log. time (hours)"
                    }
                });

                await context.TableHeaders.AddRangeAsync(tableHeaders);

                await context.SaveChangesAsync();
            }
        }
Ejemplo n.º 19
0
 public async Task Create(OrderItem model)
 {
     _context.OrderItems.Add(model);
     await _context.SaveChangesAsync();
 }
Ejemplo n.º 20
0
 public async Task Add(NhaCungCap item)
 {
     item.isDelete = 0;
     _context.NhaCungCaps.Add(item);
     await _context.SaveChangesAsync();
 }