public ActionResult SignContract(SignContractViewModel signContractViewModel) { signContractViewModel.CheckNotNull(nameof(signContractViewModel)); //获取合同级别 ContractLevel contractLevel = ShopContract.ContractLevels.SingleOrDefault(cl => cl.Name == signContractViewModel.ContractLevel); if (contractLevel == null) { return(Json(new AjaxResult("没有该类型的合同", AjaxResultType.Error))); } ContractInputDto dto = new ContractInputDto { ShopId = CurrentUser.Shop.Id, BeginTime = DateTime.Now, EndTime = DateTime.Now.AddYears(signContractViewModel.Year), State = ContractState.UnAvliable, HCoinLimit = contractLevel.HCoinLimit, InitalFee = contractLevel.InitalFee, Year = signContractViewModel.Year, Fee = contractLevel.InitalFee * signContractViewModel.Year, Number = "HMH" + DateTime.Now.ToString("yyMMddHHmmss") + new Random().GetRandomNumberString(4)//合同编号HMH0000000000000000 }; OperationResult result = ShopContract.AddContracts(dto); return(Json(result.ToAjaxResult())); }
public string DisplayTravellerContract() { if (ContractLevel == 0) { return("<a style=\"color:darkgreen\">PASS</a>"); } StringBuilder s = new StringBuilder(ContractLevel.ToString()); switch (ContractSuit) { case "S": s.Append("<a style=\"color:black\">♠</a>"); break; case "H": s.Append("<a style=\"color:red\">♥</a>"); break; case "D": s.Append("<a style=\"color:lightsalmon\">♦</a>"); break; case "C": s.Append("<a style=\"color:lightslategrey\">♣</a>"); break; case "NT": s.Append("NT"); break; } s.Append(ContractX); return(s.ToString()); }
/// <summary> /// 生成预览合同 /// </summary> /// <param name="years"></param> /// <param name="contractLevel"></param> /// <returns></returns> public ActionResult GenContract(int years, string contractLevel) { //从数据查找合同级别 ContractLevel cLevel = ShopContract.ContractLevels.SingleOrDefault(cl => cl.Name == contractLevel); ContractPreViewModel model = new ContractPreViewModel() { Shop = CurrentUser.Shop, Years = years, ContractLevel = new ContractLevel() { HCoinLimit = cLevel.HCoinLimit, InitalFee = cLevel.InitalFee } }; return(PartialView("_ContractInfo", model)); }