示例#1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            var randow = new Random().Next(1000).ToString();

            this.imgProfile.ImageUrl   = "~/Resources/imguser/" + def + "?id=" + randow;
            this.imgProfileFl.ImageUrl = "~/Resources/imguser/" + def + "?id=" + randow;
            var obj = HttpContext.Current.User.Identity.Name.Split('¬');

            //link1.NavigateUrl = "~/Resources/PoliticsPdf/cer"+ obj[1] +".pdf";
            //link2.NavigateUrl = "~/Resources/PoliticsPdf/cro" + obj[1] + ".pdf";
            //link3.NavigateUrl = "~/Resources/PoliticsPdf/pag" + obj[1] + ".pdf";
            //link4.NavigateUrl = "~/Resources/PoliticsPdf/con" + obj[1] + ".pdf";

            try
            {
                this.lblUser.Text       = "Hola " + obj[0];
                this.lblUserName.Text   = obj[0];
                this.lblNumPartner.Text = "N° Asociado: " + obj[4];
                nombreu = obj[1];
                //datos
                //'10|NUevo|Jedi|19-09-1995|M|[email protected]|phone1|phone2|country|state|city|addres|DNI|234234'

                if (!IsPostBack)
                {
                    BrUser   brUser        = new BrUser();
                    string[] dataPerson    = brUser.GetPersonalInformation(obj[1]).Split('|');
                    string[] dataAditional = brUser.GetAditionalInformation(obj[1]).Split('|');
                    string[] dataBank      = brUser.GetBankInformation(obj[1]).Split('|');
                    string[] dataCoAf      = brUser.GetCoAfiliateInformation(obj[1]).Split('|');

                    txtNameCoAfi.Text             = dataCoAf[0];
                    txtLastNameCoAfi.Text         = dataCoAf[1];
                    txtBirthDayCoAfi.Text         = dataCoAf[2];
                    txtNumberDocCoAfi.Text        = dataCoAf[3];
                    ddlTypeDocCoAfi.SelectedValue = dataCoAf[4];

                    txtUserName.Text = obj[1];
                    ////7 8
                    if (dataAditional.Length > 1)
                    {
                        txtSponsor.Text = dataAditional[0];
                        txtUpline.Text  = dataAditional[1];
                    }
                    //12 13
                    txtTipoDoc.Text = dataPerson[12];
                    txtNumDoc.Text  = dataPerson[13];

                    //1 2
                    txtName.Text     = dataPerson[1];
                    txtLastName.Text = dataPerson[2];
                    txtBirthday.Text = dataPerson[3];
                    rbMen.Checked    = true;
                    if (dataPerson[4] == "F")
                    {
                        rbWoman.Checked = true;
                    }
                    txtEmail.Text   = dataPerson[5];
                    txtPhone.Text   = dataPerson[6];
                    txtPhone2.Text  = dataPerson[7];
                    txtCountry.Text = dataPerson[8];
                    Estadop.Text    = dataPerson[9].ToString().Trim();
                    txtCiudad.Text  = dataPerson[10];
                    txtAddress.Text = dataPerson[11];

                    BrBank   brBank    = new BrBank();
                    string[] arrayBank = brBank.GetData().Split('¬');
                    for (int i = 0; i < arrayBank.Length; i++)
                    {
                        string[] row  = arrayBank[i].Split('|');
                        ListItem item = new ListItem();
                        item.Value = row[0];
                        item.Text  = row[1];
                        ddlBanck.Items.Add(item);
                        item = null;
                        row  = null;
                    }
                    if (dataBank.Length > 1)
                    {
                        ddlBanck.SelectedValue       = dataBank[0];
                        txtNameTitularCuentaBan.Text = dataBank[1];
                        rbCuentaCo.Checked           = true;
                        if (dataBank[2] == "A")
                        {
                            rbCuentaAH.Checked = true;
                        }
                        txtNumCuenta.Text     = dataBank[3];
                        txtNumContr.Text      = dataBank[4];
                        txtBusinessName.Text  = dataBank[5];
                        txtFiscalAddress.Text = dataBank[6];
                    }
                }

                // Imagen de PErfil
                var           rutaImgP = HttpContext.Current.Server.MapPath("~/Resources/imguser");
                DirectoryInfo di1      = new DirectoryInfo(rutaImgP);
                foreach (var fi2 in di1.GetFiles())
                {
                    var archivo = fi2.Name.Split('.');
                    name      = archivo[archivo.Length - 2];
                    extension = "jpg";
                    if (name == nombreu)
                    {
                        def = nombreu + "." + extension;
                    }
                }

                HyperLink itemhl = new HyperLink();
                itemhl.NavigateUrl = "../Resources/imguser/" + def + "?id=" + randow;
                itemhl.Style.Add("display", "inline-block");
                itemhl.Style.Add("margin", "0 auto");
                itemhl.Target = "_blank";

                Image img = new Image();
                img.ImageUrl = "../Resources/imguser/" + def + "?id=" + randow;
                img.Style.Add("width", "150px");
                img.Style.Add("display", "block");
                img.Style.Add("margin", "14px auto");

                Panel div = new Panel();
                div.Style.Add("display", "flex");
                itemhl.Controls.Add(img);
                div.Controls.Add(itemhl);
                panel.Controls.Add(div);


                if (def != "")
                {
                    imgProfile.ImageUrl = "~/Resources/imguser/" + def + "?id=" + randow;
                    imgProfile.Style.Add("width", "40px");
                    imgProfile.Style.Add("height", "40px");
                    imgProfile.Style.Add("margin", "0 auto");
                    imgProfileFl.ImageUrl = "~/Resources/imguser/" + def + "?id=" + randow;
                    imgProfileFl.Style.Add("width", "80px");
                    imgProfileFl.Style.Add("height", "80px");
                    imgProfileFl.Style.Add("margin", "0 auto");
                }
            }
            catch (Exception ex)
            {
                string error = ex.Message;
            }

            Response.Cache.SetCacheability(HttpCacheability.ServerAndNoCache);
            Response.Cache.SetAllowResponseInBrowserHistory(false);
            Response.Cache.SetNoStore();
        }