private void btnEliminar_Click(object sender, EventArgs e)
        {
            oEnsamble = new WCF_Ensamble.Hersan_EnsambleClient();

            try {
                if (RadMessageBox.Show("Esta acción dará de baja el almacén\nDesea continuar...?", this.Text, MessageBoxButtons.YesNo, RadMessageIcon.Question) == DialogResult.Yes)
                {
                    AlmacenPTBE obj = new AlmacenPTBE();
                    obj.Id                         = int.Parse(txtId.Text);
                    obj.Empresa.Id                 = BaseWinBP.UsuarioLogueado.Empresa.Id;
                    obj.Nombre                     = txtNombre.Text;
                    obj.Abrev                      = txtAbrev.Text;
                    obj.DatosUsuario.Estatus       = false;
                    obj.DatosUsuario.IdUsuarioCreo = BaseWinBP.UsuarioLogueado.ID;

                    int Result = oEnsamble.APT_Almacenes_Actualizar(obj);
                    if (Result == 0)
                    {
                        RadMessageBox.Show("Ocurrió un error al modificar los datos", this.Text, MessageBoxButtons.OK, RadMessageIcon.Error);
                    }
                    else
                    {
                        RadMessageBox.Show("Información actualizada correctamente", this.Text, MessageBoxButtons.OK, RadMessageIcon.Info);
                        LimpiarCampos();
                        CargarGrid();
                    }
                }
            } catch (Exception ex) {
                RadMessageBox.Show("Ocurrio un error al dar de baja el almacén\n" + ex.Message, this.Text, MessageBoxButtons.OK, RadMessageIcon.Error);
            } finally {
                oEnsamble = null;
            }
        }
        private void CboTipo_SelectedIndexChanged(object sender, Telerik.WinControls.UI.Data.PositionChangedEventArgs e)
        {
            oEnsamble = new WCF_Ensamble.Hersan_EnsambleClient();
            try {
                if (cboTipo.SelectedValue != null)
                {
                    var Ficha = oProductos.Find(item => item.Producto.Id == int.Parse(cboTipo.SelectedValue.ToString()));
                    if (Ficha != null)
                    {
                        /* COLORES DE CARCASA */
                        oCarcasas = oEnsamble.ENS_CarcasasCotizacion_Combo(Ficha.Id);
                        cboColores.DisplayMember = "Nombre";
                        cboColores.ValueMember   = "Id";
                        cboColores.DataSource    = oCarcasas;

                        /* REFLEJANTES */
                        oReflejantes = oEnsamble.ENS_ReflejanteCotizacion_Combo(Ficha.Id);
                        cboReflejantes.DisplayMember = "Nombre";
                        cboReflejantes.ValueMember   = "Id";
                        cboReflejantes.DataSource    = oReflejantes;

                        txtCavidades.Text = Ficha.Reflejantes.ToString();
                    }
                    else
                    {
                        RadMessageBox.Show("El producto seleccionado no existe o está incompletos", this.Text, MessageBoxButtons.OK, RadMessageIcon.Info);
                        cboTipo.SelectedIndex = 0;
                    }
                }
            } catch (Exception ex) {
                RadMessageBox.Show("Ocurrio un error al seleccionar el producto\n" + ex.Message, this.Text, MessageBoxButtons.OK, RadMessageIcon.Error);
            } finally {
                oEnsamble = null;
            }
        }
 private void CargarGrid()
 {
     oEnsamble = new WCF_Ensamble.Hersan_EnsambleClient();
     try {
         gvDatos.DataSource = oEnsamble.APT_Almacenes_Obtener(BaseWinBP.UsuarioLogueado.Empresa.Id);
     } catch (Exception ex) {
         throw ex;
     } finally {
         oEnsamble = null;
     }
 }
Exemple #4
0
 private void CargarPedidos()
 {
     oEnsamble = new WCF_Ensamble.Hersan_EnsambleClient();
     try {
         oList = oEnsamble.ENS_Cotizacion_Consulta(0, 0, "19000101", "29000101").FindAll(item => item.NoPedido >0);
         oList.Reverse();
         gvDatos.DataSource = oList;
     } catch (Exception ex) {
         throw ex;
     } finally {
         oEnsamble = null;
     }
 }
