public ActionResult ReviewManager_Add(FormCollection collection) { var review = new Review(); var reviewdetail = new ReviewDetail(); var reviewmethodsetting = new ReviewMethodSetting(); review.InjectFrom <RequestInjection>(Request); reviewdetail.InjectFrom <RequestInjection>(Request); reviewmethodsetting.InjectFrom <RequestInjection>(Request); reviewdetail.ReviewMethod = (ReviewMethod)Convert.ToInt32(Request.Form["reviewmethod"]); if (review.AwardID == 0) { return(Error("请选择奖项")); } if (review.ReviewName.IsNullOrEmpty()) { return(Error("请输入评审活动说明")); } if (Config.Helper.Count <Review>("where awardid=@0 and isdelete=0 and reviewname=@1", review.AwardID, review.ReviewName) > 0) { return(Error("相同评审活动名称已存在")); } if (reviewdetail.TargetNumber == 0) { return(Error("请输入目标数量")); } if (reviewdetail.ReviewMethod == ReviewMethod.Average && (reviewmethodsetting.MaxScore == 0 || reviewmethodsetting.MinScore == 0 || reviewmethodsetting.ScoreStep == 0)) { return(Error("请正确设置参数")); } if (reviewdetail.ReviewMethod == ReviewMethod.Weighting && (reviewmethodsetting.MaxScore == 0 || reviewmethodsetting.MinScore == 0 || reviewmethodsetting.ScoreStep == 0 || reviewmethodsetting.WeightLast == 0 || reviewmethodsetting.WeightNow == 0)) { return(Error("请正确设置参数")); } if (reviewdetail.ReviewMethod == ReviewMethod.Vote && (reviewmethodsetting.VoteNumber == 0)) { return(Error("请正确设置参数")); } if (review.Award.ProjectCount < reviewdetail.TargetNumber) { return(Error("目标数量不能大于参选项目总数")); } var ispublish = collection["publish"] == "1"; Review.AddReview(review, reviewdetail, reviewmethodsetting, ispublish); return(SuccessCallback("提交成功", "location.href='/Manager/ReviewManager_List'")); }
public ActionResult ReviewManager_AddNext(FormCollection collection) { var reviewdetail = new ReviewDetail(); var reviewmethodsetting = new ReviewMethodSetting(); reviewdetail.InjectFrom <RequestInjection>(Request); reviewmethodsetting.InjectFrom <RequestInjection>(Request); reviewdetail.ReviewMethod = (ReviewMethod)Convert.ToInt32(Request.Form["reviewmethod"]); var review = Config.Helper.SingleById <Review>(reviewdetail.ReviewID); if (reviewdetail.TargetNumber == 0) { return(Error("请输入目标数量")); } if (reviewdetail.ReviewMethod == ReviewMethod.Average && (reviewmethodsetting.MaxScore <= 0 || reviewmethodsetting.MinScore <= 0 || reviewmethodsetting.ScoreStep <= 0)) { return(Error("请正确设置参数")); } if (reviewdetail.ReviewMethod == ReviewMethod.Weighting && (reviewmethodsetting.MaxScore <= 0 || reviewmethodsetting.MinScore <= 0 || reviewmethodsetting.ScoreStep <= 0 || reviewmethodsetting.WeightLast <= 0 || reviewmethodsetting.WeightNow <= 0)) { return(Error("请正确设置参数")); } if (reviewdetail.ReviewMethod == ReviewMethod.Weighting && (reviewmethodsetting.WeightLast + reviewmethodsetting.WeightNow != 100)) { return(Error("本轮权重与上轮权重之和必须为100")); } if (reviewdetail.ReviewMethod == ReviewMethod.Vote && (reviewmethodsetting.VoteNumber <= 0)) { return(Error("请正确设置参数")); } if (reviewdetail.SourceProjectIDs.Split(',').Length < reviewdetail.TargetNumber) { return(Error("目标数量不能大于参选项目总数")); } var ispublish = collection["publish"] == "1"; Review.AddReview(review, reviewdetail, reviewmethodsetting, ispublish); return(SuccessCallback("提交成功", "location.href='/Manager/ReviewManager_Summary?id=" + review.ID + "'")); }