public ActionResult bill(FormCollection form, int id)
        {
            tblBooking     book = dc.tblBookings.SingleOrDefault(ob => ob.BookingId == id);
            tblConsignment con  = dc.tblConsignments.SingleOrDefault(ob => ob.ConsignmentId == book.ConsignmentId);
            tblUser        user = dc.tblUsers.SingleOrDefault(ob => ob.UserId == con.UserId);
            tblBidding     bid  = dc.tblBiddings.SingleOrDefault(ob => ob.BidId == book.BidId);

            ViewBag.UserName = (from ob in dc.tblUsers where ob.UserId == con.UserId select ob).Take(1).SingleOrDefault().FirstName;
            ViewBag.Company  = (from ob in dc.tblTransportCompanies where ob.CompanyId == bid.CompanyId select ob).Take(1).SingleOrDefault().CompanyName;
            ViewBag.Weburl   = (from ob in dc.tblTransportCompanies where ob.CompanyId == bid.CompanyId select ob).Take(1).SingleOrDefault().WebURL;
            ViewBag.Contact  = (from ob in dc.tblTransportCompanies where ob.CompanyId == bid.CompanyId select ob).Take(1).SingleOrDefault().ContactPersonNo;
            var com = Convert.ToInt32(Session["CompanyId"]);
            tblTransportCompany company = dc.tblTransportCompanies.SingleOrDefault(ob => ob.CompanyId == com);
            //ViewBag.Bill = (from ob in dc.tblBookings where ob.BookingId == id select ob).Take(1).SingleOrDefault().TotalPayment;
            tblBill bill = new tblBill();

            bill.BookingId  = id;
            bill.UserId     = Convert.ToInt32(user.UserId);
            bill.Desc       = form["txtDesc"];
            bill.Price      = Convert.ToInt32(book.TotalPayment);
            bill.TollTax    = Convert.ToInt32(form["txtToll"]);
            bill.GST        = (Convert.ToInt32(book.TotalPayment) * 18) / 100;
            bill.TotalPrice = Convert.ToInt32(book.TotalPayment) + Convert.ToInt32(form["txtToll"]) + (Convert.ToInt32(book.TotalPayment) * 18) / 100;
            bill.CompanyId  = Convert.ToInt32(Session["CompanyId"]);
            bill.CreatedOn  = DateTime.Now;
            dc.tblBills.Add(bill);
            dc.SaveChanges();
            return(RedirectToAction("Index", "Home"));
        }
        public IHttpActionResult PuttblBidding(int id, tblBidding tblBidding)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != tblBidding.BiddingId)
            {
                return(BadRequest());
            }

            db.Entry(tblBidding).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!tblBiddingExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Esempio n. 3
