Example #1
0
        public in_Producto_Dimensiones_Info Get_Info_BuscarProducto_Dimensiones(decimal IdProducto, int IdEmpresa)
        {
            try
            {
                in_Producto_Dimensiones_Info prdDimension   = new in_Producto_Dimensiones_Info();
                EntitiesInventarioEdehsa     OEprdDimension = new EntitiesInventarioEdehsa();
                var selectCbtecble = from C in OEprdDimension.in_Producto_Dimensiones
                                     where C.IdEmpresa == IdEmpresa && C.IdProducto == IdProducto
                                     select C;

                foreach (var item in selectCbtecble)
                {
                    prdDimension.IdEmpresa  = item.IdEmpresa;
                    prdDimension.IdProducto = item.IdProducto;
                    prdDimension.longitud   = item.longitud;
                    prdDimension.espesor    = item.espesor;
                    prdDimension.ancho      = item.ancho;
                    prdDimension.alto       = item.alto;
                    prdDimension.ceja       = item.ceja;
                    prdDimension.diametro   = item.diametro;
                    prdDimension.estado     = item.estado;
                }
                return(prdDimension);
            }
            catch (Exception ex)
            {
                string arreglo = ToString();
                tb_sis_Log_Error_Vzen_Data oDataLog      = new tb_sis_Log_Error_Vzen_Data();
                tb_sis_Log_Error_Vzen_Info Log_Error_sis = new tb_sis_Log_Error_Vzen_Info(ex.ToString(), "", arreglo, "", "", "", "", "", DateTime.Now);
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
                mensaje = ex.ToString() + " " + ex.Message;
                throw new Exception(ex.ToString());
            }
        }
Example #2
0
        private void txtCodigoBarra_KeyPress(object sender, KeyPressEventArgs e)
        {
            try
            {
                string sTipoMovimiento = "-";
                if (e.KeyChar == 13)
                {
                    InfoProductoAcortar = BusInve.TraeProductoxCodigoBarra_UltMov(txtCodigoBarra.Text, param.IdEmpresa, sTipoMovimiento);

                    if (InfoProductoAcortar.CodigoBarra != null)
                    {
                        InfoProductoDimensiones = BusProductoDimensiones.Get_Info_BuscarProducto_Dimensiones(param.IdEmpresa, InfoProductoAcortar.IdProducto);
                        txtProducto.Text        = InfoProductoAcortar.pr_descripcion;

                        //txtProfundidad.Text =Convert.ToString( InfoProductoAcortar.pr_profundidad);
                        //txtaltura.Text = Convert.ToString(InfoProductoAcortar.pr_alto);
                        //txtAncho.Text = Convert.ToString(InfoProductoAcortar.pr_largo);

                        txtProfundidad.Text = Convert.ToString(InfoProductoAcortar.pr_profundidad);
                        txtaltura.Text      = Convert.ToString(InfoProductoDimensiones.alto);
                        txtAncho.Text       = Convert.ToString(InfoProductoDimensiones.longitud);


                        CodigoBarra  = txtCodigoBarra.Text;
                        TxtPeso.Text = InfoProductoAcortar.pr_peso.ToString();
                        //cmbObra.EditValue = InfoProductoAcortar.ot_CodObra;
                        //cmbOrdenTaller.EditValue = InfoProductoAcortar.ot_IdOrdenTaller;
                        txtCodigoBarra.Text = "";
                        //txtProfundidad.Text = "";
                        //TxtPeso.Text = "";
                        //txtaltura.Text = "";
                        //txtAncho.Text = "";
                        //txtProducto.Text = "";
                    }
                    else
                    {
                        MessageBox.Show("El Producto con CB:" + txtCodigoBarra.Text + "No registra Egreso");
                    }
                }
            }
            catch (Exception ex)
            {
                Log_Error_bus.Log_Error(ex.ToString());
                MessageBox.Show(ex.Message);
            }
        }
        public Boolean ValidarObjeto(in_Producto_Dimensiones_Info _Info, ref string MensajeError)
        {
            try
            {
                Boolean res = true;


                if (_Info.IdEmpresa == 0)
                {
                    MensajeError = "el objeto esta errado los PK IdEmpresa , IdTipoCbte no pueden estar en cero";
                    return(false);
                }

                if (_Info.longitud == 0 || _Info.longitud == null)
                {
                    MensajeError = "El Largo no puede ser 0 o null";
                    return(false);
                }
                //if (_Info.alto == 0 || _Info.alto == null)
                //{
                //    MensajeError = "El Alto no puede ser 0 o null";
                //    return false;
                //}
                //if (_Info.espesor == 0 || _Info.espesor == null)
                //{
                //    MensajeError = "El Espesor no puede ser 0 o null";
                //    return false;
                //}
                //if (_Info.espesor == 0 || _Info.espesor == null)
                //{
                //    MensajeError = "El Espesor no puede ser 0 o null";
                //    return false;
                //}

                return(res);
            }
            catch (Exception ex)
            {
                Core.Erp.Info.Log_Exception.LoggingManager.Logger.Log(Core.Erp.Info.Log_Exception.LoggingCategory.Error, ex.Message);
                throw new Core.Erp.Info.Log_Exception.DalException(string.Format("", "ValidarObjeto", ex.Message), ex)
                      {
                          EntityType = typeof(in_Producto_Dimensiones_bus)
                      };
            }
        }
