/// <summary> /// 快速注册用户 /// </summary> /// <param name="model"></param> /// <returns></returns> public async Task <CHIS_Code_Customer> QuickRegist(QuickRegistCustomerInfo model, int opId, string opMan) { if (model.CustomerMobile.IsNotEmpty()) { if (model.CustomerMobile.IsMobileNumber()) { if (_db.vwCHIS_Code_Customer.Where(m => m.CustomerMobile == model.CustomerMobile).Count() > 0) { throw new Exception("该手机已经使用,不能快速注册"); } if (_db.CHIS_Sys_Login.Where(m => m.Mobile == model.CustomerMobile).Count() > 0) { throw new Exception("该手机已经使用,不能快速注册"); } } } var cus = new vwCHIS_Code_Customer { }; cus.CustomerName = model.CustomerName; cus.Gender = model.Gender; cus.Birthday = model.Birthday; cus.LoginName = string.Format("{0}.{1}.{2}", Ass.Data.Chinese2Spell.GetFstLettersLower(model.CustomerName), model.Gender, model.Birthday.ToString("yyyyMMdd")); if (model.CustomerMobile.IsNotEmpty() && model.CustomerMobile.GetStringType().IsMobile) { cus.CustomerMobile = model.CustomerMobile; } cus.sysSource = sysSources.CHIS约号快增.ToString(); cus.IsVIP = false; return(await CreateCustomerAsync(cus, opId, opMan)); }
public async Task <dynamic> CustomerQuickRegist([FromBody] QuickRegistCustomerInfo model) { try { if (model == null) { throw new Exception("没有传入数据"); } if (!ModelState.IsValid) { throw new ModelStateException(ModelState); } var opId = TryGet <int>(() => UserSelf.OpId, 0); var opMan = TryGet <string>(() => UserSelf.OpMan, "SYSTEM"); var customer = await _cusSvr.QuickRegist(model, opId, opMan); var d = MyDynamicResult(true, ""); d.customerId = customer.CustomerID; return(d); } catch (Exception ex) { return(MyDynamicResult(ex.InnerException ?? ex)); } }