0
        public ActionResult ViewBill(int id)
        {
            tblConsignment con = dc.tblConsignments.SingleOrDefault(ob => ob.ConsignmentId == id);

            ViewBag.UserName = (from ob in dc.tblUsers where ob.UserId == con.UserId select ob).Take(1).SingleOrDefault().FirstName;
            string Name = ViewBag.UserName;


            tblBooking book = dc.tblBookings.SingleOrDefault(ob => ob.ConsignmentId == con.ConsignmentId);
            tblBidding bid  = dc.tblBiddings.SingleOrDefault(ob => ob.BidId == book.BidId);

            ViewBag.Company    = (from ob in dc.tblTransportCompanies where ob.CompanyId == bid.CompanyId select ob).Take(1).SingleOrDefault().CompanyName;
            ViewBag.Weburl     = (from ob in dc.tblTransportCompanies where ob.CompanyId == bid.CompanyId select ob).Take(1).SingleOrDefault().WebURL;
            ViewBag.Contact    = (from ob in dc.tblTransportCompanies where ob.CompanyId == bid.CompanyId select ob).Take(1).SingleOrDefault().ContactPersonNo;
            ViewBag.Desc       = (from ob in dc.tblBills where ob.BookingId == book.BookingId select ob).Take(1).SingleOrDefault().Desc;
            ViewBag.Price      = (from ob in dc.tblBills where ob.BookingId == book.BookingId select ob).Take(1).SingleOrDefault().Price;
            ViewBag.Tolltax    = (from ob in dc.tblBills where ob.BookingId == book.BookingId select ob).Take(1).SingleOrDefault().TollTax;
            ViewBag.GST        = (from ob in dc.tblBills where ob.BookingId == book.BookingId select ob).Take(1).SingleOrDefault().GST;
            ViewBag.TotalPrice = (from ob in dc.tblBills where ob.BookingId == book.BookingId select ob).Take(1).SingleOrDefault().TotalPrice;
            string Company = ViewBag.Company;
            string weburl  = ViewBag.Weburl;
            string cno     = ViewBag.Contact;

            return(View(con));
        }
        public ActionResult EditBook(FormCollection form, int id)
        {
            tblBooking book = dc.tblBookings.SingleOrDefault(ob => ob.ConsignmentId == id);

            book.VehicleId     = Convert.ToInt32(form["ddVehicle"]);
            book.DriverId      = Convert.ToInt32(form["ddDriver"]);
            book.DispatchDate  = Convert.ToDateTime(form["txtDispatch"]);
            book.DeliveredDate = Convert.ToDateTime(form["txtDeliver"]);
            book.TotalPayment  = Convert.ToInt32(form["txtPayment"]);
            book.PaymentMode   = form["txtPaymentMode"];
            book.Remarks       = form["txtRemark"];
            Session["Price"]   = book.TotalPayment;
            dc.SaveChanges();

            tblBidding bidding = dc.tblBiddings.SingleOrDefault(ob => ob.BidId == book.BidId);

            bidding.IsAssigned = true;
            dc.SaveChanges();

            tblConsignment con = dc.tblConsignments.SingleOrDefault(ob => ob.ConsignmentId == id);

            con.IsProcessed = true;
            dc.SaveChanges();

            return(RedirectToAction("bill", "ClientCompany", new { id = book.BookingId }));
        }
        public ActionResult DeleteBid(int id1)
        {
            tblBidding bid = dc.tblBiddings.SingleOrDefault(ob => ob.BidId == id1);

            dc.tblBiddings.Remove(bid);
            dc.SaveChanges();
            return(RedirectToAction("ComBidding", "ClientCompany"));
        }
Esempio n. 6
0
        public ActionResult EditBid(int id)
        {
            TempData["id"] = id;
            tblBidding bid = dc.tblBiddings.SingleOrDefault(ob => ob.BidId == id);

            ViewBag.Budget  = (from ob in dc.tblConsignments where ob.ConsignmentId == bid.ConsignmentId select ob).Take(1).SingleOrDefault().Budget;
            ViewBag.MinTime = (from ob in dc.tblConsignments where ob.ConsignmentId == bid.ConsignmentId select ob).Take(1).SingleOrDefault().MinTime;
            ViewBag.MaxTime = (from ob in dc.tblConsignments where ob.ConsignmentId == bid.ConsignmentId select ob).Take(1).SingleOrDefault().MaxTime;
            return(View(bid));
        }
        public IHttpActionResult GettblBidding(int id)
        {
            tblBidding tblBidding = db.tblBiddings.Find(id);

            if (tblBidding == null)
            {
                return(NotFound());
            }

            return(Ok(tblBidding));
        }
        public IHttpActionResult Post([FromUri] int id, int bidderID, int latestbid)
        {
            tblBidding tblBidding = db.tblBiddings.Find(id);

            tblBidding.BidderId         = bidderID;
            tblBidding.PreviousBidPrice = tblBidding.CurrentBidPrice;
            tblBidding.CurrentBidPrice  = latestbid;
            db.Entry(tblBidding).State  = EntityState.Modified;
            db.SaveChanges();
            return(Ok("OK"));
        }
        public IHttpActionResult PosttblBidding(tblBidding tblBidding)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.tblBiddings.Add(tblBidding);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = tblBidding.BiddingId }, tblBidding));
        }
        public IHttpActionResult DeletetblBidding(int id)
        {
            tblBidding tblBidding = db.tblBiddings.Find(id);

            if (tblBidding == null)
            {
                return(NotFound());
            }

            db.tblBiddings.Remove(tblBidding);
            db.SaveChanges();

            return(Ok(tblBidding));
        }
