예제 #1
0
        protected void btnGuardar_Click(object sender, EventArgs e)
        {
            try
            {
                articuloTDA = (ArticuloTDA)Session["sellerSelect"];
                existenciaTDA = (ExistenciaTDA)Session["sellerSelect"];
                if (articuloTDA == null && existenciaTDA == null)
                {
                    articuloTDA = new ArticuloTDA();
                    existenciaTDA = new ExistenciaTDA();
                    articuloTDA.Description = txtDescripcion.Text;
                    articuloTDA.Reference = txtReferencia.Text;
                    articuloTDA.Color = txtColor.Text;
                    articuloTDA.Weight = Int16.Parse(txtPeso.Text);
                    articuloTDA.Value = Int16.Parse(txtValor.Text);
                    articuloTDA.Type = Int16.Parse(ddlTipo.SelectedValue.ToString());
                    existenciaTDA.Month = DateTime.Now.Month;
                    existenciaTDA.Year = DateTime.Now.Year;
                    existenciaTDA.Cant = Int16.Parse(txtCantidad.Text);
                    int codigo = dba.executeUpdate(articuloTDA.buildNonQuery(Record.NON_QUERY_INSERT));
                    existenciaTDA.Article = codigo;
                    int codigo1 = dba.executeUpdate(existenciaTDA.buildNonQuery(Record.NON_QUERY_INSERT));
                    articuloTDA.Code = codigo;
                    existenciaTDA.Code = codigo1;
                }
                else
                {
                    articuloTDA.Description = txtDescripcion.Text;
                    articuloTDA.Reference = txtReferencia.Text;
                    articuloTDA.Color = txtColor.Text;
                    articuloTDA.Weight = Int16.Parse(txtPeso.Text);
                    articuloTDA.Value = Int16.Parse(txtValor.Text);
                    articuloTDA.Type = Int16.Parse(ddlTipo.SelectedValue.ToString());
                    dba.executeUpdate(articuloTDA.buildNonQuery(Record.NON_QUERY_UPDATE));
                    existenciaTDA.Month = DateTime.Now.Month;
                    existenciaTDA.Year = DateTime.Now.Year;
                    existenciaTDA.Cant = Int16.Parse(txtCantidad.Text);
                    dba.executeUpdate(existenciaTDA.buildNonQuery(Record.NON_QUERY_UPDATE));
                }
                Session["Page_Load_Seller"] = false;
                Response.Redirect(Constants.NAV_RULE_LISTA_ARTICULO);
            }
            catch (Exception error)
            {
                lblError.Text = "Se presento un error no controlado [" + error + "].";
                lblError.Visible = true;

            }
        }
예제 #2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         dba = DataBaseAccess.getInstance();
         List<Object[]> listTemp = dba.executeQuery("select codigo, descripcion from dbo.tblTipoArticulo");
         Object[] temp;
         ddlTipo.Items.Clear();
         for (int i = 0; i < listTemp.Count; i++)
         {
             temp = listTemp.ElementAt(i);
             ddlTipo.Items.Add(new ListItem(temp[1].ToString(), temp[0].ToString()));
         }
         lblError.Text = "";
         lblError.Visible = false;
         //se carga la informacion de la persona
         articuloTDA = (ArticuloTDA)Session["sellerSelect"];
         if (articuloTDA != null && !(bool)Session["Page_Load_Seller"])
         {
             txtCodigo.Text = articuloTDA.Code + "";
             txtDescripcion.Text = articuloTDA.Description;
             //ddlRol.SelectedItem.Value = usuarioTDA.Rol;
             Session["Page_Load_Seller"] = true;
         }
     }
     catch (Exception error)
     {
         lblError.Text = "Se presento un error no controlado [" + error + "].";
         lblError.Visible = true;
     }
 }