public Boolean Modificar_Estado_IngEgr_Det(List <vwin_Ingreso_Egreso_varios_det_Info> lista, string tipo, ref string msgs)
        {
            try
            {
                using (EntitiesInventario context = new EntitiesInventario())
                {
                    if (tipo == "+")
                    {
                        foreach (var item in lista)
                        {
                            //   var contact = context.in_Ingreso_varios_det.First(q => q.IdEmpresa == item.IdEmpresa && q.IdSucursal == item.IdSucursal && q.IdBodega == item.IdBodega && q.IdMovi_inven_tipo == item.IdMovi_inven_tipo && q.IdNumMovi == item.IdNumMovi && q.Secuencia == item.secuencia && q.IdProducto == item.IdProducto);

                            var contact = context.in_Ing_Egr_Inven_det.First(q => q.IdEmpresa == item.IdEmpresa && q.IdSucursal == item.IdSucursal && q.IdBodega == item.IdBodega && q.IdNumMovi == item.IdNumMovi && q.Secuencia == item.secuencia && q.IdProducto == item.IdProducto);

                            contact.mv_costo       = item.mv_costo;
                            contact.IdEstadoAproba = item.IdEstadoAproba;

                            context.SaveChanges();

                            msgs = "Actualización Ingresos ok...";
                        }
                    }
                    else
                    {
                        foreach (var item in lista)
                        {
                            var contact = context.in_Ing_Egr_Inven_det.First(q => q.IdEmpresa == item.IdEmpresa && q.IdSucursal == item.IdSucursal && q.IdBodega == item.IdBodega && q.IdNumMovi == item.IdNumMovi && q.Secuencia == item.secuencia && q.IdProducto == item.IdProducto);

                            contact.mv_costo       = item.mv_costo;
                            contact.IdEstadoAproba = item.IdEstadoAproba;

                            context.SaveChanges();

                            msgs = "Actualización Egresos ok...";
                        }
                    }
                }
                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);
                msgs = ex.InnerException + " " + ex.Message;
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref msgs);
                return(false);
            }
        }
Beispiel #2
0
        public Boolean ModificarDB_desde_transferencia(in_Ing_Egr_Inven_Info info)
        {
            try
            {
                using (EntitiesInventario Context = new EntitiesInventario())
                {
                    in_Ing_Egr_Inven Entity = Context.in_Ing_Egr_Inven.FirstOrDefault(q => q.IdEmpresa == info.IdEmpresa && q.IdSucursal == info.IdSucursal && q.IdBodega == info.IdBodega && q.IdMovi_inven_tipo == info.IdMovi_inven_tipo && q.IdNumMovi == info.IdNumMovi);

                    if (Entity != null)
                    {
                        Entity.cm_fecha       = info.cm_fecha;
                        Entity.cm_observacion = info.cm_observacion;
                        Context.SaveChanges();
                    }
                }

                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;
                throw new Exception(ex.ToString());
            }
        }
Beispiel #3
0
 public Boolean AnularDB(in_grupo_info info, ref string msg)
 {
     try
     {
         using (EntitiesInventario context = new EntitiesInventario())
         {
             var contact = context.in_grupo.FirstOrDefault(var => var.IdEmpresa == info.IdEmpresa && var.IdLinea == info.IdLinea && var.IdGrupo == info.IdGrupo && var.IdCategoria == info.IdCategoria);
             if (contact != null)
             {
                 contact.Estado          = "I";
                 contact.IdUsuarioUltAnu = info.IdUsuarioUltAnu;
                 contact.Fecha_UltAnu    = info.Fecha_UltAnu;
                 contact.MotiAnula       = info.MotiAnula;
                 context.SaveChanges();
                 msg = "Anulación ok..";
             }
         }
         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;
         throw new Exception(ex.ToString());
     }
 }
