Exemple #1
0
        private void BindingNavigatorDeleteItem_Click(object sender, EventArgs e)
        {
            //preguntarle al pakito que pex
            //por que no tenia validado esto
            //
            try
            {
                if (Permiso != 1)
                {
                    ClsKit ClKA = new ClsKit();
                    ClKA.IdArticulo = 0;

                    MessageBox.Show("No Tiene los privilegios que le \n Permitan Eliminar Registros", "AVISO", MessageBoxButtons.OK, MessageBoxIcon.Stop);

                    //Borro tabla temporal
                    ClsKit.DeleteartKit(ClKA);

                    //Cargo los datos a la tabla temporal
                    ClKA.IdArticulo  = 0;
                    ClKA.Articulo    = "";
                    ClKA.Descripcion = "";
                    ClKA.Cantidad    = 0;
                    ClKA.PrecioU     = 0;
                    ClsKit.AddArtKit(ClKA, 2, Convert.ToInt32(this.textBox2.Text.Trim()));

                    //Cargo grid
                    ListKit = ClsKit.BuscaArti_Kit(Convert.ToInt32(this.textBox2.Text.Trim()));
                    ultraGrid2.DataSource = ListKit;
                    return;
                }

                DialogResult dr =
                    MessageBox.Show("Estas seguro de borrar el Registro ",
                                    "AVISO", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);

                if (dr == DialogResult.Yes)
                {
                    ClsKit CA = (ClsKit)ClsBindingKit.Current;

                    //CA.Status = 0;
                    //ClsKit.DeleteartKit(CA);
                    ClsKit.DeleteKit(Convert.ToInt32(this.textBox2.Text.Trim()));
                    ClsBindingKit.RemoveCurrent();
                    MessageBox.Show("Registro Eliminado Satisfactoriamente...", "I n f o r m a c i ó n", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                if (ListKit.Count == 0)
                {
                    AccionesNavigator(0);
                }
            }
            catch (Exception Ex) { MessageBox.Show(Ex.Message); }
        }
Exemple #2
0
        private void FrmKit_Load(object sender, EventArgs e)
        {
            //Cargo los datos a la tabla temporal
            ClsKit CK = new ClsKit();

            CK.IdArticulo  = 0;
            CK.Articulo    = "";
            CK.Descripcion = "";
            CK.Cantidad    = 0;
            CK.PrecioU     = 0;

            ClsKit.AddArtKit(CK, 2, Convert.ToInt32(this.textBox2.Text.Trim()));
        }
Exemple #3
0
        private void textBox2_TextChanged(object sender, EventArgs e)
        {
            //Cargo de nuevo el grid
            ultraGrid1.DataBind();

            ListKit = ClsKit.BuscaArti_Kit(Convert.ToInt32(this.textBox2.Text.Trim()));
            ultraGrid2.DataSource = ListKit;


            //Cargo los datos a la tabla temporal
            ClsKit CK = new ClsKit();

            ClsKit.AddArtKit(CK, 2, Convert.ToInt32(this.textBox2.Text.Trim()));
        }
Exemple #4
0
        private void btnAgregar_Click(object sender, EventArgs e)
        {
            ClsKit CK = new ClsKit();

            try
            {
                if (ultraGrid1.Rows.Count == 0)
                {
                    MessageBox.Show("Debe seleccionar articulos para agregar...", "MENSAJE DEL SISTEMA", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }

                foreach (Infragistics.Win.UltraWinGrid.UltraGridRow Rn in ultraGrid1.Rows)
                {
                    if (Rn.Cells[9].Value != "" && Rn.Cells[9].Value != null && Rn.Cells[9].Text != "")
                    {
                        //table.Rows.Add(Rn.Cells[0].Value, Rn.Cells[1].Value, Rn.Cells[2].Value, Rn.Cells[3].Value, Rn.Cells[9].Value);
                        //ClsBindingArti.DataSource = table;

                        CK.IdArticulo  = Convert.ToInt32(Rn.Cells[0].Value);
                        CK.Articulo    = Convert.ToString(Rn.Cells[1].Value);
                        CK.Descripcion = Convert.ToString(Rn.Cells[2].Value);
                        CK.Cantidad    = Convert.ToDouble(Rn.Cells[9].Value);
                        CK.PrecioU     = Convert.ToDouble(Rn.Cells[3].Value);

                        ClsKit.AddArtKit(CK, 1, 0);
                    }
                }

                ListKit = ClsKit.ListArtKit();
                ultraGrid2.DataSource = ListKit;
            }
            catch (Exception EX)
            {
                MessageBox.Show(EX.Message, "AVISO");
            }
        }
Exemple #5
0
        private void BindingNavigatorSaveItem_Click(object sender, EventArgs e)
        {
            try
            {
                if (textBox1.Text.Trim() == "")
                {
                    MessageBox.Show("Falta capturar el nombre del Kit...", "MENSAJE DEL SISTEMA", MessageBoxButtons.OK); this.textBox1.Focus();
                }
                this.BindingNavigator.Focus();
                ClsKit CK = (ClsKit)ClsBindingKit.Current;

                CK.NomKit = this.textBox1.Text.Trim();

                if (CK.IdKit == 0) //Nuevo
                {
                    if (Permiso == 3)
                    {
                        ClsKit ClKA = new ClsKit();
                        ClKA.IdArticulo = 0;

                        MessageBox.Show("No Tiene los privilegios que le \n Permitan Agregar Registros", "AVISO", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                        //Borro tabla temporal
                        ClsKit.DeleteartKit(ClKA);

                        //Cargo los datos a la tabla temporal
                        ClKA.IdArticulo  = 0;
                        ClKA.Articulo    = "";
                        ClKA.Descripcion = "";
                        ClKA.Cantidad    = 0;
                        ClKA.PrecioU     = 0;
                        ClsKit.AddArtKit(ClKA, 2, Convert.ToInt32(this.textBox2.Text.Trim()));

                        ListKit = ClsKit.BuscaArti_Kit(Convert.ToInt32(this.textBox2.Text.Trim()));
                        ultraGrid2.DataSource = ListKit;
                        AccionesNavigator(0);
                        return;
                    }

                    ClsKit.AddKit(CK);
                    ClsKit.AddArti_Kit(CK, 2, 0);
                    MessageBox.Show("Registro agregado Satisfactoriamente...", "I n f o r m a c i ó n", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else //Modificacion
                {
                    if (Permiso != 1)
                    {
                        ClsKit ClKA = new ClsKit();
                        ClKA.IdArticulo = 0;

                        MessageBox.Show("No Tiene los privilegios que le \n Permitan Modificar Registros", "AVISO", MessageBoxButtons.OK, MessageBoxIcon.Stop);

                        //Borro tabla temporal
                        ClsKit.DeleteartKit(ClKA);

                        //Cargo los datos a la tabla temporal
                        ClKA.IdArticulo  = 0;
                        ClKA.Articulo    = "";
                        ClKA.Descripcion = "";
                        ClKA.Cantidad    = 0;
                        ClKA.PrecioU     = 0;
                        ClsKit.AddArtKit(ClKA, 2, Convert.ToInt32(this.textBox2.Text.Trim()));

                        //Cargo grid
                        ListKit = ClsKit.BuscaArti_Kit(Convert.ToInt32(this.textBox2.Text.Trim()));
                        ultraGrid2.DataSource = ListKit;

                        AccionesNavigator(0);
                        return;
                    }

                    ClsKit.UpdateKit(CK.IdKit, this.textBox1.Text.Trim());

                    //foreach (Infragistics.Win.UltraWinGrid.UltraGridRow Rn in ultraGrid2.Rows)
                    //{

                    //    ClsKit.AddNewRowArtKitMan(1, Convert.ToInt32(Rn.Cells[0].Value), Convert.ToString(Rn.Cells[1].Value), Convert.ToString(Rn.Cells[2].Value), Convert.ToInt32(Rn.Cells[3].Value),Convert.ToDouble(Rn.Cells[4].Value));

                    //}


                    ClsKit.AddArti_Kit(CK, 3, Convert.ToInt32(this.textBox2.Text.Trim()));
                    MessageBox.Show("Registro modificado Satisfactoriamente...", "I n f o r m a c i ó n", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }

                textBox2.Enabled = true;

                BKit = ClsKit.BuscaKit(0, 0, "");
                this.ClsBindingKit.DataSource = BKit;
                AccionesNavigator(0);
            }
            catch (Exception EX)
            {
                MessageBox.Show(EX.Message);
            }
        }