public ActionResult QuickInsert(EAP.Logic.Z30.QuickCommunication qCom) { //string buyerTypes = Request["BuyerPersonas"]; //int intBT = buyerTypes.ToEnumInt32(); //qCom.BuyerPersonas = intBT; ValidateQCommunication(qCom); if (!ModelState.IsValid) { return(View(qCom)); } qCom.Save(_tenant.TenantID.Value, _user.UserID.Value); return(Redirect("/Z30Customer/")); }
protected void ValidateQCommunication(EAP.Logic.Z30.QuickCommunication entity) { if (entity.CorpName.IsNullOrEmpty()) { ModelState.AddModelError("CorpName required", "必须填写公司名称"); } if (entity.LinkName.IsNullOrEmpty()) { ModelState.AddModelError("LinkName required", "必须填写联系人,如果不清楚联系人,请填写“先生”或“女士”"); } if (!entity.VisitWay.HasValue) { ModelState.AddModelError("VisitWay required", "拜访方式必须填写"); } if (!entity.SuccessRatio.HasValue) { ModelState.AddModelError("SuccessRatio required", "成功概率必须填写"); } if (!string.IsNullOrEmpty(entity.Content) && entity.Content.Length > 2000) { ModelState.AddModelError("Content string length error", "沟通内容:填写的内容太多"); } }