protected void btnBorrarCiudad_Click(object sender, EventArgs e)
 {
     CheckBox chkBorrar = null;
     IUbicacion bdd = new BusinessLogic();
     UBICACIONGEOGRAFICA ubicacionTodelete = null;
     Ubicacion ubicacionSelected = null;
     List<Ubicacion> ciudades = Session["ciudades"] as List<Ubicacion>;
     List<UBICACIONGEOGRAFICA> regiones = bdd.GetRegiones();
     gridCiudades.Rows.ToList().ForEach(row =>
     {
         chkBorrar = row.FindControl("chkBorrar") as CheckBox;
         if (chkBorrar.Checked)
         {
             ubicacionSelected = ciudades.FirstOrDefault(x => x.Nombre == row.Cells[3].Text);
             ubicacionTodelete = new UBICACIONGEOGRAFICA
             {
                 IDUBICACION = ubicacionSelected.IdUbicacion,
                 NOMBREUBICACION = ubicacionSelected.Nombre,
                 ESBORRADOUBICACION = true,
                 IDPADRE = regiones.FirstOrDefault(x => x.NOMBREUBICACION == ubicacionSelected.Region) != null ? regiones.FirstOrDefault(x => x.NOMBREUBICACION == ubicacionSelected.Region).IDPADRE : null
             }.MarkAsModified();
             bdd.SaveUbicacion(ubicacionTodelete);
         }
     });
 }
Esempio n. 2
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                IUbicacion bdd = new BusinessLogic();
                UBICACIONGEOGRAFICA objUbicacion = null;
                if (Session["paisSeleccionado"] != null)
                {
                    objUbicacion = Session["paisSeleccionado"] as UBICACIONGEOGRAFICA;
                    objUbicacion = objUbicacion.MarkAsModified();
                }
                else
                {
                    objUbicacion = new UBICACIONGEOGRAFICA();
                    objUbicacion.IDUBICACION = Guid.NewGuid();
                    objUbicacion = objUbicacion.MarkAsAdded();
                }

                objUbicacion.NOMBREUBICACION = txtNombre.Text;
                objUbicacion.CATEGORIAUBICACION = Constants.TIPO_UBICACION_PAIS;
                bdd.SaveUbicacion(objUbicacion);
                Response.Redirect("~/ui/MantenimientoUbicacion.aspx");
            }
            catch (Exception ex)
            {
                lblError.Visible = true;
                lblError.Text = ex.Message;
            }
        }
Esempio n. 3
0
 protected void btnSave_Click(object sender, EventArgs e)
 {
     UBICACIONGEOGRAFICA ciudad = null;
     if (Session["ciudadToUpdate"] != null)
     {
         ciudad = Session["ciudadToUpdate"] as UBICACIONGEOGRAFICA;
         ciudad = ciudad.MarkAsModified();
     }
     else
     {
         ciudad = new UBICACIONGEOGRAFICA();
         ciudad.IDUBICACION = Guid.NewGuid();
     }
     IUbicacion bdd = new BusinessLogic();
     ciudad.IDPADRE = new Guid(ddlRegiones.SelectedValue);
     ciudad.NOMBREUBICACION = txtNombre.Text;
     ciudad.CATEGORIAUBICACION = Constants.TIPO_UBICACION_CIUDAD;
     bdd.SaveUbicacion(ciudad);
     Response.Redirect("~/ui/MantenimientoUbicacion.aspx");
 }
