public string SalvarImagem() { if (this.FileUploadField1.HasFile) { var id_ = IdProduto_.Text; int id; if (int.TryParse(id_, out id)) { using (var repo = new Repositorio()) { if (repo.TryEntity<Produto>(new Especificacao<Produto>(x => x.Id == id))) { var n = RandomString(30); var f = Path.Combine(Server.MapPath("~/resources/images/produtos/small"), n); this.FileUploadField1.PostedFile.SaveAs(f); var p = repo.SelectByKey<Produto>(id); p.Imagem = n; repo.Save(); string path = Request.Url.AbsoluteUri.Remove(Request.Url.AbsoluteUri.IndexOf(Request.Url.AbsolutePath)) + "/resources/images/produtos/small"; return Path.Combine(path, n); } } } } return null; }
private void button1_Click(object sender, EventArgs e) { //using (var ctx = new northwindEntities()) //{ // var clientes = from c in ctx.Customers // select c; // foreach (Customers c in clientes) // { // listBox1.Items.Add(c.CompanyName); // } //} try { using( var ctx = new northwindEntities()) { var _repClientes = new Repositorio<Customers>(ctx); var clientes = _repClientes.GetTodos(); foreach (Customers c in clientes) { listBox1.Items.Add(c.CompanyName); } } } catch (Exception ex) { MessageBox.Show(ex.Message + "\n" + ex.InnerException); } }
private void RefreshGrid() { using (var repo = new Repositorio()) { RefreshGrid(repo); } }
public async Task CarregarPergunta(int enqueteId) { Device.BeginInvokeOnMainThread(() => { Acr.UserDialogs.UserDialogs.Instance.ShowLoading("Carregando"); }); var dbEnquete = new Repositorio<Enquete>(); var _enquete = (await dbEnquete.RetornarTodos()).First(p => p.Id == enqueteId); var ehInteresse = _enquete.Tipo == EnumTipoEnquete.Interesse; if (_enquete.EnqueteRespondida) { Device.BeginInvokeOnMainThread(() => { Acr.UserDialogs.UserDialogs.Instance.HideLoading(); }); await this.Navigation.PushAsync(new PerguntaRespondidaPage((int)_enquete.PerguntaId, _enquete.Imagem, _enquete.UrlVideo, ehInteresse, _enquete.Id, _enquete.UsuarioCriador, _enquete.TemVoucher)); } else { Device.BeginInvokeOnMainThread(() => { Acr.UserDialogs.UserDialogs.Instance.HideLoading(); }); await this.Navigation.PushAsync(new PerguntaPage((int)_enquete.PerguntaId, _enquete.Imagem, _enquete.UrlVideo, _enquete.TemVoucher, ehInteresse, _enquete.Id, _enquete.UsuarioCriador)); } }
protected void Page_Load(object sender, EventArgs e) { if (!X.IsAjaxRequest) { if (SegurancaUsuario.ObterUsuario() != null) { /* var child = this.ContentPlaceHolder1.Page.GetType().FullName; if (!child.Contains("login")) { Response.Redirect("~/WebPage/Login.aspx"); return; } */ X.Js.AddScript("$('#liLogin').remove();$('span.t', $('#liGerenciar')).html('Gerenciar Conta').width(100); "); X.Js.AddScript("$('span.t', $('#liSair')).html('Sair').width(50).parent().click(function() { App.direct.SairUsuario(); });"); }else X.Js.AddScript("$('#liGerenciar').remove();$('#liSair').remove();"); string json = ""; using(var repositorio = new Repositorio()) json = TelaUtil.ToJson(repositorio.SelectAll<CategoriaProduto>().Select(x => new { ID = x.Id, Nome = x.Nome })); X.Js.AddScript(string.Format("upCategoria('{0}');", json)); } }
static void Main(string[] args) { var rep = new Repositorio(); var persona = new Persona {Email = "aaaa", Nombre = "yyy", FechaNacimiento = DateTime.Now}; rep.Insertar(persona); var resultado = rep.ObtenerPorId(persona.Id); var resultadoManual = rep.ObtenerPorIdManual(persona.Id); Console.WriteLine(persona.Nombre); Console.WriteLine(resultado.Nombre); try { for (int i = 0; i < 100; i++) { var resultado3 = rep.ObtenerPorNombre<Persona>(null); Console.WriteLine(resultado3.Nombre); } } catch (Exception ex) { Console.WriteLine(ex.Message); } Console.ReadLine(); }
public async Task ValidaLogin() { var autenticado = await this.service.FazerLogin(this.login, this.senha); if (autenticado) { var dbUsuario = new Repositorio<Usuario>(); var _usuarioLogado = App.Current.Properties.ContainsKey("UsuarioLogado") ? App.Current.Properties["UsuarioLogado"] as Usuario : null; var temUsuario = (await dbUsuario.RetornarTodos()).FirstOrDefault(); if (_usuarioLogado != null) await dbUsuario.InserirAsync(_usuarioLogado); temUsuario = (await dbUsuario.RetornarTodos()).FirstOrDefault(); if (temUsuario != null) await dbUsuario.InserirAsync(_usuarioLogado); var dbSession = new Repositorio<ControleSession>(); await dbSession.Inserir(new ControleSession { Logado = true }); if (temUsuario != null) { App.Current.Properties["UsuarioLogado"] = _usuarioLogado; await this.Navigation.PushModalAsync(new MainPage()); } else await Acr.UserDialogs.UserDialogs.Instance.AlertAsync("Erro na gravação do usuário"); } else UserDialogs.Instance.Alert("Dados incorretos!", "Erro", "OK"); }
private async Task InsertEnquetes() { var enquetes = EnqueteMock.MockEnquetes(); var db = new Repositorio<Enquete>(); await db.InserirTodos(enquetes); }
public async Task RetornarAmigos() { var db = new Repositorio<Amigo>(); var amigos = (await db.RetornarTodos()).Distinct(); this.Amigos = new ObservableCollection<Amigo>(amigos.Distinct().OrderBy(x => x.Nome)); }
public ActionResult BuscarUsuario(string login) { string resposta = ""; IRepositorio<Usuario> dbUsuario = new Repositorio<Usuario>(); IRepositorio<Perfil> dbPerfil = new Repositorio<Perfil>(); Usuario usuario = dbUsuario.FindOne(usu => usu.login == login); if (usuario != null) { Perfil perfil = dbPerfil.FindOne(per => per.idPerfil == usuario.idPerfil); resposta = usuario.login; Session["login_usuario"] = usuario.login; Session["id_usuario"] = usuario.idUsuario; Session["nome_perfil"] = perfil.nome; Session["id_perfil"] = perfil.idPerfil; } else { resposta = "Não"; } //if return Json(resposta); }
public JsonResult EnviarNotaFalta(int idMatricula, int idAluno, int idTurma, int idModulo, string campo, string valor) { try { Repositorio<NotaFalta> dbNT = new Repositorio<NotaFalta>(); NotaFalta notaFalta = dbNT.FindOne(x => x.idAluno == idAluno && x.idTurma == idTurma && x.idModulo == idModulo); NotaFalta nt; if (notaFalta == null) { nt = new NotaFalta(); nt.idAluno = idAluno; nt.idTurma = idTurma; nt.idModulo = idModulo; nt.nota1 = null; nt.nota2 = null; nt.qtdFalta = 0; nt.notaFinal = null; } else { nt = notaFalta; } switch (campo) { case "Nota1": nt.nota1 = !string.IsNullOrEmpty(valor) ? Convert.ToDecimal(valor.Replace(".",",")) : (decimal?)null; nt.notaFinal = nt.nota1; break; case "Nota2": nt.nota2 = !string.IsNullOrEmpty(valor) ? Convert.ToDecimal(valor.Replace(".",",")) : (decimal?)null; break; case "Faltas": nt.qtdFalta = Convert.ToInt32(valor); break; } if (notaFalta == null) { dbNT.Adicionar(nt); } else { dbNT.Atualizar(nt); } dbNT.SaveChanges(); //Verifica a situação do aluno var ntFalta = verificaSituacao(idMatricula, idAluno, idTurma, idModulo); return Json(new { notaFalta = ntFalta, success = true }, JsonRequestBehavior.AllowGet); } catch (Exception e) { return Json(new { success = false, message = e.Message }, JsonRequestBehavior.AllowGet); } }
public void ObterTodosTeste() { var repositorio = new Repositorio<Mercadoria, MercadoriaMap>(); List<Mercadoria> lista = repositorio.ObterTodos(); Assert.AreNotEqual(lista.Count,0); }
public TurmaController() { dbTurma = new Repositorio<Turma>(); dbMatriculaTurma = new Repositorio<MatriculaTurma>(); dbMatricula = new Repositorio<Matricula>(); dbTaxa = new Repositorio<Taxa>(); dbCobranca = new Repositorio<Cobranca>(); }
public PagamentoController() { dbAluno = new Repositorio<Aluno>(); dbMatricula = new Repositorio<Matricula>(); dbPessoa = new Repositorio<Pessoa>(); dbCobranca = new Repositorio<Cobranca>(); dbPagamento = new Repositorio<Pagamento>(); conn = new SqlConnection(CONNECTIONSTR); }
public void AdicionarUsuario() { var repositorio = new Repositorio<Permissao, PermissaoMap>(); bool adicionou = false; Endereco endereco = new Endereco() { Cep = "00.111-222", Cidade = "Rio de Janeiro", Complemento = "Ao lado da padaria", Estado = Endereco.Estados.RJ, Id = Guid.NewGuid(), Logradouro = "Rua 1", Numero = "0123" }; List<Telefone> telefones = new List<Telefone>(); telefones.Add(new Telefone() { Ddd = "21", Id = Guid.NewGuid(), Numero = "0123-4523", Tipo = Telefone.TipoDeTelefone.Residencial }); telefones.Add(new Telefone() { Ddd = "11", Id = Guid.NewGuid(), Numero = "9123-4523", Tipo = Telefone.TipoDeTelefone.Celular }); Usuario usuario = new Usuario() { Cpf = "111.222.333-44", DataDeNascimento = DateTime.Now, Email = "*****@*****.**", Endereco = endereco, Id = Guid.NewGuid(), Nome = "Fulano da Silva", Senha = "123Abc", Sexo = Usuario.Sexos.Masculino, Telefones = telefones }; foreach (var permissao in repositorio.ObterTodos()) { if (permissao.Tipo == Permissao.Tipos.Cliente) { permissao.AdicionarUsuario(usuario); adicionou = repositorio.Editar(permissao); } } Assert.IsTrue(adicionou); }
// // GET: /Produto/ public ActionResult Index() { var repoCategorias = new Repositorio<Categoria>(); var categorias = repoCategorias.Todas().ToList().Where(x => x.SubCategorias.Count >0); ViewBag.Categorias = categorias.OrderBy(x => x.Ordem); return View(); }
protected async override void OnAppearing() { base.OnAppearing(); var dbSession = new Repositorio<ControleSession>(); var isLogado = await dbSession.RetornarTodos(); if (isLogado != null && isLogado.Any(c => c.Logado)) await this.Navigation.PushModalAsync(new MainPage()); }
public LancarNotaFaltaController() { dbModulo = new Repositorio<Modulo>(); dbTurma = new Repositorio<Turma>(); dbAluno = new Repositorio<Aluno>(); dbStatus = new Repositorio<Status>(); dbMatricula = new Repositorio<Matricula>(); dbNotaFalta = new Repositorio<NotaFalta>(); dbCurso = new Repositorio<Curso>(); conn = new SqlConnection(CONNECTIONSTR); }
public RelatorioController() { dbAluno = new Repositorio<Aluno>(); dbMatricula = new Repositorio<Matricula>(); dbPessoa = new Repositorio<Pessoa>(); dbTurma = new Repositorio<Turma>(); dbMatriculaTurma = new Repositorio<MatriculaTurma>(); dbFuncionarioEspecializacao = new Repositorio<FuncionarioEspecializacao>(); dbCobranca = new Repositorio<Cobranca>(); conn = new SqlConnection(CONNECTIONSTR); }
public Agendamento Criar() { var repositorio = new Repositorio(); var paciente = repositorio.ObterPacientePeloCPF(cpfPaciente); var medico = repositorio.ObterMedicoPeloCrm(crmMedico); var atendente = repositorio.ObterAtendentePeloCPF(cpfAtendente); return new Agendamento(paciente, medico, atendente); }
private void create_Cliente() { //Cliente new_Cliente = new Cliente(); //new_Cliente.Nome = "Danilo"; //new_Cliente.CPF = "03123213213"; //new_Cliente.Agencia = "2424"; //new_Cliente.Conta = "2424242"; Cliente new_Cliente = (Cliente)this.bindingSource1.Current; new_Cliente.DataCadastro = DateTime.Now; Repositorio<Cliente> model = new Repositorio<Cliente>(); model.Inserir(new_Cliente); }
protected async override void OnAppearing() { base.OnAppearing(); if (App.Current.Properties.ContainsKey("UsuarioLogado")) { var u = App.Current.Properties["UsuarioLogado"] as Usuario; var dbFacebook = new Repositorio<FacebookInfos>(); var dadosFacebook = await dbFacebook.ExisteRegistroFacebook(); // if (dadosFacebook == null || String.IsNullOrEmpty(dadosFacebook.access_token)) // btnCompartilhar.IsVisible = false; } }
public async Task MontaCategoriasFake() { try { var dbCat = new Repositorio<Categoria>(); var lista = await dbCat.RetornarTodos(); this.Categorias = new ObservableCollection<Categoria>(lista.OrderBy(x => x.Nome)); } catch (Exception ex) { Insights.Report(ex); } }
public async Task<List<Categoria>> GetCategorias() { try { var dbCat = new Repositorio<Categoria>(); var lista = await dbCat.RetornarTodos(); return lista.OrderBy(x => x.Nome).ToList(); } catch (Exception ex) { Insights.Report(ex); } return new List<Categoria>(); }
protected async override void OnAppearing() { base.OnAppearing(); var control = new Repositorio<ControleSession>(); var isLogado = (await control.RetornarTodos()).First(); if (!isLogado.ViuTutorial) { if (Device.OS == TargetPlatform.Android) await this.Navigation.PushModalAsync(new TutorialPage_Android()); else await this.Navigation.PushModalAsync(new TutorialPage_iOS()); } }
protected async override void OnAppearing() { base.OnAppearing(); Acr.UserDialogs.UserDialogs.Instance.ShowLoading("Saindo..."); var dbControlSession = new Repositorio<ControleSession>(); var isLogado = (await dbControlSession.RetornarTodos()).FirstOrDefault(); if (isLogado != null) { isLogado.Logado = false; Acr.UserDialogs.UserDialogs.Instance.HideLoading(); this.Navigation.PushModalAsync(new Login_v2Page()); } }
protected void Page_Load(object sender, EventArgs e) { if (!X.IsAjaxRequest) { string path = Request.Url.AbsoluteUri.Remove(Request.Url.AbsoluteUri.IndexOf(Request.Url.AbsolutePath)) + "/resources/images/produtos/small"; var store = this.GridPanel1.GetStore(); using(var repo = new Repositorio()) { var l = repo.SelectAll<Produto>().Select(x => new {Id = x.Id, nome = x.Nome, url = Path.Combine(path, x.Imagem)}); store.DataSource = l; } store.DataBind(); } }
public async Task TrataClique() { Acr.UserDialogs.UserDialogs.Instance.ShowLoading("Importando..."); var service = App.Container.Resolve<ILogin>(); var dbUsuario = new Repositorio<Usuario>(); var _usuario = (await dbUsuario.RetornarTodos()).FirstOrDefault(); if (_usuario != null) { var friends = await DependencyService.Get<IFacebook>().GetAmigos(_usuario.FacebookToken); var dbAmigos = new Repositorio<Amigo>(); var tels = friends.data.Distinct().Select(x => x.id).ToList(); var existemNoServer = await service.RetornarAmigos(tels); var amigos = new List<Amigo>(); if (existemNoServer != null && existemNoServer.Any()) { foreach (var item in existemNoServer.Distinct()) { amigos.Add(new Amigo { Nome = item.Nome, FacebookID = item.FacebookID, UsuarioId = item.Id }); } await dbAmigos.InserirTodos(amigos.Distinct().ToList()); } this.listViewContatos.ItemsSource = (await dbAmigos.RetornarTodos()).Distinct(); var cellTemplate = new DataTemplate(typeof(TextCell)); cellTemplate.SetBinding(TextCell.TextProperty, "Nome"); this.listViewContatos.ItemTemplate = cellTemplate; Acr.UserDialogs.UserDialogs.Instance.HideLoading(); } else Acr.UserDialogs.UserDialogs.Instance.ShowError("Problemas com a autenticação"); }
public async Task<Usuario> AtualizarCategoriasFB(Usuario user) { using (var client = CallAPI.RetornaClientHttp()) { var _json = this.MontaUsuarioMobile2(user); var usuarioJSON = JsonConvert.SerializeObject(_json); response = await client.PostAsJsonAsync(Constants.uriAtualizaCategoriasFB, usuarioJSON); if (response.IsSuccessStatusCode) { var json = await response.Content.ReadAsStringAsync(); var usuario = JsonConvert.DeserializeObject<Usuario>(json); var dbCategoria = new Repositorio<Categoria>(); var cats = string.Empty; foreach (var item in usuario.Categorias) { var cat = await dbCategoria.RetornarPorId(item.Id); cat.UsuarioId = usuario.Id; await dbCategoria.Atualizar(cat); cats += item.Id.ToString() + ';'; } cats = cats.TrimEnd(';'); usuario.CategoriaMobileSelection = cats; var dbFacebook = new Repositorio<FacebookInfos>(); var _token = (await dbFacebook.RetornarTodos()).FirstOrDefault(); if (_token != null) { usuario.FacebookID = _token.user_id; usuario.FacebookToken = _token.access_token; } var dbUsuario = new Repositorio<Usuario>(); await dbUsuario.Atualizar(usuario); return (await dbUsuario.RetornarTodos()).First(); } throw new ArgumentException("Erro Geral"); } }
public ActionResult Edit([Bind(Include = "idPersona,descripcion,departamento,rol")] ingeniero ingeniero) { try { Repositorio<ingeniero> rep = new Repositorio<ingeniero>(); rep.Actualizar(ingeniero); return RedirectToAction("Index"); } catch (Exception ex) { //Construir el string a guardar en la bitácora en caso de error. ViewBag.Error = true; ViewBag.MensajeError = Utilerias.ValorRecurso(Utilerias.ArchivoRecurso.UtilRecursos, "ERROR_INGENIERO_ACTUALIZAR") + ex.Message; } ViewBag.idPersona = new SelectList(db.persona, "id", "nombre", ingeniero.idPersona); return View(ingeniero); }
public ActionResult TrocarQuestao(string codigoAvaliacao, int tipo, int indice, int codQuestao) { List <AvalTemaQuestao> antigas = (List <AvalTemaQuestao>)TempData[$"listaQuestoesAntigas{codigoAvaliacao.ToUpper()}"]; List <AvalTemaQuestao> novas = (List <AvalTemaQuestao>)TempData[$"listaQuestoesNovas{codigoAvaliacao.ToUpper()}"]; List <QuestaoTema> questoesTrocaObjetiva = (List <QuestaoTema>)TempData[$"listaQuestoesPossiveisObj{codigoAvaliacao.ToUpper()}"]; List <QuestaoTema> questoesTrocaDiscursiva = (List <QuestaoTema>)TempData[$"listaQuestoesPossiveisDisc{codigoAvaliacao.ToUpper()}"]; List <int> indices = (List <int>)TempData[$"listaQuestoesIndices{codigoAvaliacao.ToUpper()}"]; List <int> recentes = (List <int>)TempData[$"listaQuestoesRecentes{codigoAvaliacao.ToUpper()}"]; TempData.Keep(); if (!String.IsNullOrWhiteSpace(codigoAvaliacao)) { AvalAcademica acad = AvalAcademica.ListarPorCodigoAvaliacao(codigoAvaliacao); if (acad != null) { List <QuestaoTema> avalQuestTema = acad.Avaliacao.QuestaoTema; QuestaoTema questao = null; if (tipo == TipoQuestao.OBJETIVA) { if (questoesTrocaObjetiva.Count <= 0) { TempData[$"listaQuestoesPossiveisObj{codigoAvaliacao.ToUpper()}"] = Questao.ObterNovasQuestoes(avalQuestTema, tipo); questoesTrocaObjetiva = (List <QuestaoTema>)TempData[$"listaQuestoesPossiveisObj{codigoAvaliacao.ToUpper()}"]; } int random = Sistema.Random.Next(0, questoesTrocaObjetiva.Count); questao = questoesTrocaObjetiva.ElementAtOrDefault(random); } else if (tipo == TipoQuestao.DISCURSIVA) { if (questoesTrocaDiscursiva.Count <= 0) { TempData[$"listaQuestoesPossiveisDisc{codigoAvaliacao.ToUpper()}"] = Questao.ObterNovasQuestoes(avalQuestTema, tipo); questoesTrocaDiscursiva = (List <QuestaoTema>)TempData[$"listaQuestoesPossiveisDisc{codigoAvaliacao.ToUpper()}"]; } int random = Sistema.Random.Next(0, questoesTrocaDiscursiva.Count); questao = questoesTrocaDiscursiva.ElementAtOrDefault(random); } if (questao != null) { if (!indices.Contains(indice)) { AvalTemaQuestao aqtAntiga = (from atq in Repositorio.GetInstance().AvalTemaQuestao where atq.Ano == acad.Ano && atq.Semestre == acad.Semestre && atq.CodTipoAvaliacao == acad.CodTipoAvaliacao && atq.NumIdentificador == acad.NumIdentificador && atq.CodQuestao == codQuestao select atq).FirstOrDefault(); antigas.Add(aqtAntiga); indices.Add(indice); } int index = indices.IndexOf(indice); var atqNova = new AvalTemaQuestao(); atqNova.Ano = acad.Avaliacao.Ano; atqNova.Semestre = acad.Avaliacao.Semestre; atqNova.CodTipoAvaliacao = acad.Avaliacao.CodTipoAvaliacao; atqNova.NumIdentificador = acad.Avaliacao.NumIdentificador; atqNova.QuestaoTema = questao; if (novas.Count > index) { novas.RemoveAt(index); } if (recentes.Count > index) { recentes.RemoveAt(index); } novas.Insert(index, atqNova); recentes.Insert(index, codQuestao); ViewData["Index"] = indice; return(PartialView("_QuestaoConfigurar", questao.Questao)); } } } return(Json(String.Empty)); }
private void ConsultarButton_Click_1(object sender, EventArgs e) { var listado = new List <Usuarios>(); Repositorio <Usuarios> dbe = new Repositorio <Usuarios>(); if (FiltrarFechaCheckBox.Checked == true) { try { if (CriterioTextBox.Text.Trim().Length > 0) { switch (FiltroComboBox.Text) { case "Todo": listado = dbe.GetList(p => true); break; case "Id": int id = Convert.ToInt32(CriterioTextBox.Text); listado = dbe.GetList(p => p.UsuarioId == id); break; case "Nombres": listado = dbe.GetList(p => p.Nombres.Contains(CriterioTextBox.Text)); break; case "Email": listado = dbe.GetList(p => p.Email.Contains(CriterioTextBox.Text)); break; case "Usuario": listado = dbe.GetList(p => p.Usuario.Contains(CriterioTextBox.Text)); break; default: break; } listado = listado.Where(c => c.FechaIngreso.Date >= DesdeDateTimePicker.Value.Date && c.FechaIngreso.Date <= HastaDateTimePicker.Value.Date).ToList(); } else { listado = dbe.GetList(p => true); listado = listado.Where(c => c.FechaIngreso.Date >= DesdeDateTimePicker.Value.Date && c.FechaIngreso.Date <= HastaDateTimePicker.Value.Date).ToList(); } Lista = listado; UsuariosDataGridView.DataSource = Lista; } catch (Exception) { MessageBox.Show("Introdujo un dato incorrecto"); } } else { if (CriterioTextBox.Text.Trim().Length > 0) { switch (FiltroComboBox.Text) { case "Todo": listado = dbe.GetList(p => true); break; case "Id": int id = Convert.ToInt32(CriterioTextBox.Text); listado = dbe.GetList(p => p.UsuarioId == id); break; case "Nombres": listado = dbe.GetList(p => p.Nombres.Contains(CriterioTextBox.Text)); break; case "Email": listado = dbe.GetList(p => p.Email.Contains(CriterioTextBox.Text)); break; case "Usuario": listado = dbe.GetList(p => p.Usuario.Contains(CriterioTextBox.Text)); break; default: break; } } else { listado = dbe.GetList(p => true); } Lista = listado; UsuariosDataGridView.DataSource = Lista; } }
public void GetListTest() { Repositorio <Marcas> db = new Repositorio <Marcas>(); Assert.IsNotNull(db.GetList(p => true)); }
public AutenticarseController() { _repositorio = new Repositorio <Usuario>(); }
public ContaEmailEF() { _rep = new Repositorio <ContaEmail>(); }
private void Get() { var repo = new Repositorio(); var root = repo.Get(); var price = new Price(); switch (cbExchange.Text) { case "BitValor": price = root.ticker_1h.total; break; case "FoxBit": price = root.ticker_1h.exchanges.FOX; break; case "MercadoBitcoin": price = root.ticker_1h.exchanges.MBT; break; case "BitcoinToYou": price = root.ticker_1h.exchanges.B2U; break; default: price = root.ticker_1h.total; break; } var margem = Convert.ToInt32(txMargem.Text); if ((Ultimo != price.last && (Ultimo - price.last > margem || Ultimo - price.last < margem * -1))) { Atualiza = true; if (Ultimo > price.last) { Icon = ToolTipIcon.Warning; } else { Icon = ToolTipIcon.Info; } } else { Atualiza = false; } Message = $@"ÚLTIMO: {price.last.ToString("N")} ANTERIOR: {Ultimo.ToString("N")} MÍN: {price.low.ToString("N")} MÁX: {price.high.ToString("N")} USD COM: {root.rates.USDCBRL.ToString("N")} USD TUR: {root.rates.USDTBRL.ToString("N")}"; if (Atualiza) { Ultimo = price.last; } }
public VisitaEF() { _rep = new Repositorio <Visita>(); _repositorioDapper = new RepositorioDapper <VisitaConsulta>(); }
public int ObtenerCantidadPrimera(int NumeroOP) { OrdenDeProduccion op = Repositorio.getRepositorio().ObtenerOrden(NumeroOP); return(op.ObtenerCantidadPrimera()); }
public ViewResult Formulario(RespostaConvidados resposta) { Repositorio.AdicionarResposta(resposta); return(View("Obrigado", resposta)); }
public int ContabilizarDefecto(string pie, int idDefecto, int NumeroOP) { OrdenDeProduccion op = Repositorio.getRepositorio().ObtenerOrden(NumeroOP); return(op.ContabilizarDefecto(pie, idDefecto)); }
public InternamentoServico() { _repositorio = new Repositorio <Internamento>(); }
public List <HighScore> Post([FromBody] ScoreJogador jogador) { return(Repositorio.TopScoreJogador(jogador)); }
private void Guardarbutton_Click(object sender, EventArgs e) { Repositorio <Ventas> repositorio = new Repositorio <Ventas>(new Contexto()); Ventas venta; bool Paso = false; if (Validar()) { MessageBox.Show("Favor revisar todos los campos!!", "Validación!!", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } venta = LlenaClase(); if (IdNumericUpDown.Value == 0) { if (TipoVentacomboBox.SelectedIndex == 0) { Paso = VentasBLL.Guardar(venta); MessageBox.Show("Guardado!!", "Exito", MessageBoxButtons.OK, MessageBoxIcon.Information); } else if (TipoVentacomboBox.SelectedIndex == 1) { Paso = repositorio.Guardar(venta); MessageBox.Show("Guardado!!", "Exito", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { Repositorio <Ventas> repositorioD = new Repositorio <Ventas>(new Contexto()); int id = Convert.ToInt32(IdNumericUpDown.Value); Ventas ven = repositorioD.Buscar(id); if (ven != null) { Paso = repositorioD.Modificar(venta); MessageBox.Show("Modificado!!", "Exito", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("Id no existe", "Falló", MessageBoxButtons.OK, MessageBoxIcon.Error); } } reciVentas reciVentas = new reciVentas(); reciVentas.Show(); if (Paso) { LimpiaObjetos(); } else { MessageBox.Show("No se pudo guardar!!", "Fallo", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public ViewResult Editar(int id) { _repositorio = new Repositorio <Produto>(); return(View(_repositorio.Get.FirstOrDefault(p => p.idProduto == id))); }
public ObservacaoEF() { _rep = new Repositorio <Observacao>(); }
public MenuUI(Repositorio unRepositorio) { Repo = unRepositorio; InitializeComponent(); }
public static void Venda(int id) { var vendaRep = new Repositorio <Venda>(); vendaRep.Deletar(id); }
public Repositorio InserirFavorito(Repositorio repositorio) { return(_iRepositorioRepository.InserirFavorito(repositorio)); }
public async Task <List <Cidade> > FiltrarAsync(int idEstado) { return(await Repositorio.Filtrar(idEstado)); }
public void InserirBusinessPartner(SAPbobsCOM.Company company, Order pedido, out string messageError) { int addBPNumber = 0; string document = string.Empty; Boolean isCorporate = false; if (pedido.buyer.billing_info.doc_type != null && pedido.buyer.billing_info.doc_type.Equals("CNPJ")) { if (pedido.buyer.billing_info.doc_number != null) { document = pedido.buyer.billing_info.doc_number; isCorporate = true; } } else if (pedido.buyer.billing_info.doc_type != null && pedido.buyer.billing_info.doc_type.Equals("CPF")) { if (pedido.buyer.billing_info.doc_number != null) { document = pedido.buyer.billing_info.doc_number; } } try { CountyDAL countyDAL = new CountyDAL(); this.oCompany = company; int _groupCode = Convert.ToInt32(ConfigurationManager.AppSettings["GroupCode"]); int _splCode = Convert.ToInt32(ConfigurationManager.AppSettings["SlpCode"]); int _QoP = Convert.ToInt32(ConfigurationManager.AppSettings["QoP"]); int groupNum = Convert.ToInt32(ConfigurationManager.AppSettings["GroupNum"]); string indicadorIE = ConfigurationManager.AppSettings["IndicadorIE"]; string indicadorOpConsumidor = ConfigurationManager.AppSettings["IndicadorOpConsumidor"]; string gerente = ConfigurationManager.AppSettings["Gerente"]; int priceList = Convert.ToInt32(ConfigurationManager.AppSettings["PriceList"]); string cardCodePrefix = ConfigurationManager.AppSettings["CardCodePrefix"]; int categoriaCliente = Convert.ToInt32(ConfigurationManager.AppSettings["CategoriaCliente"]); this.log.WriteLogPedido("Inserindo Cliente " + cardCodePrefix + document); BusinessPartners oBusinessPartner = null; oBusinessPartner = (SAPbobsCOM.BusinessPartners)oCompany.GetBusinessObject(BoObjectTypes.oBusinessPartners); BusinessPartners oBusinessPartnerUpdateTest = null; oBusinessPartnerUpdateTest = (SAPbobsCOM.BusinessPartners)oCompany.GetBusinessObject(BoObjectTypes.oBusinessPartners); if (oBusinessPartnerUpdateTest.GetByKey(cardCodePrefix + document)) { oBusinessPartner = oBusinessPartnerUpdateTest; } //Setando campos padrões oBusinessPartner.CardCode = cardCodePrefix + document; oBusinessPartner.CardName = pedido.buyer.first_name + " " + pedido.buyer.last_name; oBusinessPartner.EmailAddress = pedido.buyer.email; oBusinessPartner.CardType = BoCardTypes.cCustomer; oBusinessPartner.GroupCode = _groupCode; oBusinessPartner.SalesPersonCode = _splCode; oBusinessPartner.PayTermsGrpCode = groupNum; oBusinessPartner.PriceListNum = priceList; //oBusinessPartner.CardForeignName = "Teste"; //Setando campos de usuário oBusinessPartner.UserFields.Fields.Item("U_TX_IndIEDest").Value = indicadorIE; oBusinessPartner.UserFields.Fields.Item("U_TX_IndFinal").Value = indicadorOpConsumidor; oBusinessPartner.UserFields.Fields.Item("U_Gerente").Value = gerente; oBusinessPartner.UserFields.Fields.Item("U_CategoriaCliente").Value = gerente; //removendo o +55 if (pedido.buyer.phone != null) { if (pedido.buyer.phone.number != null) { oBusinessPartner.Phone1 = pedido.buyer.phone.number; } } string codMunicipio = string.Empty; Repositorio repositorio = new Repositorio(); Shipments shipment = null; Task <HttpResponseMessage> responseShipment = repositorio.BuscarShipmentById(pedido.shipping.id); if (responseShipment.Result.IsSuccessStatusCode) { var jsonShipment = responseShipment.Result.Content.ReadAsStringAsync().Result; shipment = JsonConvert.DeserializeObject <Shipments>(jsonShipment); if (shipment.receiver_address != null) { codMunicipio = countyDAL.RecuperarCodigoMunicipio(shipment.receiver_address.city.name, this.oCompany); } } //Inserindo endereços //COBRANÇA oBusinessPartner.Addresses.SetCurrentLine(0); oBusinessPartner.Addresses.AddressType = BoAddressType.bo_BillTo; oBusinessPartner.Addresses.AddressName = "COBRANCA"; if (shipment != null) { oBusinessPartner.Addresses.City = shipment.receiver_address.city.name; if (shipment.receiver_address.comment != null && shipment.receiver_address.comment.Length <= 100) { oBusinessPartner.Addresses.BuildingFloorRoom = shipment.receiver_address.comment; } //oBusinessPartner.Addresses.Country = "1058"; if (shipment.receiver_address.neighborhood.name != null) { oBusinessPartner.Addresses.Block = shipment.receiver_address.neighborhood.name; } oBusinessPartner.Addresses.StreetNo = shipment.receiver_address.street_number; oBusinessPartner.Addresses.ZipCode = shipment.receiver_address.zip_code; oBusinessPartner.Addresses.State = shipment.receiver_address.state.id.Substring(3); oBusinessPartner.Addresses.Street = shipment.receiver_address.street_name; oBusinessPartner.Addresses.County = codMunicipio; //oBusinessPartner.Addresses.Country = "br"; } //FATURAMENTO oBusinessPartner.Addresses.SetCurrentLine(1); oBusinessPartner.Addresses.AddressType = BoAddressType.bo_ShipTo; oBusinessPartner.Addresses.AddressName = "FATURAMENTO"; if (shipment != null) { oBusinessPartner.Addresses.City = shipment.receiver_address.city.name; if (shipment.receiver_address.comment != null && shipment.receiver_address.comment.Length <= 100) { oBusinessPartner.Addresses.BuildingFloorRoom = shipment.receiver_address.comment; } //oBusinessPartner.Addresses.Country = "1058"; if (shipment.receiver_address.neighborhood.name != null) { oBusinessPartner.Addresses.Block = shipment.receiver_address.neighborhood.name; } oBusinessPartner.Addresses.StreetNo = shipment.receiver_address.street_number; oBusinessPartner.Addresses.ZipCode = shipment.receiver_address.zip_code; oBusinessPartner.Addresses.State = shipment.receiver_address.state.id.Substring(3); oBusinessPartner.Addresses.Street = shipment.receiver_address.street_name; oBusinessPartner.Addresses.County = codMunicipio; //oBusinessPartner.Addresses.Country = "br"; } #region ENDEREÇO FOR /* * for (int i = 0; i < 2; i++) * { * if (i > 0) * { * oBusinessPartner.Addresses.SetCurrentLine(i); * oBusinessPartner.Addresses.AddressType = BoAddressType.bo_ShipTo; * oBusinessPartner.Addresses.AddressName = "FATURAMENTO"; * } * else * { * oBusinessPartner.Addresses.SetCurrentLine(i); * oBusinessPartner.Addresses.AddressType = BoAddressType.bo_BillTo; * oBusinessPartner.Addresses.AddressName = "COBRANCA"; * * if (!oBusinessPartnerUpdateTest.GetByKey(cardCodePrefix + document)) * { * oBusinessPartner.Addresses.Add(); * } * } * * if (shipment != null) * { * oBusinessPartner.Addresses.City = shipment.receiver_address.city.name; * * if (shipment.receiver_address.comment != null && shipment.receiver_address.comment.Length <= 100) * { * oBusinessPartner.Addresses.BuildingFloorRoom = shipment.receiver_address.comment; * } * * //oBusinessPartner.Addresses.Country = "1058"; * if (shipment.receiver_address.neighborhood.name != null) * { * oBusinessPartner.Addresses.Block = shipment.receiver_address.neighborhood.name; * } * * oBusinessPartner.Addresses.StreetNo = shipment.receiver_address.street_number; * oBusinessPartner.Addresses.ZipCode = shipment.receiver_address.zip_code; * oBusinessPartner.Addresses.State = shipment.receiver_address.state.id.Substring(3); * oBusinessPartner.Addresses.Street = shipment.receiver_address.street_name; * oBusinessPartner.Addresses.County = codMunicipio; * //oBusinessPartner.Addresses.Country = "br"; * } * * }*/ #endregion #region código de endereço antigo /*oBusinessPartner.Addresses.SetCurrentLine(0); * oBusinessPartner.Addresses.AddressName = "COBRANCA"; * oBusinessPartner.Addresses.AddressType = SAPbobsCOM.BoAddressType.bo_BillTo; * * oBusinessPartner.Addresses.Street = endereco.street; * oBusinessPartner.Addresses.Block = endereco.neighborhood; * oBusinessPartner.Addresses.ZipCode = endereco.postalCode; * oBusinessPartner.Addresses.City = endereco.city; * oBusinessPartner.Addresses.Country = "BR"; * oBusinessPartner.Addresses.State = endereco.state; * oBusinessPartner.Addresses.BuildingFloorRoom = endereco.complement; * oBusinessPartner.Addresses.StreetNo = endereco.number; * * oBusinessPartner.Addresses.Add(); * * oBusinessPartner.Addresses.SetCurrentLine(1); * oBusinessPartner.Addresses.AddressName = "FATURAMENTO"; * oBusinessPartner.Addresses.AddressType = SAPbobsCOM.BoAddressType.bo_ShipTo; * * oBusinessPartner.Addresses.Street = endereco.street; * oBusinessPartner.Addresses.Block = endereco.neighborhood; * oBusinessPartner.Addresses.ZipCode = endereco.postalCode; * oBusinessPartner.Addresses.City = endereco.city; * oBusinessPartner.Addresses.Country = "BR"; * oBusinessPartner.Addresses.State = endereco.state; * oBusinessPartner.Addresses.BuildingFloorRoom = endereco.complement; * oBusinessPartner.Addresses.StreetNo = endereco.number;*/ //oBusinessPartner.Addresses.Add(); #endregion oBusinessPartner.BilltoDefault = "COBRANCA"; oBusinessPartner.ShipToDefault = "FATURAMENTO"; BusinessPartners oBusinessPartnerUpdate = null; oBusinessPartnerUpdate = (SAPbobsCOM.BusinessPartners)oCompany.GetBusinessObject(BoObjectTypes.oBusinessPartners); if (oBusinessPartnerUpdate.GetByKey(cardCodePrefix + document)) { addBPNumber = oBusinessPartner.Update(); if (addBPNumber != 0) { messageError = oCompany.GetLastErrorDescription(); this.log.WriteLogTable(oCompany, EnumTipoIntegracao.Cliente, document, cardCodePrefix + document, EnumStatusIntegracao.Erro, messageError); //this.log.WriteLogCliente("InserirBusinessPartner error SAP: " + messageError); } else { messageError = ""; this.log.WriteLogTable(oCompany, EnumTipoIntegracao.Cliente, document, cardCodePrefix + document, EnumStatusIntegracao.Sucesso, "Cliente atualizado com sucesso."); //this.Log.WriteLogCliente("BusinessPartner " + cardCodePrefix + document + " atualizado com sucesso."); System.Runtime.InteropServices.Marshal.ReleaseComObject(oBusinessPartner); System.Runtime.InteropServices.Marshal.ReleaseComObject(oBusinessPartnerUpdate); System.Runtime.InteropServices.Marshal.ReleaseComObject(oBusinessPartnerUpdateTest); } } else { //Setando informações Fiscais //oBusinessPartner.FiscalTaxID.SetCurrentLine(0); if (isCorporate) { oBusinessPartner.FiscalTaxID.TaxId0 = document; } else { oBusinessPartner.FiscalTaxID.TaxId4 = document; oBusinessPartner.FiscalTaxID.TaxId1 = "Isento"; } //oBusinessPartner.FiscalTaxID.Address = "FATURAMENTO"; //oBusinessPartner.FiscalTaxID.Add(); addBPNumber = oBusinessPartner.Add(); if (addBPNumber != 0) { messageError = oCompany.GetLastErrorDescription(); this.log.WriteLogTable(oCompany, EnumTipoIntegracao.Cliente, document, "", EnumStatusIntegracao.Erro, messageError); //Log.WriteLogCliente("InserirBusinessPartner error SAP: " + messageError); } else { string CardCode = oCompany.GetNewObjectKey(); this.log.WriteLogTable(oCompany, EnumTipoIntegracao.Cliente, document, CardCode, EnumStatusIntegracao.Sucesso, "Cliente inserido com sucesso."); //Log.WriteLogCliente("BusinessPartner " + cardCodePrefix +CardCode + " inserido com sucesso."); messageError = ""; } } System.Runtime.InteropServices.Marshal.ReleaseComObject(oBusinessPartner); System.Runtime.InteropServices.Marshal.ReleaseComObject(oBusinessPartnerUpdateTest); System.Runtime.InteropServices.Marshal.ReleaseComObject(oBusinessPartnerUpdate); } catch (Exception e) { this.log.WriteLogTable(oCompany, EnumTipoIntegracao.Cliente, document, "", EnumStatusIntegracao.Erro, e.Message); this.log.WriteLogPedido("InserirBusinessPartner Exception: " + e.Message); throw; } }
public VenueViewModel(ApplicationDbContext db) { InicializarComponenteArchivo(TipoEntidad.venue, db); Escenarios = new Repositorio <Escenario>(db).TraerTodos().OrderBy(x => x.Nombre).ToList(); }
public ActionResult Resultado(string codigo, FormCollection form) { int codPessoaFisica = Usuario.ObterPessoaFisica(Helpers.Sessao.UsuarioMatricula); if (!String.IsNullOrWhiteSpace(codigo)) { AvalAcademica aval = AvalAcademica.ListarPorCodigoAvaliacao(codigo); if (aval.Alunos.SingleOrDefault(a => a.MatrAluno == Sessao.UsuarioMatricula) != null && aval.Avaliacao.AvalPessoaResultado.SingleOrDefault(a => a.CodPessoaFisica == codPessoaFisica) == null) { var avalPessoaResultado = new AvalPessoaResultado(); avalPessoaResultado.CodPessoaFisica = codPessoaFisica; avalPessoaResultado.HoraTermino = DateTime.Now; avalPessoaResultado.QteAcertoObj = 0; double quantidadeObjetiva = 0; foreach (var avaliacaoTema in aval.Avaliacao.AvaliacaoTema) { foreach (var avalTemaQuestao in avaliacaoTema.AvalTemaQuestao) { var avalQuesPessoaResposta = new AvalQuesPessoaResposta(); avalQuesPessoaResposta.CodPessoaFisica = codPessoaFisica; if (avalTemaQuestao.QuestaoTema.Questao.CodTipoQuestao == TipoQuestao.OBJETIVA) { quantidadeObjetiva++; int respAlternativa = -1; string strRespAlternativa = form["rdoResposta" + avalTemaQuestao.QuestaoTema.Questao.CodQuestao]; if (!String.IsNullOrWhiteSpace(strRespAlternativa)) { int.TryParse(strRespAlternativa, out respAlternativa); } avalQuesPessoaResposta.RespAlternativa = respAlternativa; if (avalTemaQuestao.QuestaoTema.Questao.Alternativa.First(q => q.FlagGabarito).CodOrdem == avalQuesPessoaResposta.RespAlternativa) { avalQuesPessoaResposta.RespNota = 10; avalPessoaResultado.QteAcertoObj++; } else { avalQuesPessoaResposta.RespNota = 0; } } else { avalQuesPessoaResposta.RespDiscursiva = form["txtResposta" + avalTemaQuestao.QuestaoTema.Questao.CodQuestao].Trim(); } avalQuesPessoaResposta.RespComentario = !String.IsNullOrWhiteSpace(form["txtComentario" + avalTemaQuestao.QuestaoTema.Questao.CodQuestao]) ? form["txtComentario" + avalTemaQuestao.QuestaoTema.Questao.CodQuestao].Trim() : null; avalTemaQuestao.AvalQuesPessoaResposta.Add(avalQuesPessoaResposta); } } IEnumerable <AvalQuesPessoaResposta> lstAvalQuesPessoaResposta = aval.Avaliacao.PessoaResposta.Where(r => r.CodPessoaFisica == codPessoaFisica); avalPessoaResultado.Nota = lstAvalQuesPessoaResposta.Average(r => r.RespNota); aval.Avaliacao.AvalPessoaResultado.Add(avalPessoaResultado); Repositorio.Commit(); var model = new AvaliacaoResultadoViewModel(); model.Avaliacao = aval.Avaliacao; model.Porcentagem = (avalPessoaResultado.QteAcertoObj.Value / quantidadeObjetiva) * 100; Sessao.Inserir("RealizandoAvaliacao", false); return(View(model)); } return(RedirectToAction("Detalhe", new { codigo = aval.Avaliacao.CodAvaliacao })); } return(RedirectToAction("Index")); }
public ApiGestionarCafeController() { this.repositorio = FabricaRepositorio.crearRepositorio(); }
private void BuscarButton_Click(object sender, EventArgs e) { var lista = new List <Estudiantes>(); Repositorio <Estudiantes> db = new Repositorio <Estudiantes>(); if (FiltrarFechaCheckBox.Checked == true) { try { if (CriterioTextBox.Text.Trim().Length > 0) { switch (FiltroComboBox.Text) { case "Todo": lista = db.GetList(p => true); break; case "Id": int id = Convert.ToInt32(CriterioTextBox.Text); lista = db.GetList(p => p.EstudianteId == id); break; case "Nombre": lista = db.GetList(p => p.Nombres.Contains(CriterioTextBox.Text)); break; case "Balance": double mont = Convert.ToInt32(CriterioTextBox.Text); lista = db.GetList(p => Convert.ToDouble(p.Balance) == mont); break; default: break; } lista = lista.Where(c => c.FechaIngreso.Date >= DesdeDateTimePicker.Value.Date && c.FechaIngreso.Date <= HastaDateTimePicker.Value.Date).ToList(); } else { lista = db.GetList(p => true); lista = lista.Where(c => c.FechaIngreso.Date >= DesdeDateTimePicker.Value.Date && c.FechaIngreso.Date <= HastaDateTimePicker.Value.Date).ToList(); } ConsultaDataGridView.DataSource = null; ConsultaDataGridView.DataSource = lista; } catch (Exception) { MessageBox.Show("Introdujo un dato incorrecto"); } } else { try { if (CriterioTextBox.Text.Trim().Length > 0) { switch (FiltroComboBox.Text) { case "Todo": lista = db.GetList(p => true); break; case "Id": int id = Convert.ToInt32(CriterioTextBox.Text); lista = db.GetList(p => p.EstudianteId == id); break; case "Nombre": lista = db.GetList(p => p.Nombres.Contains(CriterioTextBox.Text)); break; case "Balance": double mont = Convert.ToInt32(CriterioTextBox.Text); lista = db.GetList(p => Convert.ToDouble(p.Balance) == mont); break; default: break; } } else { lista = db.GetList(p => true); } ConsultaDataGridView.DataSource = null; ConsultaDataGridView.DataSource = lista; } catch (Exception) { MessageBox.Show("Introdujo un dato incorrecto"); } } }
public void BuscarTest() { Repositorio <Marcas> db = new Repositorio <Marcas>(); Assert.IsNotNull(db.Buscar(1)); }
public ActionResult Confirmar(FormCollection form) { if (!StringExt.IsNullOrEmpty(form["txtNome"], form["txtCpf"])) { string nome = form["txtNome"].RemoveSpaces(); string cpf = form["txtCpf"].Replace(".", "").Replace("-", ""); Visitante visitante = PessoaFisica.ListarPorCpf(cpf)?.Usuario.FirstOrDefault(u => u.Visitante.FirstOrDefault() != null)?.Visitante.First(); if (visitante == null) { string matricula = $"VIS{Visitante.ProxCodigo.ToString("00000")}"; PessoaFisica pf = PessoaFisica.ListarPorCpf(cpf); if (pf == null) { int codPessoa = Pessoa.Inserir(new Pessoa() { TipoPessoa = "F" }); pf = new PessoaFisica(); pf.CodPessoa = codPessoa; pf.Nome = nome; pf.Cpf = cpf; pf.Categoria.Add(Categoria.ListarPorCodigo(4)); PessoaFisica.Inserir(pf); } var usuario = new Usuario(); usuario.Matricula = matricula; usuario.PessoaFisica = pf; usuario.CodCategoria = Categoria.VISITANTE; string senha = Sistema.GerarSenhaPadrao(usuario); usuario.Senha = Criptografia.RetornarHash(senha); Usuario.Inserir(usuario); visitante = new Visitante(); visitante.Usuario = usuario; Visitante.Inserir(visitante); } if (!String.IsNullOrEmpty(form["txtDtNascimento"]) && !visitante.Usuario.PessoaFisica.DtNascimento.HasValue) { visitante.Usuario.PessoaFisica.DtNascimento = DateTime.Parse(form["txtDtNascimento"], new CultureInfo("pt-BR")); } if (!String.IsNullOrEmpty(form["ddlSexo"]) && String.IsNullOrEmpty(visitante.Usuario.PessoaFisica.Sexo)) { visitante.Usuario.PessoaFisica.Sexo = form["ddlSexo"]; } if (String.IsNullOrEmpty(form["chkDtValidade"])) { visitante.DtValidade = null; } else { visitante.DtValidade = DateTime.Parse(form["txtDtValidade"] + " 23:59:59", new CultureInfo("pt-BR")); } Repositorio.Commit(); return(View(visitante)); } return(RedirectToAction("Cadastrar")); }
public void EliminarTest() { Repositorio <Marcas> db = new Repositorio <Marcas>(); Assert.IsTrue(db.Eliminar(1)); }
public UsuarioController(Repositorio repositorio) { _repositorio = repositorio; }
public ModificacionMonedaUI(Repositorio repositorio) { MonedaSeleccionada = new Moneda(); Repo = repositorio; InitializeComponent(); }
public ActionResult Agendar(string codigo, FormCollection form) { if (Sessao.UsuarioCategoriaCodigo != Categoria.PROFESSOR) { if (Session["UrlReferrer"] != null) { return(Redirect(Session["UrlReferrer"].ToString())); } else { return(RedirectToAction("Index", "Principal")); } } string codTurma = form["ddlTurma"]; string strCodSala = form["ddlSala"]; string data = form["txtData"]; string horaInicio = form["txtHoraInicio"]; string horaTermino = form["txtHoraTermino"]; if (!StringExt.IsNullOrWhiteSpace(codTurma, strCodSala, data, horaInicio, horaTermino)) { AvalAcademica acad = AvalAcademica.ListarPorCodigoAvaliacao(codigo); string matricula = Sessao.UsuarioMatricula; Professor professor = Professor.ListarPorMatricula(matricula); if (acad.CodProfessor == professor.CodProfessor) { // Turma Turma turma = Turma.ListarPorCodigo(codTurma); if (turma != null) { acad.Turma = turma; } // Sala int codSala; int.TryParse(strCodSala, out codSala); Sala sala = Sala.ListarPorCodigo(codSala); if (sala != null) { acad.Sala = sala; } // Data de Aplicacao DateTime dtAplicacao = DateTime.Parse(data + " " + horaInicio, new CultureInfo("pt-BR")); DateTime dtAplicacaoTermino = DateTime.Parse(data + " " + horaTermino, new CultureInfo("pt-BR")); if (dtAplicacao.IsFuture() && dtAplicacaoTermino.IsFuture() && dtAplicacaoTermino > dtAplicacao) { acad.Avaliacao.DtAplicacao = dtAplicacao; acad.Avaliacao.Duracao = Convert.ToInt32((dtAplicacaoTermino - acad.Avaliacao.DtAplicacao.Value).TotalMinutes); } acad.Avaliacao.FlagLiberada = false; Repositorio.Commit(); } } return(RedirectToAction("Agendada", new { codigo = codigo })); }