コード例 #1
0
        public ActionResult JobOrderDetails(string Id, string Comment, string JOReply, string JobOrderStatus, bool CV, Int64 JOCommentId = 0)
        {
            var UserDetail = generic.GetUserDetail(User.Identity.GetUserId());

            //If Client has team members with all rights
            if (UserDetail.CorporateId != null && UserDetail.CorporateId != UserDetail.SubscriberId)
            {
                UserDetail.UserId = UserDetail.CorporateId;
            }
            var joOrder = new JobOrderViewModel();

            joOrder = cmsMgr.GetJobOrderByJONumber(Id);
            string body             = " has commented for the Job Order: ";
            bool   Status           = false;
            string CommentOrReplyBy = UserDetail.UserId;
            var    result           = false;

            if (!string.IsNullOrEmpty(Id) && !string.IsNullOrEmpty(Comment))
            {
                result = cmsMgr.AddJOComments(Id, Comment, DateTime.Now, UserDetail.UserId);
                if (UserDetail.Role == "Admin")
                {
                    admin.AddNotification(joOrder.ClientId, CommentOrReplyBy, body + Id, "JobOrder", Id, Status, DateTime.Now);
                }
                else
                {
                    admin.AddNotification(joOrder.SubscriberId, CommentOrReplyBy, body + Id, "JobOrder", Id, Status, DateTime.Now);
                }
            }
            if (JOCommentId != 0 && !string.IsNullOrEmpty(JOReply))
            {
                body   = " has replied for the comment of Job Order: ";
                result = cmsMgr.AddJOReplies(JOCommentId, JOReply, DateTime.Now, UserDetail.UserId);
                if (UserDetail.Role == "Admin")
                {
                    admin.AddNotification(joOrder.ClientId, CommentOrReplyBy, body + Id, "JobOrder", Id, Status, DateTime.Now);
                }
                else
                {
                    admin.AddNotification(joOrder.SubscriberId, CommentOrReplyBy, body + Id, "JobOrder", Id, Status, DateTime.Now);
                }
            }
            return(RedirectToAction("JobOrderDetails", "JobOrder", new { area = "CMS", Id = Id, JobOrderStatus = JobOrderStatus, UpdatedBy = "", CV = CV }));
        }