示例#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");
            }
        }