public bool pushFeedBack(FeedBackDTO fb) { try { if (conn.State != ConnectionState.Open) { conn.Open(); } using (SqlCommand cmd = new SqlCommand(pushFeedBackCommand, conn)) { cmd.Parameters.Add("@Email", SqlDbType.NVarChar).Value = fb.email; cmd.Parameters.Add("@FullName", SqlDbType.NVarChar).Value = fb.fullName; cmd.Parameters.Add("@PhoneNumber", SqlDbType.VarChar).Value = fb.phoneNumber; cmd.Parameters.Add("@Content", SqlDbType.NText).Value = fb.content; cmd.ExecuteNonQuery(); return(true); } } catch (Exception) { conn.Close(); } return(false); }
public PagingWrapper <List <FeedBackDTO> > GetAllFeedback(int page, int size, string searchParam) { PagingWrapper <List <FeedBackDTO> > pagingModel = new PagingWrapper <List <FeedBackDTO> >(); List <FeedBackDTO> modelList = new List <FeedBackDTO>(); var allPost = _postRepo.GetAll().ToList(); allPost.ForEach(p => { p.comments = this._commentRepo.GetAll().Where(c => c.PostId == p.Id).ToList(); FeedBackDTO parentModel = new FeedBackDTO(); parentModel.Id = p.Id; parentModel.Content = p.Title; parentModel.Author = p.Author; parentModel.CreationDate = p.CreationTime; parentModel.TotalComments = p.comments.Count; parentModel.isParent = true; modelList.Add(parentModel); p.comments.ToList().ForEach(cm => { FeedBackDTO childModel = new FeedBackDTO(); childModel.Id = cm.Id; childModel.Content = cm.Content; childModel.Author = this._userRepo.Get(cm.UserId).UserName.ToString(); childModel.CreationDate = cm.CreationTime; childModel.TotalDislikes = this._voteRepo.GetAll().Where(v => v.CommentId == cm.Id && v.IsLiked == false).Count(); childModel.TotalLikes = this._voteRepo.GetAll().Where(v => v.CommentId == cm.Id && v.IsLiked == true).Count(); childModel.isParent = false; modelList.Add(childModel); }); }); // for searching if (searchParam != null && searchParam != "") { modelList = modelList.Where(ap => ap.Content.ToLower().Contains(searchParam.ToLower()) == true).ToList(); } var query = modelList; var entries = query.Skip((page - 1) * size).Take(size).ToList(); var count = query.Count(); var totalPages = (int)Math.Ceiling(count / (float)size); var firstPage = 1; // obviously var lastPage = totalPages; var prevPage = page > firstPage ? page - 1 : firstPage; var nextPage = page < lastPage ? page + 1 : lastPage; pagingModel.totalPages = totalPages; pagingModel.firstPage = firstPage; pagingModel.lastPage = lastPage; pagingModel.prevPage = prevPage; pagingModel.nextPage = nextPage; pagingModel.currentPage = page; pagingModel.totalRows = modelList.Count(); pagingModel.Data = entries; return(pagingModel); }
// GET: FeedBack public ActionResult FeedBackCreate(int?topic) { FeedBackDTO feedBackDTO = new FeedBackDTO(); feedBackDTO.topic = TopicList(); return(View(feedBackDTO)); }
public async Task FeebBack(FeedBackDTO feedBackDTO) { var uri = "https://localhost:5001/api/BookingFlight"; var transferContent = new StringContent(JsonConvert.SerializeObject(feedBackDTO), System.Text.Encoding.UTF8, "application/Json"); var response = await _apiClient.PostAsync(uri, transferContent); response.EnsureSuccessStatusCode(); }
public bool feedBack(FeedBackDTO fb) { if (objFeedBack.pushFeedBack(fb) == false) { MessageBox.Show("FeedBack failed"); return(false); } else { return(true); } }
public bool removeFeedBack(FeedBackDTO fb) { DialogResult result = MessageBox.Show("Are you sure want to delete this FeedBack?", "Delete", MessageBoxButtons.YesNo, MessageBoxIcon.None, MessageBoxDefaultButton.Button2); if (result == DialogResult.Yes) { return(objFeedBack.deleteFeedBack(fb)); } else { return(false); } }
public JsonResult Send(FeedBackDTO feedbackDTO) { var feedback = new FeedBack { Name = feedbackDTO.Name, Email = feedbackDTO.Email, Phone = feedbackDTO.Phone, Content = HttpUtility.HtmlEncode(feedbackDTO.Content), Address = feedbackDTO.Address }; var result = FeedBackBLL.InsertFeedback(feedback); return(result > 0 ? Json(new { status = true }, JsonRequestBehavior.AllowGet) : Json(new { status = false }, JsonRequestBehavior.AllowGet)); }
public async Task <IActionResult> FeedBack(FeedBackView model) { FeedBackDTO feedBackDTO = new FeedBackDTO(); { feedBackDTO.FirstName = model.FirstName; feedBackDTO.LastName = model.LastName; feedBackDTO.Email = model.Email; feedBackDTO.Description = model.Description; }; await _feedBackService.FeebBack(feedBackDTO); return(View("Index")); }
private void viewButton_Click(object sender, EventArgs e) { int id = int.Parse(feedBackGridView.CurrentRow.Cells[1].Value.ToString()); DateTime time = (System.DateTime)feedBackGridView.CurrentRow.Cells[2].Value; string title = feedBackGridView.CurrentRow.Cells[3].Value.ToString(); string name = feedBackGridView.CurrentRow.Cells[4].Value.ToString(); string email = feedBackGridView.CurrentRow.Cells[5].Value.ToString(); string num = feedBackGridView.CurrentRow.Cells[6].Value.ToString(); string content = feedBackGridView.CurrentRow.Cells[7].Value.ToString(); DictionaryDTO.FeedBackDTO fb = new FeedBackDTO(id, time, title, email, name, num, content); openViewFBForm(new ViewFeedBackForm(fb)); }
public void AddAnswer(FeedBackDTO feedBackDTO) { FeedBack feedBack = Database.FeedBack.Get(feedBackDTO.Id); if (feedBack == null) { throw new ValidationException($"Feedback with id {feedBackDTO.Id} not found", string.Empty); } feedBack.Answer = feedBackDTO.Answer; feedBack.DateTimeAnswer = feedBackDTO.DateTimeAnswer; feedBack.UserIdAnswering = feedBackDTO.UserIdAnswering; feedBack.IsAnswered = feedBackDTO.IsAnswered; Database.FeedBack.Update(feedBack); Database.Save(); }
private void btnDeleteFeedBack_Click(object sender, EventArgs e) { int id = int.Parse(feedBackGridView.CurrentRow.Cells[1].Value.ToString()); DateTime time = (System.DateTime)feedBackGridView.CurrentRow.Cells[2].Value; string title = feedBackGridView.CurrentRow.Cells[3].Value.ToString(); string name = feedBackGridView.CurrentRow.Cells[4].Value.ToString(); string email = feedBackGridView.CurrentRow.Cells[5].Value.ToString(); string num = feedBackGridView.CurrentRow.Cells[6].Value.ToString(); string content = feedBackGridView.CurrentRow.Cells[7].Value.ToString(); DictionaryDTO.FeedBackDTO fb = new FeedBackDTO(id, time, title, email, name, num, content); fbManager.removeFeedBack(fb); loadFeedBack(); }
public IActionResult Add(string question) { string currentUserId = GetCurrentUserId(); FeedBackDTO feedBack = new FeedBackDTO() { DateTimeQuestion = DateTime.Now, IsAnswered = false, Question = question, UserIdAsking = currentUserId }; _feedBackService.AddQuestion(feedBack); _loggerService.LogInformation(CONTROLLER_NAME + LoggerConstants.ACTION_ADD, LoggerConstants.TYPE_POST, $"add question: {question} successful", currentUserId); return(Redirect("MyFeedBack")); }
public async Task <IActionResult> PostFeedBack([FromBody] FeedBackDTO model) { var person = await _personService.GetPersonByMobileAsync(CurrentUserName); if (person == null) { throw new AwroNoreException("You are not a member of the system"); } await _contactUsService.InsertNewAsync(new Core.Domain.ContactUs { CreatedAt = DateTime.Now, Email = person.Email ?? "", Name = RequestLang == Core.Enums.Lang.KU ? person.FullName_Ku : RequestLang == Core.Enums.Lang.AR ? person.FullName_Ar : person.FullName, Topic = "App Feedback", Message = model.Comment, Mobile = person.Mobile }); return(Ok()); }
public bool AddReport([FromBody] FeedBackDTO model) { var report = model.Adapt <FeedBack>(); report.CreatedDate = DateTime.Now; report.Mark = Math.Round(report.Mark, 2); DbContext.Reports.Add(report); DbContext.SaveChanges(); var c1 = DbContext.Cars.Where(x => model.CarId == x.Id).FirstOrDefault(); if (c1.Mark == 0) { c1.Mark = report.Mark; } else { c1.Mark = Math.Round((c1.Mark + report.Mark) / 2, 2); } DbContext.SaveChanges(); return(true); }
public bool deleteFeedBack(FeedBackDTO fb) { try { if (conn.State != ConnectionState.Open) { conn.Open(); } using (SqlCommand cmd = new SqlCommand(deleteFeedBackCommand, conn)) { cmd.Parameters.Add("@Id", SqlDbType.Int).Value = fb.Id; cmd.ExecuteNonQuery(); return(true); } } catch (Exception e) { conn.Close(); throw e; } }
public void Edit(FeedBackDTO feedBackDTO) { Database.FeedBack.Update(_converterFeedBack.ConvertDTOByModel(feedBackDTO)); Database.Save(); }
public void AddQuestion(FeedBackDTO feedBackDTO) { Database.FeedBack.Create(_converterFeedBack.ConvertDTOByModel(feedBackDTO)); Database.Save(); }