コード例 #1
0
    private void CarregaServico()
    {
        ServicoDB sevDB = new ServicoDB();
        DataSet   ds    = sevDB.SelectAll();

        Function.CarregaDDL(ds, ddlServico, "SEV_CODIGO", "SEV_SERVICO");
    }
コード例 #2
0
    protected void btnAdicionarServico_Click(object sender, EventArgs e)
    {
        try
        {
            Servico servico = new Servico();

            servico.TipoServico = TipoServicoDB.Select(Convert.ToInt64(ddlSubTipoServico.SelectedValue));
            if (Session["ObjEst"] != null)
            {
                servico.Estabelecimento = (Estabelecimento)Session["ObjEst"];
            }

            servico.Nome  = txbNomeServico.Text;
            servico.Preco = Convert.ToDouble(txbValorServico.Text);

            if (ServicoDB.Insert(servico) == 0)
            {
                Session["ObjEst"] = EstabelecimentoDB.Select(servico.Estabelecimento.Codigo);

                txbValorServico.Text = "";
                txbNomeServico.Text  = "";

                Response.Redirect("/editar/meusservicos?n=d");
            }
            else
            {
                Response.Redirect("/editar/meusservicos?n=D");
            }
        }
        catch (Exception exc) { }
    }
コード例 #3
0
        public void BindChartTipoPagamentosByDateHome(int adv, Literal lt, DateTime initialdate, DateTime finaldate)
        {
            StringBuilder str   = new StringBuilder();
            Pagamento     pag   = new Pagamento();
            PagamentoDB   pagDB = new PagamentoDB();
            DataTable     dt    = new DataTable();
            Servico       sev   = new Servico();
            ServicoDB     sevDB = new ServicoDB();

            int totalServico = sevDB.SelectTotalServico();

            dt.Columns.Add("total", typeof(int));
            dt.Columns.Add("tipo", typeof(string));

            for (int j = 1; j <= totalServico; j++)
            {
                sev = sevDB.Select(j);
                if (sev.Descricao != "Outros")
                {
                    double total = pagDB.GetTotalPagamentoByDate(adv, sev.Codigo, initialdate, finaldate);
                    dt.Rows.Add(total, sev.Descricao);
                }
            }

            str.Append(@"<script type=*text/javascript*> google.load( *visualization*, *1*, {packages:[*corechart*]});
                       google.setOnLoadCallback(drawChartServicoPagamentoByMonth);
                       function drawChartServicoPagamentoByMonth() {
        var data = google.visualization.arrayToDataTable([
             ['TipoDespesa', 'quantidade'],
            ");
            for (int i = 0; i <= dt.Rows.Count - 1; i++)
            {
                str.Append("['" + dt.Rows[i]["tipo"].ToString() + "'," + dt.Rows[i]["total"].ToString() + "],");
            }
            str.Append(" ]); ");
            str.Append(" var options = { ");
            str.Append(" is3D: true, ");
            str.Append(" backgroundColor: '#e8f1f4', ");
            str.Append("            chartArea: { left: 40, top: 20, width: '100%', height: '100%' } ");
            str.Append("         }; ");
            str.Append(" var chart = new google.visualization.PieChart(document.getElementById('piechart_ServicoPagamentoByMonth'));");
            str.Append(" chart.draw(data, options);");
            str.Append("}");

            str.Append("</script>");

            lt.Text = str.ToString().Replace('*', '"');
        }
コード例 #4
0
 protected void gdvMeusServicos_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName == "Excluir")
     {
         Servico servico = new Servico();
         servico.Codigo = Convert.ToInt64(e.CommandArgument.ToString());
         if (ServicoDB.Delete(servico) != -2)
         {
             Response.Redirect("/editar/meusservicos?n=z");
         }
         else
         {
             Response.Redirect("/editar/meusservicos?n=Z");
         }
         CarregarGridServicos();
     }
 }
コード例 #5
0
ファイル: PerfilEstab.aspx.cs プロジェクト: neidsonh/Bellaweb
    private void SetPageInfo(Estabelecimento estabelecimento)
    {
        lblEstFantasia.Text = estabelecimento.Fantasia;
        lblRazaoSocial.Text = estabelecimento.RazaoSocial;
        lblEndereco.Text    = estabelecimento.Endereco.Logradouro;
        lblEndNum.Text      = estabelecimento.Endereco.Numero;
        lblBairro.Text      = estabelecimento.Endereco.Bairro;
        lblCep.Text         = estabelecimento.Endereco.Cep;
        lblCidade.Text      = estabelecimento.Endereco.Cidade.Nome;
        lblUf.Text          = estabelecimento.Endereco.Cidade.Estado.Nome;
        lblTelefone.Text    = estabelecimento.Telefone;
        lblCelular.Text     = estabelecimento.Celular;
        lblStatus.Text      = estabelecimento.StatusAtivacao;


        if (estabelecimento.StatusAtivacao == "APROVADO")
        {
            lblStatus.CssClass = "label label-success";
        }
        else if (estabelecimento.StatusAtivacao == "NEGADO")
        {
            lblStatus.CssClass = "label label-danger";
        }
        else if (estabelecimento.StatusAtivacao == "AGUARDANDO")
        {
            lblStatus.CssClass = "label label-info";
        }

        if (estabelecimento.Plus == true)
        {
            lblPlus.CssClass = "label label-success";
            lblPlus.Text     = "ATIVO";
        }
        else
        {
            lblPlus.CssClass = "label label-danger";
            lblPlus.Text     = "DESATIVADO <a href='/editar/plus' class='text-center txt-sabermaisplus'>Saber mais!</a>";
        }

        ViewState["ImagemUrl"] = (estabelecimento.HasImagem()) ? estabelecimento.ImagemUrl : "../assets/img/profile.jpg";

        Dictionary <TipoServico, List <Servico> > map = ServicoDB.MapTipoServicoByEstabelecimento(estabelecimento);

        servicosContainer.Controls.Add(new TipoServicosPanel(map));
    }
コード例 #6
0
        protected void btnSalvar_Click(object sender, EventArgs e)
        {
            try
            {
                Servico ser = new Servico();
                ser.NomeSer = txtNomeSer.Text;
                ser.Preco   = Convert.ToDecimal(txtpreco.Text);

                ServicoDB serDB = new ServicoDB();
                serDB.insert(ser);

                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Registro Inserido com sucesso')", true);
            }
            catch (Exception ex)
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Erro ao inserir Registro, Erro: '" + ex.Message + ")", true);
            }
        }
コード例 #7
0
    public void CarregarGridServicos()
    {
        // CARREGAR GRID MEUS SERVIÇOS
        var     EstabLogado = (Estabelecimento)Session["ObjEst"];
        DataSet ds          = (ServicoDB.SelectByEstabelecimentoDS(EstabLogado));
        int     qtd         = ds.Tables[0].Rows.Count;

        if (qtd > 0)
        {
            gdvMeusServicos.DataSource = ds.Tables[0].DefaultView;
            gdvMeusServicos.DataBind();
            gdvMeusServicos.Visible    = true;
            lblResultMeusServicos.Text = "Foram encontrados " + qtd + " de registros";
        }
        else
        {
            gdvMeusServicos.Visible    = false;
            lblResultMeusServicos.Text = "Não foram encontrados serviços...</br>Adicione novos serviços no menu lateral.";
        }
    }
コード例 #8
0
    private bool InsertPagamento()
    {
        try
        {
            if (Convert.ToDateTime(txtDataPagamento.Text) > DateTime.Today)
            {
                lblMsgAddPagamento.Text = "A data não pode ser maior que hoje";
                divMsgAddPagamento.Attributes["class"] = "alert alert-danger";
            }
            else if (string.IsNullOrWhiteSpace(txtValor.Text))
            {
                lblMsgAddPagamento.Text = "Insira um valor";
                divMsgAddPagamento.Attributes["class"] = "alert alert-danger";
            }
            else if (string.IsNullOrWhiteSpace(txtDataPagamento.Text))
            {
                lblMsgAddPagamento.Text = "Insira uma data";
                divMsgAddPagamento.Attributes["class"] = "alert alert-danger";
            }
            else if (ddlServico.SelectedItem.Text == "Selecione")
            {
                lblMsgAddPagamento.Text = "Selecione um Serviço para o pagamento";
                divMsgAddPagamento.Attributes["class"] = "alert alert-danger";
            }
            else if (ddlServico.SelectedItem.Text == "Outros" && string.IsNullOrWhiteSpace(txtDescricaoServico.Text))
            {
                lblMsgAddPagamento.Text = "Insira uma descrição para o pagamento";
                divMsgAddPagamento.Attributes["class"] = "alert alert-danger";
            }
            else if (ddlServico.SelectedItem.Text == "Processo" && ddlProcesso.SelectedItem.Text == "Selecione")
            {
                lblMsgAddPagamento.Text = "informe de qual processo é o pagamento";
                divMsgAddPagamento.Attributes["class"] = "alert alert-danger";
            }
            else
            {
                Pagamento   pag   = new Pagamento();
                PagamentoDB pagDB = new PagamentoDB();
                Servico     sev   = new Servico();
                ServicoDB   sevDB = new ServicoDB();
                Processo    pro   = new Processo();
                Pessoa      pes   = new Pessoa();
                Advogado    adv   = new Advogado();

                pag.Valor         = Convert.ToDecimal(txtValor.Text);
                pag.DataPagamento = Convert.ToDateTime(txtDataPagamento.Text);
                sev.Codigo        = Convert.ToInt32(ddlServico.SelectedItem.Value);
                pag.Servico       = sev;

                adv.Codigo   = Convert.ToInt32(Session["Advogado"]);
                pag.Advogado = adv;

                pes.Codigo      = Convert.ToInt32(Session["PagamentoCliente"]);
                pag.Pes_cliente = pes;

                if (ddlProcesso.SelectedItem.Text != "Selecione")
                {
                    pro.Codigo   = Convert.ToInt32(ddlProcesso.SelectedItem.Value);
                    pag.Processo = pro;
                }
                if (ddlServico.SelectedItem.Text == "Outros")
                {
                    sev.Descricao = txtDescricaoServico.Text;
                    sevDB.Insert(sev);
                    sev         = sevDB.GetLastId(txtDescricaoServico.Text);
                    pag.Servico = sev;
                }

                if (!pagDB.Insert(pag))
                {
                    //mensagem de falha
                }
                else
                {
                    txtValor.Text           = string.Empty;
                    lblMsgAddPagamento.Text = "Pagamento inserido com secesso";
                    divMsgAddPagamento.Attributes["class"] = "alert alert-success";
                    txtDataPagamento.Text = DateTime.Today.ToString("dd/MM/yyyy");
                    Function.LimpaDDL(ddlProcesso);
                    Function.LimpaDDL(ddlServico);
                    txtDescricaoServico.Enabled = false;
                    ddlProcesso.Enabled         = false;
                }
            }
        }
        catch (FormatException)
        {
            lblMsgAddPagamento.Text = "Data Invalida";
            divMsgAddPagamento.Attributes["class"] = "alert alert-danger";
        }
        return(true);
    }