Beispiel #4
0
 public Boolean ModificarDB(in_Marca_Info prI, ref string mensaje)
 {
     try
     {
         using (EntitiesInventario context = new EntitiesInventario())
         {
             var contact = context.in_Marca.FirstOrDefault(VProdu => VProdu.IdEmpresa == prI.IdEmpresa && VProdu.IdMarca == prI.IdMarca);
             if (contact != null)
             {
                 contact.Estado          = prI.Estado;
                 contact.IdMarca         = prI.IdMarca;
                 contact.Descripcion     = prI.Descripcion;
                 contact.IdUsuarioUltMod = prI.IdUsuarioUltMod;
                 contact.Fecha_UltMod    = prI.Fecha_UltMod;
                 contact.nom_pc          = prI.nom_pc;
                 contact.ip = prI.ip;
                 context.SaveChanges();
                 mensaje = "Grabacion ok...";
             }
         }
         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;
         throw new Exception(ex.ToString());
     }
 }
Beispiel #5
0
 public Boolean ModificarDB(in_producto_x_tb_bodega_Info item, ref string mensaje)
 {
     try
     {
         using (EntitiesInventario Contex = new EntitiesInventario())
         {
             var contac = Contex.in_producto_x_tb_bodega.FirstOrDefault(Obj => Obj.IdEmpresa == item.IdEmpresa && Obj.IdBodega == item.IdBodega && Obj.IdSucursal == item.IdSucursal && Obj.IdProducto == item.IdProducto);
             if (contac != null)
             {
                 contac.IdCtaCble_Inven       = item.IdCtaCble_Inven == "" ? null : item.IdCtaCble_Inven;
                 contac.IdCtaCble_Costo       = item.IdCtaCble_Costo == "" ? null : item.IdCtaCble_Costo;
                 contac.IdCtaCble_Vta         = item.IdCtaCble_Vta == "" ? null : item.IdCtaCble_Vta;
                 contac.IdCtaCble_Inven       = item.IdCtaCble_Inven == "" ? null : item.IdCtaCble_Inven;
                 contac.IdCtaCble_Costo       = item.IdCtaCble_Costo == "" ? null : item.IdCtaCble_Costo;
                 contac.IdCtaCble_Gasto_x_cxp = item.IdCtaCble_Gasto_x_cxp == "" ? null : item.IdCtaCble_Gasto_x_cxp;
                 Contex.SaveChanges();
             }
         }
         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 = "Error en : public Boolean GrabaDB(List<in_producto_x_tb_bodega_Info> ls, int idempresa, ref string mensaje) ...  " + ex.ToString() + " ";
         throw new Exception(mensaje);
     }
 }
Beispiel #6
0
 public Boolean Anular(in_transferencia_Info info)
 {
     try
     {
         using (EntitiesInventario Contex = new EntitiesInventario())
         {
             var contac = Contex.in_transferencia.FirstOrDefault(Obj => Obj.IdTransferencia == info.IdTransferencia && Obj.IdEmpresa == info.IdEmpresa && Obj.IdBodegaOrigen == info.IdBodegaOrigen && Obj.IdSucursalOrigen == info.IdSucursalOrigen);
             if (contac != null)
             {
                 contac.Estado            = "I";
                 contac.tr_fechaAnulacion = DateTime.Now;
                 contac.tr_userAnulo      = info.tr_userAnulo;
                 contac.motivo_anula      = info.MotivoAnu;
                 contac.nom_pc            = info.nom_pc;
                 contac.ip = info.ip;
                 contac.IdEstadoAprobacion_cat = "REP";
                 contac.tr_Observacion         = "**Anulado**" + contac.tr_Observacion;
                 Contex.SaveChanges();
             }
         }
         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;
         throw new Exception(mensaje);
     }
 }
        public bool guardarDB(List <in_Producto_alerta_x_sucursal_Info> Lista)
        {
            try
            {
                using (EntitiesInventario Context = new EntitiesInventario())
                {
                    foreach (var item in Lista)
                    {
                        in_Producto_alerta_x_sucursal Entity = new in_Producto_alerta_x_sucursal();
                        Entity.IdEmpresa  = item.IdEmpresa;
                        Entity.IdSucursal = item.IdSucursal;
                        Entity.IdProducto = item.IdProducto;
                        Entity.se_controla_stock_minimo = item.se_controla_stock_minimo;
                        Entity.pr_stock_minimo          = item.pr_stock_minimo;
                        Entity.observacion = item.observacion;
                        Context.in_Producto_alerta_x_sucursal.Add(Entity);
                        Context.SaveChanges();
                    }
                }

                return(true);
            }
            catch (Exception ex)
            {
                string mensaje = "";
                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());
            }
        }
