示例#1
0
        public ActionResult SelectedPublish(int id)
        {
            if (id <= 0)
            {
                throw new HttpRequestValidationException();
            }
            Company         _currentcompany = ((EInvoiceContext)FXContext.Current).CurrentCompany;
            IPublishService pubSrc          = IoC.Resolve <IPublishService>();
            string          ERRMessage      = "";
            Publish         pub             = pubSrc.Getbykey(id);

            if (pub.Status == PublishStatus.Newpub)
            {
                if (pubSrc.SendforApprove(pub, out ERRMessage) == true)
                {
                    log.Info("SelectedPublish Publish by: " + HttpContext.User.Identity.Name + " Info-- ID: " + id.ToString());
                    Messages.AddFlashMessage("Gửi thành công");
                }
                else
                {
                    log.Error("SelectedPublish Publish:" + ERRMessage);
                    Messages.AddErrorFlashMessage(ERRMessage);
                }
                return(RedirectToAction("DetailRPublish/" + id + ""));
            }
            if (pub.Status == PublishStatus.Waiting)
            {
                if (pubSrc.Approve(pub, out ERRMessage) == true)
                {
                    log.Info("SelectedPublish Publish by: " + HttpContext.User.Identity.Name + " Info-- ID: " + id.ToString());
                    Messages.AddFlashMessage("Phát hành thành công!");
                }
                else
                {
                    log.Error("SelectedPublish Publish:" + ERRMessage);
                    Messages.AddErrorFlashMessage(ERRMessage);
                }
                return(RedirectToAction("DetailRPublish/" + id + ""));
            }
            Messages.AddErrorFlashMessage("Không thực hiện thành công");
            return(RedirectToAction("DetailRPublish/" + id + ""));
        }