/// <summary> /// Recupera a data de último acesso do banco ( tarefa = printLogImport ) /// </summary> public DateTime GetLastAccess() { ApplicationParamDAO applicationParamDAO = new ApplicationParamDAO(sqlConnection); ApplicationParam lastAccessParam = applicationParamDAO.GetParam("lastAccess", "printLogImport"); return(DateTime.Parse(lastAccessParam.value)); }
public async Task <string> CreateAsync(ApplicationParam model) { if (model == null) { throw new ArgumentNullException(nameof(model)); } var entity = await _manager.FindByClientIdAsync(model.ClientId); if (entity == null) { // create new entity var newEntity = new OpenIddictEntityFrameworkCoreApplication { ClientId = model.ClientId, DisplayName = model.DisplayName, Type = model.Type }; HandleCustomProperties(model, newEntity); await _manager.CreateAsync(newEntity, model.ClientSecret); return(newEntity.Id); } // update existing entity model.Id = entity.Id; await UpdateAsync(model); return(entity.Id); }
private void btnUpdateParam_Click(object sender, EventArgs e) { ApplicationParam lastAccessParam = applicationParamDAO.GetParam("lastAccess", "copyLogImport"); lastAccessParam.value = "13/03/2010"; applicationParamDAO.SetParam(lastAccessParam); }
protected void Page_Load(Object sender, EventArgs e) { if (!Authentication.IsAuthenticated(Session)) { Response.Redirect("LoginPage.aspx"); } Tenant tenant = (Tenant)Session["tenant"]; if (tenant == null) { EmbedClientScript.ShowErrorMessage(this, "Sessão inválida.", true); return; } int licenseId; Boolean isNumeric = int.TryParse(Request.QueryString["licenseId"], out licenseId); if (!isNumeric) { EmbedClientScript.ShowErrorMessage(this, "Os parâmetros passados para a página não estão em um formato válido.", true); return; } // Abre a conexão com o banco DataAccess dataAccess = DataAccess.Instance; dataAccess.MountConnection(FileResource.MapWebResource(this.Page.Server, "DataAccess.xml"), DatabaseEnum.PrintAccounting); dataAccess.OpenConnection(); ApplicationParamDAO appParamDAO = new ApplicationParamDAO(dataAccess.GetConnection()); ApplicationParam urlParam = appParamDAO.GetParam("url", "webAccounting"); // Fecha a conexão com o banco dataAccess.CloseConnection(); dataAccess = null; if (urlParam == null) { EmbedClientScript.ShowErrorMessage(this, "Falha ao buscar url do sistema no banco.", true); return; } String serviceUrl = urlParam.value + "/JobRoutingService.aspx"; DateTime oneYearFromNow = DateTime.Now.AddYears(1); DateTime expirationDate = new DateTime(oneYearFromNow.Year, oneYearFromNow.Month, oneYearFromNow.Day, 0, 0, 0); this.Response.Clear(); this.Response.ContentType = "application/octet-stream"; this.Response.AddHeader("content-disposition", "attachment; filename=ProductKey.bin"); String licenseKey = LicenseKeyMaker.GenerateKey(serviceUrl, tenant.id, licenseId, expirationDate); Response.Write(licenseKey); this.Response.End(); }
/// <summary> /// Armazena a data de último acesso no banco ( tarefa = printLogImport ) /// </summary> public void SetLastAccess(DateTime date) { ApplicationParamDAO applicationParamDAO = new ApplicationParamDAO(sqlConnection); ApplicationParam lastAccessParam = applicationParamDAO.GetParam("lastAccess", "printLogImport"); lastAccessParam.value = date.ToShortDateString(); applicationParamDAO.SetParam(lastAccessParam); }
private void btnGetParam_Click(object sender, EventArgs e) { infoBox.Text = ""; ApplicationParam lastAccess = applicationParamDAO.GetParam("lastAccess", "copyLogImport"); infoBox.Text = infoBox.Text + lastAccess.name + " " + lastAccess.value + Environment.NewLine; infoBox.Select(0, 1); }
public void SetParam(ApplicationParam param) { ProcedureCall updateAccountingParam = new ProcedureCall("pr_storeAccountingParam", sqlConnection); updateAccountingParam.parameters.Add(new ProcedureParam("@paramId", SqlDbType.Int, 4, param.id)); updateAccountingParam.parameters.Add(new ProcedureParam("@name", SqlDbType.VarChar, 100, param.name)); updateAccountingParam.parameters.Add(new ProcedureParam("@value", SqlDbType.VarChar, 255, param.value)); updateAccountingParam.parameters.Add(new ProcedureParam("@ownerTask", SqlDbType.VarChar, 100, param.ownerTask)); updateAccountingParam.Execute(false); }
public async Task <ServiceResponeCode> UpdateAsync(int id, ApplicationParam entityToUpdate) { var current = _appRepository.GetByIdAsync(id); if (current != null) { await _appRepository.UpdateAsync(id, entityToUpdate); return(ServiceResponeCode.OK); } return(ServiceResponeCode.NOT_FOUND); }
public async Task UpdateAsync(ApplicationParam model) { if (string.IsNullOrWhiteSpace(model.Id)) { throw new InvalidOperationException(nameof(model.Id)); } var entity = await _manager.FindByIdAsync(model.Id); SimpleMapper.Map(model, entity); HandleCustomProperties(model, entity); await _manager.UpdateAsync(entity, model.ClientSecret); }
private static void HandleCustomProperties( ApplicationParam model, OpenIddictEntityFrameworkCoreApplication entity ) { entity.ConsentType = model.RequireConsent ? ConsentTypes.Explicit : ConsentTypes.Implicit; entity.Permissions = JsonSerializer.Serialize(model.Permissions); entity.RedirectUris = JsonSerializer.Serialize(model.RedirectUris); entity.PostLogoutRedirectUris = JsonSerializer.Serialize(model.PostLogoutRedirectUris); entity.Requirements = model.RequirePkce ? JsonSerializer.Serialize(new List <string> { Requirements.Features.ProofKeyForCodeExchange }) : null; }
private Boolean CheckParamMethod(Object param) { ApplicationParam paramToCheck = (ApplicationParam)param; // Verifica se o nome do parametro bate if (paramToCheck.name.ToUpper() != currentParamName.ToUpper()) { return(false); } // Verifica se a tarefa a que ele pertence bate if (paramToCheck.ownerTask.ToUpper() != currentOwnerTask.ToUpper()) { return(false); } return(true); }
public async Task <ServiceResponeCode> CreateAsync(ApplicationParam entityToCreate) { if (entityToCreate.Id != 0) { return(ServiceResponeCode.INVALID); } try { await _appRepository.CreateAsync(entityToCreate); return(ServiceResponeCode.OK); } catch { return(ServiceResponeCode.ERROR); } }
public async Task <List <ApplicationDataset> > GetAppliedCVs(int postId, ApplicationParam param) { Func <IQueryable <Models.Application>, IOrderedQueryable <Models.Application> > order; switch (param.OrderBy) { case "+created": order = a => a.OrderBy(a => a.Created); break; default: order = a => a.OrderByDescending(a => a.Created); break; } IEnumerable <Application> list = await _uow.AppliedCVRepository.Get(filter : a => (a.PostId == postId) && (param.Viewed == null || a.Viewed == param.Viewed), first : param.Limit, offset : param.Offset, orderBy : order, includeProperties : "CV,CV.Employee"); return(_mapper.Map <List <ApplicationDataset> >(list)); }
public async Task <ActionResult <List <ApplicationDataset> > > GetAppliedCVs([FromRoute] int postId, [FromQuery] ApplicationParam param) { return(Ok(await _recruitmentService.GetAppliedCVs(postId, param))); }
public async Task <ActionResult <List <ApplicationDataset> > > GetAllAppliedCVs([FromQuery] ApplicationParam param) { int id = int.Parse(User.FindFirstValue(ClaimTypes.NameIdentifier)); return(Ok(await _recruitmentService.GetAllAppliedCVs(id, param))); }