Ejemplo n.º 1
0
        public void UpdateState(int QRQuotationID)
        {
            QRQuotation _dbEntry = _context.QRQuotations.Find(QRQuotationID);

            _dbEntry.Enabled = false;
            _context.SaveChanges();
        }
Ejemplo n.º 2
0
        public PRQuotationGridViewModel(int PurchaseRequestID,
                                        IEnumerable <PRContent> PRContents,
                                        IEnumerable <QRSupplier> PRSuppliers,
                                        IEnumerable <QRQuotation> PRQuotations)
        {
            rows = new List <PRQuotationGridRowModel>();

            foreach (PRContent _content in PRContents)
            {
                string[] SupplierName = new string[PRSuppliers.Count()];
                int[]    SupplierID   = new int[PRSuppliers.Count()];
                string[] Quotations   = new string[PRQuotations.Count()];
                int[]    QuotationID  = new int[PRQuotations.Count()];
                int      i            = 0;
                foreach (QRSupplier _supplier in PRSuppliers)
                {
                    SupplierName[i] = _supplier.SupplierName;
                    SupplierID[i]   = _supplier.SupplierID;
                    QRQuotation _quotation = PRQuotations.Where(p => p.SupplierID == _supplier.SupplierID).Where(p => p.QRContentID == _content.PRContentID).FirstOrDefault();
                    if (_quotation == null)
                    {
                        Quotations[i] = "-";
                    }
                    else
                    {
                        Quotations[i] = _quotation.UnitPrice.ToString();
                    }
                    PRQuotationGridRowModel _rowModel = new PRQuotationGridRowModel(_content, Quotations);
                    i = i + 1;
                }
            }
        }
Ejemplo n.º 3
0
 public int Save(QRQuotation QRQuotation)
 {
     if (QRQuotation.QRQuotationID == 0)
     {
         _context.QRQuotations.Add(QRQuotation);
     }
     else
     {
         QRQuotation _dbEntry = _context.QRQuotations.Find(QRQuotation.QRQuotationID);
         if (_dbEntry != null)
         {
             _dbEntry.QRContentID        = QRQuotation.QRContentID;
             _dbEntry.SupplierID         = QRQuotation.SupplierID;
             _dbEntry.QuotationRequestID = QRQuotation.QuotationRequestID;
             _dbEntry.UnitPrice          = QRQuotation.UnitPrice;
             _dbEntry.TotalPrice         = QRQuotation.TotalPrice;
             _dbEntry.Quantity           = QRQuotation.Quantity;
             _dbEntry.QuotationDate      = QRQuotation.QuotationDate;
             _dbEntry.UnitPriceWT        = QRQuotation.UnitPriceWT;
             _dbEntry.TotalPriceWT       = QRQuotation.TotalPriceWT;
             _dbEntry.TaxRate            = QRQuotation.TaxRate;
             _dbEntry.Enabled            = true;
         }
     }
     _context.SaveChanges();
     return(QRQuotation.QRQuotationID);
 }
Ejemplo n.º 4
0
 public QRQuotationEditModel(QRContent QRContent, QRQuotation QRQuotation = null)
 {
     _qrContent = QRContent;
     if (QRQuotation != null)
     {
         _prQuotation = QRQuotation;
     }
     else
     {
         _prQuotation = new QRQuotation();
     }
 }