public static void SeedEntities(ADProjectDb context) { List <OrderStatus> orderStatuses = new List <OrderStatus>() { new OrderStatus("PENDING"), new OrderStatus("DELIVERED") }; context.OrderStatus.AddRange(orderStatuses); context.SaveChanges(); Order order = new Order(); order.OrderDate = DateTime.Today; order.OrderStatus = orderStatuses[0]; OrderDetail orderDetail = new OrderDetail(); orderDetail.OrderQuantity = 2; orderDetail.ExpDelDate = new DateTime(2020, 1, 4); orderDetail.ActDelDate = null; order.OrderDetails = new List <OrderDetail>() { orderDetail }; Supplier supplier = new Supplier(); supplier.SupplierName = "ABC Holdings"; order.Supplier = supplier; Employee employee = context.Employee.FirstOrDefault(); order.Employee = employee; context.Order.Add(order); context.OrderDetail.Add(orderDetail); context.Supplier.Add(supplier); Category category = new Category(); category.CategoryDescription = "pencil"; ItemCatalogue itemCatalogue = new ItemCatalogue(); itemCatalogue.ItemDes = "AA pencil"; itemCatalogue.Category = category; context.Categories.Add(category); context.ItemCatalogue.Add(itemCatalogue); context.SaveChanges(); }
public static void SeedEntities(ADProjectDb context) { Request request = context.Request.FirstOrDefault(); CollectionPoint collectionPoint = new CollectionPoint(); collectionPoint.Location = "CANTEEN"; collectionPoint.Employee = context.Employee.FirstOrDefault(); List <DisbursementStatus> disbursementStatuses = new List <DisbursementStatus>() { new DisbursementStatus("FULFILLED"), new DisbursementStatus("UNFULFILLED") }; Disbursement disbursement = new Disbursement(); disbursement.Request = context.Request.ToList(); //disbursement.Employee = context.Employee.FirstOrDefault(); disbursement.Department = context.Department.SingleOrDefault(dep => dep.DepartmentId == 1); DisbursementDetail disbursementDetail = new DisbursementDetail(); disbursementDetail.Disbursement = disbursement; disbursementDetail.DisbursementStatus = disbursementStatuses[0]; disbursementDetail.ItemCatalogue = context.ItemCatalogue.FirstOrDefault(); context.CollectionPoint.Add(collectionPoint); context.DisbursementStatus.AddRange(disbursementStatuses); context.Disbursement.Add(disbursement); context.DisbursementDetail.Add(disbursementDetail); context.SaveChanges(); }
public static void SeedEntities(ADProjectDb context) { List <Role> roles = new List <Role>() { new Role("DEPARTMENT_HEAD"), new Role("EMPLOYEE") }; Department department = new Department(); Employee employee = new Employee(); employee.Role = roles[0]; Employee departmentHead = new Employee(); departmentHead.Role = roles[1]; department.Employees = new List <Employee>(); department.Employees.Add(employee); department.Employees.Add(departmentHead); RequestStatus approvedStatus = new RequestStatus(); approvedStatus.RequestStatusDescription = "APPROVED"; Request request = new Request(); request.ApprByEmp = employee; request.Department = department; request.ApprByEmp = null; context.Employee.Add(employee); context.Department.Add(department); context.Role.AddRange(roles); context.RequestStatus.Add(approvedStatus); context.SaveChanges(); }
public static void SeedEntities(ADProjectDb context) { StockInfo stockInfo = new StockInfo(); stockInfo.ItemCatalogue = context.ItemCatalogue.FirstOrDefault(); AdjustmentStatus adjustmentStatus = new AdjustmentStatus(); adjustmentStatus.Description = "APPROVED"; AdjustmentDetail adjustmentDetail = new AdjustmentDetail(); adjustmentDetail.ItemCatalogue = context.ItemCatalogue.FirstOrDefault(); AdjustmentVoucher adjustmentVoucher = new AdjustmentVoucher(); adjustmentVoucher.AdjustmentStatus = adjustmentStatus; adjustmentVoucher.AdjustmentDetail = new List <AdjustmentDetail>() { adjustmentDetail }; context.StockInfo.Add(stockInfo); context.AdjustmentStatus.Add(adjustmentStatus); context.AdjustmentDetail.Add(adjustmentDetail); context.AdjustmentVoucher.Add(adjustmentVoucher); context.SaveChanges(); }