Esempio n. 4
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            IUbicacion bdd = new BusinessLogic();
            UBICACIONGEOGRAFICA ubicacion = null;
            if (Session["ubicacionToUpdate"] != null)
            {
                ubicacion = Session["ubicacionToUpdate"] as UBICACIONGEOGRAFICA;
                ubicacion=ubicacion.MarkAsModified();
            }
            else
            {
                ubicacion = new UBICACIONGEOGRAFICA();
                ubicacion.IDUBICACION = Guid.NewGuid();
            }

            ubicacion.NOMBREUBICACION = txtNombre.Text;
            ubicacion.IDPADRE = new Guid(ddlPais.SelectedValue);
            ubicacion.CATEGORIAUBICACION = Constants.TIPO_UBICACION_REGION;
            bdd.SaveUbicacion(ubicacion);
            Response.Redirect("~/ui/MantenimientoUbicacion.aspx");
        }
 protected void btnBorrarRegion_Click(object sender, EventArgs e)
 {
     CheckBox chkBorrar = null;
     List<Ubicacion> regiones = Session["regiones"] as List<Ubicacion>;
     List<UBICACIONGEOGRAFICA> paises = Session["paises"] as List<UBICACIONGEOGRAFICA>;
     UBICACIONGEOGRAFICA ubicacionTodelete = null;
     Ubicacion ubicacionSelected=null;
     IUbicacion bdd = new BusinessLogic();
     gridRegiones.Rows.ToList().ForEach(row =>
     {
         chkBorrar = row.FindControl("chkBorrar") as CheckBox;
         if (chkBorrar.Checked)
         {
             ubicacionSelected=regiones.FirstOrDefault(x => x.Nombre==row.Cells[3].Text);
             ubicacionTodelete = new UBICACIONGEOGRAFICA
             {
                 IDUBICACION = ubicacionSelected.IdUbicacion,
                 NOMBREUBICACION = ubicacionSelected.Nombre,
                 CATEGORIAUBICACION = Constants.TIPO_UBICACION_REGION,
                 ESBORRADOUBICACION = true,
                 IDPADRE = paises.FirstOrDefault(x => x.NOMBREUBICACION == ubicacionSelected.Pais) != null ? paises.FirstOrDefault(x => x.NOMBREUBICACION == ubicacionSelected.Pais).IDPADRE : null
             }.MarkAsModified();
             bdd.SaveUbicacion(ubicacionTodelete);
         }
     });
     Response.Redirect("~/ui/MantenimientoUbicacion.aspx");
 }
 protected void gridRegiones_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     GridViewRow row = null;
     int index = 0;
     Ubicacion regionSelected = null;
     List<Ubicacion> regiones;
     UBICACIONGEOGRAFICA ubicacionToUpdate = null;
     List<UBICACIONGEOGRAFICA> paises = Session["paises"] as List<UBICACIONGEOGRAFICA>;
     Guid? idPais = null;
     if (e.CommandName == Constants.COMMAND_EDITAR)
     {
         index = int.Parse(e.CommandArgument.ToString());
         row = gridRegiones.Rows[index];
         regiones = Session["regiones"] as List<Ubicacion>;
         regionSelected = regiones.FirstOrDefault(x => x.Nombre == row.Cells[3].Text);
         idPais=paises.FirstOrDefault(x => x.NOMBREUBICACION == regionSelected.Pais) != null ? paises.FirstOrDefault(x => x.NOMBREUBICACION == regionSelected.Pais).IDUBICACION : Guid.Empty;
         if (idPais == Guid.Empty) idPais = null;
         ubicacionToUpdate = new UBICACIONGEOGRAFICA
         {
             IDUBICACION = regionSelected.IdUbicacion,
             NOMBREUBICACION = regionSelected.Nombre,
             CATEGORIAUBICACION = Constants.TIPO_UBICACION_REGION,
             IDPADRE = idPais
         }.MarkAsUnchanged();
         Session.Add("ubicacionToUpdate", ubicacionToUpdate);
         Response.Redirect("~/ui/EditarRegion.aspx");
     }
 }
 protected void gridCiudades_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     GridViewRow row = null;
     int index = 0;
     Ubicacion regionSelected = null;
     List<Ubicacion> ciudades;
     UBICACIONGEOGRAFICA ciudadToUpdate = null;
     IUbicacion bdd = new BusinessLogic();
     List<UBICACIONGEOGRAFICA> regiones = null;
     Guid? idRegion = null;
     if (e.CommandName == Constants.COMMAND_EDITAR)
     {
         regiones = bdd.GetRegiones();
         index = int.Parse(e.CommandArgument.ToString());
         row = gridCiudades.Rows[index];
         ciudades = Session["ciudades"] as List<Ubicacion>;
         regionSelected = ciudades.FirstOrDefault(x => x.Nombre == row.Cells[3].Text);
         idRegion = regiones.FirstOrDefault(x => x.NOMBREUBICACION == regionSelected.Region) != null ? regiones.FirstOrDefault(x => x.NOMBREUBICACION == regionSelected.Region).IDUBICACION : Guid.Empty;
         if (idRegion == Guid.Empty) idRegion = null;
         ciudadToUpdate = new UBICACIONGEOGRAFICA
         {
             IDUBICACION = regionSelected.IdUbicacion,
             NOMBREUBICACION = regionSelected.Nombre,
             CATEGORIAUBICACION = Constants.TIPO_UBICACION_CIUDAD,
             IDPADRE = idRegion
         }.MarkAsUnchanged();
         Session.Add("ciudadToUpdate", ciudadToUpdate);
         Response.Redirect("~/ui/EditarCiudad.aspx");
     }
 }
