コード例 #1
0
        public Boolean GrabarDB(List <in_movi_inve_detalle_x_com_ordencompra_local_detalle_Info> lista, ref string mensaje)
        {
            try
            {
                using (EntitiesInventario context = new EntitiesInventario())
                {
                    EntitiesInventario EDB = new EntitiesInventario();

                    foreach (var item in lista)
                    {
                        in_movi_inve_detalle_x_com_ordencompra_local_det address = new in_movi_inve_detalle_x_com_ordencompra_local_det();

                        address.mi_IdEmpresa         = item.mi_IdEmpresa;
                        address.mi_IdSucursal        = item.mi_IdSucursal;
                        address.mi_IdBodega          = item.mi_IdBodega;
                        address.mi_IdMovi_inven_tipo = item.mi_IdMovi_inven_tipo;
                        address.mi_IdNumMovi         = item.mi_IdNumMovi;
                        address.mi_Secuencia         = item.mi_Secuencia;
                        address.ocd_IdEmpresa        = item.ocd_IdEmpresa;
                        address.ocd_IdSucursal       = item.ocd_IdSucursal;
                        address.ocd_IdOrdenCompra    = item.ocd_IdOrdenCompra;
                        address.ocd_Secuencia        = item.ocd_Secuencia;

                        if (item.observacion == null)
                        {
                            item.observacion = "";
                        }
                        address.observacion = item.observacion;

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

                        mensaje = "Grabacion ok..";
                    }

                    return(true);
                }
            }
            catch (Exception ex)
            {
                string arreglo = ToString();
                tb_sis_Log_Error_Vzen_Data oDataLog      = new tb_sis_Log_Error_Vzen_Data();
                tb_sis_Log_Error_Vzen_Info Log_Error_sis = new tb_sis_Log_Error_Vzen_Info(ex.ToString(), "", arreglo, "", "", "", "", "", DateTime.Now);
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
                mensaje = ex.ToString() + " " + ex.Message;
                throw new Exception(ex.ToString());
            }
        }
        public Boolean GuardarDB(List <in_movi_inve_detalle_Info> Lst)
        {
            try
            {
                foreach (var item in Lst)
                {
                    using (EntitiesInventario Context = new EntitiesInventario())
                    {
                        in_movi_inve_detalle_x_com_ordencompra_local_det Address = new in_movi_inve_detalle_x_com_ordencompra_local_det();

                        Address.mi_IdEmpresa         = item.IdEmpresa;
                        Address.mi_IdSucursal        = item.IdSucursal;
                        Address.mi_IdBodega          = item.IdBodega;
                        Address.mi_IdMovi_inven_tipo = item.IdMovi_inven_tipo;
                        Address.mi_IdNumMovi         = item.IdNumMovi;
                        Address.mi_Secuencia         = item.Secuencia;
                        Address.ocd_IdEmpresa        = item.oc_IdEmpresa;
                        Address.ocd_IdSucursal       = item.oc_IdSucursal;
                        Address.ocd_IdOrdenCompra    = item.oc_IdOrdenCompra;
                        Address.ocd_Secuencia        = item.oc_Secuencial;

                        if (item.dm_observacion == null || item.dm_observacion == "")
                        {
                            Address.observacion = "";
                        }
                        else
                        {
                            Address.observacion = item.dm_observacion;
                        }

                        Context.in_movi_inve_detalle_x_com_ordencompra_local_det.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());
            }
        }