Ejemplo n.º 1
0
        public ActionResult Nuevo(DatosPersonalesDTO datosPersonales)
        {
            HttpClient clienteHttp = new HttpClient();

            clienteHttp.BaseAddress = new Uri("http://localhost:5476/");

            var request = clienteHttp.PostAsync("api/DatosPersonales", datosPersonales, new JsonMediaTypeFormatter()).Result;

            try
            {
                if (request.IsSuccessStatusCode)
                {
                    var resultString = request.Content.ReadAsStringAsync().Result;
                    var correcto     = JsonConvert.DeserializeObject <bool>(resultString);

                    if (correcto)
                    {
                        return(RedirectToAction("index"));
                    }
                    return(View(datosPersonales));
                }
            }
            catch (Exception ex)
            {
                log.ErrorFormat("Error: {0}{1}", ex.StackTrace, ex.Message);
                return(View(datosPersonales));
            }
            return(View());
        }
Ejemplo n.º 2
0
        private void CargarGrillaDatosPersonales()
        {
            usuarioentidad = UsuarioBLL.Select(usuarioentidad.CUIT, usuarioentidad.NombreUsuario);

            DatosPersonalesDTO DatosPersonalesDTO = new DatosPersonalesDTO();

            DatosPersonalesDTO.Apellido = usuarioentidad.Apellido;
            DatosPersonalesDTO.Email    = usuarioentidad.Email;
            DatosPersonalesDTO.Nombre   = usuarioentidad.Nombre;

            List <DatosPersonalesDTO> ListaDatosPersonalesDTO = new List <DatosPersonalesDTO>();

            ListaDatosPersonalesDTO.Add(DatosPersonalesDTO);

            grilladedatospersonales.DataSource = ListaDatosPersonalesDTO;

            //Bind data to the GridView control.
            grilladedatospersonales.DataBind();
        }
Ejemplo n.º 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            DireccionesFacturacionDeUsuario.Clear();
            DireccionesEnvioDeUsuario.Clear();
            cargarTipoTel();
            usuarioentidad = (UsuarioEntidad)HttpContext.Current.Session["Usuario"];

            if (usuarioentidad == null)
            {
                Response.Redirect("Home.aspx");
            }

            usuario.Value = usuarioentidad.NombreUsuario;
            clave.Value   = usuarioentidad.Clave;
            clave.Value   = clave.Value.Replace(usuarioentidad.Clave, "*********");

            DatosPersonalesDTO DatosPersonalesDTO = new DatosPersonalesDTO()
            {
                Apellido = usuarioentidad.Apellido,
                Email    = usuarioentidad.Email,
                Nombre   = usuarioentidad.Nombre
            };


            List <DatosPersonalesDTO> ListaDatosPersonalesDTO = new List <DatosPersonalesDTO>();

            ListaDatosPersonalesDTO.Add(DatosPersonalesDTO);
            grilladedatospersonales.DataSource = ListaDatosPersonalesDTO;


            if (!IsPostBack)
            {
                idioma = (LenguajeEntidad)Session["Idioma"];
                if (idioma == null)
                {
                    idioma = new LenguajeEntidad();
                    idioma.DescripcionLenguaje = "es";
                    Session["Idioma"]          = idioma;
                }
                cotizacion = new MonedaEmpresaEntidad();
                cotizacion = (MonedaEmpresaEntidad)Session["Cotizacion"];
                Session.Add("cotizacionAnterior", "");
                grilladedatospersonales.DataBind();
            }
            else
            {
                cotizacion.IdMoneda        = Convert.ToInt16(Master.obtenerValorDropDown());
                Session["Cotizacion"]      = cotizacion;
                idioma.DescripcionLenguaje = Master.obtenerIdiomaCombo();
                Session["Idioma"]          = idioma;
            }
            if (cotizacion != null)
            {
                moneda = _coreMoneda.selectMoneda(cotizacion.IdMoneda);
            }


            TelefonosDelUsuario = UsuarioBLL.SelectTelefonosDeUsuario(usuarioentidad.CUIT, usuarioentidad.NombreUsuario);
            if (TelefonosDelUsuario != null && TelefonosDelUsuario.Count > 0)
            {
                TelefonosDelUsuario = TelefonosDelUsuario.Where(X => X.FecBaja == null).ToList();
            }


            foreach (var tel in TelefonosDelUsuario)
            {
                TelefonoDTO TipodeTelefono = new TelefonoDTO();
                TipodeTelefono.Tipo     = UsuarioBLL.ObtenerTipodeTelefono(tel.miTipoTel.IdTipoTel);
                TipodeTelefono.Telefono = tel.NroTelefono;
                TipodeTelefono.CodArea  = tel.CodArea;
                ListaDeTelefonosDTO.Add(TipodeTelefono);
            }

            grillatelefonos.DataSource = ListaDeTelefonosDTO;

            if (!IsPostBack)
            {
                grillatelefonos.DataBind();
            }

            DireccionesDeUsuario = UsuarioBLL.SelectDireccionesDeUsuarioActuales(usuarioentidad);

            foreach (var item in DireccionesDeUsuario)
            {
                if (item.IdTipoDireccion == 1)
                {
                    DireccionesFacturacionDeUsuario.Add(item);
                }
                else if (item.IdTipoDireccion == 2)
                {
                    DireccionesEnvioDeUsuario.Add(item);
                }
            }

            grilladirecciondefacturacion.DataSource = DireccionesFacturacionDeUsuario;
            if (!IsPostBack)
            {
                grilladirecciondefacturacion.DataBind();
            }

            grilladirecciondeenvio.DataSource = DireccionesEnvioDeUsuario;
            if (!IsPostBack)
            {
                grilladirecciondeenvio.DataBind();
            }

            if (!IsPostBack)
            {
                CargarDropdownProvinciasFact();
                cargarLocalidadesFact();
                CargarDropdownProvinciasEnvio();
                cargarLocalidadesEnvio();
            }

            DropDownList lblIdioma = FindControlFromMaster <DropDownList>("ddlLanguages");

            if (lblIdioma != null)
            {
                lblIdioma.SelectedValue = idioma.DescripcionLenguaje;
            }
            DropDownList lblStatus = FindControlFromMaster <DropDownList>("MonedaDRW");

            if (lblStatus != null)
            {
                if (cotizacion != null)
                {
                    lblStatus.SelectedValue = cotizacion.IdMoneda.ToString();
                }
            }
        }