示例#1
0
        public Boolean Actualizar_Producto_Creado(int IdEmpresa, int IdSucursal, decimal IdSolicitudCompra, int Secuencia, decimal IdProducto, string nom_producto, ref string mensaje)
        {
            try
            {
                using (EntitiesCompras context = new EntitiesCompras())
                {
                    var contact = context.com_solicitud_compra_det.FirstOrDefault(VProdu => VProdu.IdEmpresa == IdEmpresa && VProdu.IdSolicitudCompra == IdSolicitudCompra && VProdu.IdSucursal == IdSucursal && VProdu.Secuencia == Secuencia);

                    if (contact != null)
                    {
                        contact.IdProducto  = IdProducto;
                        contact.NomProducto = nom_producto;

                        context.SaveChanges();

                        mensaje = "Se ha procedido a Actualizar la Información 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();
                throw new Exception(ex.ToString());
            }
        }
示例#2
0
        public Boolean GuardarDB(com_Catalogo_Info Info)
        {
            try
            {
                using (EntitiesCompras Context = new EntitiesCompras())
                {
                    var Address = new com_catalogo();
                    Address.IdCatalogocompra = Info.IdCatalogocompra;

                    Address.IdCatalogocompra_tipo = Info.IdCatalogocompra_tipo;
                    Address.Nombre    = Info.Nombre;
                    Address.Estado    = "A";
                    Address.Orden     = Info.orden;
                    Address.IdUsuario = Info.IdUsuario;
                    Address.nom_pc    = Info.nom_pc;
                    Address.ip        = Info.ip;
                    Context.com_catalogo.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.InnerException + " " + ex.Message;
                throw new Exception(ex.ToString());
            }
        }
        public Boolean AnularDB(com_ListadoMateriales_Info Info, ref string msg)
        {
            try
            {
                using (EntitiesCompras context = new EntitiesCompras())
                {
                    var address = context.com_ListadoMateriales.First
                                      (A => A.IdEmpresa == Info.IdEmpresa &&
                                      A.IdListadoMateriales == Info.IdListadoMateriales
                                      );

                    address.Estado         = "I";
                    address.Usuario        = Info.Usuario;
                    address.lm_Observacion = Info.lm_Observacion;
                    //contact = address;
                    context.SaveChanges();
                }
                msg = "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.InnerException + " " + ex.Message;

                msg = "Error no se guardó " + ex.Message + " ";
                throw new Exception(ex.ToString());
            }
        }
 public Boolean GrabarDB(List <com_GenerOCompra_Det_x_com_ordencompra_local_det_CusCider_Info> Lst, ref string msg)
 {
     try
     {
         foreach (var item in Lst)
         {
             using (EntitiesCompras context = new EntitiesCompras())
             {
                 var address = new com_GenerOCompra_Det_x_com_ordencompra_local_det_CusCider();
                 address.goc_IdEmpresa     = item.goc_IdEmpresa;
                 address.goc_IdDetTrans    = item.oc_Secuencia;
                 address.goc_IdTransaccion = item.goc_IdTransaccion;
                 address.oc_IdEmpresa      = item.goc_IdEmpresa;
                 address.oc_IdSucursal     = item.oc_IdSucursal;
                 address.oc_IdOrdenCompra  = item.oc_IdOrdenCompra;
                 address.oc_Secuencia      = item.oc_Secuencia;
                 context.com_GenerOCompra_Det_x_com_ordencompra_local_det_CusCider.Add(address);
                 context.SaveChanges();
                 msg = "Se ha procedido a grabar el registro 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.InnerException + " " + ex.Message;
         msg     = ex.ToString();
         throw new Exception(ex.ToString());
     }
 }
示例#5
0
        public Boolean GuardarDB(com_departamento_Info Info)
        {
            try
            {
                using (EntitiesCompras Context = new EntitiesCompras())
                {
                    var Address = new com_departamento();

                    Address.IdEmpresa        = Info.IdEmpresa;
                    Address.IdDepartamento   = Info.IdDepartamento = GetId(Info.IdEmpresa);
                    Address.nom_departamento = Info.nom_departamento;
                    Address.Estado           = "A";
                    Address.IdUsuario        = Info.IdUsuario;
                    Address.Fecha_Transac    = DateTime.Now;

                    Context.com_departamento.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.InnerException + " " + ex.Message;
                throw new Exception(ex.ToString());
            }
        }
示例#6
0
        public Boolean ModificarDB(com_estado_cierre_Info Info, ref string msg)
        {
            try
            {
                using (EntitiesCompras context = new EntitiesCompras())
                {
                    var contact = context.com_estado_cierre.FirstOrDefault(v => v.IdEstado_cierre == Info.IdEstado_cierre);

                    if (contact != null)
                    {
                        contact.IdEstado_cierre = Info.IdEstado_cierre;
                        contact.Descripcion     = Info.Descripcion;
                        contact.estado          = Info.estado;
                        contact.Fecha_UltMod    = Info.Fecha_UltMod;
                        contact.IdUsuarioUltMod = Info.IdUsuarioUltMod;
                        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.InnerException + " " + ex.Message;
                throw new Exception(ex.ToString());
            }
        }
示例#7
0
        public Boolean GuardarDB(com_comprador_Info info, ref string mensaje)
        {
            try
            {
                using (EntitiesCompras Context = new EntitiesCompras())
                {
                    com_comprador Address = new com_comprador();

                    Address.IdComprador   = info.IdComprador = getIdComprador(info.IdEmpresa, ref mensaje);
                    Address.IdEmpresa     = info.IdEmpresa;
                    Address.IdUsuario_com = info.IdUsuario_com;
                    Address.Descripcion   = info.Descripcion.Trim();
                    Address.Estado        = "A";
                    Address.IdPersona     = (info.IdPersona == 0) ? null : info.IdPersona;
                    Address.cedula        = info.cedula;
                    Address.IdUsuario     = info.IdUsuario;
                    Address.Fecha_Transac = DateTime.Now;


                    Context.com_comprador.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.InnerException + " " + ex.Message;
                throw new Exception(ex.ToString());
            }
        }
示例#8
0
        public Boolean ModificarDB(com_GeneracionOCompra_Info info, ref string msg)
        {
            try
            {
                using (EntitiesCompras context = new EntitiesCompras())
                {
                    var contact = context.com_GenerOCompra.FirstOrDefault(obj => obj.IdEmpresa == info.IdEmpresa &&
                                                                          obj.IdTransaccion == info.IdTransaccion);

                    if (contact != null)
                    {
                        contact.FechaReg        = info.FechaReg;
                        contact.Usuario         = info.Usuario;
                        contact.g_ocObservacion = info.g_ocObservacion;


                        context.SaveChanges();
                        msg = "Se ha procedido actualizar elListado de Materiales #: " + info.IdTransaccion.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.InnerException + " " + ex.Message;

                msg = "Se ha producido el siguiente error: " + ex.Message;
                throw new Exception(ex.ToString());
            }
        }
示例#9
0
        public Boolean AnularDB(com_GeneracionOCompra_Info Info, ref string msg)
        {
            try
            {
                using (EntitiesCompras context = new EntitiesCompras())
                {
                    var address = context.com_GenerOCompra.FirstOrDefault
                                      (A => A.IdEmpresa == Info.IdEmpresa &&
                                      A.IdTransaccion == Info.IdTransaccion
                                      );
                    if (address != null)
                    {
                        address.Estado          = "I";
                        address.IdUsuarioAnula  = Info.IdUsuarioAnula;
                        address.FechaAnula      = Info.FechaAnula;
                        address.MotivoAnulacion = Info.MotivoAnulacion;
                        context.SaveChanges();
                    }
                }
                msg = "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.InnerException + " " + ex.Message;

                msg = "Error no se guardó " + ex.Message + " ";
                throw new Exception(ex.ToString());
            }
        }
示例#10
0
        public Boolean GuardarDB(com_solicitante_Info info, ref string mensaje)
        {
            try
            {
                using (EntitiesCompras Context = new EntitiesCompras())
                {
                    com_solicitante Address = new com_solicitante();

                    Address.IdSolicitante   = info.IdSolicitante = GetIdSolicitante(info.IdEmpresa, ref mensaje);
                    Address.IdEmpresa       = info.IdEmpresa;
                    Address.nom_solicitante = info.nom_solicitante.Trim();
                    Address.estado          = "A";
                    Address.IdPersona       = (info.IdPersona == 0) ? null : info.IdPersona;
                    Address.cedula          = info.cedula;
                    Address.IdUsuario       = info.IdUsuario;
                    Address.Fecha_Transac   = DateTime.Now;

                    Context.com_solicitante.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(ex.ToString());
            }
        }
示例#11
0
        public Boolean ModificarDB(com_solicitante_Info info, ref string mensaje)
        {
            try
            {
                using (EntitiesCompras context = new EntitiesCompras())
                {
                    var contact = context.com_solicitante.FirstOrDefault(var => var.IdEmpresa == info.IdEmpresa && var.IdSolicitante == info.IdSolicitante);

                    if (contact != null)
                    {
                        contact.nom_solicitante = info.nom_solicitante;
                        contact.estado          = info.estado;
                        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(ex.ToString());
            }
        }
示例#12
0
        public bool ActualizarProducto(int IdEmpresa, decimal IdOrdenPedido, int Secuencia, decimal IdProducto, string IdUnidadMedida, string pr_descripcion)
        {
            try
            {
                using (EntitiesCompras db = new EntitiesCompras())
                {
                    var Entity = db.com_OrdenPedidoDet.Where(q => q.IdEmpresa == IdEmpresa && q.IdOrdenPedido == IdOrdenPedido && q.Secuencia == Secuencia).FirstOrDefault();
                    if (Entity == null)
                    {
                        return(false);
                    }

                    Entity.IdProducto     = IdProducto;
                    Entity.pr_descripcion = pr_descripcion;
                    Entity.IdUnidadMedida = IdUnidadMedida;
                    db.SaveChanges();
                }

                return(true);
            }
            catch (Exception)
            {
                throw;
            }
        }
示例#13
0
 public bool RechazarComprador(List <com_OrdenPedidoDet_Info> Lista)
 {
     try
     {
         using (EntitiesCompras db = new EntitiesCompras())
         {
             foreach (var item in Lista)
             {
                 var det = db.com_OrdenPedidoDet.Where(q => q.IdEmpresa == item.IdEmpresa && q.IdOrdenPedido == item.IdOrdenPedido && q.Secuencia == item.Secuencia).FirstOrDefault();
                 if (det != null)
                 {
                     det.opd_EstadoProceso   = "RC";
                     det.opd_Detalle         = "Com:" + item.opd_Detalle + " Sol:" + det.opd_Detalle;
                     det.IdUsuarioCotizacion = item.IdUsuario;
                     det.FechaCotizacion     = DateTime.Now;
                 }
                 db.SaveChanges();
             }
             var Ordenes = Lista.GroupBy(q => new { q.IdEmpresa, q.IdOrdenPedido }).Select(q => new
             {
                 IdEmpresa     = q.Key.IdEmpresa,
                 IdOrdenPedido = q.Key.IdOrdenPedido
             }).ToList();
             foreach (var item in Ordenes)
             {
                 odata_c.ValidarProceso(item.IdEmpresa, item.IdOrdenPedido);
             }
         }
         return(true);
     }
     catch (Exception)
     {
         throw;
     }
 }
示例#14
0
 public Boolean ModificarEstadoAproba_DetSolCom(int IdEmpresa, int IdSucursal, decimal IdSolicitudCompra, int Secuencia, decimal IdProducto, string IdEstadoAprobacion, ref string mensaje)
 {
     try
     {
         using (EntitiesCompras context = new EntitiesCompras())
         {
             var contact = context.com_solicitud_compra_det.FirstOrDefault(VProdu => VProdu.IdEmpresa == IdEmpresa &&
                                                                           VProdu.IdSolicitudCompra == IdSolicitudCompra &&
                                                                           VProdu.IdSucursal == IdSucursal && VProdu.Secuencia == Secuencia);
             if (contact != null)
             {
                 context.SaveChanges();
                 mensaje = "Actualizació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();
         throw new Exception(ex.ToString());
     }
 }
示例#15
0
        public Boolean EliminarDB(List <com_ListadoMateriales_Det_Info> LstInfo, ref string msg)
        {
            try
            {
                using (EntitiesCompras context = new EntitiesCompras())
                {
                    foreach (var item in LstInfo)
                    {
                        var address = context.com_ListadoMateriales_Det.FirstOrDefault
                                          (A => A.IdEmpresa == item.IdEmpresa &&
                                          A.IdOrdenTaller == item.IdOrdenTaller && A.IdListadoMateriales == item.IdListadoMateriales);

                        if (address != null)
                        {
                            context.com_ListadoMateriales_Det.Remove(address);
                            context.SaveChanges();
                        }
                    }
                }
                msg = "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.InnerException + " " + ex.Message;

                msg = "Error no se guardó " + ex.Message + " ";
                throw new Exception(ex.ToString());
            }
        }
示例#16
0
        public Boolean ModificarDB(com_Motivo_Orden_Compra_Info info, ref string msg)
        {
            try
            {
                using (EntitiesCompras context = new EntitiesCompras())
                {
                    var contact = context.com_Motivo_Orden_Compra.FirstOrDefault(var => var.IdEmpresa == info.IdEmpresa && var.IdMotivo == info.IdMotivo);

                    if (contact != null)
                    {
                        contact.Descripcion = info.Descripcion;
                        contact.Cod_Motivo  = info.Cod_Motivo;
                        contact.estado      = info.estado;
                        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.InnerException + " " + ex.Message;
                throw new Exception(ex.ToString());
            }
        }
示例#17
0
        public Boolean ActualizarEstadoAprob(com_ListadoMateriales_Det_Info Info, ref string msg)
        {
            try
            {
                using (EntitiesCompras context = new EntitiesCompras())
                {
                    var contact = context.com_ListadoMateriales_Det.FirstOrDefault(obj => obj.IdEmpresa == Info.IdEmpresa &&
                                                                                   obj.IdListadoMateriales == Info.IdListadoMateriales && obj.IdDetalle == Info.IdDetalle);

                    if (contact != null)
                    {
                        contact.IdEstadoAprob = Info.lm_IdEstadoAprobado;

                        context.SaveChanges();
                        msg = "Se ha procedido actualizar elListado de Materiales #: " + Info.IdListadoMateriales.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.InnerException + " " + ex.Message;
                msg     = "Se ha producido el siguiente error: " + ex.Message;
                throw new Exception(ex.ToString());
            }
        }
示例#18
0
        public Boolean AnularDB(com_Motivo_Orden_Compra_Info info, ref string msg)
        {
            try
            {
                using (EntitiesCompras context = new EntitiesCompras())
                {
                    var contact = context.com_Motivo_Orden_Compra.FirstOrDefault(var => var.IdEmpresa == info.IdEmpresa && var.IdMotivo == info.IdMotivo);

                    if (contact != null)
                    {
                        contact.IdUsuarioUltAnu = info.IdUsuarioUltAnu;
                        contact.MotivoAnulacion = info.MotivoAnulacion;
                        contact.FechaHoraAnul   = DateTime.Now;
                        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();
                throw new Exception(ex.ToString());
            }
        }
示例#19
0
        public bool PasarDB(int IdEmpresa, decimal IdCotizacion, string IdUsuario)
        {
            try
            {
                using (EntitiesCompras db = new EntitiesCompras())
                {
                    if (db.com_CotizacionPedidoSaltar.Where(q => q.IdEmpresa == IdEmpresa && q.IdCotizacion == IdCotizacion && q.IdUsuario == IdUsuario).Count() == 0)
                    {
                        db.com_CotizacionPedidoSaltar.Add(new com_CotizacionPedidoSaltar
                        {
                            IdEmpresa    = IdEmpresa,
                            IdCotizacion = IdCotizacion,
                            IdUsuario    = IdUsuario
                        });
                    }
                    db.SaveChanges();
                }

                return(true);
            }
            catch (Exception)
            {
                throw;
            }
        }
示例#20
0
 public Boolean GuardarDB(com_Motivo_Orden_Compra_Info info, ref int IdMotivo, ref string msg)
 {
     try
     {
         using (EntitiesCompras Context = new EntitiesCompras())
         {
             var Address = new com_Motivo_Orden_Compra();
             Address.IdEmpresa   = info.IdEmpresa;
             Address.IdMotivo    = info.IdMotivo = GetId(info.IdEmpresa);
             Address.Cod_Motivo  = info.Cod_Motivo;
             Address.Descripcion = info.Descripcion;
             Address.estado      = info.estado;
             Context.com_Motivo_Orden_Compra.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(ex.ToString());
     }
 }
示例#21
0
        public Boolean ModificarDB(com_comprador_Info info, ref string mensaje)
        {
            try
            {
                using (EntitiesCompras context = new EntitiesCompras())
                {
                    var contact = context.com_comprador.First(var => var.IdEmpresa == info.IdEmpresa && var.IdComprador == info.IdComprador);

                    contact.IdUsuario_com = info.IdUsuario_com;
                    contact.Descripcion   = info.Descripcion;
                    contact.Estado        = info.Estado;
                    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.InnerException + " " + ex.Message;
                throw new Exception(ex.ToString());
            }
        }
        public Boolean ModificarDB(com_cotizacion_compra_det_Info info, ref string msg)
        {
            try
            {
                using (EntitiesCompras Context = new EntitiesCompras())
                {
                    var contact = Context.com_cotizacion_compra.FirstOrDefault(A => A.IdEmpresa == info.IdEmpresa && A.IdEmpresa == info.IdEmpresa);

                    if (contact != null)
                    {
                        contact.Observacion = info.Observacion;
                        Context.SaveChanges();
                    }
                }
                msg = "Grabación 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);
                msg = ex.InnerException + " " + ex.Message;
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref msg);
                throw new Exception(ex.ToString());
            }
        }
示例#23
0
        public Boolean ModificarDB_EstadoAprobacion(com_solicitud_compra_Info info)
        {
            try
            {
                using (EntitiesCompras context = new EntitiesCompras())
                {
                    var contact = context.com_solicitud_compra.FirstOrDefault(var => var.IdEmpresa == info.IdEmpresa && var.IdSucursal == info.IdSucursal && var.IdSolicitudCompra == info.IdSolicitudCompra);

                    if (contact != null)
                    {
                        contact.IdEstadoAprobacion  = info.IdEstadoAprobacion;
                        contact.IdUsuarioAprobo     = (info.IdUsuarioAprobo == null) ? "" : Convert.ToString(info.IdUsuarioAprobo);
                        contact.MotivoAprobacion    = (info.MotivoAprobacion == null) ? "" : Convert.ToString(info.MotivoAprobacion);
                        contact.FechaHoraAprobacion = info.FechaHoraAprobacion;
                        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(ex.ToString());
            }
        }
        public Boolean Eliminarregistrotabla(List <com_ordencompra_local_det_Info> lmDetalleInfo, ref string msg)
        {
            try
            {
                using (EntitiesCompras context = new EntitiesCompras())
                {
                    foreach (var item in lmDetalleInfo)
                    {
                        var address = context.com_ordencompra_local_det.FirstOrDefault(A => A.IdEmpresa == item.IdEmpresa &&
                                                                                       A.IdSucursal == item.IdSucursal && A.IdOrdenCompra == item.IdOrdenCompra &&
                                                                                       A.Secuencia == item.Secuencia);

                        if (address != null)
                        {
                            context.com_ordencompra_local_det.Remove(address);
                            context.SaveChanges();
                        }
                    }
                }
                msg = "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);
                msg = "Error no se guardó " + ex.Message + " ";
                throw new Exception(ex.ToString());
            }
        }
示例#25
0
        public com_ordencompra_local_correo_Info GetOC()
        {
            try
            {
                using (EntitiesCompras db = new EntitiesCompras())
                {
                    com_ordencompra_local_correo_Info info = db.vwcom_ordencompra_local_correo.Select(q => new com_ordencompra_local_correo_Info
                    {
                        IdEmpresa         = q.IdEmpresa,
                        IdSucursal        = q.IdSucursal,
                        IdOrdenCompra     = q.IdOrdenCompra,
                        CorreoComprador   = q.CorreoComprador,
                        CorreoProveedor   = q.pe_correo,
                        pe_cedulaRuc      = q.pe_cedulaRuc,
                        pe_nombreCompleto = q.pe_nombreCompleto,
                        Codigo            = q.Codigo
                    }).FirstOrDefault();

                    db.SaveChanges();

                    return(info);
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
示例#26
0
        public Boolean GrabarDB(com_ListadoMateriales_Det_Info Info, com_ListadoMateriales_Det_Info Info_, ref string msg)
        {
            try
            {
                using (EntitiesCompras context = new EntitiesCompras())
                {
                    var address = new com_ListadoMateriales_Det_x_com_GenerOCompra_Det();

                    address.go_IdEmpresa           = Info.IdEmpresa;
                    address.go_IdDetTrans          = Info.IdDetTrans;
                    address.go_IdTransaccion       = Info.IdTransaccion;
                    address.lm_IdEmpresa           = Info_.IdEmpresa;
                    address.lm_IdListadoMateriales = Info_.IdListadoMateriales;
                    address.lm_IdDetalle           = Info_.IdDetalle;
                    context.com_ListadoMateriales_Det_x_com_GenerOCompra_Det.Add(address);
                    context.SaveChanges();
                    msg = "Se ha procedido a grabar el registro 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.InnerException + " " + ex.Message;
                msg     = ex.ToString();
                throw new Exception(ex.ToString());
            }
        }
示例#27
0
 public bool ModificarDB(com_Catalogo_Info info)
 {
     try
     {
         EntitiesCompras context   = new EntitiesCompras();
         var             contenido = context.com_catalogo.FirstOrDefault(var => var.IdCatalogocompra == info.IdCatalogocompra);
         if (contenido != null)
         {
             contenido.Nombre          = info.Nombre;
             contenido.Orden           = info.orden;
             contenido.Estado          = info.estado;
             contenido.IdUsuarioUltMod = info.IdUsuarioUltMod;
             contenido.FechaUltMod     = info.FechaUltMod;
             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.InnerException + " " + ex.Message;
         throw new Exception(ex.ToString());
     }
 }
示例#28
0
        public Boolean AnularDB(com_TerminoPago_Info Info)
        {
            try
            {
                using (EntitiesCompras context = new EntitiesCompras())
                {
                    var contact = context.com_TerminoPago.FirstOrDefault(var => var.IdTerminoPago == Info.IdTerminoPago
                                                                         );

                    if (contact != null)
                    {
                        contact.Estado = "I";
                        //contact.IdUsuarioUltAnu = Info.IdUsuarioUltAnu;
                        //contact.Fecha_UltAnu = Info.FechaHoraAnul;
                        //contact.MotiAnula = Info.MotivoAnulacion;
                        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.InnerException + " " + ex.Message;
                throw new Exception(ex.ToString());
            }
        }
示例#29
0
        public Boolean AnularDB(com_comprador_Info info, ref string mensaje)
        {
            try
            {
                using (EntitiesCompras context = new EntitiesCompras())
                {
                    var contact = context.com_comprador.FirstOrDefault(var => var.IdEmpresa == info.IdEmpresa && var.IdComprador == info.IdComprador);

                    if (contact != null)
                    {
                        contact.IdUsuarioUltAnu = info.IdUsuarioUltAnu;
                        contact.MotiAnula       = info.MotiAnula;
                        contact.Fecha_UltAnu    = DateTime.Now;
                        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.InnerException + " " + ex.Message;
                throw new Exception(ex.InnerException.ToString());
            }
        }
        public Boolean Actualizar_CantidadAprobada(int IdEmpresa, int IdSucursal, decimal IdSolicitudCompra, int Secuencia_SC, double Cantidad_aprobada)
        {
            try
            {
                using (EntitiesCompras context = new EntitiesCompras())
                {
                    var registro = context.com_solicitud_compra_det_aprobacion.FirstOrDefault
                                       (A => A.IdEmpresa == IdEmpresa &&
                                       A.IdSucursal_SC == IdSucursal &&
                                       A.IdSolicitudCompra == IdSolicitudCompra &&
                                       A.Secuencia_SC == Secuencia_SC);

                    if (registro != null)
                    {
                        registro.Cantidad_aprobada = Cantidad_aprobada;
                        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(ex.ToString());
            }
        }