Esempio n. 1
0
        // GET: Sections/Procurement
        public ActionResult Index()
        {
            int siteCoID = base.siteusercompanyid;

            if (TempData["SyncSuccessMessage"] != null)
            {
                ViewBag.SyncSuccessMessage = TempData["SyncSuccessMessage"];
                TempData.Remove("SyncSuccessMessage");
            }
            if (TempData["SyncErrorMessage"] != null)
            {
                ViewBag.SyncErrorMessage = TempData["SyncErrorMessage"];
                TempData.Remove("SyncErrorMessage");
            }
            ViewBag.VendorList    = db.GetVendorsByPors(siteusercompanyid).Where(s => s.Vendor != null && s.Vendor.Trim() != "").ToList();
            ViewBag.JobList       = db.GetProjectsByPors(siteusercompanyid).ToList();
            ViewBag.StatusList    = db.GetStatusByPors(siteusercompanyid).ToList();
            ViewBag.SelectPORList = db.GetPorNumberByPors(siteCoID).ToList();

            ProcurementResult result = new ProcurementResult();

            result.PurchaseList          = db.GetPurchasingBySiteCoID(siteCoID).ToList();
            result.CustodyList           = db.GetCustodyBySiteCoID(siteCoID).ToList();
            result.DeliveryList          = db.GetDeliveriesBySiteCoID(siteCoID).ToList();
            result.TransferList          = db.GetTransfersBySiteCoID(siteCoID).ToList();
            result.PendingList           = db.GetPendingBySiteCoID(siteCoID).ToList();
            result.InventoryList         = db.GetInventoryBySiteCoID(siteCoID).ToList();
            qbModels                     = new QBModels();
            qbModels.SyncObjectsModel    = new QBSyncdto();
            qbModels.OAuthorizationModel = new QBAuthorizationdto();
            qbModels.IsReadySync         = false;
            var oAuthModel = new QBOAuthService(qbModels.OAuthorizationModel).IsTokenAvailable(this, siteusercompanyid);

            if (oAuthModel.IsConnected)
            {
                ViewBag.IsQBConnected = true;
            }
            return(View(result));
        }