예제 #1
0
        public ActionResult RequestForProposal(Proposal item, IEnumerable<HttpPostedFileBase> files)
        {
            if (ModelState.IsValid)
            {
                if (files != null && files.Count() > 0)
                {
                    UploadFilesForProposal(item, files);
                }

                if (item.Id != 0)
                {
                    bll.ProposalManager.UpdateProposal(item);

                    TempData["message"] = new AlertMessage(string.Format("{0} has been saved", item.Name));
                    return RedirectToAction("Proposals", "Admin");
                }
                else
                {
                    bll.ProposalManager.InsertProposal(item);

                    SendProposalNotification(item);

                    TempData["message"] = new AlertMessage(string.Format("{0} has been saved", item.Name));
                    return RedirectToAction("ProposalSucceed");
                }
            }
            else
            {
                return View(item);
            }
        }
예제 #2
0
 public ActionResult DeleteProposal(int id)
 {
     var item = bll.ProposalManager.DeleteProposal(id);
     if (item != null)
     {
         TempData["message"] = new AlertMessage(string.Format("{0} has been deleted", item.ProjectTitle));
     }
     return RedirectToAction("Proposals");
 }
예제 #3
0
        public ActionResult EditProject([Bind(Prefix = "Project")]Project item, IEnumerable<string> technologies)
        {
            if (ModelState.IsValid)
            {
                if (item.Id != 0)
                {
                    bll.ProjectManager.UpdateProject(item, technologies);
                }
                else
                {
                    bll.ProjectManager.InsertProject(item, technologies);
                }

                TempData["message"] = new AlertMessage(string.Format("{0} has been saved", item.Name));
                return RedirectToAction("Projects");
            }
            else
            {
                var model = new ProjectViewModel { Project = item };
                FillAdditionalProperties(model);
                return View(model);
            }
        }
예제 #4
0
        public ActionResult Login(string userName, string password, bool? rememberMe)
        {
            string error = string.Empty;
            if (string.IsNullOrEmpty(userName) || string.IsNullOrEmpty(password))
            {
                error = "用户名或密码不能为空";
            }
            var user = bll.UserManager.SelectUser(userName);
            if(user == null)
            {
                error = "用户不存在";
            }
            else
            {
                if (user.Password != password)
                {
                    error = "用户名或密码不正确";
                }
                else if (!user.Status)
                {
                    error = "用户已失效";
                }
            }

            if(!string.IsNullOrEmpty(error))
            {
                TempData["message"] = new AlertMessage(AlertCategory.Error, error);
                return View();
            }
            else
            {
                SessionHelper.Set(Session, SessionKey.LOGON_USER, user);
                return RedirectToAction("Projects");
            }
        }