public int Save(QRContent QRContent) { if (QRContent.QRContentID == 0) { QRContent.SupplierID = -1; _context.QRContents.Add(QRContent); } else { QRContent _dbEntry = _context.QRContents.Find(QRContent.QRContentID); if (_dbEntry != null) { _dbEntry.PRContentID = QRContent.PRContentID; _dbEntry.PartID = QRContent.PartID; _dbEntry.PartName = QRContent.PartName; _dbEntry.PartNumber = QRContent.PartNumber; _dbEntry.PartSpecification = QRContent.PartSpecification; _dbEntry.Quantity = QRContent.Quantity; _dbEntry.PurchaseRequestID = QRContent.PurchaseRequestID; _dbEntry.QuotationRequestID = QRContent.QuotationRequestID; _dbEntry.MaterialName = QRContent.MaterialName; _dbEntry.Hardness = QRContent.Hardness; _dbEntry.BrandName = QRContent.BrandName; _dbEntry.PurchaseDrawing = QRContent.PurchaseDrawing; _dbEntry.Memo = QRContent.Memo; _dbEntry.Enabled = QRContent.Enabled; _dbEntry.SupplierID = QRContent.SupplierID; _dbEntry.QRcMemo = QRContent.QRcMemo; _dbEntry.RequireDate = QRContent.RequireDate; } } _context.SaveChanges(); return(QRContent.QRContentID); }
public void Delete(int QRContentID) { QRContent _dbEntry = GetByID(QRContentID); if (_dbEntry != null) { _dbEntry.Enabled = false; } _context.SaveChanges(); }
public QRQuotationEditModel(QRContent QRContent, QRQuotation QRQuotation = null) { _qrContent = QRContent; if (QRQuotation != null) { _prQuotation = QRQuotation; } else { _prQuotation = new QRQuotation(); } }
public QRContentGridRowModel(QRContent QRContent) { cell = new string[13]; cell[0] = QRContent.QRContentID.ToString(); cell[1] = QRContent.PartName; cell[2] = QRContent.PartNumber; cell[3] = QRContent.PartSpecification; cell[4] = QRContent.MaterialName; cell[5] = QRContent.Hardness; cell[6] = QRContent.Quantity.ToString(); cell[7] = QRContent.unit ?? "件"; cell[8] = QRContent.PurchaseDrawing.ToString(); cell[9] = QRContent.PRContentID.ToString(); cell[10] = QRContent.PurchaseItemID.ToString(); cell[11] = QRContent.Memo; cell[12] = QRContent.QRcMemo; //cell[13] = QRContent.RequireDate == new DateTime(1900, 1, 1) ? "-" : QRContent.RequireDate.ToString("yyyy-MM-dd"); }