Esempio n. 11
0
        public ActionResult EditBid(FormCollection form)
        {
            int        id     = Convert.ToInt32(TempData["id"]);
            tblBidding bid    = dc.tblBiddings.SingleOrDefault(ob => ob.BidId == id);
            int        LastID = Convert.ToInt32(Session["LastID"]);

            bid.CompanyId         = Convert.ToInt32(Session["CompanyId"]);
            bid.BidAmount         = Convert.ToInt32(form["txtBidAmount"]);
            bid.EstimatedDelivery = form["txtBidTime"];
            bid.IsModified        = true;
            bid.ModifiedOn        = DateTime.Now;
            dc.SaveChanges();
            return(RedirectToAction("ComList", "ClientConsignment", new { id = bid.ConsignmentId }));
        }
Esempio n. 12
0
        public IHttpActionResult PostBidNow(string id, bidDetails b)
        {
            tblBidding bid = new tblBidding();

            bid.BiddersId   = b.userID;
            bid.AuctionId   = id;
            bid.BidPrice    = b.amount;
            bid.Status      = 0;
            bid.DateCreated = DateTime.Now;

            db.Entry(bid).State = System.Data.Entity.EntityState.Added;
            db.SaveChanges();

            return(Ok());
        }
        public IHttpActionResult Post([FromUri] int Id, int adminId, int initprice)
        {
            tblCropRequest tblCropRequest = db.tblCropRequests.Find(Id);

            tblCropRequest.CropApproved    = true;
            tblCropRequest.ApprovalAdminId = adminId;
            db.Entry(tblCropRequest).State = EntityState.Modified;
            db.SaveChanges();
            tblBidding tblBidding = new tblBidding();

            tblBidding.RequestId        = tblCropRequest.RequestId;
            tblBidding.InitialPrice     = initprice;
            tblBidding.CurrentBidPrice  = initprice;
            tblBidding.PreviousBidPrice = initprice;
            DateTime dateTime = DateTime.Now;

            tblBidding.BidCloseTime = dateTime.AddMinutes(720);
            db.tblBiddings.Add(tblBidding);
            db.SaveChanges();
            return(Ok("OK"));
        }
        public IHttpActionResult ApproveAuctionAdmin([FromUri] int id, int adminid)
        {
            tblBidding tblBidding = db.tblBiddings.Find(id);

            tblBidding.ApprovalAdminId = adminid;
            tblCropRequest tblCropRequest = db.tblCropRequests.Find(tblBidding.RequestId);
            tblFarmer      tblFarmer      = db.tblFarmers.Find(tblCropRequest.FarmerId);
            tblSale        tblSale        = new tblSale();

            tblSale.FarmerId           = tblFarmer.FarmerId;
            tblSale.BidderId           = tblBidding.BidderId;
            tblSale.Quantity           = (int?)tblCropRequest.Quantity;
            tblSale.CropName           = tblCropRequest.CropName;
            tblSale.MinSalePrice       = tblBidding.InitialPrice;
            tblSale.TotalPrice         = tblBidding.CurrentBidPrice;
            tblSale.SaleDate           = DateTime.Now.Date;
            tblSale.ApprovalAdminId    = adminid;
            db.Entry(tblBidding).State = EntityState.Modified;

            db.tblSales.Add(tblSale);
            db.SaveChanges();
            return(Ok("OK"));
        }
Esempio n. 15
0
 public ActionResult ComConsignment(FormCollection form, int conID)
 {
     if (Session["CompanyId"] != null)
     {
         int        LastID = Convert.ToInt32(Session["LastID"]);
         tblBidding bid    = new tblBidding();
         bid.CompanyId         = Convert.ToInt32(Session["CompanyId"]);
         bid.ConsignmentId     = conID;
         bid.BidAmount         = Convert.ToInt32(form["txtBidAmount"]);
         bid.BidOn             = DateTime.Now;
         bid.EstimatedDelivery = form["txtBidTime"];
         bid.IsModified        = false;
         //bid.ModifiedOn = DateTime.Now;
         bid.IsAssigned = true;
         dc.tblBiddings.Add(bid);
         dc.SaveChanges();
         return(RedirectToAction("ComList", "ClientConsignment", new { id = bid.ConsignmentId }));
     }
     else
     {
         return(View());
     }
 }