Beispiel #8
0
 public Boolean AnularDB(in_Motivo_Inven_Info Info, ref int Id, ref string msg)
 {
     try
     {
         using (EntitiesInventario context = new EntitiesInventario())
         {
             var contact = context.in_Motivo_Inven.FirstOrDefault(v => v.IdEmpresa == Info.IdEmpresa && v.IdMotivo_Inv == Info.IdMotivo_Inv);
             if (contact != null)
             {
                 contact.estado          = "I";
                 contact.FechaHoraAnul   = DateTime.Now;
                 contact.MotivoAnulacion = Info.MotivoAnulacion;
                 contact.IdUsuarioUltAnu = Info.IdUsuarioUltAnu;
                 context.SaveChanges();
             }
         }
         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;
         throw new Exception(ex.ToString());
     }
 }
Beispiel #9
0
        public Boolean AnularDB(in_UnidadMedida_Info UniInfo, ref string mensaje)
        {
            try
            {
                using (EntitiesInventario context = new EntitiesInventario())
                {
                    var contact = context.in_UnidadMedida.FirstOrDefault(prod1 => prod1.IdUnidadMedida == UniInfo.IdUnidadMedida);
                    if (contact != null)
                    {
                        contact.Estado          = "I"; //cambio el estado de activo por inactivo
                        contact.IdUsuarioUltAnu = UniInfo.IdUsuarioUltAnu;
                        contact.Fecha_UltAnu    = DateTime.Now;
                        contact.Fecha_UltMod    = DateTime.Now;
                        contact.IdUsuarioUltMod = UniInfo.IdUsuarioUltMod;
                        context.SaveChanges();

                        mensaje = "Anulacion Exitosa..";
                    }
                }
                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 = "Error al Anular:  " + ex.Message;
                throw new Exception(mensaje);
            }
        }
Beispiel #10
0
        public Boolean ModificarDB(in_UnidadMedida_Info prI, ref string mensaje)
        {
            try
            {
                using (EntitiesInventario context = new EntitiesInventario())
                {
                    var contact = context.in_UnidadMedida.FirstOrDefault(VProdu => VProdu.IdUnidadMedida == prI.IdUnidadMedida);
                    if (contact != null)
                    {
                        if (prI.cod_alterno == "")
                        {
                            prI.cod_alterno = prI.IdUnidadMedida;
                        }

                        contact.cod_alterno         = prI.cod_alterno;
                        contact.Descripcion         = prI.Descripcion;
                        contact.Usado_en_Movimiento = prI.Usado_en_Movimiento;
                        contact.Estado = prI.Estado;
                        context.SaveChanges();
                        mensaje = "Grabacion ok...";
                    }
                }
                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 = "Error al Grabar" + ex.Message;
                throw new Exception(mensaje);
            }
        }
Beispiel #11
0
 public Boolean AnularDB(in_ajusteFisico_Info info)
 {
     try
     {
         using (EntitiesInventario Contex = new EntitiesInventario())
         {
             var contac = Contex.in_ajusteFisico.FirstOrDefault(Obj => Obj.IdAjusteFisico == info.IdAjusteFisico && Obj.IdEmpresa == info.IdEmpresa);
             if (contac != null)
             {
                 contac.Estado             = "I";
                 contac.FechaAnulacion     = DateTime.Now;
                 contac.IdUsuarioAnulacion = info.IdUsuarioAnulacion;
                 contac.motivo_anula       = info.motivo_anula;
                 contac.nom_pc             = info.nom_pc;
                 contac.ip = info.ip;
                 Contex.SaveChanges();
             }
         }
         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;
         throw new Exception(mensaje);
     }
 }
