Exemplo n.º 1
0
        protected void btnGuardar_Click(object sender, EventArgs e)
        {
            try
            {
                DTO.Region region = new DTO.Region();
                region.Region_ID = Convert.ToInt32(txtID.Text);
                region.Nombre    = txtNombre.Text;

                if (region.Create())
                {
                    ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert('Guardado con exito.');", true);
                }
                else
                {
                    ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert('Error.');", true);
                }
            }
            catch (Exception ex)
            {
                txtNombre.Text = ex.Message;
            }
        }
Exemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["admin"] == null)
            {
                FormsAuthentication.SignOut();
                Response.Redirect("~/web/Login/Default.aspx");
            }
            if (!IsPostBack)
            {
                DTO.Region region = new DTO.Region();

                if (region.ReadAll())
                {
                    foreach (var tmp in region.Coleccion)
                    {
                        ddlComuna.Items.Add(new ListItem()
                        {
                            Text = tmp.Nombre, Value = tmp.Region_ID.ToString()
                        });
                    }
                }
            }
        }