public static bool InsertThirdAppSetting(SqlConnection conn, OpenAppModel model) { string sql = @" Insert into [Gungnir].[dbo].[tbl_OpenApp]( [AppId] ,[AppName] ,[AppSecret] ,[OrderChannel] ,[CreateTime] ,[UpdateTime] ,[IsDeleted] ,[InputCharset] ,[SignType] ,[EncryptType] ,[PrivateKey] ,[BigCustomerUrl] ,[BigCustomerStatus] ) values( @AppId ,@AppName ,@AppSecret ,@OrderChannel ,GetDate() ,GetDate() ,0 ,@InputCharset ,@SignType ,@EncryptType ,@PrivateKey ,@BigCustomerUrl ,@BigCustomerStatus )"; var result = conn.Execute(sql, new { AppId = model.AppId , AppName = model.AppName , AppSecret = model.AppSecret , OrderChannel = model.OrderChannel , InputCharset = string.IsNullOrEmpty(model.InputCharset) ? "utf-8" : model.InputCharset , SignType = model.SignType , EncryptType = model.EncryptType , PrivateKey = model.PrivateKey , BigCustomerUrl = model.BigCustomerUrl , BigCustomerStatus = model.BigCustomerStatus }, commandType: CommandType.Text); return(result > 0); }
public JsonResult GetThirdAppSettingsDetail(int pkid) { OpenAppModel result = null; IEnumerable <SYS_CompanyUser> accountUsers = null; result = manager.GetThirdAppSettingDetail(pkid); if (result != null && result.CompanyId > 0) { accountUsers = UserAccountService.GetCompanyUsersByCompanyId(result.CompanyId); } return(Json(new { result = result ?? new OpenAppModel(), accountUsers = accountUsers ?? new List <SYS_CompanyUser>() }, JsonRequestBehavior.AllowGet)); }
public OpenAppModel GetThirdAppSettingsDetailByGroupId(string appId) { OpenAppModel result = null; try { result = DbTuhuGunginrScopeReadManager.Execute(conn => DALUnivRedemptionCode.GetThirdAppSettingsDetailByAppId(conn, appId)); } catch (Exception ex) { Logger.Error(ex.Message, ex); } return(result); }
private void GetAppInfo(OpenAppModel model) { int count = 5; while (count > 0) { var appId = RandomHelper.Instanse.GetStringFromRandomString(16).Trim(); if (!manager.CheckAppIdIsExist(appId)) { model.AppId = appId; model.AppSecret = RandomHelper.Instanse.GetStringFromRandomString(32).Trim(); break; } count--; } }
public JsonResult SaveThirdAppSetting(OpenAppModel model) { if (model == null) { return(Json(new { result = false, msg = "model参数不能为空" })); } if (model.Id <= 0) { GetAppInfo(model); } if (model.BigCustomerUrlInstanse != null && (!string.IsNullOrEmpty(model.BigCustomerUrlInstanse.GetUserUrl) || !string.IsNullOrEmpty(model.BigCustomerUrlInstanse.VerifyUrl))) { model.BigCustomerUrl = JsonConvert.SerializeObject(model.BigCustomerUrlInstanse); } var result = manager.SaveThirdAppSetting(model, User.Identity.Name); return(Json(new { result = result.Item1, msg = result.Item2 })); }
public bool SaveThirdAppSetting(OpenAppModel model, string userName) { bool result = false; try { if (model.Id > 0) { var oldModel = GetThirdAppSettingDetail(model.Id); result = DbTuhuGunginrScopeReadManager.Execute(conn => DALUnivRedemptionCode.UpdateThirdAppSetting(conn, model)); if (result) { InsertBeautyOprLog(new { LogType = "UpdateThirdAppSetting", IdentityID = model.AppId, NewValue = JsonConvert.SerializeObject(model), OldValue = JsonConvert.SerializeObject(oldModel), OperateUser = userName, }); } } else { result = DbTuhuGunginrScopeReadManager.Execute(conn => DALUnivRedemptionCode.InsertThirdAppSetting(conn, model)); if (result) { InsertBeautyOprLog(new { LogType = "InsertThirdAppSetting", IdentityID = model.AppId, NewValue = JsonConvert.SerializeObject(model), OldValue = string.Empty, OperateUser = userName, }); } } } catch (Exception ex) { Logger.Error(ex.Message, ex); } return(result); }
public static bool UpdateThirdAppSetting(SqlConnection conn, OpenAppModel model) { string sql = @" Update [Gungnir].[dbo].[tbl_OpenApp] SET [AppId]=@AppId ,[AppName]=@AppName ,[AppSecret]=@AppSecret ,[OrderChannel]=@OrderChannel ,[UpdateTime]=GetDate() ,[InputCharset]=@InputCharset ,[SignType]=@SignType ,[EncryptType]=@EncryptType ,[PrivateKey]=@PrivateKey ,[BigCustomerUrl]=@BigCustomerUrl ,[BigCustomerStatus]=@BigCustomerStatus WHERE Id=@Id"; var result = conn.Execute(sql, new { Id = model.Id , AppId = model.AppId , AppName = model.AppName , AppSecret = model.AppSecret , OrderChannel = model.OrderChannel , InputCharset = string.IsNullOrEmpty(model.InputCharset) ? "utf-8" : model.InputCharset , SignType = model.SignType , EncryptType = model.EncryptType , PrivateKey = model.PrivateKey , BigCustomerUrl = model.BigCustomerUrl , BigCustomerStatus = model.BigCustomerStatus }, commandType: CommandType.Text); return(result > 0); }