Exemple #5
0
        private void gvDatos_CurrentRowChanged(object sender, Telerik.WinControls.UI.CurrentRowChangedEventArgs e)
        {
            oEnsamble = new WCF_Ensamble.Hersan_EnsambleClient();
            try {
                if (gvDatos.RowCount > 0)
                    gvDetalle.DataSource = oEnsamble.ENS_Cotizacion_ReporteDetalle(int.Parse(gvDatos.CurrentRow.Cells["Id"].Value.ToString()));

            } catch (Exception ex) {
                RadMessageBox.Show("Ocurrió un error al seleccionar el pedido\n" + ex.Message, this.Text, MessageBoxButtons.OK, RadMessageIcon.Error);
            } finally {
                oEnsamble = null;
            }
        }
        private void CargarDatos()
        {
            oEnsamble = new WCF_Ensamble.Hersan_EnsambleClient();
            try {
                Task <List <UbicacionesBE> > Aux = oEnsamble.APT_Ubicacion_ObtenerAsync();
                Aux.Wait();

                gvDatos.DataSource = Aux.Result;
            } catch (Exception ex) {
                throw ex;
            } finally {
                oEnsamble = null;
            }
        }
        private void CargaAlmacenes()
        {
            oEnsamble = new WCF_Ensamble.Hersan_EnsambleClient();
            try {
                Task <List <AlmacenPTBE> > Aux = oEnsamble.APT_Almacenes_ComboAsync(BaseWinBP.UsuarioLogueado.Empresa.Id);
                Aux.Wait();

                cboAlmacen.ValueMember   = "Id";
                cboAlmacen.DisplayMember = "Nombre";
                cboAlmacen.DataSource    = Aux.Result;
            } catch (Exception ex) {
                throw ex;
            } finally {
                oEnsamble = null;
            }
        }
