protected void Page_Load(object sender, EventArgs e) { bll = new AppInfoService(); aBll = new WXAgentService(new AgentRepository()); adminEntity = GetAdminInfo(); //取得管理员信息 agent = aBll.GetAgentModel(adminEntity.Id); if (!Page.IsPostBack) { int id = 0; if (!int.TryParse(Request.QueryString["id"] as string, out id)) { JscriptMsg("传输参数不正确!", "back", "Error"); return; } if (!bll.Exists(id)) { JscriptMsg("记录不存在或已被删除!", "back", "Error"); return; } returnPage = "wxcodemgr.aspx"; //如果是从微用户管理里来的,还得判断下 if (MyCommFun.QueryString("fpage").Trim().Length > 0 && MyCommFun.RequestInt("uid") > 0) { returnPage = "weixin_list.aspx?id=" + MyCommFun.RequestInt("uid"); } ShowInfo(id); } }
public static string GenerateDatabasePath(Account account) { DBOpenHelper open = DBOpenHelper.GetOpenHelper(account); var localPath = AppInfoService.GetApplicationLocalFolderPath(); return(Path.Combine(localPath, open.DatabaseFile)); }
/// <summary> /// Read the config file and load up the server information. Uses the xml path from ServerFilePath, please see /// Salesforce.SDK.Resources.servers.xml for the default values to be used. /// The account dialog is affected by what is set in the serves.xml file. The attribute allowNewConnections on the /// servers node will dictate if the "add connection" button is visible or not /// in the account creation UI. If there is only a single server, and new connections is disabled, add account will /// immediately go to oauth. /// </summary> protected async Task SetupServersAsync() { String xml; try { xml = await AppInfoService.ReadApplicationFileAsync(ServerFilePath); } catch (Exception) { xml = ConfigHelper.ReadConfigFromResource(DefaultServerPath); } XDocument servers = XDocument.Parse(xml); XAttribute connectionCheck = servers.Element("servers").Attribute("allowNewConnections"); try { AllowNewConnections = connectionCheck == null || (bool)connectionCheck; } catch (FormatException) { AllowNewConnections = true; } IEnumerable <ServerSetting> data = from query in servers.Descendants("server") select new ServerSetting { ServerName = (string)query.Attribute("name"), ServerHost = (string)query.Attribute("url"), CanDelete = false }; ServerList = new ObservableCollection <ServerSetting>(data); }
protected void Page_Load(object sender, EventArgs e) { try { //如果存在OpenId,就不再处理 if (!string.IsNullOrEmpty(OpenId)) { return; } var appInfo = new AppInfoService().GetAppInfo(Wid); if (appInfo == null) { throw new Exception(string.Format("不合法的参数wid {0}", Wid)); } //判断是否存在Code if (string.IsNullOrEmpty(Code)) { //存在Code,则向微信申请Code var newUrl = OAuthApi.GetAuthorizeUrl(appInfo.AppId, "http://www.cloudorg.com.cn/admin/login.aspx", "OAuth2", OAuthScope.snsapi_base); Response.Redirect(newUrl); } else { var result = OAuthApi.GetAccessToken(appInfo.AppId, appInfo.AppSecret, Code); Response.Redirect(string.Format("{0}&OpenId={1}", ReturnUrl, result.openid)); } } catch (Exception ex) { Response.Write(ex.Message); } }
protected void Page_Load(object sender, EventArgs e) { try { //如果存在OpenId,就不再处理 if (!string.IsNullOrEmpty(OpenId)) return; var appInfo = new AppInfoService().GetAppInfo(Wid); if (appInfo == null) throw new Exception(string.Format("不合法的参数wid {0}", Wid)); //判断是否存在Code if (string.IsNullOrEmpty(Code)) { //存在Code,则向微信申请Code var newUrl = OAuthApi.GetAuthorizeUrl(appInfo.AppId, "http://www.cloudorg.com.cn/admin/login.aspx", "OAuth2", OAuthScope.snsapi_base); Response.Redirect(newUrl); } else { var result = OAuthApi.GetAccessToken(appInfo.AppId, appInfo.AppSecret, Code); Response.Redirect(string.Format("{0}&OpenId={1}", ReturnUrl, result.openid)); } } catch (Exception ex) { Response.Write(ex.Message); } }
public ModInstallerBuilder(string modRootPath, string title, string description = null, AppInfoService infoService = null, ImageLocatorService imageLocator = null) { _rootPath = modRootPath; _title = title; _description = description; _infoService = infoService; _imageLocator = imageLocator; }
protected void Page_Load(object sender, EventArgs e) { bll = new AppInfoService(); this.keywords = MXRequest.GetQueryString("keywords"); if (!Page.IsPostBack) { RptBind(keywords); } }
protected void Page_Load(object sender, EventArgs e) { bll = new AppInfoService(); if (!Page.IsPostBack) { //txtapiurl.Text = MyCommFun.getWebSite() + "/api/weixin/api.aspx"; ChkAdminLevel("wx_paysetting", MXEnums.ActionEnum.View.ToString()); //检查权限 ShowInfo(); } }
protected void Page_Load(object sender, EventArgs e) { this.keywords = MXRequest.GetQueryString("keywords"); bll = new AppInfoService(); this.pageSize = GetPageSize(10); //每页数量 if (!Page.IsPostBack) { //ChkAdminLevel("wcodemgr", MXEnums.ActionEnum.View.ToString()); //检查权限 RptBind(CombSqlTxt(keywords), "uid asc, createDate desc"); } }
public async Task InitializeAsync() { var configJson = await AppInfoService.GetConfigurationSettingsAsync(); if (String.IsNullOrWhiteSpace(configJson)) { await SetupServersAsync(); await SaveConfigAsync(); } _isInitialized = true; }
protected void Page_Load(object sender, EventArgs e) { try { _appInfoService = new AppInfoService(); if (CurrentAction == MXEnums.ActionEnum.Edit) { if (!int.TryParse(Request.QueryString["id"] as string, out this.Id)) { JscriptMsg("传输参数不正确!", "back", "Error"); return; } if (!_appInfoService.Exists(this.Id)) { JscriptMsg("记录不存在或已被删除!", "back", "Error"); return; } } else { //添加,则需要判断可以添加的微信号数量 if (IsChaoGuoWxNum()) { return; } } if (!IsPostBack) { txtapiurl.Text = MyCommFun.getWebSite() + "/api/weixin/api.aspx"; // ChkAdminLevel("manager_list", MXEnums.ActionEnum.View.ToString()); //检查权限 //1e2124dd04e11d01b9df2865f85944be var model = GetAdminInfo(); //取得管理员信息 if (this.CurrentAction == MXEnums.ActionEnum.Edit) //修改 { ShowInfo(this.Id); } else { txtEncodingAESKey.Text = Utils.GetLetterOrNumberRandom(43); txtwxToken.Text = Utils.GetLetterOrNumberRandom(10); } } } catch (Exception exception) { JscriptMsg(exception.Message, "back", "Error"); } }
public BuildCommand( IOptionsPrompt <BuildCommand.Settings> prompt, IFileService fileService, ILogger <BuildCommand> logger, AppInfoService infoService, ImageLocatorService imageLocator, ArchiveService archiveService) { _prompt = prompt; _fileService = fileService; _logger = logger; _infoService = infoService; _imageLocator = imageLocator; _archiveService = archiveService; }
// point d'entrée CLI static async Task Main(string[] args) { ILogger logger = new Logger(false); var ts = DateTime.Now.Ticks; var arguments = new Args(); try { // analyse des arguments arguments.Parse(args); if (arguments.Help.Value) { // affichage de l'aide Console.WriteLine(arguments.GetUsage()); } else if (arguments.Symbols.Value) { Console.WriteLine("List of available symbols:"); var symbols = AppInfoService.GetSymbolDescriptions(); var maxLen = symbols.Values.Max(_ => _.Length); Func <string, string> format = (string x) => x + new string(' ', maxLen - x.Length); foreach (var entry in symbols) { if (string.IsNullOrWhiteSpace(entry.Key) || entry.Key.Contains("*")) { Console.WriteLine(); Console.WriteLine($" === {entry.Value} ==="); } else { Console.WriteLine($" {format(entry.Value)} = {{{entry.Key}}}"); } } Console.WriteLine(); } else { // lancement de l'export Highlight logger = new Logger(arguments.Verbose.Value); var program = new Program(); await program.Run(logger, arguments); } } catch (Exception ex) { logger.Error($"An error occurred: {ex.Message}"); } var ticks = DateTime.Now.Ticks - ts; logger?.Log($"Finished in {new TimeSpan(ticks)}"); }
//批量删除 protected void btnDelete_Click(object sender, EventArgs e) { int sucCount = 0; int errorCount = 0; var bll = new AppInfoService(); for (int i = 0; i < rptList.Items.Count; i++) { int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value); CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId"); if (cb.Checked) { if (bll.Delete(id)) { sucCount += 1; } else { errorCount += 1; } } } //bool isAgent = false; //BLL.wx_agent_info aBll = new BLL.wx_agent_info(); //Model.manager adminEntity = GetAdminInfo(); //取得管理员信息 //Model.wx_agent_info agent = new Model.wx_agent_info(); //if (adminEntity.agentLevel > 0) //{ // isAgent = true; // agent = aBll.GetAgentModel(adminEntity.id); //} //if (isAgent && agent != null) //{ // //如果为代理商,则将起微帐号数量减掉 // agent.wcodeNum -= sucCount; // aBll.Update(agent); //} AddAdminLog(MXEnums.ActionEnum.Delete.ToString(), "删除微信号信息" + sucCount + "条,失败" + errorCount + "条"); //记录日志 JscriptMsg("删除成功" + sucCount + "条,失败" + errorCount + "条!", Utils.CombUrlTxt("weixin_list.aspx", "id={0}&keywords={1}", this.uid.ToString(), this.keywords), "Success"); }
// traitement principal async Task Run(ILogger logger, Args args) { WebTaskMonitorFactory.MaxConcurrency = args.MaxConcurrency.Value; using (var client = new HighlightClient(args.Url.Value)) { try { var credSrv = new CredentialService(logger); await client.Authenticate(await credSrv.GetCredential(args)); } catch (Exception ex) { throw new UnauthorizedAccessException("Authentication failed", ex); } Exception appInfoServiceException = null; try { var appInfoService = new AppInfoService(logger, client, args); await appInfoService.Run(); } catch (Exception ex) { appInfoServiceException = ex; } Exception auditServiceException = null; try { var auditService = new AuditService(logger, client, args); await auditService.Run(); } catch (Exception ex) { auditServiceException = ex; } if (appInfoServiceException != null || auditServiceException != null) { if (appInfoServiceException == null) { throw auditServiceException; } if (auditServiceException == null) { throw appInfoServiceException; } throw new AggregateException(appInfoServiceException, auditServiceException); } } }
public static async Task <T> RetrieveConfig <T>() where T : SalesforceConfig { var configJson = await AppInfoService.GetConfigurationSettingsAsync(); if (String.IsNullOrWhiteSpace(configJson)) { return(null); } try { return(JsonConvert.DeserializeObject <T>(EncryptionService.Decrypt(configJson))); } catch (Exception) { // couldn't decrypt config... await AppInfoService.ClearConfigurationSettingsAsync(); return(null); } }
protected void Page_Load(object sender, EventArgs e) { bll = new AppInfoService(); this.keywords = MXRequest.GetQueryString("keywords"); this.uid = MyCommFun.RequestInt("id", 0); if (this.uid == 0) { JscriptMsg("传输参数不正确!", "back", "Error"); return; } this.pageSize = GetPageSize(10); //每页数量 if (!Page.IsPostBack) { var mBll = new ManagerInfoService(); var user = mBll.GetModel(uid); lblUserName.Text = "[" + user.UserName + " " + user.RealName + "]"; ChkAdminLevel("wcodemgr", MXEnums.ActionEnum.View.ToString()); //检查权限 RptBind(CombSqlTxt(keywords), "wStatus desc, createDate desc"); } }
public LoginController() { _appInfoService = new AppInfoService(); }
//批量删除 protected void btnDelete_Click(object sender, EventArgs e) { ChkAdminLevel("manager_list", MXEnums.ActionEnum.Delete.ToString()); //检查权限 bool isAgent = false; var aBll = new WXAgentService(new AgentRepository()); var adminEntity = GetAdminInfo(); //取得管理员信息 var agent = new AgentInfo(); if (adminEntity.AgentLevel > 0) { isAgent = true; agent = aBll.GetAgentModel(adminEntity.Id); } var wBll = new AppInfoService(); int sucCount = 0; int errorCount = 0; var bll = new ManagerInfoService(); for (int i = 0; i < rptList.Items.Count; i++) { int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value); CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId"); if (cb.Checked) { int hasNum = wBll.GetUserWxNumCount(id); if (hasNum > 0) { JscriptMsg("该用户已经添加微信号,无法删除!", "back", "Error"); return; } } } for (int i = 0; i < rptList.Items.Count; i++) { int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value); CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId"); if (cb.Checked) { int hasNum = wBll.GetUserWxNumCount(id); if (bll.Delete(id)) { sucCount += 1; } else { errorCount += 1; } } } if (isAgent && agent != null) { //如果为代理商,则将起用户数量减掉 agent.UserNum -= sucCount; aBll.Update(agent); } AddAdminLog(MXEnums.ActionEnum.Delete.ToString(), "删除用户" + sucCount + "条,失败" + errorCount + "条"); //记录日志 JscriptMsg("删除成功" + sucCount + "条,失败" + errorCount + "条!", Utils.CombUrlTxt("manager_list.aspx", "keywords={0}", this.keywords), "Success"); }
public AboutController(AppInfoService appInfoService) { _appInfoService = appInfoService; }
public async Task SaveConfigAsync() { String configJson = JsonConvert.SerializeObject(this); await AppInfoService.SaveConfigurationSettingsAsync(configJson); }
public InfoCommand(ILogger <InfoCommand> logger, IEnumerable <IIdentifierParser> parsers, AppInfoService infoService) { _parsers = parsers?.ToList() ?? new List <IIdentifierParser>(); _logger = logger; _infoService = infoService; }
public static async Task <bool> HasSmartStore(Account account) { var path = DBOpenHelper.GetOpenHelper(account).DatabaseFile; return(await AppInfoService.DoesFileExistAsync(path)); }
//批量删除 protected void btnDelete_Click(object sender, EventArgs e) { ChkAdminLevel("manager_list", MXEnums.ActionEnum.Delete.ToString()); //检查权限 bool isAgent = false; var aBll = new WXAgentService(new AgentRepository()); var adminEntity = GetAdminInfo(); //取得管理员信息 var agent = new AgentInfo(); if (adminEntity.AgentLevel > 0) { isAgent = true; agent = aBll.GetAgentModel(adminEntity.Id); } var wBll = new AppInfoService(); int sucCount = 0; int errorCount = 0; var bll = new ManagerInfoService(); for (int i = 0; i < rptList.Items.Count; i++) { int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value); CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId"); if (cb.Checked) { int hasNum = wBll.GetUserWxNumCount(id); if (hasNum > 0) { JscriptMsg("该用户已经添加微信号,无法删除!", "back", "Error"); return; } } } for (int i = 0; i < rptList.Items.Count; i++) { int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value); CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId"); if (cb.Checked) { int hasNum = wBll.GetUserWxNumCount(id); if (bll.Delete(id)) { sucCount += 1; } else { errorCount += 1; } } } if (isAgent && agent!=null) { //如果为代理商,则将起用户数量减掉 agent.UserNum -= sucCount; aBll.Update(agent); } AddAdminLog(MXEnums.ActionEnum.Delete.ToString(), "删除用户" + sucCount + "条,失败" + errorCount + "条"); //记录日志 JscriptMsg("删除成功" + sucCount + "条,失败" + errorCount + "条!", Utils.CombUrlTxt("manager_list.aspx", "keywords={0}", this.keywords), "Success"); }