コード例 #1
0
        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();
        }
コード例 #2
0
        public static Adjustment Create(int requestNumber, string requestDocumentNumber, string notes,
                                        Guid?cellarId, AdjustmentStatus adjustmentStatus, TypeAdjustment typeAdjustment, Guid creatorid, DateTime createDateTime, string personInCharge, string companyName)
        {
            var @adjustment = new Adjustment
            {
                Id                    = Guid.NewGuid(),
                RequestNumber         = requestNumber,
                RequestDocumentNumber = requestDocumentNumber,
                Notes                 = notes,
                CellarId              = cellarId,
                Status                = adjustmentStatus,
                TypeAdjustment        = typeAdjustment,
                CreationTime          = createDateTime,
                CreatorUserId         = creatorid,
                PersonInCharge        = personInCharge,
                IsDeleted             = false,
                CompanyName           = companyName
            };

            return(@adjustment);
        }