Example #4
0
        public List <in_Producto_Dimensiones_Info> Get_List_Producto_Dimensiones(int idEmpresa, int IdProducto)
        {
            try
            {
                List <in_Producto_Dimensiones_Info> lM = new List <in_Producto_Dimensiones_Info>();
                EntitiesInventarioEdehsa            OEProducto_Dimensines_Info = new EntitiesInventarioEdehsa();
                var selectProducto_Dimensiones_Info = from C in OEProducto_Dimensines_Info.in_Producto_Dimensiones
                                                      where C.IdEmpresa == idEmpresa &&
                                                      C.IdProducto == IdProducto
                                                      select C;

                foreach (var item in selectProducto_Dimensiones_Info)
                {
                    //in_Categoria_x_Formula_Info
                    in_Producto_Dimensiones_Info info = new in_Producto_Dimensiones_Info();
                    info.IdEmpresa  = item.IdEmpresa;
                    info.IdProducto = item.IdProducto;

                    //info.Secuencia = item.Secuencia;
                    info.longitud = item.longitud;
                    info.espesor  = item.espesor;
                    info.ancho    = item.ancho;
                    info.alto     = item.alto;
                    info.ceja     = item.ceja;
                    info.diametro = item.diametro;
                    info.estado   = item.estado;
                    //prd.estado = (item.estado eq 1) ? "ACTIVO" : "*ANULADO*";

                    // prd.Sestado = (item.Estado == "A") ? "ACTIVO" : "*ANULADO*";
                    lM.Add(info);
                    //lM.Add(info);
                }
                return(lM);
            }
            catch (Exception ex)
            {
                string arreglo = ToString();
                tb_sis_Log_Error_Vzen_Data oDataLog      = new tb_sis_Log_Error_Vzen_Data();
                tb_sis_Log_Error_Vzen_Info Log_Error_sis = new tb_sis_Log_Error_Vzen_Info(ex.ToString(), "", arreglo, "", "", "", "", "", DateTime.Now);
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
                mensaje = ex.ToString() + " " + ex.Message;
                throw new Exception(ex.ToString());
            }
        }
