예제 #1
0
        public void CreateNewBid(BidModel bid)
        {
            DbConnection.Open();
            MySqlCommand command = DbConnection.CreateCommand();

            command.CommandText = "INSERT INTO bid (owner,noticeid,pdfdoc) values(@owner,@noticeid,@pdfdoc)";
            command.Parameters.AddWithValue("@owner", bid.Owner);
            command.Parameters.AddWithValue("@noticeid", bid.NoticeId);
            command.Parameters.AddWithValue("@pdfdoc", bid.PdfDoc);
            command.ExecuteNonQuery();
            DbConnection.Close();
        }
예제 #2
0
        public ActionResult AddBid()
        {
            //  create a new bid
            if (Request.HttpMethod.Equals("POST"))
            {
                   BidModel bid = new BidModel();
                   bid.Owner = (String)Session["username"];
                   bid.NoticeId = int.Parse(Request.Form["noticeid"]);
                   HttpPostedFileBase file = Request.Files["PDF"];

                if (file != null && file.ContentLength > 0)     //  upload PDF document
                {
                    System.IO.Stream fileStream = file.InputStream;
                    byte[] data = new byte[file.ContentLength];
                    fileStream.Read(data, 0, data.Length);
                    fileStream.Close();
                    bid.PdfDoc = data;
                }

                DBContext.GetInstance().CreateNewBid(bid);
                return RedirectToAction("BidDashboard", "Bidder");
            }
            return RedirectToAction("BidDashboard", "Bidder");   //  return to dashboard after creating it.
        }
예제 #3
0
 public void CreateNewBid(BidModel bid)
 {
     DbConnection.Open();
     MySqlCommand command = DbConnection.CreateCommand();
     command.CommandText = "INSERT INTO bid (owner,noticeid,pdfdoc) values(@owner,@noticeid,@pdfdoc)";
     command.Parameters.AddWithValue("@owner", bid.Owner);
     command.Parameters.AddWithValue("@noticeid", bid.NoticeId);
     command.Parameters.AddWithValue("@pdfdoc", bid.PdfDoc);
     command.ExecuteNonQuery();
     DbConnection.Close();
 }