public void CarregarVisualizar(string par) { sol_solicitacao usu = new sol_solicitacao(); DataSet ds = som_solicitacaomotoristaDB.Select(Convert.ToInt32(par)); Label1.Text = par; if (ds.Tables[0].Rows.Count == 1) { //Label1.Text = ds.Tables[0].Rows[0]["ser_id"].ToString(); txtOrigem.Text = ds.Tables[0].Rows[0]["sol_origem"].ToString(); txtDestino.Text = ds.Tables[0].Rows[0]["sol_destino"].ToString(); txtDataInicio.Text = String.Format("{0:dd/MM/yyyy}", ds.Tables[0].Rows[0]["sol_datainicio"].ToString()); txtDataFim.Text = String.Format("{0:dd/MM/yyyy}", ds.Tables[0].Rows[0]["sol_datafim"].ToString()); //txtHoraInicio.Text = String.Format("{0:HH:MM}", ds.Tables[0].Rows[0]["sol_datainicio"].ToString()); //txtHoraFim.Text = String.Format("{0:HH:MM}", ds.Tables[0].Rows[0]["sol_datafim"].ToString()); txtPessoas.Text = ds.Tables[0].Rows[0]["sol_qtdpessoas"].ToString(); txtMensagem.Text = ds.Tables[0].Rows[0]["sol_descricao"].ToString(); txtNomeM.Text = ds.Tables[0].Rows[0]["pes_nome"].ToString(); txtProposta.Text = ds.Tables[0].Rows[0]["som_proposta"].ToString(); txtTContato.Text = ds.Tables[0].Rows[0]["tpc_descricao"].ToString(); txtContato.Text = ds.Tables[0].Rows[0]["mxc_descricao"].ToString(); //Label1.Text = ds.Tables[0].Rows[0]["pes_id"].ToString(); } }
protected void btnCadastrar_Click(object sender, EventArgs e) { hdf.Value = Session["value"].ToString(); sol_solicitacao sol = new sol_solicitacao(); sol.Sol_origem = txtOrigem.Text; sol.Sol_destino = txtDestino.Text; sol.Sol_datainicio = Convert.ToDateTime(txtDataInicio.Text); sol.Sol_datainicio = Convert.ToDateTime(txtHoraInicio.Text); sol.Sol_datafim = Convert.ToDateTime(txtDataFim.Text); sol.Sol_datafim = Convert.ToDateTime(txtHoraFim.Text); sol.Sol_qtdpessoas = Convert.ToInt32(txtPessoas.Text); if (cbl.Checked == true) { sol.Sol_private = true; } else { sol.Sol_private = false; } sol.Sol_descricao = txtMensagem.Text; pas_passageiro pas = new pas_passageiro(); DataSet id = new DataSet(); id = usu_usuarioDB.Select(Convert.ToInt32(hdf.Value)); pas.Pas_id = Convert.ToInt32(id.Tables[0].Rows[0][0]); sol.Pas_id = pas; switch (sol_solicitacaoDB.Insert(sol)) { case 0: //Response.Write("<script>alert('Cadastrado com Sucesso');</script>"); ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "openModalSS();", true); txtDestino.Text = null; txtMensagem.Text = null; txtDataInicio.Text = null; txtDataFim.Text = null; txtOrigem.Text = null; txtPessoas.Text = null; break; case -2: //Response.Write("<script>alert('Erro, verifique os campos acima e tente novamente');</script>"); ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "openModalSE();", true); break; } }
public static int Insert(sol_solicitacao sol) { int retorno = 0; try { //Correto IDbConnection objConexao; //Abrir a conexão IDbCommand objCommand; // Criar e executar os comandos string sql = "insert into sol_solicitacao "; sql += "(sol_origem, sol_destino, sol_datainicio, sol_datafim, sol_qtdpessoas, sol_descricao, sol_private, pas_id)"; sql += "values "; sql += "(?sol_origem, ?sol_destino, ?sol_datainicio, ?sol_datafim, ?sol_qtdpessoas, ?sol_descricao, ?sol_private, ?pas_id)"; objConexao = Mapped.Connection(); objCommand = Mapped.Command(sql, objConexao); objCommand.Parameters.Add(Mapped.Parameter("?sol_origem", sol.Sol_origem)); objCommand.Parameters.Add(Mapped.Parameter("?sol_destino", sol.Sol_destino)); objCommand.Parameters.Add(Mapped.Parameter("?sol_datainicio", sol.Sol_datainicio)); objCommand.Parameters.Add(Mapped.Parameter("?sol_datafim", sol.Sol_datafim)); objCommand.Parameters.Add(Mapped.Parameter("?sol_qtdpessoas", sol.Sol_qtdpessoas)); objCommand.Parameters.Add(Mapped.Parameter("?sol_descricao", sol.Sol_descricao)); objCommand.Parameters.Add(Mapped.Parameter("?sol_private", sol.Sol_private)); // Chave estrangeira objCommand.Parameters.Add(Mapped.Parameter("?pas_id", sol.Pas_id.Pas_id)); objCommand.ExecuteNonQuery(); objConexao.Close(); objConexao.Dispose(); objCommand.Dispose(); } catch (Exception) { //erro retorno = -2; } return(retorno); }
public void CarregarVisualizar(string par) { sol_solicitacao usu = new sol_solicitacao(); DataSet ds = ser_servicosDB.SelectDados(Convert.ToInt32(par)); Label1.Text = par; if (ds.Tables[0].Rows.Count == 1) { Label1.Text = ds.Tables[0].Rows[0]["ser_id"].ToString(); txtOrigem.Text = ds.Tables[0].Rows[0]["sol_origem"].ToString(); txtDestino.Text = ds.Tables[0].Rows[0]["sol_destino"].ToString(); txtDataInicio.Text = ds.Tables[0].Rows[0]["sol_datainicio"].ToString(); txtDataFim.Text = ds.Tables[0].Rows[0]["sol_datafim"].ToString(); txtDataInicio.Text = ds.Tables[0].Rows[0]["sol_datainicio"].ToString(); txtDataFim.Text = ds.Tables[0].Rows[0]["sol_datafim"].ToString(); txtPessoas.Text = ds.Tables[0].Rows[0]["sol_qtdpessoas"].ToString(); txtMensagem.Text = ds.Tables[0].Rows[0]["sol_descricao"].ToString(); Label1.Text = ds.Tables[0].Rows[0]["pes_id"].ToString(); } }
protected void btnCadastrar_Click(object sender, EventArgs e) { hdf.Value = Session["value"].ToString(); DataSet codigo = new DataSet(); codigo = mot_motoristaDB.SelectID(Convert.ToInt32(hdf.Value)); // Label1.Text = par; int c = Convert.ToInt32(codigo.Tables[0].Rows[0][0]); sol_solicitacao sol = new sol_solicitacao(); sol.Sol_id = Convert.ToInt32(Label1.Text); mot_motorista mot = new mot_motorista(); mot.Mot_id = c; som_solicitacaomotorista som = new som_solicitacaomotorista(); som.Sol_id = sol; som.Mot_id = mot; som.Som_proposta = Convert.ToDouble(txtProposta.Text); switch (som_solicitacaomotoristaDB.Insert(som)) { case 0: ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "openModalS();", true); txtProposta.Text = null; break; case -2: ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "openModalE();", true); break; } }