Beispiel #12
0
 public Boolean ModificarDB(in_ajusteFisico_Info Info)
 {
     try
     {
         using (EntitiesInventario Contex = new EntitiesInventario())
         {
             var Address = Contex.in_ajusteFisico.FirstOrDefault(q => q.IdEmpresa == Info.IdEmpresa && q.IdAjusteFisico == Info.IdAjusteFisico);
             if (Address != null)
             {
                 Address.Observacion        = Info.Observacion;
                 Address.Fecha              = Convert.ToDateTime(Info.Fecha.ToShortDateString());
                 Address.IdEstadoAprobacion = Info.IdEstadoAprobacion;
                 Contex.SaveChanges();
             }
         }
         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;
         throw new Exception(mensaje);
     }
 }
        public Boolean GuardarDB(in_transferencia_x_in_Guia_x_traspaso_bodega_Info InfoGuia, ref string msjError)
        {
            try
            {
                using (EntitiesInventario Context = new EntitiesInventario())
                {
                    var Address = new in_transferencia_x_in_Guia_x_traspaso_bodega();
                    Address.IdEmpresa       = InfoGuia.IdEmpresa;
                    Address.IdSucursalOrgen = InfoGuia.IdSucursalOrgen;
                    Address.IdBodegaOrigen  = InfoGuia.IdBodegaOrigen;
                    Address.IdTransferencia = InfoGuia.IdTransferencia;
                    Address.IdEmpresa_Guia  = InfoGuia.IdEmpresa_Guia;
                    Address.IdGuia          = InfoGuia.IdGuia;
                    Address.Observacion     = InfoGuia.Observacion;

                    Context.in_transferencia_x_in_Guia_x_traspaso_bodega.Add(Address);
                    Context.SaveChanges();
                }
                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;
                throw new Exception(ex.ToString());
            }
        }
        public Boolean ModificarDB(in_subgrupo_info info, ref string msg)
        {
            try
            {
                using (EntitiesInventario context = new EntitiesInventario())
                {
                    var contact = context.in_subgrupo.FirstOrDefault(var => var.IdEmpresa == info.IdEmpresa && var.IdLinea == info.IdLinea && var.IdGrupo == info.IdGrupo && var.IdCategoria == info.IdCategoria && var.IdSubgrupo == info.IdSubgrupo);
                    if (contact != null)
                    {
                        contact.cod_subgrupo    = info.cod_subgrupo;
                        contact.nom_subgrupo    = info.nom_subgrupo;
                        contact.observacion     = info.observacion;
                        contact.IdUsuarioUltMod = info.IdUsuarioUltMod;
                        contact.Fecha_UltMod    = info.Fecha_UltMod;



                        context.SaveChanges();
                        msg = "Grabación ok..";
                    }
                }
                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;
                throw new Exception(mensaje);
            }
        }
 public Boolean ModificarDB(in_ProductoTipo_Info info, ref string msg)
 {
     try
     {
         using (EntitiesInventario context = new EntitiesInventario())
         {
             var contact = context.in_ProductoTipo.FirstOrDefault(obj => obj.IdEmpresa == info.IdEmpresa && obj.IdProductoTipo == info.IdProductoTipo);
             if (contact != null)
             {
                 contact.tp_descripcion  = info.tp_descripcion;
                 contact.tp_EsCombo      = info.tp_EsCombo;
                 contact.tp_ManejaInven  = info.tp_ManejaInven;
                 contact.IdUsuarioUltMod = info.IdUsuarioUltMod;
                 contact.Fecha_UltMod    = info.Fecha_UltMod;
                 contact.ip                  = info.ip;
                 contact.Estado              = info.Estado;
                 contact.EsMateriaPrima      = info.EsMateriaPrima;
                 contact.EsProductoTerminado = info.EsProductoTerminado;
                 context.SaveChanges();
                 msg = "Se ha procedido actualizar el registro del Tipo de 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;
         msg     = "Se ha producido el siguiente error: " + ex.Message;
         throw new Exception(mensaje);
     }
 }
Beispiel #16
0
        public Boolean AnularDB(List <in_movi_inve_detalle_Info> ListMoviInfo, ref string mensaje)
        {
            try
            {
                foreach (in_movi_inve_detalle_Info MoviInfo in ListMoviInfo)
                {
                    using (EntitiesInventario context = new EntitiesInventario())
                    {
                        var contact = context.in_movi_inve_detalle.FirstOrDefault(VMovi => VMovi.IdEmpresa == MoviInfo.IdEmpresa && VMovi.IdSucursal == MoviInfo.IdSucursal &&
                                                                                  VMovi.IdBodega == MoviInfo.IdBodega && VMovi.IdMovi_inven_tipo == MoviInfo.IdMovi_inven_tipo &&
                                                                                  VMovi.IdNumMovi == MoviInfo.IdNumMovi && VMovi.Secuencia == MoviInfo.Secuencia);
                        if (contact != null)
                        {
                            contact.dm_observacion = " ***ANULADO***" + contact.dm_observacion.Trim();
                            context.SaveChanges();
                            context.Dispose();
                        }
                    }
                }
                mensaje = "Anulacion Exitosa..";

                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 = "Error al Anular:  " + ex.Message;
                throw new Exception(ex.ToString());
            }
        }
Beispiel #17
0
 public Boolean AnularDB(in_movi_inve_detalle_Info MoviInfo, ref string mensaje)
 {
     try
     {
         using (EntitiesInventario context = new EntitiesInventario())
         {
             var contact = context.in_movi_inve_detalle.FirstOrDefault(VMovi => VMovi.IdEmpresa == MoviInfo.IdEmpresa && VMovi.IdSucursal == MoviInfo.IdSucursal &&
                                                                       VMovi.IdBodega == MoviInfo.IdBodega && VMovi.IdMovi_inven_tipo == MoviInfo.IdMovi_inven_tipo &&
                                                                       VMovi.IdNumMovi == MoviInfo.IdNumMovi);
             //no elimino el registro solo cambia el estado de activo a inactivo
             if (contact != null)
             {
                 contact.dm_observacion = " ***ANULADO***" + "Cant Ant.:" + contact.dm_cantidad.ToString();//+ " Precio Ant.:" + contact.dm_precio.ToString() + contact.dm_observacion.Trim();
                 contact.dm_cantidad    = 0;
                 //contact.dm_precio = 0;
                 contact.dm_stock_actu = 0;
                 contact.dm_stock_ante = 0;
                 context.SaveChanges();
                 mensaje = "Anulacion Exitosa..";
             }
         }
         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 = "Error al Anular:  " + ex.Message;
         throw new Exception(ex.ToString());
     }
 }
        public Boolean GuardarDB(in_movi_inve_x_ct_cbteCble_Info Info)
        {
            try
            {
                using (EntitiesInventario entity = new EntitiesInventario())
                {
                    in_movi_inve_x_ct_cbteCble item = new in_movi_inve_x_ct_cbteCble();
                    item.IdEmpresa         = Info.IdEmpresa;
                    item.IdSucursal        = Info.IdSucursal;
                    item.IdBodega          = Info.IdBodega;
                    item.IdMovi_inven_tipo = Info.IdMovi_inven_tipo;
                    item.IdNumMovi         = Info.IdNumMovi;

                    item.IdEmpresa_ct = Info.IdEmpresa_ct;
                    item.IdTipoCbte   = Info.IdTipoCbte;
                    item.IdCbteCble   = Info.IdCbteCble;
                    item.Observacion  = (Info.Observacion == null) ? "" : Info.Observacion;
                    entity.in_movi_inve_x_ct_cbteCble.Add(item);
                    entity.SaveChanges();
                }
                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;
                throw new Exception(ex.ToString());
            }
        }
Beispiel #19
0
 public Boolean AnularReactiva(int IdEmpresa, in_presupuesto_Info info, ref string msg)
 {
     try
     {
         using (EntitiesInventario context = new EntitiesInventario())
         {
             var contact = context.in_presupuesto.FirstOrDefault(A => A.IdEmpresa == IdEmpresa && A.IdSucursal == info.IdSucursal && A.IdPresupuesto == info.IdPresupuesto);
             if (contact != null)
             {
                 contact.Estado = info.Estado;
                 if (info.Estado == "I")
                 {
                     contact.FechaHoraAnul   = info.FechaHoraAnul;
                     contact.IdUsuarioUltAnu = info.IdUsuarioUltAnu;
                 }
                 context.SaveChanges();
                 msg = "Se Cambio el estado del Presupuesto # :" + info.pr_NumDocumento.ToString() + " 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;
         msg     = "Error del Sistema :" + ex.Message + " ";
         throw new Exception(mensaje);
     }
 }
Beispiel #20
0
 public Boolean ModificarDB(in_Catalogo_Info info)
 {
     try
     {
         using (EntitiesInventario oEnti = new EntitiesInventario())
         {
             var registro = oEnti.in_Catalogo.FirstOrDefault(cata => cata.IdCatalogo == info.IdCatalogo && cata.IdCatalogo_tipo == info.IdCatalogo_tipo);
             if (registro != null)
             {
                 registro.Nombre          = info.Nombre;
                 registro.NombreIngles    = info.NombreIngles;
                 registro.Abrebiatura     = info.Abrebiatura;
                 registro.IdUsuarioUltMod = info.IdUsuarioUltMod;
                 registro.FechaUltMod     = info.FechaUltMod;
                 oEnti.SaveChanges();
             }
         }
         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;
         throw new Exception(ex.ToString());
     }
 }
Beispiel #21
0
        public bool guardarDB(in_Producto_imagenes_Info info)
        {
            try
            {
                using (EntitiesInventario Context = new EntitiesInventario())
                {
                    in_Producto_imagenes Entity = new in_Producto_imagenes
                    {
                        IdEmpresa  = info.IdEmpresa,
                        IdProducto = info.IdProducto,
                        Secuencia  = info.Secuencia = 1,
                        Imagen     = info.Imagen
                    };
                    Context.in_Producto_imagenes.Add(Entity);
                    Context.SaveChanges();
                }

                return(true);
            }
            catch (Exception ex)
            {
                string mensaje = "";
                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());
            }
        }
Beispiel #22
0
 public Boolean EliminarDB(in_Catalogo_Info info)
 {
     try
     {
         using (EntitiesInventario context = new EntitiesInventario())
         {
             var contact = context.in_Catalogo.FirstOrDefault(catalogo => catalogo.IdCatalogo == info.IdCatalogo && catalogo.IdCatalogo_tipo == info.IdCatalogo_tipo);
             if (contact != null)
             {
                 contact.Estado = "I";
                 context.SaveChanges();
             }
         }
         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;
         throw new Exception(ex.ToString());
     }
 }
Beispiel #23
0
 public bool Modificar_IdMovi_Inven_x_Transf(in_transferencia_Info info_transferencia, int IdEmpresa_Ing_Egr_Inven_Origen, int IdSucursal_Ing_Egr_Inven_Origen, decimal IdNumMovi_Ing_Egr_Inven_Origen
                                             , int IdEmpresa_Ing_Egr_Inven_Destino, int IdSucursal_Ing_Egr_Inven_Destino, decimal IdNumMovi_Ing_Egr_Inven_Destino)
 {
     try
     {
         using (EntitiesInventario Contex = new EntitiesInventario())
         {
             var contac = Contex.in_transferencia.FirstOrDefault(q => q.IdEmpresa == info_transferencia.IdEmpresa && q.IdSucursalOrigen == info_transferencia.IdSucursalOrigen && q.IdBodegaOrigen == info_transferencia.IdBodegaOrigen && q.IdTransferencia == info_transferencia.IdTransferencia);
             if (contac != null)
             {
                 contac.IdEmpresa_Ing_Egr_Inven_Origen   = IdEmpresa_Ing_Egr_Inven_Origen;
                 contac.IdSucursal_Ing_Egr_Inven_Origen  = IdSucursal_Ing_Egr_Inven_Origen;
                 contac.IdNumMovi_Ing_Egr_Inven_Origen   = IdNumMovi_Ing_Egr_Inven_Origen;
                 contac.IdEmpresa_Ing_Egr_Inven_Destino  = IdEmpresa_Ing_Egr_Inven_Destino;
                 contac.IdSucursal_Ing_Egr_Inven_Destino = IdSucursal_Ing_Egr_Inven_Destino;
                 contac.IdNumMovi_Ing_Egr_Inven_Destino  = IdNumMovi_Ing_Egr_Inven_Destino;
                 Contex.SaveChanges();
             }
         }
         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;
         throw new Exception(mensaje);
     }
 }
        public Boolean GuardarDB(in_movi_inve_detalle_x_item_Info info, ref string mensaje)
        {
            try
            {
                using (EntitiesInventario Context = new EntitiesInventario())
                {
                    in_movi_inve_detalle_x_item Entity = new in_movi_inve_detalle_x_item();
                    Entity.IdEmpresa         = info.IdEmpresa;
                    Entity.IdSucursal        = info.IdSucursal;
                    Entity.IdBodega          = info.IdBodega;
                    Entity.IdMovi_inven_tipo = info.IdMovi_inven_tipo;
                    Entity.IdNumMovi         = info.IdNumMovi;
                    Entity.Secuencia         = info.Secuencia;
                    Entity.Secuencia_reg     = info.Secuencia_reg;
                    Entity.codigo_reg        = info.codigo_reg;
                    Entity.cantidad          = info.cantidad;
                    Context.in_movi_inve_detalle_x_item.Add(Entity);
                    Context.SaveChanges();
                }

                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;
                throw new Exception(mensaje);
            }
        }
Beispiel #25
0
        public Boolean EliminarDB(in_producto_x_tb_bodega_Info item, int idempresa, ref string mensaje)
        {
            try
            {
                using (EntitiesInventario context = new EntitiesInventario())
                {
                    EntitiesInventario EDB = new EntitiesInventario();
                    var address            = context.in_producto_x_tb_bodega.FirstOrDefault(A => A.IdEmpresa == idempresa && A.IdSucursal == item.IdSucursal && A.IdBodega == item.IdBodega && A.IdProducto == item.IdProducto);
                    if (address != null)
                    {
                        address.IdEmpresa  = idempresa;
                        address.IdSucursal = item.IdSucursal;
                        address.IdBodega   = item.IdBodega;
                        address.IdProducto = item.IdProducto;

                        context.in_producto_x_tb_bodega.Remove(address);
                        context.SaveChanges();
                        mensaje = "Eliminado OK..";
                    }
                    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 = "Error consulte con sistemas" + ex.ToString() + "";
                throw new Exception(mensaje);
            }
        }
        public Boolean Guardar(int imp_IdEmpresa, int imp_IdSucursal, decimal imp_IdOrdenCompraExt, int in_IdEmpresa, int in_IdSucursal, int in_IdBodega, int in_IdMovi_inven_tipo, decimal in_IdNumMovi)
        {
            try
            {
                using (EntitiesInventario context = new EntitiesInventario())
                {
                    var Address = new in_movi_inven_X_imp_OrdCompraExterna();

                    Address.imp_IdEmpresa        = imp_IdEmpresa;
                    Address.imp_IdSucursal       = imp_IdSucursal;
                    Address.imp_IdOrdenCompraExt = imp_IdOrdenCompraExt;
                    Address.in_IdEmpresa         = in_IdEmpresa;
                    Address.in_IdSucursal        = in_IdSucursal;
                    Address.in_IdBodega          = in_IdBodega;
                    Address.in_IdMovi_inven_tipo = in_IdMovi_inven_tipo;
                    Address.in_IdNumMovi         = in_IdNumMovi;
                    context.in_movi_inven_X_imp_OrdCompraExterna.Add(Address);
                    context.SaveChanges();
                }
                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();
                throw new Exception(mensaje);
            }
        }
Beispiel #27
0
 public Boolean AnularDB(in_Marca_Info info)
 {
     try
     {
         using (EntitiesInventario context = new EntitiesInventario())
         {
             var contact = context.in_Marca.FirstOrDefault(minfo => minfo.IdEmpresa == info.IdEmpresa && minfo.IdMarca == info.IdMarca);
             if (contact != null)
             {
                 contact.Estado          = "I";
                 contact.IdUsuarioUltAnu = info.IdUsuarioUltAnu;
                 contact.Fecha_UltAnu    = info.Fecha_UltAnu;
                 contact.MotiAnula       = info.MotiAnula;
                 contact.nom_pc          = info.nom_pc;
                 contact.ip = info.ip;
                 context.SaveChanges();
             }
         }
         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;
         throw new Exception(ex.ToString());
     }
 }
Beispiel #28
0
        public Boolean ModificarDB(in_movi_inven_tipo_x_tb_bodega_Info lst, int IdEmpresa, in_movi_inven_tipo_Info moviI, ref string mensaje)
        {
            try
            {
                EntitiesInventario oege = new EntitiesInventario();

                using (EntitiesInventario contex = new EntitiesInventario())
                {
                    var address = new in_movi_inven_tipo_x_tb_bodega();
                    address.IdBodega          = lst.IdBodega;
                    address.IdEmpresa         = IdEmpresa;
                    address.IdCtaCble         = lst.IdCtaCble;
                    address.IdMovi_inven_tipo = moviI.IdMovi_inven_tipo;
                    address.IdSucucursal      = lst.IdSucucursal;
                    contex.in_movi_inven_tipo_x_tb_bodega.Add(address);
                    contex.SaveChanges();
                    contex.Dispose();
                    mensaje = "Guardado con exito";
                    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 = "Error ocurrido por: " + ex.ToString();
                throw new Exception(mensaje);
            }
        }
Beispiel #29
0
 public Boolean Modificar_Estado_IngEgr_Det(List <in_Ing_Egr_Inven_det_Info> lista, string tipo, ref string msgs)
 {
     try
     {
         using (EntitiesInventario context = new EntitiesInventario())
         {
             foreach (var item in lista)
             {
                 var contact = context.in_Ing_Egr_Inven_det.FirstOrDefault(q => q.IdEmpresa == item.IdEmpresa && q.IdSucursal == item.IdSucursal && q.IdNumMovi == item.IdNumMovi && q.Secuencia == item.Secuencia && item.IdMovi_inven_tipo == q.IdMovi_inven_tipo);
                 if (contact != null)
                 {
                     contact.mv_costo          = item.mv_costo;
                     contact.IdEstadoAproba    = item.IdEstadoAproba;
                     contact.Motivo_Aprobacion = item.Motivo_Aprobacion;
                     context.SaveChanges();
                     msgs = "El Estado se aprobo 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);
         msgs = ex.ToString() + " " + ex.Message;
         oDataLog.Guardar_Log_Error(Log_Error_sis, ref msgs);
         throw new Exception(mensaje);
     }
 }
Beispiel #30
0
 public Boolean ModificarDB(List <in_movi_inven_tipo_x_tb_bodega_Info> lst, ref string mensaje)
 {
     try
     {
         foreach (var item in lst)
         {
             using (EntitiesInventario contex = new EntitiesInventario())
             {
                 var address = contex.in_movi_inven_tipo_x_tb_bodega.FirstOrDefault(v => v.IdBodega == item.IdBodega && v.IdSucucursal == item.IdSucucursal && v.IdEmpresa == item.IdEmpresa && v.IdMovi_inven_tipo == item.IdMovi_inven_tipo);
                 if (address != null)
                 {
                     address.IdBodega          = item.IdBodega;
                     address.IdEmpresa         = item.IdEmpresa;
                     address.IdCtaCble         = item.IdCtaCble;
                     address.IdMovi_inven_tipo = item.IdMovi_inven_tipo;
                     address.IdSucucursal      = item.IdSucucursal;
                     contex.SaveChanges();
                     contex.Dispose();
                     mensaje = "Guardado con exito";
                 }
             }
         }
         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 = ex.Message + "::::::::::::::::::::" + ex.ToString();
         throw new Exception(mensaje);
     }
 }