Exemple #8
0
        private void BtnAdd_Click(object sender, EventArgs e)
        {
            oEnsamble = new WCF_Ensamble.Hersan_EnsambleClient();
            string IdComp = string.Empty;
            string Tipo   = string.Empty;
            string Reflex = string.Empty;

            try {
                if (cboTipo.SelectedValue != null && cboColores.SelectedValue != null && cboReflejantes.CheckedItems.Count > 0)
                {
                    gvDatos.DataSource = null;

                    OrdenCompraDetalleBE obj = new OrdenCompraDetalleBE();
                    obj.Producto.Producto.Id     = int.Parse(cboTipo.SelectedValue.ToString());
                    obj.Producto.Producto.Nombre = cboTipo.Text;
                    obj.Carcasa.Id     = int.Parse(cboColores.SelectedValue.ToString());
                    obj.Carcasa.Nombre = cboColores.Text;
                    obj.Sugerido       = int.Parse(spSugerido.Value.ToString());
                    obj.Solicitado     = int.Parse(spSolicitado.Value.ToString());
                    obj.Fecha          = dtFecha.Value;

                    foreach (var item in cboReflejantes.CheckedItems)
                    {
                        IdComp += item.Value.ToString() + ",";
                        Tipo    = oReflex.Find(x => x.Tipo == item.Text.Split('-')[0].ToString().Trim()).Tipo;
                        Reflex += oReflex.Find(x => x.Id == int.Parse(item.Value.ToString())).Color.Nombre + "-";
                    }
                    Task <string> Aux = oEnsamble.ENS_CodigoProducto_ObtenerAsync(obj.Producto.Producto.Id, obj.Carcasa.Id, IdComp);
                    obj.Producto.Codigo = Aux.Result;

                    obj.Producto.Producto.Familia.Clave          = IdComp;
                    obj.Producto.Producto.Familia.Entidad.Nombre = Tipo;
                    obj.Producto.Producto.Familia.Nombre         = Reflex.Substring(0, Reflex.Length - 1);

                    oDetalle.Add(obj);
                }
                gvDatos.DataSource = oDetalle;
                cboReflejantes.CheckedItems.Clear();
            } catch (Exception ex) {
                RadMessageBox.Show("Ocurrió un error al agregar el producto a la Orden de Compra\n" + ex.Message, this.Text, MessageBoxButtons.OK, RadMessageIcon.Error);
            } finally { oEnsamble = null; }
        }
        private void CargaProductos()
        {
            oEnsamble = new WCF_Ensamble.Hersan_EnsambleClient();
            try {
                Task <List <ProductoEnsambleBE> > Aux = oEnsamble.ENS_ProductosCotizacion_ComboAsync(true, "");
                Aux.Wait();
                oProductos = Aux.Result;

                cboTipo.DisplayMember = "Producto.Nombre";
                cboTipo.ValueMember   = "Producto.Id";
                cboTipo.DataSource    = oProductos;

                if (oProductos.Count > 0)
                {
                    cboTipo.SelectedIndex = 0;
                }
            } catch (Exception ex) {
                throw ex;
            } finally {
                oEnsamble = null;
            }
        }
        private void BtnEliminar_Click(object sender, EventArgs e)
        {
            oEnsamble = new WCF_Ensamble.Hersan_EnsambleClient();
            UbicacionesBE obj = new UbicacionesBE();

            try {
                if (chkEstatus.Checked)
                {
                    if (RadMessageBox.Show("Esta acción dará de baja la ubicación del producto\nDesea continuar...?", this.Text, MessageBoxButtons.YesNo, RadMessageIcon.Question) == DialogResult.Yes)
                    {
                        obj.Id      = int.Parse(txtId.Text);
                        obj.Rack    = cboRack.Text;
                        obj.Fila    = int.Parse(spFila.Value.ToString());
                        obj.Columna = int.Parse(spColumna.Value.ToString());
                        obj.Minimo  = decimal.Parse(spMin.Value.ToString());
                        obj.Maximo  = decimal.Parse(spMax.Value.ToString());
                        obj.DatosUsuario.IdUsuarioModif = BaseWinBP.UsuarioLogueado.ID;
                        obj.DatosUsuario.Estatus        = false;

                        if (oEnsamble.APT_Ubicacion_Actualizar(obj) == 0)
                        {
                            RadMessageBox.Show("Ocurrió un error al modificar los datos", this.Text, MessageBoxButtons.OK, RadMessageIcon.Error);
                        }
                        else
                        {
                            RadMessageBox.Show("Información actualizada correctamente", this.Text, MessageBoxButtons.OK, RadMessageIcon.Info);
                            LimpiarCampos();
                            CargarDatos();
                        }
                    }
                }
            } catch (Exception ex) {
                RadMessageBox.Show("Ocurrio un error al dar de baja el tipo de producto\n" + ex.Message, this.Text, MessageBoxButtons.OK, RadMessageIcon.Error);
            } finally {
                oEnsamble = null;
            }
        }
        private void btnGuardar_Click(object sender, EventArgs e)
        {
            oEnsamble = new WCF_Ensamble.Hersan_EnsambleClient();

            try {
                if (txtNombre.Text.Trim().Length == 0 || txtAbrev.Text.Trim().Length == 0)
                {
                    RadMessageBox.Show("Debe capturar todos los datos para continuar", this.Text, MessageBoxButtons.OK, RadMessageIcon.Exclamation);
                    return;
                }

                if (oList.FindAll(item => item.Nombre.Trim() == txtNombre.Text.Trim()).Count > 0)
                {
                    RadMessageBox.Show("La información capturada ya existe, no es posible guardar", this.Text, MessageBoxButtons.OK, RadMessageIcon.Exclamation);
                    LimpiarCampos();
                    return;
                }

                if (RadMessageBox.Show("Desea guardar los datos capturados...?", this.Text, MessageBoxButtons.YesNo, RadMessageIcon.Question) == DialogResult.Yes)
                {
                    int Result = 0;

                    AlmacenPTBE obj = new AlmacenPTBE();
                    obj.Id                         = int.Parse(txtId.Text);
                    obj.Empresa.Id                 = BaseWinBP.UsuarioLogueado.Empresa.Id;
                    obj.Nombre                     = txtNombre.Text;
                    obj.Abrev                      = txtAbrev.Text;
                    obj.DatosUsuario.Estatus       = chkEstatus.Checked;
                    obj.DatosUsuario.IdUsuarioCreo = BaseWinBP.UsuarioLogueado.ID;

                    //PROCESO DE GUARDADO Y ACTUALIZACION
                    if (txtId.Text == "0")
                    {
                        Result = oEnsamble.APT_Almacenes_Guardar(obj);
                        if (Result == 0)
                        {
                            RadMessageBox.Show("Ocurrió un error al guardar el almacén", this.Text, MessageBoxButtons.OK, RadMessageIcon.Error);
                        }
                        else
                        {
                            RadMessageBox.Show("Entidad guardada correctamente", this.Text, MessageBoxButtons.OK, RadMessageIcon.Info);
                            LimpiarCampos();
                            CargarGrid();
                        }
                    }
                    else
                    {
                        Result = oEnsamble.APT_Almacenes_Actualizar(obj);
                        if (Result == 0)
                        {
                            RadMessageBox.Show("Ocurrió un error al actualizar los datos", this.Text, MessageBoxButtons.OK, RadMessageIcon.Error);
                        }
                        else
                        {
                            RadMessageBox.Show("Información actualizada correctamente", this.Text, MessageBoxButtons.OK, RadMessageIcon.Info);
                            LimpiarCampos();
                            CargarGrid();
                        }
                    }
                }
            } catch (Exception ex) {
                RadMessageBox.Show("Ocurrió un error al actualizar la información\n" + ex.Message, this.Text, MessageBoxButtons.OK, RadMessageIcon.Error);
            } finally {
                oEnsamble = null;
            }
        }
        private void BtnGuardar_Click(object sender, EventArgs e)
        {
            oEnsamble = new WCF_Ensamble.Hersan_EnsambleClient();
            UbicacionesBE obj = new UbicacionesBE();

            try {
                if (RadMessageBox.Show("Se guardará la ubicación del producto\nDesea continuar...?", this.Text, MessageBoxButtons.YesNo, RadMessageIcon.Question) == DialogResult.No)
                {
                    return;
                }

                foreach (GridViewRowInfo oRow in gvDatos.Rows)
                {
                    if (oRow.Cells["IdAlmacen"].Value.ToString() == cboAlmacen.SelectedValue.ToString() &&
                        oRow.Cells["IdProducto"].Value.ToString() == cboTipo.SelectedValue.ToString() &&
                        oRow.Cells["IdCarcasa"].Value.ToString() == cboColores.SelectedValue.ToString()
                        //&& oRow.Cells["IdReflejante"].Value.ToString() == cboReflejantes.SelectedValue.ToString()
                        && int.Parse(txtId.Text) == 0)
                    {
                        RadMessageBox.Show("El Producto capturado ya tiene ubicación asignada", this.Text, MessageBoxButtons.OK, RadMessageIcon.Exclamation);
                        LimpiarCampos();
                        return;
                    }
                }

                obj.Id = int.Parse(txtId.Text);
                obj.Almacen.Empresa.Id = BaseWinBP.UsuarioLogueado.Empresa.Id;
                obj.Almacen.Id         = int.Parse(cboAlmacen.SelectedValue.ToString());
                obj.Producto.Id        = int.Parse(cboTipo.SelectedValue.ToString());
                obj.Carcasa.Id         = int.Parse(cboColores.SelectedValue.ToString());
                foreach (var item in cboReflejantes.CheckedItems)
                {
                    obj.Reflejante.Nombre += item.Value.ToString() + ",";
                }
                obj.Rack    = cboRack.Text;
                obj.Fila    = int.Parse(spFila.Value.ToString());
                obj.Columna = int.Parse(spColumna.Value.ToString());
                obj.Minimo  = decimal.Parse(spMin.Value.ToString());
                obj.Maximo  = decimal.Parse(spMax.Value.ToString());
                obj.DatosUsuario.Estatus       = chkEstatus.Checked;
                obj.DatosUsuario.IdUsuarioCreo = BaseWinBP.UsuarioLogueado.ID;

                //PROCESO DE GUARDADO Y ACTUALIZACION
                if (txtId.Text == "0")
                {
                    int Result = oEnsamble.APT_Ubicacion_Guardar(obj);
                    if (Result == 0)
                    {
                        RadMessageBox.Show("Ocurrió un error al guardar la ubicación del producto", this.Text, MessageBoxButtons.OK, RadMessageIcon.Error);
                    }
                    else
                    {
                        RadMessageBox.Show("Producto asignado a la ubicación correctamente", this.Text, MessageBoxButtons.OK, RadMessageIcon.Info);
                        LimpiarCampos();
                        CargarDatos();
                    }
                }
                else
                {
                    int Result = oEnsamble.APT_Ubicacion_Actualizar(obj);
                    if (Result == 0)
                    {
                        RadMessageBox.Show("Ocurrió un error al actualizar los datos", this.Text, MessageBoxButtons.OK, RadMessageIcon.Error);
                    }
                    else
                    {
                        RadMessageBox.Show("Información actualizada correctamente", this.Text, MessageBoxButtons.OK, RadMessageIcon.Info);
                        LimpiarCampos();
                        CargarDatos();
                    }
                }
            } catch (Exception ex) {
                RadMessageBox.Show("Ocurrió un error al actualizar la información\n" + ex.Message, this.Text, MessageBoxButtons.OK, RadMessageIcon.Error);
            } finally {
                oEnsamble = null;
            }
        }