コード例 #1
0
ファイル: Crear.aspx.cs プロジェクト: lgodoyc/PcFucktorySA
        protected void btnGuardar_Click(object sender, EventArgs e)
        {
            try {
                DTO.Categoria categoria = new DTO.Categoria();
                categoria.Categoria_ID = Convert.ToInt32(txtID.Text);
                categoria.Nombre       = txtNombre.Text;

                if (categoria.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;
            }
        }
コード例 #2
0
ファイル: Crear.aspx.cs プロジェクト: lgodoyc/PcFucktorySA
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Session["admin"] == null)
     {
         FormsAuthentication.SignOut();
         Response.Redirect("~/web/Login/Default.aspx");
     }
     if (!IsPostBack)
     {
         DTO.Categoria categoria = new DTO.Categoria();
         if (categoria.ReadAll())
         {
             foreach (var tmp in categoria.Coleccion)
             {
                 ddlArticulo.Items.Add(new ListItem()
                 {
                     Value = tmp.Categoria_ID.ToString(), Text = tmp.Nombre
                 });
             }
         }
     }
 }