protected void update_button_Click(object sender, EventArgs e) { if (editRating_textBox.Text != "" && editReview_textBox.Text != "") { if (Int32.Parse(editRating_textBox.Text) < 1 || Int32.Parse(editRating_textBox.Text) > 5) { notificationError_label.Text = "Please insert rating from 1-5!"; } else if (editReview_textBox.Text.Length > 255) { notificationError_label.Text = "Maximal length up to 255 characters!"; } else { ReviewId = Int32.Parse(Request.QueryString["review"]); ReviewHandler.Update(ReviewId, Int32.Parse(editRating_textBox.Text), editReview_textBox.Text); notificationSuccess_label.Text = "Update Review Success"; //Response.Redirect("ProductShowCaseDetail.aspx?productId=" + ProductId); Response.Redirect("Home.aspx"); } } else { notificationError_label.Text = "Please fill all the fields!"; } }
private void setPreview() { if (Request.QueryString["productId"] != null) { ProductId = Int32.Parse(Request.QueryString["productId"]); Product p = ProductHandler.GetById(ProductId); productName.Text = p.ProductName; productPrice.Text = p.ProductPrice.ToString(); productStock.Text = p.ProductStock.ToString(); image.ImageUrl = string.Format("~/{0}", p.ProductImage); DataTable reviews = ReviewHandler.GetAllByProductId(ProductId); review.DataSource = reviews; review.DataBind(); } }
// DELETE BY GETTING PARAMETER FROM URL private void deleteValue() { if (Request.QueryString["productId"] != null) { ProductId = Int32.Parse(Request.QueryString["productId"]); Product p = ProductHandler.GetById(ProductId); if (System.IO.File.Exists(Server.MapPath("~/") + p.ProductImage)) { System.IO.File.Delete(Server.MapPath("~/") + p.ProductImage); } ReviewHandler.Delete(ProductId); ProductHandler.Delete(ProductId); Response.Redirect("Home.aspx"); } else if (Request.QueryString["userId"] != null) { UserId = Int32.Parse(Request.QueryString["userId"]); User u = UserHandler.GetById(UserId); if (System.IO.File.Exists(Server.MapPath("~/") + u.UserProfilePicture)) { System.IO.File.Delete(Server.MapPath("~/") + u.UserProfilePicture); } UserHandler.Delete(UserId); Response.Redirect("Member.aspx"); } else if (Request.QueryString["review"] != null) { ReviewId = Int32.Parse(Request.QueryString["review"]); //Review r = ReviewHandler.GetById(ReviewId); ReviewHandler.Delete(ReviewId); //Response.Redirect("ProductShowCaseDetail.aspx?productId=" + ProductId); Response.Redirect("Home.aspx"); } }
protected void add_button_Click(object sender, EventArgs e) { if (inputRating_textBox.Text != "" && inputReview_textBox.Text != "") { if (Int32.Parse(inputRating_textBox.Text) < 1 || Int32.Parse(inputRating_textBox.Text) > 5) { notificationError_label.Text = "Please insert rating from 1-5!"; } else if (inputReview_textBox.Text.Length > 255) { notificationError_label.Text = "Maximal length up to 255 characters!"; } else { ReviewHandler.Insert(Int32.Parse(inputRating_textBox.Text), inputReview_textBox.Text, ProductId, u.UserId); notificationSuccess_label.Text = "Insert Review Success"; Response.Redirect("ProductShowCaseDetail.aspx?productId=" + ProductId); } } else { notificationError_label.Text = "Please fill all the fields!"; } }
public static List <Review> GetShowReviewByShowId(int showId) { return(ReviewHandler.GetShowReviewByShowId(showId)); }
public static Review GetReviewByToken(string token) { return(ReviewHandler.GetReviewByToken(token)); }
public static bool DeleteReview(int reviewId) { return(ReviewHandler.DeleteReview(reviewId)); }
public static bool UpdateReview(int reviewId, int rating, string description) { return(ReviewHandler.UpdateReview(reviewId, rating, description)); }
public static bool InsertNewReview(int trDetailId, int rating, string desciption) { return(ReviewHandler.InsertNewReview(trDetailId, rating, desciption)); }
public void ClientInterface(Client clientM) { bool clientConnected = true; //Add Some Sort of Return method later on Socket cSock = clientM.ClientSocket; while (clientConnected) { try { string token = Receive.ReceiveMessage(cSock); string request = Receive.ReceiveMessage(cSock); int lastResp = clientM.GetLastResponseSpan() - DateTime.Now.Minute; if (lastResp > 5) { //Renew Token } else { clientM.LastResponse = DateTime.Now; } if (token == clientM.TToken) { //Temporary Tokens are only able to Login Or Register switch (request) { default: //Send.SendMessage(clientSocket, "Invalid request socket killed") //string ipadd = cSock.LocalEndPoint.ToString(); break; case "Login": LoginAuthentication.LoginHandler(cSock, ref clientM); break; case "Register": RegisterAuthentication.RegistrationHandler(cSock); break; } } else if (token == clientM.SToken) { //Clients with a Session token can send any command. switch (request) { case "StoreMenuInfo": //Single Command Which Handles all Menu Related commands to prevent 20 different requests in the switch statement StoreMenuHandler.MenuHandler(cSock); break; case "StoreInfo": //Handles Store Info Transaction from Vendor StoreInfo.GetStoreInfo(cSock); break; case "UpdateStoreInfo": //Handles Settings For Vendor StoreInfo.UpdateStoreInfo(cSock); break; case "OrderHandling": // Handles all Order Requests from Customers & Vendors OrderHandler orderHand = new OrderHandler(); orderHand.HandleOrder(ref clientM); break; case "GetUserInfo": //Used to Set & Retreive user Information CustomerHandler.GetCustomerInfo(cSock); break; case "UpdateUserInfo": //Same as UpdateStoreInfo but is used for Customers. CustomerHandler.UpdateUserInfo(cSock); break; case "ReviewHandler": ReviewHandler revHandle = new ReviewHandler(); revHandle.HandleReviews(ref clientM); break; } } else { //Add Some sort of handling || just leave blank ServerLogger($"Invalid Token Received From Client {token}", cSock); } } catch (Exception) { //ServerLogger("Undiagnosed Error Uccored When Contacting Client Retrying...", cSock); } } }