protected void Page_Load(object sender, EventArgs e) { if (Session["nome"] == null || Session["perfil"] == null) { Response.Redirect("error.aspx"); } else { string perfil = Convert.ToString(Session["perfil"]); if (perfil == "Passageiro") { Sessão usu = (Sessão)Session["nome"]; lblSessao.Text = usu.nome; Context.Items["value"] = usu.id.ToString(); CarregarLiteral(); //hdf.Value = usu.id.ToString(); //lblSessao.Text = Session["nome"].ToString(); } else { Response.Redirect("error.aspx"); } } }
protected void Page_Load(object sender, EventArgs e) { if (Session["nome"] == null || Session["perfil"] == null) { Response.Redirect("error.aspx"); } else { string perfil = Convert.ToString(Session["perfil"]); if (perfil == "Motorista") { Sessão usu = (Sessão)Session["nome"]; lbl.Text = usu.nome; //Context.Items["value"] = usu.id.ToString(); hdf.Value = usu.id.ToString(); //lbl.Text = Session["nome"].ToString(); } else { Response.Redirect("error.aspx"); } } DateTime data = DateTime.Today; DateTime firstDay = new DateTime(data.Year, data.Month, 1); mot_motorista mot = new mot_motorista(); if (data == firstDay) { int publicacoes = 0; mot.Mot_publicacoes = publicacoes; mot_motoristaDB.UpdatePublicacoes(mot); } }
protected void Page_Load(object sender, EventArgs e) { Sessão usu = (Sessão)Session["nome"]; //lblSessao.Text = usu.email; hdf.Value = usu.id.ToString(); }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { if (Session["nome"] != null) { Sessão usu = (Sessão)Session["nome"]; hdf.Value = usu.id.ToString(); DataSet ds = mxc_motorista_tipo_contatoDB.SelectAll(Convert.ToInt32(hdf.Value)); int qtd = ds.Tables[0].Rows.Count; if (qtd != 0) { pBefore.Visible = false; pAfter.Visible = true; } else { pBefore.Visible = true; pAfter.Visible = false; } CarregarDDL(); } } }
public void Update(Sessão s) { DataBase bd = DataBase.GetInstance(); string sql = string.Format("UPDATE Sessao set Filme ={0},Sala={1},Horario='{2}',Lugares={3},PEntrada={4} where Id={5} ;", s.Filme.Id, s.Sala.Id, s.Horario.ToString(), s.LugaresDisponiveis, s.PrecoEntrada, s.Id); SQLiteCommand cmd = new SQLiteCommand(sql); bd.ExecuteNonQuery(cmd); }
public void Create(Sessão s) { DataBase bd = DataBase.GetInstance(); string sql = string.Format("Insert into Sessao(Filme,Sala,Horario,Lugares,PEntrada,Qingresso)VALUES('{0}','{1}','{2}',{3},{4},{5});", s.Filme.Id, s.Sala.Id, s.Horario, s.LugaresDisponiveis, s.PrecoEntrada, 0); SQLiteCommand cmd = new SQLiteCommand(sql); bd.ExecuteNonQuery(cmd); }
public void updateQI(Sessão s) { DataBase bd = DataBase.GetInstance(); string sql = string.Format("UPDATE Sessao set QIngresso ='{0}' where Id='{1}' ;", s.IngressosVendidos1, s.Id); SQLiteCommand cmd = new SQLiteCommand(sql); bd.ExecuteNonQuery(cmd); }
public Sessão Read(int id) { DataBase bd = DataBase.GetInstance(); string sql = string.Format("SELECT * FROM Sessao WHERE Id={0};", id); SQLiteCommand cmd = new SQLiteCommand(sql); DataSet ds = bd.ExecuteQuery(cmd); DataRow dr = ds.Tables[0].Rows[0]; Sessão s = RowToApp(dr); return(s); }
//Abre a Janela de vender ingressos private void btnProximoS_Click(object sender, EventArgs e) { SessaoDAO DAo = new SessaoDAO(); pnSessões.Visible = false; pnFilmes.Visible = true; Sessão s = DAo.Read(int.Parse(dgvSessoes.CurrentRow.Cells[0].Value.ToString())); VenderIngresso V = new VenderIngresso(s); V.StartPosition = FormStartPosition.CenterParent; V.ShowDialog(this); }
//Construtor que recebe uma sessão public VenderIngresso(Sessão s) { InitializeComponent(); sessão = s; Console.WriteLine(s.LugaresDisponiveis); txtCodigoSessão.Text = s.Id.ToString(); txtFilmeNome.Text = s.Filme.Nome; txtTotal.Text = 0.ToString("c"); precoIngreço = s.PrecoEntrada; Quantidade(); LoadDataBase(); Fill(); }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { if (Session["nome"] != null) { Sessão usu = (Sessão)Session["nome"]; //lblSessao.Text = usu.email; hdf.Value = usu.id.ToString(); CampoVazio(); } } ServicesLoad(); }
public Sessão RowToApp(DataRow dr) { FilmeDAO DAOf = new FilmeDAO(); SalaDAO DAOs = new SalaDAO(); Sessão s = new Sessão(); s.Id = int.Parse(dr["Id"].ToString()); s.Filme = DAOf.Read(int.Parse(dr["Filme"].ToString())); s.Sala = DAOs.Read(int.Parse(dr["Sala"].ToString())); s.Horario = dr["Horario"].ToString(); s.LugaresDisponiveis = (int.Parse(dr["Lugares"].ToString())); s.PrecoEntrada = (float.Parse(dr["PEntrada"].ToString())); s.IngressosVendidos1 = (int.Parse(dr["QIngresso"].ToString())); return(s); }
protected void btnEnviar_Click(object sender, EventArgs e) { usu_usuario usu = new usu_usuario(); usu.Usu_email = txtEmail.Text; usu.Usu_senha = Funções.Hash(txtSenha.Text, "SHA512"); DataSet ds = usu_usuarioDB.SelectLOGIN(usu); // mot_motorista mot = new mot_motorista(); if (ds.Tables[0].Rows.Count == 1) { Sessão ses = new Sessão(Convert.ToInt32(ds.Tables[0].Rows[0]["usu_id"].ToString()), ds.Tables[0].Rows[0]["usu_email"].ToString(), ds.Tables[0].Rows[0]["pes_nome"].ToString()); Session["nome"] = ses; Session["perfil"] = ds.Tables[0].Rows[0]["usu_tipo"].ToString(); Session["value"] = ds.Tables[0].Rows[0]["usu_id"].ToString(); string perfil = Convert.ToString(Session["perfil"]); string a = Session["value"].ToString(); switch (perfil) { case "Passageiro": Response.Redirect("homeCliente.aspx"); break; case "Motorista": Response.Redirect("homeMotorista.aspx"); break; case "Administrador": Response.Redirect("allAdmin.aspx"); break; } lbl.Visible = false; } else { Response.Write(""); lbl.Visible = true; lbl.Text = "Erro, verifique os campos acima e tente novamente"; } }
protected void Page_Load(object sender, EventArgs e) { if (Session["nome"] == null || Session["perfil"] == null) { Response.Redirect("error.aspx"); } else { string perfil = Convert.ToString(Session["perfil"]); if (perfil == "Administrador") { Sessão usu = (Sessão)Session["nome"]; lblAdmin.Text = usu.nome; //hdf.Value = usu.id.ToString(); //lblSessao.Text = Session["nome"].ToString(); } else { Response.Redirect("error.aspx"); } } }