public Boolean Anular(int idempresa, prd_OrdenTaller_Info info, ref string msg)
 {
     try
     {
         using (EntitiesProduccion_Cidersus context = new EntitiesProduccion_Cidersus())
         {
             var contact = context.prd_Orden_Taller.FirstOrDefault(A => A.IdEmpresa == idempresa && A.IdSucursal == info.IdSucursal && A.IdOrdenTaller == info.IdOrdenTaller && A.CodObra == info.CodObra);
             if (contact != null)
             {
                 contact.Estado = info.Estado;
                 context.SaveChanges();
                 msg = "Se Cambio el estado de la Orden de Taller :" + info.Codigo.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);
         msg = ex.ToString() + " " + ex.Message;
         oDataLog.Guardar_Log_Error(Log_Error_sis, ref msg);
         throw new Exception(ex.ToString());
     }
 }
        public Boolean ModificarDB(int IdEmpresa, prd_ControlProduccionObrero_Info info, ref string msg)
        {
            try
            {
                using (EntitiesProduccion_Cidersus context = new EntitiesProduccion_Cidersus())
                {
                    var contact = context.prd_ControlProduccion_Obrero.FirstOrDefault(obj => obj.IdEmpresa == IdEmpresa && obj.IdSucursal == info.IdSucursal && obj.IdControlProduccionObrero == info.IdControlProduccionObrero);
                    if (contact != null)
                    {
                        contact.NumCPO         = info.NumDoc;
                        contact.IdGrupoTrabajo = info.IdGrupoTrabajo;
                        contact.CodObra        = info.CodObra;
                        contact.IdOrdenTaller  = info.IdOrdenTaller;
                        contact.IdEmpleado     = info.IdEmpleado;
                        contact.Observacion    = info.Observacion;
                        contact.FechaRegistro  = info.FechaRegistro;
                        contact.Estado         = info.Estado;
                        contact.CantAsignada   = info.CantAsignada;

                        context.SaveChanges();
                        msg = "Se ha procedido actualizar el registro del Control de Producción #: " + info.IdControlProduccionObrero + " 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);
                msg = ex.ToString() + " " + ex.Message;
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref msg);
                return(false);
            }
        }
Exemple #3
0
        public Boolean ModificarDB(prd_Obra_Info info, ref string msg)
        {
            try
            {
                using (EntitiesProduccion_Cidersus Context = new EntitiesProduccion_Cidersus())
                {
                    var contact = Context.prd_Obra.FirstOrDefault(A => A.IdEmpresa == info.IdEmpresa && A.CodObra == info.CodObra);
                    if (contact != null)
                    {
                        contact.Descripcion      = info.Descripcion;
                        contact.Estado           = info.Estado;
                        contact.Fecha            = info.Fecha;
                        contact.IdUsuarioAnu     = info.IdUsuarioAnu;
                        contact.IdUsuarioUltModi = info.IdUsuarioUltModi;
                        contact.FechaUltModi     = info.FechaUltModi;
                        contact.IdCliente        = info.IdCliente;
                        contact.PesoObra         = info.PesoObra;
                        contact.Referencia       = info.Referencia;

                        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.ToString() + " " + ex.Message;
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref msg);
                throw new Exception(ex.ToString());
            }
        }
        public bool ModificarDB(prd_GrupoTrabajo_Info Info)
        {
            try
            {
                using (EntitiesProduccion_Cidersus context = new EntitiesProduccion_Cidersus())
                {
                    var address = new prd_GruposTrabajo();

                    address.IdEmpresa      = Info.IdEmpresa;
                    address.IdSucursal     = Info.IdSucursal;
                    address.IdGrupoTrabajo = getId(Info.IdEmpresa, Info.IdSucursal);
                    address.Descripcion    = Info.Descripcion;
                    address.AreaProduccion = Info.AreaProduccion;
                    address.Fecha          = Info.Fecha;
                    address.Estado         = Info.Estado;
                    address.Usuario        = Info.Usuario;
                    context.prd_GruposTrabajo.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 Anular(prd_Conversion_CusCidersus_Info Info, ref String Mensaje)
        {
            try
            {
                using (EntitiesProduccion_Cidersus Context = new EntitiesProduccion_Cidersus())
                {
                    var Contact = Context.prd_Conversion_CusCidersus.FirstOrDefault(v => v.IdEmpresa == Info.IdEmpresa && v.IdConversion == Info.IdConversion);
                    if (Contact != null)
                    {
                        Contact.Estado            = "I";
                        Contact.IdUsuarioAnu      = Info.IdUsuarioAnu;
                        Contact.Fecha_transaccion = Info.Fecha_Anu;
                        Context.SaveChanges();

                        Mensaje = "Anulacion realizada Exitozamente";
                    }
                }

                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);
                mensaje = ex.ToString() + " " + ex.Message;
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
                throw new Exception(ex.ToString());
            }
        }
Exemple #6
0
        public Boolean GuardarTIMovim_EgresoConsumo(in_movi_inve_detalle_x_Producto_CusCider_Info Info)
        {
            try
            {
                using (EntitiesProduccion_Cidersus Context = new EntitiesProduccion_Cidersus())
                {
                    var Address = new in_movi_inve_detalle_x_Producto_CusCider();

                    Address.IdEmpresa         = Info.IdEmpresa;
                    Address.IdSucursal        = Info.IdSucursal;
                    Address.IdBodega          = Info.IdBodega;
                    Address.IdMovi_inven_tipo = Info.IdMovi_inven_tipo;
                    Address.IdNumMovi         = Info.IdNumMovi;
                    Address.IdEmpresa         = Info.IdEmpresa;
                    Address.IdSucursal        = Info.IdSucursal;
                    Address.IdBodega          = Info.IdBodega;
                    Address.IdMovi_inven_tipo = Info.IdMovi_inven_tipo;
                    Address.IdNumMovi         = Info.IdNumMovi;
                    Address.ot_CodObra        = Info.ot_CodObra;
                    Address.ot_IdOrdenTaller  = Info.ot_IdOrdenTaller;
                    Context.in_movi_inve_detalle_x_Producto_CusCider.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);
                mensaje = ex.ToString() + " " + ex.Message;
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
                throw new Exception(ex.ToString());
            }
        }
Exemple #7
0
        public Boolean GuardarDB(prd_conversion_cusCidersus_x_in_movi_inven_Info Info)
        {
            try
            {
                List <prd_conversion_cusCidersus_x_in_movi_inven_Info> Lst = new List <prd_conversion_cusCidersus_x_in_movi_inven_Info>();
                using (EntitiesProduccion_Cidersus Context = new EntitiesProduccion_Cidersus())
                {
                    var Address = new prd_conversion_cusCidersus_x_in_movi_inven();

                    Address.IdEmpresa         = Info.IdEmpresa;
                    Address.IdSucursal        = Info.IdSucursal;
                    Address.IdBodega          = Info.IdBodega;
                    Address.IdMovi_inven_tipo = Info.IdMovi_inven_tipo;
                    Address.IdNumMovi         = Info.IdNumMovi;
                    Address.cv_IdEmpresa      = Info.cv_IdEmpresa;
                    Address.cv_IdConversion   = Info.cv_IdConversion;

                    Context.prd_conversion_cusCidersus_x_in_movi_inven.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);
                mensaje = ex.ToString() + " " + ex.Message;
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
                throw new Exception(ex.ToString());
            }
        }
Exemple #8
0
 public Boolean eliminarregistrotabla(List <prd_ControlProduccionObreroDetalle_Info> lmDetalleInfo, int idempresa, decimal IdCtrlPrdObrero, ref string msg)
 {
     try
     {
         var contact = new prd_ControlProduccion_Obrero_Det();
         using (EntitiesProduccion_Cidersus context = new EntitiesProduccion_Cidersus())
         {
             foreach (var item in lmDetalleInfo)
             {
                 var address = context.prd_ControlProduccion_Obrero_Det.FirstOrDefault(A => A.IdEmpresa == idempresa && A.IdSucursal == item.IdSucursal && A.IdControlProduccionObrero == IdCtrlPrdObrero);
                 //&& A.Secuencia == item.Secuencia && A.IdFecha == item.IdFecha);
                 if (address != null)
                 {
                     contact = address;
                     context.prd_ControlProduccion_Obrero_Det.Remove(contact);
                     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);
         msg = ex.ToString() + " " + ex.Message;
         oDataLog.Guardar_Log_Error(Log_Error_sis, ref msg);
         throw new Exception(ex.ToString());
     }
 }
Exemple #9
0
        public bool GrabaDB(List <prd_GruposTrabajo_PorPP_Info> Info, ref string Error)
        {
            // Disponibilidad_PorSubgrupo_Data data = new Disponibilidad_PorSubgrupo_Data();
            try
            {
                EntitiesProduccion_Cidersus entie = new EntitiesProduccion_Cidersus();

                foreach (var item in Info)
                {
                    prd_GruposTrabajo_PorPP Add = new prd_GruposTrabajo_PorPP();
                    Add.IdProcesoProductivo = item.IdProcesoProductivo;
                    Add.IdEtapa             = item.IdEtapa;
                    Add.IdGrupoTrabajo      = item.IdGrupoTrabajo;
                    Add.IdSubgrupo          = item.IdSubgrupo;
                    entie.prd_GruposTrabajo_PorPP.Add(Add);
                    entie.SaveChanges();

                    //data.Disponibilidad_GT(item.IdGrupoTrabajo, item.IdSubgrupo, item.IdProcesoProductivo, item.IdEtapa, 0);
                }

                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());
            }
        }
Exemple #10
0
        public Boolean Anular(int idempresa, prd_MovPteGrua_Info Info, ref string msg)
        {
            try
            {
                using (EntitiesProduccion_Cidersus context = new EntitiesProduccion_Cidersus())
                {
                    // var contact = context.prd_MovPteGrua.First(A => A.IdEmpresa == idempresa && A.IdSucursal == Info.IdSucursal && A.IdMovPteGrua == Info.IdMovPteGrua);



                    context.SaveChanges();
                    // msg = "Se Cambio el estado de la Movilización Pte Grua # :" + Info.IdMovPteGrua.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);
                msg = ex.ToString() + " " + ex.Message;
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref msg);
                throw new Exception(ex.ToString());
            }
        }
 public Boolean eliminaregistrotabla(List <prd_Ensamblado_Det_CusCider_Info> lstDetEns, ref string msg)
 {
     try
     {
         using (EntitiesProduccion_Cidersus context = new EntitiesProduccion_Cidersus())
         {
             foreach (var item in lstDetEns)
             {
                 var address = context.prd_Ensamblado_Det_CusCider.FirstOrDefault(var => var.IdEmpresa == item.IdEmpresa && var.IdSucursal == item.IdSucursal && var.IdEnsamblado == item.IdEnsamblado && var.Secuencia == item.Secuencia);
                 if (address != null)
                 {
                     context.prd_Ensamblado_Det_CusCider.Remove(address);
                     context.SaveChanges();
                     msg = "Guardado con éxito";
                 }
             }
         }
         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.ToString() + " " + ex.Message;
         oDataLog.Guardar_Log_Error(Log_Error_sis, ref msg);
         throw new Exception(ex.ToString());
     }
 }
Exemple #12
0
 //Funcion para eliminar la lista
 public Boolean eliminarLisEtapas(List <prd_EtapaProduccion_Info> ListInfo, int IdEmpresa, int IdModeloProductivo, ref string msg)
 {
     try
     {
         using (EntitiesProduccion_Cidersus context = new EntitiesProduccion_Cidersus())
         {
             foreach (var item in ListInfo)
             {
                 var address = context.prd_EtapaProduccion.FirstOrDefault(A => A.IdEmpresa == IdEmpresa && A.IdProcesoProductivo == IdModeloProductivo);
                 if (address != null)
                 {
                     context.prd_EtapaProduccion.Remove(address);
                     context.SaveChanges();
                     msg = "Se ha procedido a Eliminar las Etapas de producción del modelo  #: " + IdModeloProductivo.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);
         msg = ex.ToString() + " " + ex.Message;
         oDataLog.Guardar_Log_Error(Log_Error_sis, ref msg);
         throw new Exception(ex.ToString());
     }
 }
 public Boolean ModificarDB(prd_CotizacionCompras_Info info, ref string msg)
 {
     try
     {
         using (EntitiesProduccion_Cidersus Context = new EntitiesProduccion_Cidersus())
         {
             var contact = Context.prd_Obra.FirstOrDefault(A => A.IdEmpresa == info.IdEmpresa && A.IdEmpresa == info.IdEmpresa);
             if (contact != null)
             {
                 contact.Estado = 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.ToString() + " " + ex.Message;
         oDataLog.Guardar_Log_Error(Log_Error_sis, ref msg);
         return(false);
     }
 }
 public Boolean AnularDB(int IdEmpresa, prd_ControlProduccionObrero_Info info, ref string msg)
 {
     try
     {
         using (EntitiesProduccion_Cidersus context = new EntitiesProduccion_Cidersus())
         {
             var contact = context.prd_ControlProduccion_Obrero.FirstOrDefault(A => A.IdEmpresa == IdEmpresa && A.IdSucursal == info.IdSucursal && A.IdControlProduccionObrero == info.IdControlProduccionObrero);
             if (contact != null)
             {
                 contact.Estado = "I";
                 context.SaveChanges();
                 msg = "Se Cambio el estado del Control de Producción # :" + info.IdControlProduccionObrero.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);
         msg = ex.ToString() + " " + ex.Message;
         oDataLog.Guardar_Log_Error(Log_Error_sis, ref msg);
         return(false);
     }
 }
Exemple #15
0
        public Boolean ModificarDB(int idempresa, prd_SubGrupoTrabajo_Info info, ref string msg)
        {
            try
            {
                using (EntitiesProduccion_Cidersus context = new EntitiesProduccion_Cidersus())
                {
                    var contact = context.prd_GrupoTrabajo.FirstOrDefault(obj => obj.IdEmpresa == idempresa && obj.IdSucursal == info.IdSucursal && obj.IdGrupoTrabajo == info.IdGrupoTrabajo);
                    if (contact != null)
                    {
                        contact.Descripcion   = info.Descripcion;
                        contact.FechaCreacion = info.FechaCreacion;

                        contact.IdGrupo             = info.idGrupo;
                        contact.IdLider             = info.IdLider;
                        contact.IdProcesoProductivo = info.IdProcesoProductivo;
                        contact.IdEtapa             = info.IdEtapa;
                        contact.Estado = info.Estado;

                        context.SaveChanges();
                        msg = "Se ha procedido actualizar el registro del Grupo de trabajo #: " + info.IdGrupoTrabajo + " 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);
                msg = ex.ToString() + " " + ex.Message;
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref msg);
                throw new Exception(ex.ToString());
            }
        }
 public Boolean AnularItem(prd_ProcesoProductivo_Info info, ref string msg)
 {
     try
     {
         using (EntitiesProduccion_Cidersus context = new EntitiesProduccion_Cidersus())
         {
             var contact = context.prd_ProcesoProductivo.FirstOrDefault(A => A.IdEmpresa == info.IdEmpresa && A.IdProcesoProductivo == info.IdProcesoProductivo);
             if (contact != null)
             {
                 contact.Estado = "I";
                 context.SaveChanges();
                 msg = "Se ha procedio anular el Id del Proceso Productivo # :" + info.IdProcesoProductivo.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);
         msg = ex.ToString() + " " + ex.Message;
         oDataLog.Guardar_Log_Error(Log_Error_sis, ref msg);
         throw new Exception(ex.ToString());
     }
 }
        public Boolean GrabarModelo_x_Obra(prd_ProcesoProductivo_Info infoMP, prd_Obra_Info InfoOBra)
        {
            try
            {
                using (EntitiesProduccion_Cidersus context = new EntitiesProduccion_Cidersus())
                {
                    var address = new prd_ProcesoProductivo_x_prd_obra();
                    address.IdEmpresa_obra      = InfoOBra.IdEmpresa;
                    address.CodObra             = InfoOBra.CodObra;
                    address.IdEmpresa_Pr        = infoMP.IdEmpresa;
                    address.IdProcesoProductivo = infoMP.IdProcesoProductivo;

                    context.prd_ProcesoProductivo_x_prd_obra.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);
                mensaje = ex.ToString() + " " + ex.Message;
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
                throw new Exception(ex.ToString());
            }
        }
        public Boolean GrabarItem(prd_ProcesoProductivo_Info info, ref int idpp, ref string msg)
        {
            try
            {
                using (EntitiesProduccion_Cidersus context = new EntitiesProduccion_Cidersus())
                {
                    var address = new prd_ProcesoProductivo();
                    idpp = getIdProcesoProductivo(info.IdEmpresa);
                    address.IdEmpresa           = info.IdEmpresa;
                    address.IdProcesoProductivo = idpp;

                    address.Nombre = info.Nombre;
                    address.Estado = (info.Estado == true) ? "A" : "I";
                    context.prd_ProcesoProductivo.Add(address);
                    context.SaveChanges();

                    msg = "Se ha generado el Proceso Productivo No.:" + idpp.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);
                msg = ex.ToString() + " " + ex.Message;
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref msg);
                throw new Exception(ex.ToString());
            }
        }
Exemple #19
0
 public Boolean eliminarregistrotabla(List <prd_SubGrupoTrabajoDetalle_Info> lmDetalleInfo, int idempresa, decimal IdGrupoTrabajo, ref string msg)
 {
     try
     {
         using (EntitiesProduccion_Cidersus contex1 = new EntitiesProduccion_Cidersus())
         {
             foreach (var item in lmDetalleInfo)
             {
                 var address = contex1.prd_GrupoTrabajo_Det.FirstOrDefault(A => A.IdEmpresa == idempresa && A.IdSucursal == item.IdSucursal && A.IdGrupotrabajo == IdGrupoTrabajo && A.Secuencia == item.Secuencia);
                 if (address != null)
                 {
                     contex1.prd_GrupoTrabajo_Det.Remove(address);
                     contex1.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);
         msg = ex.ToString() + " " + ex.Message;
         oDataLog.Guardar_Log_Error(Log_Error_sis, ref msg);
         throw new Exception(ex.ToString().ToString());
     }
 }
        public Boolean GuardarDB(prd_Ensamblado_CusCider_Info Info, List <prd_Ensamblado_Det_CusCider_Info> Det, ref decimal idEnsamblado, ref string msg)
        {
            try
            {
                List <prd_Ensamblado_CusCider_Info> Lst     = new List <prd_Ensamblado_CusCider_Info>();
                prd_Ensamblado_Det_CusCider_Data    DetData = new prd_Ensamblado_Det_CusCider_Data();
                using (EntitiesProduccion_Cidersus Context = new EntitiesProduccion_Cidersus())
                {
                    var Address = new prd_Ensamblado_CusCider();
                    idEnsamblado           = getId(Info.IdEmpresa, Info.IdSucursal);
                    Address.IdEmpresa      = Info.IdEmpresa;
                    Address.IdSucursal     = Info.IdSucursal;
                    Address.IdEnsamblado   = idEnsamblado;
                    Address.IdBodega       = Info.IdBodega;
                    Address.IdGrupoTrabajo = Info.IdGrupoTrabajo;
                    Address.IdProducto     = Info.IdProducto;

                    Address.CodigoBarra   = "A" + DateTime.Now.Year + "M" + DateTime.Now.Month + "D" + DateTime.Now.Day + "E" + Info.IdEmpresa + "N" + idEnsamblado + "O" + Info.CodObra + "T" + Info.IdOrdenTaller + "P" + Info.IdProducto + "G" + Info.IdGrupoTrabajo;
                    Address.CodObra       = Info.CodObra;
                    Address.IdOrdenTaller = Info.IdOrdenTaller;
                    Address.IdUsuario     = Info.IdUsuario;
                    Address.FechaTransac  = Info.FechaTransac;

                    Address.IdDespacho = Info.IdDespacho;

                    Address.Estado = "A";
                    if (Info.Observacion.Length > 1000)
                    {
                        Address.Observacion = Info.Observacion.Substring(0, 1000);
                    }
                    else
                    {
                        Address.Observacion = Info.Observacion;
                    }
                    Context.prd_Ensamblado_CusCider.Add(Address);
                    Context.SaveChanges();

                    Det.ForEach(var =>
                    {
                        var.IdEnsamblado = Address.IdEnsamblado;
                        var.IdEmpresa    = Info.IdEmpresa;
                        var.IdSucursal   = Info.IdSucursal;
                    });
                    return(DetData.GuardarDB(Det, ref msg));
                }
            }
            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.ToString() + " " + ex.Message;
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref msg);
                throw new Exception(ex.ToString());
            }
        }
        public Boolean GrabarDB(int idempresa, prd_OrdenTaller_Info info, ref string msg, ref decimal idgenerada, ref string numDoc)
        {
            try
            {
                using (EntitiesProduccion_Cidersus context = new EntitiesProduccion_Cidersus())
                {
                    var address = new prd_Orden_Taller();
                    idgenerada = getNumDoc(idempresa, info.IdSucursal);

                    address.IdEmpresa     = idempresa;
                    address.IdSucursal    = info.IdSucursal;
                    address.IdOrdenTaller = idgenerada;
                    address.CodObra       = info.CodObra;
                    //Para pasarla al winform
                    address.IdCliente  = info.IdCliente;
                    address.IdProducto = info.IdProducto;
                    //address.NumeroOT = idgenerada;
                    address.TotalPeso     = info.TotalPeso;
                    address.Estado        = info.Estado;
                    address.FechaReg      = info.FechaReg;
                    address.CantidadPieza = info.CantidadPieza;

                    address.LongitudUnitaria = info.LongitudUnitaria;
                    address.TotalLongitud    = info.TotalLongitud;
                    address.IdListadoDiseno  = info.IdListadoDiseno;
                    address.Observacion      = info.Observacion;
                    address.PesoUnitaro      = info.PesoUnitario;
                    if (info.Codigo == string.Empty)
                    {
                        info.Codigo = idgenerada.ToString("00");
                    }
                    while ((VerificarCodigo(info.Codigo)))
                    {
                        info.Codigo = info.Codigo + "-0";
                    }

                    address.Codigo = info.Codigo;
                    numDoc         = address.Codigo;

                    context.prd_Orden_Taller.Add(address);
                    context.SaveChanges();
                }
                msg = "Se ha generado la Orden de Taller # " + numDoc + " 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);
                mensaje = ex.ToString() + " " + ex.Message;
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
                throw new Exception(ex.ToString());
            }
        }
        public Boolean GuardarDB(prd_Conversion_CusCidersus_Info Info, ref Decimal Id, ref String Mensaje)
        {
            try
            {
                List <prd_Conversion_CusCidersus_Info> Lst = new List <prd_Conversion_CusCidersus_Info>();
                using (EntitiesProduccion_Cidersus Context = new EntitiesProduccion_Cidersus())
                {
                    var Address = new prd_Conversion_CusCidersus();

                    Address.IdEmpresa         = Info.IdEmpresa;
                    Address.IdConversion      = Id = GetId(Info.IdEmpresa);
                    Address.IdSucursal        = Info.IdSucursal;
                    Address.IdBodega          = Info.IdBodega;
                    Address.CodObra           = Info.CodObra;
                    Address.IdOrdenTaller     = Info.IdOrdenTaller;
                    Address.IdEtapa           = Info.IdEtapa;
                    Address.CodBarraProducto  = Info.CodBarraProducto;
                    Address.NomProducto       = Info.NomProducto;
                    Address.Fecha             = Info.Fecha;
                    Address.IdUsuario         = Info.IdUsuario;
                    Address.Fecha_transaccion = Info.Fecha_transaccion;
                    Address.IdGrupoTrabajo    = Info.IdGrupoTrabajo;
                    Address.Estado            = "A";
                    Address.Observacion       = Info.Observacion;

                    Context.prd_Conversion_CusCidersus.Add(Address);
                    Context.SaveChanges();

                    prd_Conversion_det_CusCidersus_Data DataDeta = new prd_Conversion_det_CusCidersus_Data();

                    Info.ListDetalle.ForEach(var => var.IdConversion = Address.IdConversion);
                    if (DataDeta.GuardarDB(Info.ListDetalle, ref Mensaje))
                    {
                        Mensaje = "Se guardado Correctamente el registro # " + Id;  return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
            }
            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);
                Mensaje = ex.ToString() + " " + ex.Message;
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref Mensaje);
                throw new Exception(ex.ToString());
            }
        }
Exemple #23
0
        public Boolean GuardarDB(prd_parametros_CusCidersus_Info Info)
        {
            try
            {
                List <prd_parametros_CusCidersus_Info> Lst = new List <prd_parametros_CusCidersus_Info>();
                using (EntitiesProduccion_Cidersus Context = new EntitiesProduccion_Cidersus())
                {
                    var Address = new prd_parametros_CusCidersus();

                    Address.IdEmpresa                              = Info.IdEmpresa;
                    Address.IdSucursal_Princ                       = Info.IdSucursal_Princ;
                    Address.IdBodega_Princ                         = Info.IdBodega_Princ;
                    Address.IdSucursal_Produccion                  = Info.IdSucursal_Produccion;
                    Address.IdBodega_Produccion                    = Info.IdBodega_Produccion;
                    Address.IdMovi_inven_tipo_ing_suc_princ        = Info.IdMovi_inven_tipo_ing_suc_princ;
                    Address.IdMovi_inven_tipo_egr_suc_princ        = Info.IdMovi_inven_tipo_egr_suc_princ;
                    Address.IdMovi_inven_tipo_egr_consumoprod      = Info.IdMovi_inven_tipo_egr_consumoprod;
                    Address.IdMovi_inven_tipo_ing_consumoprod      = Info.IdMovi_inven_tipo_ing_consumoprod;
                    Address.IdMovi_inven_tipo_ing_ContrlProduccion = Info.IdMovi_inven_tipo_ing_ContrlProduccion;
                    Address.IdMovi_inven_tipo_egr_ContrlProduccion = Info.IdMovi_inven_tipo_egr_ContrlProduccion;
                    Address.IdMovi_inven_tipo_egr_Conversion       = Info.IdMovi_inven_tipo_egr_Conversion;
                    Address.IdMovi_inven_tipo_ing_Conversion       = Info.IdMovi_inven_tipo_ing_Conversion;
                    Address.IdMovi_inven_tipo_egr_Ensamblado       = Info.IdMovi_inven_tipo_egr_Ensamblado;
                    Address.IdMovi_inven_tipo_ing_Ensamblado       = Info.IdMovi_inven_tipo_ing_Ensamblado;
                    Address.IdMovi_inven_tipo_ingxresid_Conversion = Info.IdMovi_inven_tipo_ingxresid_Conversion;
                    Address.IdMovi_invent_tipo_egr_Despacho        = Info.IdMovi_invent_tipo_egr_Despacho;
                    Address.IdEstadoAprobacion_x_default           = Info.IdEstadoAprobacion_x_default;
                    Address.IdProductoTipo_ProdTerm                = Info.IdProductoTipo_ProdTerm;
                    Address.IdCategoria_ProdTerm                   = Info.IdCategoria_ProdTerm;
                    Address.IdProveedor_ProdTerm                   = Info.IdProveedor_ProdTerm;
                    Address.IdMarca_ProdTerm                       = Info.IdMarca_ProdTerm;

                    Address.idTipo_Produto_Elemento     = Info.idTipo_Produto_Elemento;
                    Address.IdProductoTipo_MateriaPrima = Info.IdProductoTipo_MateriaPrima;
                    Address.IdMoviInicio = Info.IdMoviInicio;

                    Context.prd_parametros_CusCidersus.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);
                mensaje = ex.ToString() + " " + ex.Message;
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
                throw new Exception(ex.ToString());
            }
        }
        public Boolean GrabarDB(int IdEmpresa, prd_ControlProduccionObrero_Info info, List <prd_ControlProduccionObreroDetalle_Info> lmDetalleInfo, ref string msg, ref decimal idgenerada)
        {
            try
            {
                using (EntitiesProduccion_Cidersus context = new EntitiesProduccion_Cidersus())
                {
                    var address = new prd_ControlProduccion_Obrero();
                    int id      = GetId(IdEmpresa, info.IdSucursal);
                    address.IdEmpresa  = IdEmpresa;
                    address.IdSucursal = info.IdSucursal;
                    address.IdBodega   = info.IdBodega;
                    address.IdControlProduccionObrero = id;
                    //Para pasarla al winform
                    idgenerada = id;

                    address.NumCPO         = id;
                    address.IdGrupoTrabajo = info.IdGrupoTrabajo;
                    address.CodObra        = info.CodObra;
                    address.IdOrdenTaller  = info.IdOrdenTaller;
                    address.IdEmpleado     = info.IdEmpleado;
                    address.CantAsignada   = info.CantAsignada;
                    address.Observacion    = info.Observacion;
                    address.FechaRegistro  = info.FechaRegistro;
                    address.Estado         = "A";

                    context.prd_ControlProduccion_Obrero.Add(address);
                    context.SaveChanges();

                    prd_ControlProduccionObreroDetalle_Data datadetalle = new prd_ControlProduccionObreroDetalle_Data();
                    if (datadetalle.grabarDB(lmDetalleInfo, IdEmpresa, id, ref msg))
                    {
                        return(true);

                        msg = "Se ha procedido a grabar el registro del Control  de Producción #: " + id.ToString() + " exitosamente.";
                    }
                    else
                    {
                        return(false);
                    }
                }
            }
            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.ToString() + " " + ex.Message;
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref msg);
                return(false);
            }
        }
Exemple #25
0
        //Graba Cabecera  del grupo de trabajo

        public Boolean GrabarCabeceraDB(int idempresa, prd_SubGrupoTrabajo_Info info, List <prd_SubGrupoTrabajoDetalle_Info> lmDetalleInfo, ref string msg, ref decimal idgenerada)
        {
            try
            {
                using (EntitiesProduccion_Cidersus context = new EntitiesProduccion_Cidersus())
                {
                    var address = new prd_GrupoTrabajo();
                    int id      = getId(idempresa, info.IdSucursal);
                    address.IdEmpresa           = idempresa;
                    address.IdSucursal          = info.IdSucursal;
                    address.IdGrupoTrabajo      = id;
                    idgenerada                  = id;
                    address.Descripcion         = info.Descripcion;
                    address.FechaCreacion       = info.FechaCreacion;
                    address.IdLider             = info.IdLider;
                    address.IdProcesoProductivo = info.IdProcesoProductivo;
                    address.IdEtapa             = info.IdEtapa;
                    address.Estado              = info.Estado;
                    address.IdGrupo             = info.idGrupo;
                    context.prd_GrupoTrabajo.Add(address);
                    context.SaveChanges();

                    lmDetalleInfo.ForEach(var => { var.CodObra        = info.CodObra;
                                                   var.IdEmpresa      = info.IdEmpresa; var.IdSucursal = info.IdSucursal;
                                                   var.IdGrupotrabajo = id; });
                    prd_SubGrupoTrabajoDetalle_Data datadetalle = new prd_SubGrupoTrabajoDetalle_Data();
                    if (datadetalle.grabarDB(lmDetalleInfo, idempresa, id, ref msg))
                    {
                        //Disponibilidad_PorSubgrupo_Data DataGT = new Disponibilidad_PorSubgrupo_Data();
                        //DataGT.Disponibilidad_GT(info.idGrupo, id, info.IdProcesoProductivo, info.IdEtapa, 0);
                        return(true);

                        msg = "Se ha procedido a grabar el Grupo de trabajo #: " + id.ToString() + " exitosamente.";
                    }
                    else
                    {
                        return(false);
                    }
                }
            }
            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.ToString() + " " + ex.Message;
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref msg);
                throw new Exception(ex.ToString());
            }
        }
        //modificado por pedro salinas, se le cambio el First por el FirstOrDefault y se agrego una pregunta para identificar si el query esta en null
        public Boolean AnularDB(prd_Ensamblado_CusCider_Info ensamblado, ref string msg)
        {
            try
            {
                using (EntitiesProduccion_Cidersus context = new EntitiesProduccion_Cidersus())
                {
                    var contact = context.prd_Ensamblado_CusCider.FirstOrDefault(obj => obj.IdEnsamblado == ensamblado.IdEnsamblado && obj.IdSucursal == ensamblado.IdSucursal && obj.IdEmpresa == ensamblado.IdEmpresa);
                    if (contact != null)
                    {
                        contact.Estado       = "I";
                        contact.FechaAnu     = ensamblado.FechaAnu;
                        contact.IdUsuarioAnu = ensamblado.IdUsuarioAnu;
                        contact.MotivoAnu    = ensamblado.MotivoAnu;

                        context.SaveChanges();

                        prd_Ensamblado_Det_CusCider_Data        datadet = new prd_Ensamblado_Det_CusCider_Data();
                        List <prd_Ensamblado_Det_CusCider_Info> det     = new List <prd_Ensamblado_Det_CusCider_Info>();
                        det = datadet.ConsultaEnsamblado(ensamblado.IdEmpresa, ensamblado.IdSucursal, ensamblado.IdEnsamblado, ref msg);
                        if (datadet.eliminaregistrotabla(det, ref msg))
                        {
                            det.ForEach(var => { var.en_cantidad = 0; var.Observacion = "**ANULADO***" + var.Observacion; });
                            if (datadet.GuardarDB(det, ref msg))
                            {
                                msg = "Se ha procedido a anular el Ensamblado No: " + ensamblado.IdEnsamblado.ToString() + " exitosamente";
                            }
                            else
                            {
                                return(false);
                            }
                        }
                        else
                        {
                            return(false);
                        }
                    }
                }
                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.ToString() + " " + ex.Message;
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref msg);
                throw new Exception(ex.ToString());
            }
        }
        public Boolean grabarDB(List <prd_DespachoDetalle_Info> lmDetalleinfo, int idempresa, decimal IdDespacho, ref string msg)
        {
            try
            {
                using (EntitiesProduccion_Cidersus context = new EntitiesProduccion_Cidersus())
                {
                    int sec = 0;
                    foreach (var item in lmDetalleinfo)
                    {
                        var Address = new prd_DespachoDet();

                        Address.IdEmpresa  = item.IdEmpresa;
                        Address.IdSucursal = item.IdSucursal;
                        Address.IdDespacho = IdDespacho;

                        Address.Secuencia = ++sec;

                        Address.IdOrdenTaller      = Convert.ToDecimal(item.IdOrdenTaller);
                        Address.Hora               = item.Hora;
                        Address.IdProducto         = item.IdProducto;
                        Address.CodigoBarraMaestro = item.CodigoBarraMaestro;
                        Address.CodigoBarra        = item.CodigoBarra;
                        Address.Cantidad           = item.Cantidad;
                        Address.Observacion        = item.Observacion;
                        Address.precio             = Convert.ToDecimal(item.precio);
                        Address.peso               = Convert.ToDecimal(item.peso);
                        if (item.Observacion.Length > 200)
                        {
                            Address.Observacion = item.Observacion.Substring(0, 200);
                        }

                        context.prd_DespachoDet.Add(Address);
                        context.SaveChanges();
                    }
                    context.Dispose();
                }
                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);
                mensaje = ex.ToString() + " " + ex.Message;
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
                throw new Exception(ex.ToString());
            }
        }
Exemple #28
0
        public Boolean ModificaDB(prd_Despacho_Info info, ref string msg)
        {
            try
            {
                using (EntitiesProduccion_Cidersus context = new EntitiesProduccion_Cidersus())
                {
                    var contact = context.prd_Despacho.FirstOrDefault(obj => obj.IdEmpresa == info.IdEmpresa && obj.IdSucursal == info.IdSucursal && obj.CodObra == info.CodObra && obj.IdDespacho == info.IdDespacho);
                    if (contact != null)
                    {
                        contact.IdBodega        = info.IdBodega;
                        contact.IdCliente       = info.IdCliente;
                        contact.FechaReg        = info.FechaReg;
                        contact.FechaFinTras    = info.FechaFinTras;
                        contact.FechaIniTras    = info.FechaIniTras;
                        contact.PuntoPartida    = info.PuntoPartida;
                        contact.PuntoLLegada    = info.PuntoLLegada;
                        contact.NumGuiaRemision = info.NumGuiaRemision;
                        contact.Chofer          = info.Chofer;
                        contact.Placa           = info.Placa;
                        contact.TipoTransporte  = info.TipoTransporte;
                        contact.Observacion     = info.Observacion;
                        if (info.Observacion.Length > 1000)
                        {
                            contact.Observacion = info.Observacion.Substring(0, 1000);
                        }
                        contact.IdUsuarioUltModi = info.IdUsuarioUltModi;
                        contact.FechaUltModi     = DateTime.Now;
                        contact.NumDespacho      = info.NumDespacho;
                        contact.NumFactura       = info.NumFactura;


                        context.SaveChanges();
                        msg = "Se ha procedido a actualizar el Despacho #: " + info.NumDespacho.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);
                msg = ex.ToString() + " " + ex.Message;
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref msg);
                throw new Exception(ex.ToString());
            }
        }
Exemple #29
0
        public Boolean ModificarDB(prd_MovPteGrua_Info Info, ref string msg)
        {
            try
            {
                using (EntitiesProduccion_Cidersus context = new EntitiesProduccion_Cidersus())
                {
                    var Address = context.prd_Movimiento_PteGrua.FirstOrDefault(A => A.IdEmpresa == Info.IdEmpresa && A.IdSucursal == Info.IdSucursal && A.IdPuenteGrua == Info.IdPuenteGrua && A.IdMovimiento == Info.IdMovimiento);
                    if (Address != null)
                    {
                        Address.IdEmpresa    = Info.IdEmpresa;
                        Address.IdSucursal   = Info.IdSucursal;
                        Address.IdPuenteGrua = Info.IdPuenteGrua;
                        Address.IdOperador   = Info.IdOperador;

                        Address.IdProcesoProductivo = Info.IdProcesoProductivo;
                        Address.IdMovimiento        = Info.IdMovimiento;
                        Address.IdEtapaInicio       = Info.IdEtapaInicio;
                        Address.IdEtapaSiguiente    = Info.IdEtapaSiguiente;
                        Address.CodigoBarra         = Info.CodigoBarra;
                        Address.DescripcionPieza    = Info.DescripcionPieza;
                        Address.ToneladasMover      = Info.ToneladasMover;
                        Address.Observacion         = Info.Observacion;
                        Address.FechaTransaccion    = Info.FechaTransaccion;
                        Address.IdUsuario           = Info.IdUsuario;
                        Address.IdUsuarioAnu        = Info.IdUsuarioAnu;
                        Address.MotivoAnu           = Info.MotivoAnu;
                        Address.IdUsuarioUltModi    = Info.IdUsuarioUltModi;
                        Address.FechaAnu            = null;
                        Address.FechaUltModi        = null;
                        Address.Estado = Info.Estado;
                        // context.prd_Movimiento_PteGrua.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);
                msg = ex.ToString() + " " + ex.Message;
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref msg);
                throw new Exception(ex.ToString());
            }
        }
Exemple #30
0
        //Modificado por Pedro Salinas, se combio el First por el FirstorDefault y se puso una pregunta si el query tiene o no información
        public Boolean AnularReactiva(prd_Despacho_Info info, ref string msg)
        {
            try
            {
                using (EntitiesProduccion_Cidersus context = new EntitiesProduccion_Cidersus())
                {
                    var contact = context.prd_Despacho.FirstOrDefault(A => A.IdEmpresa == info.IdEmpresa && A.IdSucursal == info.IdSucursal && A.IdDespacho == info.IdDespacho);
                    if (contact != null)
                    {
                        contact.Estado       = "I";
                        contact.FechaAnu     = info.FechaAnu;
                        contact.IdUsuarioAnu = info.IdUsuarioAnu;
                        contact.MotivoAnu    = info.MotivoAnu;
                        contact.Observacion  = info.Observacion;
                        context.SaveChanges();

                        prd_DespachoDetalle_Data        datadetalle = new prd_DespachoDetalle_Data();
                        List <prd_DespachoDetalle_Info> LstDetalle  = new List <prd_DespachoDetalle_Info>();

                        LstDetalle = datadetalle.ObtenerDespachoDetalle(info.IdDespacho, info.IdEmpresa, info.IdSucursal);
                        if (datadetalle.eliminarregistrotabla(LstDetalle, info.IdEmpresa, info.IdDespacho, ref msg))
                        {
                            foreach (var item in LstDetalle)
                            {
                                item.Cantidad    = 0;
                                item.Observacion = "**ANULADO**" + item.Observacion;
                            }
                            datadetalle.grabarDB(LstDetalle, info.IdEmpresa, info.IdDespacho, ref msg);
                        }


                        msg = "Se anulo correctamente el Despacho # :" + info.NumDespacho;
                    }
                }
                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.ToString() + " " + ex.Message;
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref msg);
                throw new Exception(ex.ToString());
            }
        }