public ActionResult Feedback(FeedbackMaster objFeedbackMaster) { string errorMsg = string.Empty; if (!ModelState.IsValid) { Response.StatusCode = (int)HttpStatusCode.BadRequest; errorMsg = "Not valid model"; return(Json(new { IsSuccess = false, errorMsg }, JsonRequestBehavior.AllowGet)); } else { objFeedbackMaster.FeedbackDate = DateTime.Now; objAsopalavDBEntities.FeedbackMasters.Add(objFeedbackMaster); objAsopalavDBEntities.SaveChanges(); if (!SendAcknowledgementMail(objFeedbackMaster.EmailID)) { return(Json(new { IsSuccess = false, errorMsg = TempData["SendAcknowledgementMailMsg"] }, JsonRequestBehavior.AllowGet)); } if (!SendMailToAdmin(objFeedbackMaster)) { return(Json(new { IsSuccess = false, errorMsg = TempData["SendMailToAdminMsg"] }, JsonRequestBehavior.AllowGet)); } } return(Json(new { IsSuccess = true }, JsonRequestBehavior.AllowGet)); }
public FeedbackDetailDTO GetFeedbackDetails(int FeedbackID) { FeedbackDetailDTO objResult = null; FeedbackMaster objFeedback = FeedbackRepository.GetFeedbackDetails(FeedbackID); DateTime FeedbackCloseDate; //=DateTime.Today; if (objFeedback != null) { if (objFeedback.CurrentStatusID == 4 && objFeedback.CurrentStatusID == 8 && objFeedback.CurrentStatusID == 9) { FeedbackCloseDate = objFeedback.ModifiedOn.Value.Date; } else { FeedbackCloseDate = DateTime.Now; } //double TimeTaken = (FeedbackCloseDate - objFeedback.CreatedOn.Date).TotalDays; double TimeTaken = (FeedbackCloseDate - objFeedback.CreatedOn).TotalHours; objResult = new FeedbackDetailDTO(); objResult.FeedbackCatID = objFeedback.FeedbackCatID; objResult.FeedbackNumber = objFeedback.FeedbackNo; objResult.TeamID = objFeedback.FeedbackCategoryMaster.TeamID; objResult.FeedbackTypeID = objFeedback.FeedbackTypeID; objResult.TimeTaken = Convert.ToSingle(Math.Round(TimeTaken, 0)); objResult.SpocID = objFeedback.SpocID; objResult.ImageURL = objFeedback.ImageURL; objResult.CurrentFeedbackStatusID = objFeedback.CurrentStatusID; //objFeedback.FeedbackStatusLogs.FirstOrDefault(k=>k.StatusID==1).PendingWith.Value; objResult.UserID = objFeedback.CreatedBy; var logs = from log in objFeedback.FeedbackStatusLogs select new FeedbackDetailLogDTO() { CreatedBy = log.UserMaster.FirstName + " " + log.UserMaster.LastName, CreatedOn = log.CreatedOn.Value.ToString("dd/MM/yyyy HH:mm:ss"), FeedbackStatusID = log.StatusID.Value, PendingWith = log.UserMaster1.FirstName + " " + log.UserMaster1.LastName, Remarks = log.Remarks, ResponseDate = log.ResponseDate == null ? "" : log.ResponseDate.Value.ToString("dd/MM/yyyy HH:mm:ss"), }; objResult.FeedbackDetailLog = logs.ToList(); } return(objResult); }
public JsonResult ProvideFeedback(string feedback) { try { FeedbackMaster db = new FeedbackMaster(); db.Date = DateTime.Now; db.CustomerId = Convert.ToInt32(Session["UserID"]); db.Feedback = feedback; model.FeedbackMasters.Add(db); model.SaveChanges(); return(Json("success", JsonRequestBehavior.AllowGet)); } catch (Exception ex) { return(Json("Error")); } }
public ActionResult FeedbackEntry(FormCollection frm) { try { Chatpata_dabbaEntities1 Entity = new Chatpata_dabbaEntities1(); FeedbackMaster fbm = new FeedbackMaster(); fbm.Feedback = Convert.ToString(frm["Feedback"]); fbm.Date = DateTime.Now; fbm.CustId = Convert.ToInt16(Session["UserID"]); Entity.FeedbackMasters.Add(fbm); Entity.SaveChanges(); return(RedirectToAction("Customer")); } catch (Exception ex) { throw ex; } }
private bool SendMailToAdmin(FeedbackMaster objFeedbackMaster) { bool IsSendMail = false; var host = System.Web.HttpContext.Current.Request.Url.OriginalString.Replace(System.Web.HttpContext.Current.Request.Url.PathAndQuery, ""); string imageName = host + "/Content/images/[email protected]"; //Mail to Admin string msg = "<p><img src='" + imageName + "' alt='LogoName' border='0' width='95px' height='77px'/></p>" + "<p><em><strong>Subject:</strong> " + objFeedbackMaster.FeedbackSubject + "</em></p>" + "<p><em><strong>Queries:</strong> " + objFeedbackMaster.FeedbackMessage + "</em></p>" + "<p><em> - Asopalav Jewellers</em></p>"; try { MailHelper.SendMailMessage(ConfigurationManager.AppSettings["MailFrom"], ConfigurationManager.AppSettings["MailFrom"], string.Empty, string.Empty, "Feedback - Asopalav Jewellers", msg); IsSendMail = true; } catch (Exception ex) { TempData["SendMailToAdminMsg"] = ex.InnerException; } return(IsSendMail); }