Exemple #1
0
 public Boolean GrabarDB(List <in_movi_inven_tipo_x_tb_bodega_Info> lst, ref string mensaje)
 {
     try
     {
         foreach (var item in lst)
         {
             using (EntitiesInventario contex = new EntitiesInventario())
             {
                 var address = new in_movi_inven_tipo_x_tb_bodega();
                 address.IdBodega          = item.IdBodega;
                 address.IdEmpresa         = item.IdEmpresa;
                 address.IdCtaCble         = item.IdCtaCble;
                 address.IdMovi_inven_tipo = item.IdMovi_inven_tipo;
                 address.IdSucucursal      = item.IdSucucursal;
                 contex.in_movi_inven_tipo_x_tb_bodega.Add(address);
                 contex.SaveChanges();
                 contex.Dispose();
                 mensaje = "Guardado con exito";
             }
         }
         return(true);
     }
     catch (Exception ex)
     {
         string arreglo = ToString();
         tb_sis_Log_Error_Vzen_Data oDataLog      = new tb_sis_Log_Error_Vzen_Data();
         tb_sis_Log_Error_Vzen_Info Log_Error_sis = new tb_sis_Log_Error_Vzen_Info(ex.ToString(), "", arreglo, "", "", "", "", "", DateTime.Now);
         oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
         mensaje = ex.ToString() + " " + ex.Message;
         mensaje = ex.Message + "::::::::::::::::::::" + ex.ToString();
         throw new Exception(mensaje);
     }
 }
Exemple #2
0
        public Boolean ModificarDB(in_movi_inven_tipo_x_tb_bodega_Info lst, int IdEmpresa, in_movi_inven_tipo_Info moviI, ref string mensaje)
        {
            try
            {
                EntitiesInventario oege = new EntitiesInventario();

                using (EntitiesInventario contex = new EntitiesInventario())
                {
                    var address = new in_movi_inven_tipo_x_tb_bodega();
                    address.IdBodega          = lst.IdBodega;
                    address.IdEmpresa         = IdEmpresa;
                    address.IdCtaCble         = lst.IdCtaCble;
                    address.IdMovi_inven_tipo = moviI.IdMovi_inven_tipo;
                    address.IdSucucursal      = lst.IdSucucursal;
                    contex.in_movi_inven_tipo_x_tb_bodega.Add(address);
                    contex.SaveChanges();
                    contex.Dispose();
                    mensaje = "Guardado con exito";
                    return(true);
                }
            }
            catch (Exception ex)
            {
                string arreglo = ToString();
                tb_sis_Log_Error_Vzen_Data oDataLog      = new tb_sis_Log_Error_Vzen_Data();
                tb_sis_Log_Error_Vzen_Info Log_Error_sis = new tb_sis_Log_Error_Vzen_Info(ex.ToString(), "", arreglo, "", "", "", "", "", DateTime.Now);
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
                mensaje = ex.ToString() + " " + ex.Message;
                mensaje = "Error ocurrido por: " + ex.ToString();
                throw new Exception(mensaje);
            }
        }
Exemple #3
0
        public Boolean GrabarDB(in_movi_inven_tipo_x_tb_bodega_Info lst, int idEmpresa, in_movi_inven_tipo_Info moviI, ref string mensaje)
        {
            try
            {
                EntitiesInventario oege = new EntitiesInventario();

                using (EntitiesInventario contex = new EntitiesInventario())
                {
                    var address = new in_movi_inven_tipo_x_tb_bodega();
                    address.IdBodega  = lst.IdBodega;
                    address.IdEmpresa = idEmpresa;
                    if (lst.IdCtaCble != "")
                    {
                        address.IdCtaCble = lst.IdCtaCble;
                    }
                    address.IdMovi_inven_tipo = moviI.IdMovi_inven_tipo;
                    address.IdSucucursal      = lst.IdSucucursal;


                    contex.in_movi_inven_tipo_x_tb_bodega.Add(address);
                    contex.SaveChanges();
                    contex.Dispose();

                    mensaje = "Guardado con exito";
                    return(true);
                }
            }
            catch (Exception ex)
            {
                string arreglo = ToString();
                tb_sis_Log_Error_Vzen_Data oDataLog      = new tb_sis_Log_Error_Vzen_Data();
                tb_sis_Log_Error_Vzen_Info Log_Error_sis = new tb_sis_Log_Error_Vzen_Info(ex.ToString(), "", arreglo, "", "", "", "", "", DateTime.Now);
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
                mensaje = ex.ToString() + " " + ex.Message;

                try
                {
                    using (EntitiesInventario contex = new EntitiesInventario())
                    {
                        in_movi_inven_tipo_x_tb_bodega Consulta = new in_movi_inven_tipo_x_tb_bodega();
                        Consulta = contex.in_movi_inven_tipo_x_tb_bodega.FirstOrDefault(v => v.IdEmpresa == idEmpresa && v.IdSucucursal == lst.IdSucucursal && v.IdBodega == lst.IdBodega && v.IdMovi_inven_tipo == moviI.IdMovi_inven_tipo);
                        if (Consulta != null)
                        {
                            Consulta.IdCtaCble = lst.IdCtaCble;
                            contex.SaveChanges();
                        }
                        return(true);
                    }
                }
                catch (Exception)
                {
                    oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
                    mensaje = ex.ToString() + " " + ex.Message;
                    throw new Exception(mensaje);
                }
            }
        }