public Boolean ModificarDB(int idempresa, in_RecepcionMaterialesCab_Info info, ref string msg)
        {
            try
            {
                using (EntitiesInventario context = new EntitiesInventario())
                {
                    var contact = context.in_recepcion_material_cab.FirstOrDefault(obj => obj.IdEmpresa == idempresa && obj.IdSucursal == info.IdSucursal && obj.IdRecepcionMaterial == info.IdRecepcionMaterial);
                    if (contact != null)
                    {
                        contact.IdEmpresa           = idempresa;
                        contact.IdSucursal          = info.IdSucursal;
                        contact.IdRecepcionMaterial = info.IdRecepcionMaterial;
                        contact.IdOrdenCompra       = info.IdOrdenCompra;
                        contact.Fecha           = info.Fecha;
                        contact.EstadoRecepcion = info.EstadoRecepcion;
                        contact.Estado          = info.Estado;
                        contact.NumRecepcion    = info.NumRecepcion;

                        context.SaveChanges();
                        msg = "Se ha procedido actualizar el registro de la Recepción de materiales #: " + info.NumRecepcion + " exitosamente";
                    }
                }
                return(true);
            }
            catch (Exception ex)
            {
                string arreglo = ToString();
                tb_sis_Log_Error_Vzen_Data oDataLog      = new tb_sis_Log_Error_Vzen_Data();
                tb_sis_Log_Error_Vzen_Info Log_Error_sis = new tb_sis_Log_Error_Vzen_Info(ex.ToString(), "", arreglo, "", "", "", "", "", DateTime.Now);
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
                mensaje = ex.ToString() + " " + ex.Message;
                msg     = "Se ha producido el siguiente error: " + ex.Message;
                throw new Exception(mensaje);
            }
        }
 public Boolean AnularDB(int idempresa, in_RecepcionMaterialesCab_Info info, ref string msg)
 {
     try
     {
         using (EntitiesInventario context = new EntitiesInventario())
         {
             var contact = context.in_recepcion_material_cab.FirstOrDefault(obj => obj.IdEmpresa == idempresa && obj.IdSucursal == info.IdSucursal && obj.IdRecepcionMaterial == info.IdRecepcionMaterial);
             if (contact != null)
             {
                 contact.Estado = info.Estado;
                 context.SaveChanges();
                 msg = "Se Cambio el estado de la Recepción de Materiales # :" + info.NumRecepcion + " exitosamente";
             }
         }
         return(true);
     }
     catch (Exception ex)
     {
         string arreglo = ToString();
         tb_sis_Log_Error_Vzen_Data oDataLog      = new tb_sis_Log_Error_Vzen_Data();
         tb_sis_Log_Error_Vzen_Info Log_Error_sis = new tb_sis_Log_Error_Vzen_Info(ex.ToString(), "", arreglo, "", "", "", "", "", DateTime.Now);
         oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
         mensaje = ex.ToString() + " " + ex.Message;
         msg     = "Error del Sistema :" + ex.Message + " ";
         throw new Exception(mensaje);
     }
 }
Beispiel #3
0
 public Boolean Anular(int idempresa, in_RecepcionMaterialesCab_Info info, ref string msg)
 {
     try
     {
         return(data.AnularDB(idempresa, info, ref msg));
     }
     catch (Exception ex)
     {
         Core.Erp.Info.Log_Exception.LoggingManager.Logger.Log(Core.Erp.Info.Log_Exception.LoggingCategory.Error, ex.Message);
         throw new Core.Erp.Info.Log_Exception.DalException(string.Format("", "Anular", ex.Message), ex)
               {
                   EntityType = typeof(in_RecepcionMaterialesCab_Bus)
               };
     }
 }
Beispiel #4
0
 public Boolean GrabarDB(int idempresa, in_RecepcionMaterialesCab_Info info, List <in_RecepcionMaterialesDet_Info> lmDetalleInfo, ref string msg, ref int idgenerada)
 {
     try
     {
         return(data.GrabarDB(idempresa, info, lmDetalleInfo, ref msg, ref idgenerada));
     }
     catch (Exception ex)
     {
         Core.Erp.Info.Log_Exception.LoggingManager.Logger.Log(Core.Erp.Info.Log_Exception.LoggingCategory.Error, ex.Message);
         throw new Core.Erp.Info.Log_Exception.DalException(string.Format("", "GrabarDB", ex.Message), ex)
               {
                   EntityType = typeof(in_RecepcionMaterialesCab_Bus)
               };
     }
 }
        public Boolean GrabarDB(int idempresa, in_RecepcionMaterialesCab_Info info, List <in_RecepcionMaterialesDet_Info> lmDetalleInfo, ref string msg, ref int idgenerada)
        {
            try
            {
                using (EntitiesInventario context = new EntitiesInventario())
                {
                    var address = new in_recepcion_material_cab();
                    int id      = GetId(idempresa, info.IdSucursal);
                    address.IdEmpresa           = idempresa;
                    address.IdSucursal          = info.IdSucursal;
                    address.IdOrdenCompra       = info.IdOrdenCompra;
                    address.IdRecepcionMaterial = id;
                    address.NumRecepcion        = info.NumRecepcion;
                    address.Fecha           = info.Fecha;
                    address.Estado          = info.Estado;
                    address.EstadoRecepcion = info.EstadoRecepcion;
                    //Para pasarla al winform
                    idgenerada = id;
                    context.in_recepcion_material_cab.Add(address);
                    context.SaveChanges();

                    //Graba el detalle
                    in_RecepcionMaterialesDet_Data datadet = new in_RecepcionMaterialesDet_Data();
                    if (datadet.GrabarDB(lmDetalleInfo, idempresa, id, ref msg))
                    {
                        return(true);

                        msg = "Se ha procedido a grabar el registro de la Recepción de Material #: " + info.NumRecepcion + " 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);
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
                mensaje = ex.ToString() + " " + ex.Message;
                msg     = "Se ha producido el siguiente error: " + ex.Message;
                throw new Exception(mensaje);
            }
        }