예제 #1
0
        public ActionResult SubmitServiceRequest(string DateDue, string VendorType, string Details)
        {
            ServiceRequest x = new ServiceRequest();

            List <int> y = new List <int>();

            y.Add(1);
            y.Add(2);


            using (var db = new AFEWellBookDB())
            {
                x.OperatorID   = 1;
                x.DateDue      = Convert.ToDateTime(DateDue);
                x.DatePosted   = DateTime.Now;
                x.StatusID     = (int)ServiceRequestModel.ServiceStatus.OPEN;
                x.VendorIDList = y;
                x.Details      = Details;

                db.Insert(x, "ServiceRequest", "AFEWellBook");
            }



            return(Json(x, JsonRequestBehavior.AllowGet));
        }
예제 #2
0
        public JsonResult GetSubCategories(int categoryID)
        {
            using (var db = new AFEWellBookDB())
            {
                var subCategories = 9;
                //get em where categoryID = categoryID

                return(Json(subCategories, JsonRequestBehavior.AllowGet));
            }
        }
예제 #3
0
        public ActionResult Validate(string Username, string Password)
        {
            using (var db = new AFEWellBookDB())
            {
                if (db.Users.Any(p => p.UserName == Username && p.UserPassword == Password))
                {
                    var x = 9;
                }
            }



            return(View());
        }
예제 #4
0
        public JsonResult GetCategories()
        {
            Dictionary <int, string> categories = new Dictionary <int, string>();

            using (var db = new AFEWellBookDB())
            {
                foreach (var x in db.Categories)
                {
                    categories.Add(x.CategoryID, x.NameX);
                }
            }


            return(Json(categories, JsonRequestBehavior.AllowGet));
        }
예제 #5
0
        public JsonResult GetServiceRequests(int vendorID)
        {
            List <ServiceRequest> serviceRequests = new List <ServiceRequest>();

            using (var db = new AFEWellBookDB())
            {
                var v = db.Vendors;

                var x = db.ServiceRequests.Where(s => s.VendorIDList.Contains(vendorID));

                foreach (var serveReq in x)
                {
                    serviceRequests.Add(serveReq);
                }
            }

            return(Json(serviceRequests, JsonRequestBehavior.AllowGet));
        }
예제 #6
0
        public ActionResult AcceptQuote(int serviceRequestID, int quoteID)
        {
            using (var db = new AFEWellBookDB())
            {
                db.ServiceRequests.Where(s => s.ServiceRequestID == serviceRequestID).FirstOrDefault().AcceptedVendorID = db.Quotes.Where(q => q.QuoteID == quoteID).FirstOrDefault().VendorID;


                db.ServiceRequests.Where(s => s.ServiceRequestID == serviceRequestID).FirstOrDefault().StatusID = 3;

                db.Quotes.Where(q => q.QuoteID == quoteID).FirstOrDefault().StatusID = 4;



                db.Update(db.ServiceRequests);
            }


            return(View());
        }
예제 #7
0
        public ActionResult Validate(string Username, string Password)
        {
            bool isValid = false;

            int UserID = 0;

            using (var db = new AFEWellBookDB())
            {
                if (db.Users.Any(p => p.UserName == Username && p.UserPassword == Password))
                {
                    isValid = true;

                    UserID = db.Users.Where(x => x.UserName == Username).Select(x => x.UserID).FirstOrDefault();
                }
            }



            return(Json(new { isValid = "isValid", UserID = "UserID" }, JsonRequestBehavior.AllowGet));
        }
예제 #8
0
        public JsonResult GetPendingServiceRequests()
        {
            List <ServiceRequest> serviceRequests = new List <ServiceRequest>();

            using (var db = new AFEWellBookDB())
            {
                var sreq =
                    from sr in db.ServiceRequests
                    join q in db.Quotes on sr.ServiceRequestID equals q.ServiceRequestID
                    where q.StatusID == 2 //&& sr.OperatorID == THIS OPERATOR
                    select sr;

                foreach (var s in sreq)
                {
                    serviceRequests.Add(s);
                }
            }


            return(Json(serviceRequests, JsonRequestBehavior.AllowGet));
        }
예제 #9
0
        public ActionResult PlaceQuote(int serviceRequestID, string quoteAmt)
        {
            Quote x = new Quote();


            using (var db = new AFEWellBookDB())
            {
                x.QuoteAmount      = Convert.ToDouble(quoteAmt);
                x.ServiceRequestID = serviceRequestID;
                x.StatusID         = 2;
                x.DateSubmitted    = DateTime.Now;

                //TODO: WRITE TO DOCUMENT TABLE
                //x.DocumentID

                //x.VendorID =   THIS VENDOR

                db.Insert(x, "ServiceRequest", "AFEWellBook");
            }



            return(View());
        }