public ActionResult Delete(string id, string file)
        {
            var layouts = LayoutManagerFactory.Invoke(id);

            layouts.Delete(file);
            var company    = Repository.Single(c => c.Id == id);
            var oldStat    = company.Status;
            var changeDate = DateTime.Now;

            company.Status = AppStatus.Open;
            company.LayoutRejected.Clear();
            Repository.Update(company);
            ChangeStatusEmail.SendEmail(oldStat.ToString(), company.Status.ToString(), _session, changeDate,
                                        company.CompanyName, company.Payment.PONumber);
            return(RedirectToAction("Index", new { id }));
        }
Esempio n. 2
0
        public ActionResult Status(string id, AppStatus status)
        {
            var company = Repository.GetById(id);

            if (company == null)
            {
                return(HttpNotFound());
            }
            var oldStat    = company.Status;
            var changeDate = DateTime.Now;

            company.Status = status;
            Repository.Update(company);

            ChangeStatusEmail.SendEmail(oldStat.ToString(), company.Status.ToString(), _session, changeDate,
                                        company.CompanyName, company.Payment.PONumber);
            return(RedirectToAction("Index"));
        }
        public ActionResult ResetApproval(string id)
        {
            var company = Repository.GetById(id);

            if (company == null)
            {
                return(HttpNotFound());
            }
            var oldStat    = company.Status;
            var changeDate = DateTime.Now;

            company.LayoutsApprovedOn = null;
            company.Status            = AppStatus.LayoutCompleted;
            Repository.Update(company);
            ChangeStatusEmail.SendEmail(oldStat.ToString(), company.Status.ToString(), _session, changeDate,
                                        company.CompanyName, company.Payment.PONumber);
            return(RedirectToAction("Index", new { id }));
        }
        public ActionResult Reject(LayoutRejectModel data)
        {
            var repository = new MongoRepository <Company>();

            foreach (var key in data.rejectLayout.Keys)
            {
                var    date    = DateTime.Now;
                var    company = repository.GetById(key);
                var    oldStat = company.Status;
                string reason  = String.Empty;
                company.Status            = AppStatus.LayoutRejected;
                company.LayoutsApprovedOn = null;
                company.LayoutRejected.Add(date, data.rejectLayout[key]);
                if (data.rejectLayout[key] != null)
                {
                    reason = "Reason: " + data.rejectLayout[key];
                }
                repository.Update(company);
                ChangeStatusEmail.SendEmail(oldStat.ToString(), company.Status.ToString(), _session, date,
                                            company.CompanyName, reason);
            }

            return(RedirectToAction("Index", "Home"));
        }