Example #5
0
        public Boolean GrabarDB(in_Producto_Dimensiones_Info info, ref decimal IdProducto, ref string mensaje)
        {
            try
            {
                using (EntitiesInventarioEdehsa context = new EntitiesInventarioEdehsa())
                {
                    var address = new in_Producto_Dimensiones();
                    //int idpv = GetSecuencia(info.IdEmpresa,);
                    // id = idpv;
                    address.IdEmpresa = info.IdEmpresa;
                    //address.Secuencia = GetSecuencia(info.IdEmpresa,1);

                    address.IdProducto = IdProducto;
                    address.longitud   = info.longitud;
                    address.espesor    = info.espesor;
                    address.ancho      = info.ancho;
                    address.alto       = info.alto;
                    address.ceja       = info.ceja;
                    address.diametro   = info.diametro;
                    address.estado     = info.estado;


                    context.in_Producto_Dimensiones.Add(address);
                    context.SaveChanges();
                    mensaje = "Se ha procedido a grabar el registro de las Dimensiones del Producto"
                              //+ info.tp_descripcion
                              + " exitosamente.";
                }
                return(true);
            }
            catch (Exception ex)
            {
                string arreglo = ToString();
                tb_sis_Log_Error_Vzen_Data oDataLog      = new tb_sis_Log_Error_Vzen_Data();
                tb_sis_Log_Error_Vzen_Info Log_Error_sis = new tb_sis_Log_Error_Vzen_Info(ex.ToString(), "", arreglo, "", "", "", "", "", DateTime.Now);
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
                mensaje = ex.ToString() + " " + ex.Message;
                mensaje = "Se ha producido el siguiente error: " + ex.Message;
                throw new Exception(mensaje);
            }
        }
        public Boolean ModificarDB(in_Producto_Dimensiones_Info prIDim, ref string mensaje)
        {
            try
            {
                Boolean res = false;

                if (ValidarObjeto(prIDim, ref mensaje) == true)
                {
                    res = proDimen.ModificarDB(prIDim, ref mensaje);
                }

                return(res);
            }
            catch (Exception ex)
            {
                Core.Erp.Info.Log_Exception.LoggingManager.Logger.Log(Core.Erp.Info.Log_Exception.LoggingCategory.Error, ex.Message);
                throw new Core.Erp.Info.Log_Exception.DalException(string.Format("", "GrabarDB", ex.Message), ex)
                      {
                          EntityType = typeof(in_Producto_Dimensiones_bus)
                      };
            }
        }
Example #7
0
        //public int GetSecuencia(int IdEmpresa, int IdProducto)
        //{
        //    try
        //    {
        //        decimal Secuencia;
        //        EntitiesInventarioEdehsa OEProDim = new EntitiesInventarioEdehsa();
        //        var select = (from q in OEProDim.in_Producto_Dimensiones
        //                      where q.IdEmpresa == IdEmpresa
        //                      select q.Secuencia).Max();

        //        if (select == null)
        //        {
        //            Secuencia = 1;
        //        }
        //        else
        //        {
        //            Secuencia = Convert.ToDecimal(select.ToString()) + 1;
        //        }
        //        return Secuencia;
        //    }
        //    catch (Exception ex)
        //    {
        //        string arreglo = ToString();
        //        tb_sis_Log_Error_Vzen_Data oDataLog = new tb_sis_Log_Error_Vzen_Data();
        //        tb_sis_Log_Error_Vzen_Info Log_Error_sis = new tb_sis_Log_Error_Vzen_Info(ex.ToString(), "", arreglo, "", "", "", "", "", DateTime.Now);
        //        oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
        //        mensaje = ex.InnerException + " " + ex.Message;
        //        throw new Exception(ex.InnerException.ToString());
        //    }

        //}
        public Boolean ModificarDB(in_Producto_Dimensiones_Info info, ref string mensaje)
        {
            try
            {
                using (EntitiesInventarioEdehsa context = new EntitiesInventarioEdehsa())
                {
                    var contact = context.in_Producto_Dimensiones.FirstOrDefault(VProdu => VProdu.IdEmpresa == info.IdEmpresa && VProdu.IdProducto == info.IdProducto);
                    if (contact != null)
                    {
                        contact.IdProducto = info.IdProducto;
                        contact.longitud   = info.longitud;

                        contact.espesor  = info.espesor;
                        contact.ancho    = info.ancho;
                        contact.alto     = info.alto;
                        contact.ceja     = info.ceja;
                        contact.diametro = info.diametro;
                        contact.estado   = info.estado;
                        //contact.Fe = DateTime.Now;

                        context.SaveChanges();
                        mensaje = "Actualizacion ok...";
                    }
                }
                return(true);
            }
            catch (DbEntityValidationException ex)
            {
                string arreglo = ToString();
                tb_sis_Log_Error_Vzen_Data oDataLog      = new tb_sis_Log_Error_Vzen_Data();
                tb_sis_Log_Error_Vzen_Info Log_Error_sis = new tb_sis_Log_Error_Vzen_Info(ex.ToString(), "", arreglo, "", "", "", "", "", DateTime.Now);
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
                mensaje = ex.ToString() + " " + ex.Message;
                mensaje = "Error al Grabar" + ex.Message;
                throw new Exception(ex.ToString());
            }
        }