protected void Page_Load(object sender, EventArgs e) { if (!checkCookie()) Response.Redirect("Login.aspx"); DataSet ds = new DataSet(); String orderId=Request.QueryString["orderId"].ToString(); EncryptDecrypt obj=new EncryptDecrypt(); orderId=obj.Decrypt(HttpUtility.UrlDecode(orderId)); DatabaseHandler obj1 = new DatabaseHandler(); ds = obj1.GetSellerPendingOrderInfo(orderId); Label1.Text = ds.Tables[0].Rows[0]["CAR_BRAND"].ToString(); Label2.Text = ds.Tables[0].Rows[0]["CAR_MODEL_NAME"].ToString(); Label3.Text = ds.Tables[0].Rows[0]["CAR_MODEL_NUMBER"].ToString(); Label4.Text = ds.Tables[0].Rows[0]["CAR_PRICE"].ToString(); Label5.Text = ds.Tables[0].Rows[0]["CAR_STOCK_QUANTITY"].ToString(); Label6.Text = ds.Tables[0].Rows[0]["CAR_POSSESSION_TYPE"].ToString(); Label7.Text = ds.Tables[0].Rows[0]["CUSTOMER_FIRST_NAME"].ToString() + " " + ds.Tables[0].Rows[0]["CUSTOMER_LAST_NAME"].ToString(); Label8.Text = ds.Tables[0].Rows[0]["CUSTOMER_PHONE_NUMBER"].ToString(); Label9.Text = ds.Tables[0].Rows[0]["CUSTOMER_ADDRESS"].ToString(); Label10.Text = ds.Tables[0].Rows[0]["PAYMENT_MODE"].ToString(); Label11.Text = ds.Tables[0].Rows[0]["ORDER_DATE"].ToString(); if (Label5.Text == "0") { Label13.Visible = true; Button1.Enabled = false; Label13.Text = "This car is out of stock"; } }
protected void Button1_Click(object sender, EventArgs e) { if (!checkCookie()) Response.Redirect("Login.aspx"); String orderId = Request.QueryString["orderId"].ToString(); EncryptDecrypt obj = new EncryptDecrypt(); orderId = obj.Decrypt(HttpUtility.UrlDecode(orderId)); DatabaseHandler obj1 = new DatabaseHandler(); String sellerUsername = Request.Cookies["Car-Trading"]["Username"].ToString(); DataSet ds = obj1.GetSellerId(sellerUsername); String sellerId = ds.Tables[0].Rows[0]["SELLER_ID"].ToString(); ds = obj1.GetSellerPendingOrderInfo(orderId); String customerId = ds.Tables[0].Rows[0]["CUSTOMER_ID"].ToString(); String carId = ds.Tables[0].Rows[0]["CAR_ID"].ToString(); String oldStock = Label5.Text; int oldStock1 = Convert.ToInt32(oldStock); int newStock = oldStock1-1; String newStock1 = newStock.ToString(); obj1.DecrementCarStock(carId, newStock1); String paymentMode = Label10.Text; String customerAddr = Label9.Text; String orderDate = Label11.Text; obj1.InsertCompletedOrder(orderId, customerId, carId, sellerId, paymentMode, customerAddr, orderDate); Label13.Visible = true; Label13.Text = "Order Completed"; Button1.Enabled = false; }