Esempio n. 8
0
        private void FixupUBICACIONGEOGRAFICA(UBICACIONGEOGRAFICA previousValue)
        {
            if (IsDeserializing)
            {
                return;
            }

            if (previousValue != null && previousValue.LABORATORIO.Contains(this))
            {
                previousValue.LABORATORIO.Remove(this);
            }

            if (UBICACIONGEOGRAFICA != null)
            {
                if (!UBICACIONGEOGRAFICA.LABORATORIO.Contains(this))
                {
                    UBICACIONGEOGRAFICA.LABORATORIO.Add(this);
                }

                IDUBICACION = UBICACIONGEOGRAFICA.IDUBICACION;
            }
            if (ChangeTracker.ChangeTrackingEnabled)
            {
                if (ChangeTracker.OriginalValues.ContainsKey("UBICACIONGEOGRAFICA")
                    && (ChangeTracker.OriginalValues["UBICACIONGEOGRAFICA"] == UBICACIONGEOGRAFICA))
                {
                    ChangeTracker.OriginalValues.Remove("UBICACIONGEOGRAFICA");
                }
                else
                {
                    ChangeTracker.RecordOriginalValue("UBICACIONGEOGRAFICA", previousValue);
                }
                if (UBICACIONGEOGRAFICA != null && !UBICACIONGEOGRAFICA.ChangeTracker.ChangeTrackingEnabled)
                {
                    UBICACIONGEOGRAFICA.StartTracking();
                }
            }
        }
Esempio n. 9
0
        private void FixupUBICACIONGEOGRAFICA(UBICACIONGEOGRAFICA previousValue, bool skipKeys = false)
        {
            if (IsDeserializing)
            {
                return;
            }

            if (previousValue != null && previousValue.CORPORACION.Contains(this))
            {
                previousValue.CORPORACION.Remove(this);
            }

            if (UBICACIONGEOGRAFICA != null)
            {
                if (!UBICACIONGEOGRAFICA.CORPORACION.Contains(this))
                {
                    UBICACIONGEOGRAFICA.CORPORACION.Add(this);
                }

                IdUbicacion = UBICACIONGEOGRAFICA.IDUBICACION;
            }
            else if (!skipKeys)
            {
                IdUbicacion = null;
            }

            if (ChangeTracker.ChangeTrackingEnabled)
            {
                if (ChangeTracker.OriginalValues.ContainsKey("UBICACIONGEOGRAFICA")
                    && (ChangeTracker.OriginalValues["UBICACIONGEOGRAFICA"] == UBICACIONGEOGRAFICA))
                {
                    ChangeTracker.OriginalValues.Remove("UBICACIONGEOGRAFICA");
                }
                else
                {
                    ChangeTracker.RecordOriginalValue("UBICACIONGEOGRAFICA", previousValue);
                }
                if (UBICACIONGEOGRAFICA != null && !UBICACIONGEOGRAFICA.ChangeTracker.ChangeTrackingEnabled)
                {
                    UBICACIONGEOGRAFICA.StartTracking();
                }
            }
        }