Example #1
0
 /// <summary>
 /// Create a new PurchaseRequest object.
 /// </summary>
 /// <param name="id">Initial value of the Id property.</param>
 /// <param name="pRNo">Initial value of the PRNo property.</param>
 /// <param name="requestedBy">Initial value of the RequestedBy property.</param>
 /// <param name="isPoReady">Initial value of the IsPoReady property.</param>
 /// <param name="isQuoted">Initial value of the IsQuoted property.</param>
 /// <param name="isFinished">Initial value of the IsFinished property.</param>
 /// <param name="isCanvased">Initial value of the IsCanvased property.</param>
 /// <param name="isEditable">Initial value of the IsEditable property.</param>
 /// <param name="dateRequired">Initial value of the DateRequired property.</param>
 public static PurchaseRequest CreatePurchaseRequest(global::System.Guid id, global::System.Int32 pRNo, global::System.Guid requestedBy, global::System.Boolean isPoReady, global::System.Boolean isQuoted, global::System.Boolean isFinished, global::System.Boolean isCanvased, global::System.Boolean isEditable, global::System.DateTime dateRequired)
 {
     PurchaseRequest purchaseRequest = new PurchaseRequest();
     purchaseRequest.Id = id;
     purchaseRequest.PRNo = pRNo;
     purchaseRequest.RequestedBy = requestedBy;
     purchaseRequest.IsPoReady = isPoReady;
     purchaseRequest.IsQuoted = isQuoted;
     purchaseRequest.IsFinished = isFinished;
     purchaseRequest.IsCanvased = isCanvased;
     purchaseRequest.IsEditable = isEditable;
     purchaseRequest.DateRequired = dateRequired;
     return purchaseRequest;
 }
Example #2
0
 /// <summary>
 /// Deprecated Method for adding a new object to the PurchaseRequests EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToPurchaseRequests(PurchaseRequest purchaseRequest)
 {
     base.AddObject("PurchaseRequests", purchaseRequest);
 }
        private void SaveRfqToDb()
        {
            //------------------Database Operation-------------------------
            foreach (var vendor in selectedVendors) {
                selectedVendor = vendor;
                // Create RFQ
                Guid rfqId = Guid.NewGuid();
                var rfq = db.RFQs.CreateObject();
                rfq.Id = rfqId;
                rfq.IssuedBy = CurrentUser.Id;
                rfq.DateRequired = DateRequired;
                rfq.date_created = DateTime.Now;
                rfq.VendorId = vendor.Id;

                bool IsPrDataTaken = false;
                Guid RequestId = Guid.Empty;
                //Add Items
                foreach (var item in items) {
                    //Add to quotation item list
                    var mRfqItems = db.mRfqs_mItemsRequests.CreateObject();
                    mRfqItems.RfqId = rfqId;
                    mRfqItems.mItemsRequestId = item.ext_id;

                    //Mark itemrequest as quoted
                    IQueryable<mItemsRequest> allItemRequest = db.mItemsRequests;
                    var itemRequest = allItemRequest.Where(x => x.Id == item.ext_id).SingleOrDefault();
                    itemRequest.IsQuoteSent = true;

                    //Get Purchase Request Data for printing
                    if (!IsPrDataTaken) {
                        CurrentRequest = itemRequest.PurchaseRequest;
                        CurrentRequest.Status = "Pending Quotation";
                        RequestId = CurrentRequest.Id;
                        IsPrDataTaken = true;
                    }
                    //Add object
                    mRfqItems.RequestId = RequestId;
                    db.mRfqs_mItemsRequests.AddObject(mRfqItems);
                }
                // Add object
                rfq.RequestId = RequestId;
                db.RFQs.AddObject(rfq);
                //Save To Database
                db.SaveChanges();

                RfqNo = db.RFQs.Where(x => x.Id == rfqId).SingleOrDefault().RfqNumber;
                DeployAndRenderRfq();
            }
        }