예제 #1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Session["sIdEmp"] == null)
     {
         Response.Redirect("loginEmpresa.aspx?sit=1&msg=sessaoInvalida");
     }
     if (!IsPostBack)
     {
         if (Request["id"] != null)
         {
             int id = Int32.Parse(Request["id"]);
             servico                 = banco.selectEmpServ(id);
             idServico.Value         = id.ToString();
             Tags.Text               = servico.Tags;
             categoria.SelectedValue = servico.IdCat.ToString();
             precoMedio.Text         = servico.ValorAprox.ToString();
             descricao.Text          = servico.Desc;
             tempo.Text              = servico.TempoAprox;
         }
         else
         {
             idServico.Value = "0";
             servico.Id      = 0;
         }
         categorias = categoriaDAO.selectAllCategorias();
         foreach (var item in categorias)
         {
             categoria.Items.Add(new ListItem()
             {
                 Value = item.Id.ToString(), Text = item.Descricao
             });
         }
     }
 }
예제 #2
0
        protected void deleteServicoEmpresa(int idServico)
        {
            var bancoServico = new EmpresaServicoDAO();
            var servico      = bancoServico.selectEmpServ(idServico);

            if (bancoServico.deleteEmpServ(servico))
            {
                Response.Redirect("gerenciarServicos.aspx?sit=1&msg=desativarServicoSucesso");
            }
            else
            {
                Response.Redirect("gerenciarServicos.aspx?sit=2&msg=desativarServicoErro");
            }
        }