public void WhenTheAPIHeaderIs(string header) { string[] api_header = header.Split(','); for (int i = 0; i < api_header.Length; i++) { if (api_header[i].Contains("x-req-id")) { string RRN = ContextPage.GetInstance().Get_RRN(); string res = (Convert.ToDouble(RRN) + 1).ToString(); string act_res = ""; int count = 0; while (act_res.Length != 12) { if (count == (12 - res.Length)) { act_res += res; } else { act_res += "0"; } count++; } api_header[i] = "x-req-id:" + act_res; ContextPage.GetInstance().Set_RRN(act_res); break; } } context.Set_Api_header(api_header); }
////For Taking Screenshot public static void TakeScreenshot() { try { string FeatureName = ContextPage.GetInstance().GetExcelRecord().FeatureName; string savelocation = Configuration.GetInstance().GetByKey("ScreenshotFolderPath") + FeatureName + DateTime.Now.ToString("yyyyMMdd") + "/"; if (!Directory.Exists(savelocation)) { Directory.CreateDirectory(savelocation); } //ITakesScreenshot ssdriver = ContextPage.Driver as ITakesScreenshot; //Screenshot screenshot = ssdriver.GetScreenshot(); //string fileName = ContextPage.GetInstance().GetExcelRecord().ScenarioName + ".png"; //screenshot.SaveAsFile(savelocation + fileName, ScreenshotImageFormat.Png); Rectangle bounds = Screen.GetBounds(Point.Empty); using (Bitmap bitmap = new Bitmap(bounds.Width, bounds.Height)) { using (Graphics g = Graphics.FromImage(bitmap)) { g.CopyFromScreen(Point.Empty, Point.Empty, bounds.Size); } string fileName = ContextPage.GetInstance().GetExcelRecord().ScenarioName + DateTime.Now.ToString("yyyyMMdd_HHmmss") + ".png"; bitmap.Save(savelocation + fileName, ImageFormat.Png); } } catch (Exception exception) { throw new AssertFailedException(exception.Message); } }
public ProdutoOrdemController(ContexDataService db, IHttpContextAccessor httpContext) { this.produtoData = new ProdutoData(db); this.produtoOrdemData = new ProdutoOrdemData(db); this.ItemlistaPrecoData = new ItemListaPrecoData(db); this.contexto = new ContextPage().ExtractContext(httpContext); }
public static Guid BalcaoVendasCreate(BalcaoVendasViewModel entrada, ContextPage contexto, IBalcaoVendasData balcaoData) { entrada.balcaoVendas.codigo = AutoNumber.GeraCodigo(31, contexto.idOrganizacao); entrada.balcaoVendas.statusBalcaoVendas = CustomEnumStatus.StatusBalcaoVendas.Fechado; if (entrada.cliente != null) { entrada.balcaoVendas.idCliente = entrada.cliente.id; } if (entrada.balcaoVendas.codigo != null) { ////************ Objetos de controle de acesso *************** entrada.balcaoVendas.criadoEm = DateTime.Now; entrada.balcaoVendas.criadoPor = contexto.idUsuario; entrada.balcaoVendas.criadoPorName = contexto.nomeUsuario; entrada.balcaoVendas.modificadoEm = DateTime.Now; entrada.balcaoVendas.modificadoPor = contexto.idUsuario; entrada.balcaoVendas.modificadoPorName = contexto.nomeUsuario; entrada.balcaoVendas.idOrganizacao = contexto.idOrganizacao; ////************ FIM Objetos de controle de acesso *************** //Grava objeto na base balcaoData.Add(entrada.balcaoVendas); } return(entrada.balcaoVendas.id); }
public async void DeletePerson(object parameter) { if (await ContextPage.DisplayAlert("Löschen", "Soll diese Person wirklich gelöscht werden?", "Ja", "Nein")) { Personenliste.Remove(parameter as Model.Person); } }
public ProfissionalController(ContexDataService db, IHttpContextAccessor httpContext, SqlGenericData _sqlData) { this.profissionalData = new ProfissionalData(db); // this.contexto = new ContextPage(httpContext.HttpContext.Session.GetString("email"), httpContext.HttpContext.Session.GetString("organizacao")); this.contexto = new ContextPage().ExtractContext(httpContext); this.sqlData = _sqlData; }
public EnderecoController(ContexDataService db, IHttpContextAccessor httpContext) { this.enderecoData = new EnderecoData(db); this.Sqlservice = new SqlGenericData(); // this.contexto = new ContextPage(httpContext.HttpContext.Session.GetString("email"), httpContext.HttpContext.Session.GetString("organizacao")); this.contexto = new ContextPage().ExtractContext(httpContext); }
public ListaPrecoController(ContexDataService db, IHttpContextAccessor httpContext) { this.listaPrecoData = new ListaPrecoData(db); // this.contexto = new ContextPage(httpContext.HttpContext.Session.GetString("email"), httpContext.HttpContext.Session.GetString("organizacao")); this.contexto = new ContextPage().ExtractContext(httpContext); }
public static bool PedidoCreate(PedidoViewModel entrada, out Pedido modelo, ContextPage contexto) { modelo = new Pedido(); modelo = entrada.pedido; if (modelo.idCliente != null) { //Gera código do Pedido SqlGeneric sqlservice = new SqlGeneric(); //Associa Cliente modelo.idCliente = entrada.cliente.id; modelo.codigoPedido = sqlservice.RetornaNovaPosicao(4, contexto.idOrganizacao); //************ Objetos de controle de acesso ****************** modelo.criadoEm = DateTime.Now; modelo.criadoPor = contexto.idUsuario; modelo.criadoPorName = contexto.nomeUsuario; modelo.modificadoEm = DateTime.Now; modelo.modificadoPor = contexto.idUsuario; modelo.modificadoPorName = contexto.nomeUsuario; modelo.idOrganizacao = contexto.idOrganizacao; //************ FIM Objetos de controle de acesso *************** return(true); } return(false); }
public void WhenTheBodyIs(string body) { if (body.Contains("{RRN}")) { string RRN = ContextPage.GetInstance().Get_RRN_FetchDBCard(); string res = (Convert.ToDouble(RRN) + 1).ToString(); string act_res = "MB_"; int count = 0; while (act_res.Length != 20) { if (count == (17 - res.Length)) { act_res += res; } else { act_res += "0"; } count++; } body = body.Replace("{RRN}", act_res); act_res = act_res.Replace("MB_", string.Empty); ContextPage.GetInstance().Set_RRN_FetchDBCard(act_res); } if (body.Contains("{CNIC}")) { body = body.Replace("{CNIC}", context.GetCustomerCNIC()); } context.Set_Api_Body(body); }
public ProdutoFornecedorController(ContexDataService db, IHttpContextAccessor httpContext) { this.produtoData = new ProdutoData(db); this.produtoFornecedorData = new ProdutoFornecedorData(db); this.fornecedorData = new FornecedorData(db); this.contexto = new ContextPage().ExtractContext(httpContext); }
public void GivenTheTestCaseTitleIs(string p0) { ExcelRecord record = new ExcelRecord(); record.FeatureName = FeatureContext.Current.FeatureInfo.Title; record.ScenarioName = ScenarioContext.Current.ScenarioInfo.Title + p0; ContextPage.GetInstance().SetExcelRecord(record); }
public ContasReceberController(ContexDataService db, IHttpContextAccessor httpContext, SqlGenericData _sqlData) { this.contasReceberData = new ContasReceberData(db); this.pagamentoData = new PagamentoData(db); this.sqlData = _sqlData; this.contexto = new ContextPage().ExtractContext(httpContext); this.clienteData = new ClienteData(db); this.balcaoVendasData = new BalcaoVendasData(db); }
public PedidoController(ContexDataService db, IHttpContextAccessor httpContext) { this.pedidoData = new PedidoData(db); this.produtoPedidoData = new ProdutoPedidoData(db); this.listaprecoData = new ListaPrecoData(db); // this.contexto = new ContextPage(httpContext.HttpContext.Session.GetString("email"), httpContext.HttpContext.Session.GetString("organizacao")); this.contexto = new ContextPage().ExtractContext(httpContext); this.Sqlservice = new SqlGenericData(); }
public ProdutoController(ContexDataService db, IHttpContextAccessor httpContext, OscaConfig _oscaConfig) { this.produtoData = new ProdutoData(db); this.itemListaPrecoData = new ItemListaPrecoData(db); this.produtoFornecedorData = new ProdutoFornecedorData(db); this.orgConfig = new OrgConfigData(db); this.contexto = new ContextPage().ExtractContext(httpContext); this.oscaConfig = _oscaConfig; }
private async void DeletePerson(object person) { bool result = await ContextPage.DisplayAlert("Löschen", "Soll diese Person wirklich gelöscht werden?", "Ja", "Nein"); if (result) { Datenbank.DeletePerson(person as Person); PersonenListe.Remove(person as Person); } }
public InfoPageViewModel(ContextPage contextPage) { this.dataProvider = new DataProvider(); this.ContextPage = contextPage; this.InfoCollection = new ObservableCollection <Info>(); this.CloseButton = (FileImageSource)ImageSource.FromFile(Constants.Constants.closeButton); this.BackCommand = new Command(BackExecute); this.GetInfo(this.ContextPage); }
public static void afterTestRun() { ExcelWriter.GetInstance().WriteOutputFile(); if (File.Exists("D:/Automation/list.csv")) { ContextPage.GetInstance().getStreamWriter().Close(); } ExcelWriter.GetInstance().WriteOutputFile(); extent.Flush(); }
public OrdemServicoController(SqlGenericData _sqlData, ContexDataService db, IHttpContextAccessor httpContext) { this.sqlData = _sqlData; this.ordemServicoData = new OrdemServicoData(db); this.servicoOrdemData = new ServicoOrdemData(db); this.listaprecoData = new ListaPrecoData(db); this.produtoOrdemData = new ProdutoOrdemData(db); this.contexto = new ContextPage().ExtractContext(httpContext); }
public PedidoRetiradaController(ContexDataService db, IHttpContextAccessor httpContext) { this.modeloData = new PedidoRetiradaData(db); this.clienteData = new ClienteData(db); this.orgConfigData = new OrgConfigData(db); this.organizacaoData = new OrganizacaoData(db); this.Sqlservice = new SqlGenericData(); this.contexto = new ContextPage().ExtractContext(httpContext); this.enderecoData = new EnderecoData(db); }
public void PutFirstPage([NotNull] List <ContextTrack> tracks) { if (_currentPage != -1 || _pages.Any()) { throw new Exception(); } var tr = new ContextPage(); tr.Tracks.AddRange(tracks); _pages.Add(tr); }
private async void DeletePerson(object person) { //Aufruf einer 'MessageBox' und Abfrage der User-Antwort über ContextPage-Property bool result = await ContextPage.DisplayAlert("Löschen", "Soll diese Person wirklich gelöscht werden?", "Ja", "Nein"); if (result) { Datenbank.DeletePerson(person as Person); PersonenListe.Remove(person as Person); } }
public static bool RollbackProdutoBalcao(ProdutoBalcao[] produtosBalcao, ContextPage contexto, IProdutoData produtoData) { foreach (var item in produtosBalcao) { Produto prodBase = produtoData.Get(item.idProduto); prodBase.quantidade = prodBase.quantidade + item.quantidade; produtoData.UpdateQuantity(prodBase); } return(true); }
public UsuarioController(ApplicationDbContext db, IHttpContextAccessor httpContext, UserManager <ApplicationUser> userManager, SignInManager <ApplicationUser> signInManager, ILoggerFactory loggerFactory) { this.usuarioData = new UsuarioData(db); // this.contexto = new ContextPage(httpContext.HttpContext.Session.GetString("email"), httpContext.HttpContext.Session.GetString("organizacao")); _userManager = userManager; _signInManager = signInManager; _logger = loggerFactory.CreateLogger <AccountController>(); sqlData = new SqlGenericData(); this.contexto = new ContextPage().ExtractContext(httpContext); }
public async Task <IActionResult> Login(LoginViewModel model, string returnUrl = null) { ViewData["ReturnUrl"] = returnUrl; //Executa validação se o usuário pertence a empresa SqlGeneric sqlgeneric = new SqlGeneric(); if (sqlgeneric.ConsultaUsuarioEmpresa(model.empresa, model.Email)) { // This doesn't count login failures towards account lockout // To enable password failures to trigger account lockout, set lockoutOnFailure: true var result = await _signInManager.PasswordSignInAsync(model.Email, model.Password, model.RememberMe, lockoutOnFailure : false); if (result.Succeeded) { _logger.LogInformation(1, "User logged in."); ////***********Gerar Contexto para todos controller ******************* HttpContext.Session.SetString("email", model.Email); HttpContext.Session.SetString("organizacao", model.empresa); contexto = new ContextPage(model.Email, model.empresa); HttpContext.Session.SetString("idOrganizacao", contexto.idOrganizacao.ToString()); HttpContext.Session.SetString("idUsuario", contexto.idUsuario.ToString()); HttpContext.Session.SetString("nomeUsuario", contexto.nomeUsuario.ToString()); //***************************************************************************** //Loga acesso do usuario try { sqlgeneric.LogaUsuario(contexto.idOrganizacao.ToString(), contexto.idUsuario.ToString()); } catch (Exception) { } return(RedirectToAction("PainelHome", "Paineis", new { })); } if (result.IsLockedOut) { _logger.LogWarning(2, "User account locked out."); return(View("Lockout")); } else { ModelState.AddModelError(string.Empty, "Tentativa inválida de login."); return(View(model)); } } else { ModelState.AddModelError(string.Empty, "Esse usuário não pertence a essa empresa"); return(View(model)); } }
public BalcaoVendasController(ContexDataService db, IHttpContextAccessor httpContext) { this.balcaoVendasData = new BalcaoVendasData(db); this.listaprecoData = new ListaPrecoData(db); this.clienteData = new ClienteData(db); this.organizacaoData = new OrganizacaoData(db); this.orgConfigData = new OrgConfigData(db); this.produtoData = new ProdutoData(db); this.contexto = new ContextPage().ExtractContext(httpContext); this.Sqlservice = new SqlGenericData(); this.sqlGeneric = new SqlGeneric(); }
public BalcaoVendasAPIController(SqlGeneric _sqlGeneric, SqlGenericRules _sqlRules, IHttpContextAccessor httpContext, ContexDataService db) { this.balcaoVendasData = new BalcaoVendasData(db); this.contaReceberData = new ContasReceberData(db); this.produtoData = new ProdutoData(db); this.orgConfigData = new OrgConfigData(db); this.sqlServices = _sqlRules; this.sqlGeneric = _sqlGeneric; this.contexto = new ContextPage().ExtractContext(httpContext); this.clienteData = new ClienteData(db); this.orgConfig = this.orgConfigData.Get(this.contexto.idOrganizacao); }
public static ProdutoBalcao MontaCreate(ProdutoBalcao produtoBalcao, ContextPage contexto, Guid idBalcao) { ProdutoBalcao retorno = new ProdutoBalcao(); retorno = produtoBalcao; ////************ Objetos de controle de acesso *************** retorno.idBalcaoVenda = idBalcao; retorno.idOrganizacao = contexto.idOrganizacao; ////************ FIM Objetos de controle de acesso *************** return(retorno); }
private List <ContextTrack> GetPage(int index) { if (index == -1) { throw new Exception("You must call nextPage() first!"); } if (index == 0 && !_pages.Any() && _resolveUrl != null) { var m = _session.Mercury().SendSync(MercuryRequests.ResolveContext(_resolveUrl)); var x = ProtoUtils.JsonToContextPages(JObject.Parse(m)["pages"] as JArray); _pages.AddRange(x); } _resolveUrl = null; if (index < _pages.Count) { var page = _pages[index]; var tracks = ResolvePage(page); page.ClearPageUrl(); page.Tracks.Clear(); page.Tracks.Add(tracks); _pages[index] = page; return(tracks); } else { if (index > _pages.Count) { throw new IndexOutOfRangeException(); } var prev = _pages[index - 1]; if (!prev.HasNextPageUrl) { throw new Exception("Illegal State"); } var nextPageUrl = prev.NextPageUrl; prev.ClearNextPageUrl(); _pages[index - 1] = prev; var tracks = FetchTracks(nextPageUrl); var tr = new ContextPage(); tr.Tracks.AddRange(tracks); _pages.Add(tr); return(tracks); } }
public void AfterScenario() { ExcelRecord rec = ContextPage.GetInstance().GetExcelRecord(); if (!(rec == null)) { if (ScenarioContext.Current.TestError == null && (rec.ExpectedResult == null && rec.ActualResult == null)) { rec.Result = "PASS"; } if (rec.ExpectedResult == null && rec.ActualResult == null && ScenarioContext.Current.TestError != null) { rec.Result = "FAIL"; string error = ScenarioContext.Current.TestError.Message; error = error.Replace(",", " "); error = error.Replace("\n", " "); error = error.Replace("\r\n", " "); error = error.Replace("\r", " "); rec.ErrorMessage = error; } if (rec.ExpectedResult != null && rec.ActualResult != null) { if (rec.ExpectedResult.Equals(rec.ActualResult) && ScenarioContext.Current.TestError == null) { rec.Result = "PASS"; } else { if (ScenarioContext.Current.TestError != null) { rec.Result = "FAIL"; string error = ScenarioContext.Current.TestError.Message; error = error.Replace(",", " "); error = error.Replace("\n", " "); error = error.Replace("\r\n", " "); error = error.Replace("\r", " "); rec.ErrorMessage = error; } } } ContextPage.GetInstance().SetExcelRecord(rec); } ExcelWriter.GetInstance().excelRecord.Add(ContextPage.GetInstance().GetExcelRecord()); //Flyshing Out Contextual Data// //ContextPage.GetInstance().ResetPostData(); //Flyshing Out Contextual Data// }