Example #1
0
        public frmNuevoPack(Pack pack)
        {
            InitializeComponent();

            txtCodigoPack.KeyPress += new KeyPressEventHandler(Utils.Utils.ValidaNumerico);
            txtPrecioPack.KeyPress += new KeyPressEventHandler(Utils.Utils.ValidaNumerico);

            this.txtNombre.Text=pack.Nombre;
            this.dtpFechaInicio.Text=pack.FechaInicio.ToString();
            this.dtpFechaFin.Text=pack.FechaFin.ToString();
            this.txtCodigoPack.Text=pack.CodigoPack;

            this.txtPrecioPack.Text = pack.PrecioPack.ToString();
            this.upDwNumPacks.Value = pack.CantidadPacks;
            this.lblCantidadUtilizada.Text = pack.CantidadUtilizada.ToString();

            //llena los articulos del pack
                List<String> properties = new List<String>();
                List<Object> values = new List<Object>();
                 properties.Add("IdPack");
                 values.Add(pack.Id);

                 listaArtxPack= objArtxPackBL.Filtrar(properties, values);

                 dgvArticulos.Rows.Clear();

                 foreach (ArticuloXPack artxpack in listaArtxPack)
                 {
                     object[] row = { artxpack.Articulo.CodigoArticulo,artxpack.Articulo.Titulo, artxpack.Articulo.Tipo, artxpack.CantidadPack,artxpack.Articulo.PrecioVenta.ToString(),artxpack.Articulo.PrecioVenta*artxpack.CantidadPack };
                     total = total + (float)artxpack.Articulo.PrecioVenta * (float)artxpack.CantidadPack;
                     dgvArticulos.Rows.Add(row);
                 }
                 lblTotal.Text = total.ToString();

            //llena la categoria de los clientes participantes
                llenarCategoriaClientes();

                properties = new List<String>();
                values = new List<Object>();
                properties.Add("IdPack");
                values.Add(pack.Id);

                listaPackxCat = objcatCliente.Filtrar(properties, values);

                    foreach (PackXCategoriaCliente packxcat in listaPackxCat)
                        for (int i = 0; i<chkClientes.Items.Count; i++)
                            if (chkClientes.Items[i].ToString()==packxcat.CategoriaCliente.Descripcion.ToString()) chkClientes.SetItemChecked(i,true);

                deshabilitar();

                this.dgvArticulos.Enabled = false;

            this.pack = pack;
        }
Example #2
0
        public frmNuevoPack()
        {
            //NUEVO PACK
            InitializeComponent();
            txtCodigoPack.KeyPress += new KeyPressEventHandler(Utils.Utils.ValidaNumerico);
            txtPrecioPack.KeyPress += new KeyPressEventHandler(Utils.Utils.ValidaNumerico);

            //Agregamos las categorias
            llenarCategoriaClientes();

            this.btnEditar.Visible = false;

            pack = new Pack();
        }
Example #3
0
        public void Grabar(Pack pack)
        {
            /* if (pack.FechaInicio.Value <= DateTime.Today && pack.FechaFin.Value >= DateTime.Today) pack.Estado = "Activo";
            else pack.Estado = "Inactivo";*/

            if (pack.CantidadUtilizada == pack.CantidadPacks) pack.Estado = "Inactivo";

            if (pack.Id == 0)
            {
                new PackDA().Save(pack);
            }
            else
            {
                new PackDA().Update(pack);
            }
        }
Example #4
0
        public void Update(Pack instance)
        {
            ISession hisession = null;
            try
            {
                hisession = NHibernateHelper.GetCurrentSession();
                hisession.BeginTransaction();
                hisession.Merge(instance);
                hisession.Transaction.Commit();
                hisession.Close();
            }
            catch (Exception ex)
            {
                if (hisession != null)
                {
                    if (hisession.IsOpen)
                    {
                        hisession.Close();

                    }
                }

            }
        }