/// <summary> /// 添加用户登陆信息 /// </summary> /// <param name="param"></param> /// <returns></returns> public void AddHospitalOperator(AddHospitalOperatorParam param) { using (var sqlConnection = new SqlConnection(_connectionString)) { string insertSql = null; try { sqlConnection.Open(); string querySql = $"select COUNT(*) from [dbo].[HospitalOperator] where [HisUserId]='{param.UserId}' "; var resultNum = sqlConnection.QueryFirst <int>(querySql); if (resultNum > 0) { insertSql = $"update [dbo].[HospitalOperator] set HisUserAccount='{param.UserAccount}',HisUserPwd='{param.UserPwd}',UpdateTime=GETDATE(),UpdateUserId='{param.UserId}',OrganizationCode='{param.OrganizationCode}',ManufacturerNumber='{param.ManufacturerNumber}' where [HisUserId]='{param.UserId}'"; } else { insertSql = $@" INSERT INTO [dbo].[HospitalOperator] ([Id] ,[FixedEncoding],[HisUserId],ManufacturerNumber, [HisUserAccount],[HisUserPwd],[CreateTime],[CreateUserId],[HisUserName],[IsDelete] ) VALUES('{Guid.NewGuid()}','{BitConverter.ToInt64(Guid.Parse(param.UserId).ToByteArray(), 0)}','{param.UserId}','{param.ManufacturerNumber}', '{param.UserAccount}','{param.UserPwd}',GETDATE(),'{param.UserId}','{param.HisUserName}',0)"; } sqlConnection.Execute(insertSql); } catch (Exception e) { _log.Debug(insertSql); throw new Exception(e.Message); } } }
public ApiJsonResultData AddHospitalOperator(AddHospitalOperatorParam param) { return(new ApiJsonResultData(ModelState).RunWithTry(y => { if (string.IsNullOrWhiteSpace(param.ManufacturerNumber)) { throw new Exception("厂商编号不能为空!!!"); } var inputParam = new UserInfoParam() { UserName = param.UserAccount, Pwd = param.UserPwd, ManufacturerNumber = param.ManufacturerNumber, }; string inputParamJson = JsonConvert.SerializeObject(inputParam, Formatting.Indented); var verificationCode = _webServiceBasicService.GetVerificationCode("01", inputParamJson); if (verificationCode != null) { param.OrganizationCode = verificationCode.OrganizationCode; param.HisUserName = verificationCode.UserName; } _systemManage.AddHospitalOperator(param); })); }