public ActionResult AddRecord(ARTrackingCommentModel commentModel, string CustomerID, string returnUrl) { try { if (ModelState.IsValid) { commentModel.CommentID = System.Guid.NewGuid(); commentModel.CustomerID = CustomerID; commentModel.CommentDate = DateTime.Today.Date; commentModel.CreatedBy = User.Identity.Name; _ARTrackingManager.Save(commentModel); ViewData["month"] = DateTime.Today.Month.ToString(); ViewData["year"] = DateTime.Today.Year.ToString(); ViewData["CustomerID"] = CustomerID; return PartialView("_CommentList"); } else { throw new Exception(); } } catch (Exception ex) { var modal = new HandleErrorInfo(ex, "ARTracking", "Detail"); return View("Error", modal); } }
public ActionResult EditRecordPartial(ARTrackingCommentModel commentModel, string returnUrl) { if (ModelState.IsValid) { try { ARTrackingCommentModel objComment = _ARTrackingManager.getCommentByCommentID(commentModel.CommentID); if (objComment != null) { commentModel.ModifiedBy = User.Identity.Name; _ARTrackingManager.Update(commentModel); ViewData["CustomerID"] = commentModel.CustomerID; ViewData["CustomerName"] = _F01030Manager.GetDataByCustomerID(commentModel.CustomerID).CustomerName; ModelState.Clear(); return PartialView("_Comments"); } } catch (Exception ex) { var modal = new HandleErrorInfo(ex, "ARTracking", "Index"); return View("Error", modal); } } else { var errors = ModelState.SelectMany(x => x.Value.Errors.Select(z => z.Exception)); } return Redirect(returnUrl); }
public ActionResult EditRecord(ARTrackingCommentModel commentModel, string returnUrl) { if (ModelState.IsValid) { try { ARTrackingCommentModel objComment = _ARTrackingManager.getCommentByCommentID(commentModel.CommentID); if (objComment != null) { commentModel.ModifiedBy = User.Identity.Name; _ARTrackingManager.Update(commentModel); ViewData["month"] = DateTime.Today.Month.ToString(); ViewData["year"] = DateTime.Today.Year.ToString(); ViewData["CustomerID"] = commentModel.CustomerID; return PartialView("_CommentList"); } } catch (Exception ex) { var modal = new HandleErrorInfo(ex, "ARTracking", "Detail"); return View("Error", modal); } } else { var errors = ModelState.SelectMany(x => x.Value.Errors.Select(z => z.Exception)); } return Redirect(returnUrl); }
public ActionResult AddRecordPartial(ARTrackingCommentModel commentModel, string CustomerID, string returnUrl) { try { if (ModelState.IsValid) { if (Request.IsAjaxRequest()) { commentModel.CommentID = System.Guid.NewGuid(); commentModel.CustomerID = CustomerID; commentModel.CommentDate = DateTime.Today.Date; commentModel.CreatedBy = User.Identity.Name; _ARTrackingManager.Save(commentModel); ViewData["CustomerID"] = CustomerID; ViewData["CustomerName"] = _F01030Manager.GetDataByCustomerID(CustomerID).CustomerName; ModelState.Clear(); return PartialView("_Comments"); } else return Content("Failed"); } else { throw new Exception(); } } catch (Exception ex) { var modal = new HandleErrorInfo(ex, "ARTracking", "Index"); return View("Error", modal); //return Content("Failed"); } }
public void Update(ARTrackingCommentModel entity) { objComments = new ARTS_CommentRepository(); ARTS_Comment comment = objComments.GetSingle(x=>x.CommentID.Equals(entity.CommentID)); comment.CommentType = entity.CommentType; comment.Comment = entity.Comment; comment.CommentDate = DateTime.Now; comment.ModifiedBy = entity.ModifiedBy; comment.ModifiedDate = DateTime.Now; objComments.Update(comment); }
public void Save(ARTrackingCommentModel entity) { objComments = new ARTS_CommentRepository(); ARTS_Comment comment = new ARTS_Comment(); comment.CommentID = entity.CommentID; comment.CustomerID = entity.CustomerID; comment.CommentType = entity.CommentType; comment.Comment = entity.Comment; comment.CommentDate = entity.CommentDate; comment.CreatedBy = entity.CreatedBy; comment.CreatedDate = DateTime.Now; objComments.Add(comment); }
public ARTrackingCommentModel getCommentByCommentID(Guid id) { objComments=new ARTS_CommentRepository(); Mapper.CreateMap<ARTS_Comment, ARTrackingCommentModel>(); var entity = objComments.GetSingle(x => x.CommentID.Equals(id)); ARTrackingCommentModel result = new ARTrackingCommentModel(); result = Mapper.Map(entity, result); return result; }