コード例 #1
0
        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);
            }
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        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);
        }
コード例 #4
0
        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");
            }
        }
コード例 #5
0
        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);
        }
コード例 #6
0
        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);
        }
コード例 #7
0
        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;
        }