Example #1
0
    private void Retrieve()
    {
        t02_usuario t02 = new t02_usuario();
        {
            t02.t02_cd_usuario = GridView1.SelectedValue.ToString();
            t02.Retrieve();
            if (t02.Found)
            {
                this.txtnm_nome.Text = t02.nm_nome;
                this.txtnm_email.Text = t02.nm_email;
                this.txtnm_cargo.Text = t02.nm_cargo;
                txtnm_cpf.Text = t02.nm_cpf;
                if (t02.nu_telefone.ToString().Length == 10)
                {
                    this.txtnu_dddt.Text = t02.nu_telefone.ToString().Substring(0, 2);
                    this.txtnu_telefone.Text = t02.nu_telefone.ToString().Substring(2, 8);
                }
                if (t02.nu_celular.ToString().Length == 10)
                {
                    this.txtnu_celular.Text = t02.nu_celular.ToString().Substring(2, 8);
                    this.txtnu_dddc.Text = t02.nu_celular.ToString().Substring(0, 2);
                }

                //Response.Write(String.Format("t02.t05_cd_parceiro = {0}, t02.t01_cd_entidade={1}<br>", t02.t05_cd_parceiro, t02.t01_cd_entidade));

                if (t02.t05_cd_parceiro > 0)
                {
                    cblt25_cd_perfil.Items.FindByValue("1").Enabled = false;
                    cblt25_cd_perfil.Items.FindByValue("2").Enabled = false;

                   DropDownList ddl = ddlt05_cd_parceiro;
                    t05_parceiro t05 = new t05_parceiro();
                    {
                        t05.t05_cd_parceiro = t02.t05_cd_parceiro;
                        t05.Retrieve();
                        if (t05.Found)
                        {
                            t05.order = "order by nm_parceiro";
                            //t05.t01_cd_entidade = pb.cd_entidade();
                            ddl.DataSource = t05.List();
                            ddl.DataTextField = "nm_parceiro";
                            ddl.DataValueField = "t05_cd_parceiro";
                            ddl.DataBind();
                            pb.AddEmptyItem(ddl, "Selecione");
                        }
                    }

                    trEntidade.Visible = false; trParceiro.Visible = true;
                    this.ddlt05_cd_parceiro.ClearSelection();
                    ListItem li2 = this.ddlt05_cd_parceiro.Items.FindByValue(t02.t05_cd_parceiro.ToString());
                    if (li2 != null)
                        li2.Selected = true;
                }
                else
                {
                    cblt25_cd_perfil.Items.FindByValue("1").Enabled = true;
                    cblt25_cd_perfil.Items.FindByValue("2").Enabled = true;

                    trEntidade.Visible = true; trParceiro.Visible = false;
                    this.ddlt01_cd_entidade.ClearSelection();
                    ListItem li = this.ddlt01_cd_entidade.Items.FindByValue(t02.t01_cd_entidade.ToString());
                    if (li != null)
                        li.Selected = true;
                }
                //Response.Write(String.Format("trEntidade.Visible = {0}; trParceiro.Visible = {1};", trEntidade.Visible, trParceiro.Visible));
            }

            t26_usuarioperfil t26 = new t26_usuarioperfil();
            {
                t26.t02_cd_usuario = t02.t02_cd_usuario;
                foreach (DataRow dr in t26.List().Tables[0].Rows)
                {
                    ListItem li = cblt25_cd_perfil.Items.FindByValue(dr["t25_cd_perfil"].ToString());
                    if (li != null) li.Selected = true;
                }
            }
        }
    }
Example #2
0
    protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        GridView gv = (GridView)sender;
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            DataRowView drv = ((DataRowView)e.Row.DataItem);
            t26_usuarioperfil t26 = new t26_usuarioperfil();
            {
                t26.t02_cd_usuario = drv["t02_cd_usuario"].ToString();
                foreach (DataRow dr in t26.List().Tables[0].Rows)
                {
                    e.Row.Cells[9].Controls.Add(pb.GetLiteral("- " + dr["nm_perfil"].ToString() + "<br />"));
                }
            }
            t01_entidade t01 = new t01_entidade();
            {
                t01.t01_cd_entidade = (int)drv["t01_cd_entidade"];
                t01.Retrieve();
                if (!t01.Found)
                {
                    t05_parceiro t05 = new t05_parceiro();
                    {
                        t05.t05_cd_parceiro = (int)drv["t05_cd_parceiro"];
                        t05.Retrieve();
                        if (t05.Found)
                        {
                            t01.t01_cd_entidade = t05.t01_cd_entidade;
                            t01.Retrieve();
                            if (t01.Found)
                            {
                                if (pb.fl_admin())
                                {
                                    e.Row.Cells[8].Controls.Add(pb.GetLiteral(t01.nm_entidade + "\\" + t05.nm_parceiro));
                                }
                                else
                                {
                                    e.Row.Cells[8].Controls.Add(pb.GetLiteral(t05.nm_parceiro));
                                }
                            }
                        }
                    }
                }
            }

            if ((Int64)drv["nu_telefone"] == 0)
                e.Row.Cells[5].Text = "-";

            if ((Int64)drv["nu_celular"] == 0)
                e.Row.Cells[6].Text = "-";
        }
    }