public void AddReview(ReviewInfo reviewInfo) { DataProvider.Instance().AddReview( reviewInfo.PortalID, reviewInfo.ProductID, reviewInfo.UserID, reviewInfo.UserName, reviewInfo.Rating, reviewInfo.Comments, reviewInfo.Authorized, reviewInfo.CreatedDate); }
protected void Page_Load(object sender, System.EventArgs e) { _nav = new AdminNavigation(Request.QueryString); try { // Get the Review ID ReviewInfo review = new ReviewInfo(); if (!Page.IsPostBack) { cmdDelete.Attributes.Add("onClick", "javascript:return confirm('" + Localization.GetString("DeleteItem") + "');"); if (!Null.IsNull(_nav.ReviewID)) { ReviewController controller = new ReviewController(); review = controller.GetReview(_nav.ReviewID); if (review != null) { cmdDelete.Visible = true; txtUserName.Text = review.UserName; cmbRating.SelectedValue = review.Rating.ToString(); txtComments.Text = review.Comments; chkAuthorized.Checked = review.Authorized; } } plhRating.Controls.Clear(); plhRating.Controls.Add(GetRatingImages(int.Parse(cmbRating.SelectedValue))); } // Which controls do we display? if (string.Compare(_nav.PageID, "ReviewAdmin", true) == 0) { txtUserName.Enabled = false; cmbRating.Enabled = false; labelAuthorized.Visible = true; chkAuthorized.Visible = true; } } catch(Exception ex) { Exceptions.ProcessModuleLoadException(this, ex); } }
private void cmdUpdate_Click(object sender, EventArgs e) { try { if (Page.IsValid == true) { PortalSecurity security = new PortalSecurity(); ReviewInfo review = new ReviewInfo(); review = ((ReviewInfo)CBO.InitializeObject(review, typeof(ReviewInfo))); review.ReviewID = _nav.ReviewID; review.PortalID = this.PortalId; review.ProductID = _nav.ProductID; //review.UserID = this.UserId; review.UserName = security.InputFilter(txtUserName.Text, PortalSecurity.FilterFlag.NoMarkup | PortalSecurity.FilterFlag.NoScripting | PortalSecurity.FilterFlag.NoSQL);; review.Rating = int.Parse(cmbRating.SelectedValue); review.Comments = security.InputFilter(txtComments.Text, PortalSecurity.FilterFlag.NoMarkup | PortalSecurity.FilterFlag.NoScripting | PortalSecurity.FilterFlag.NoSQL);; review.Authorized = chkAuthorized.Checked; review.CreatedDate = DateTime.Now; ReviewController controller = new ReviewController(); if (_nav.ReviewID == 0) { controller.AddReview(review); } else { controller.UpdateReview(review); } invokeEditComplete(); } } catch(Exception ex) { Exceptions.ProcessModuleLoadException(this, ex); } }
public void UpdateReview(ReviewInfo reviewInfo) { DataProvider.Instance().UpdateReview( reviewInfo.ReviewID, reviewInfo.UserName, reviewInfo.Rating, reviewInfo.Comments, reviewInfo.Authorized); }