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()); } }
public int GetId() { try { int Id; EntitiesCompras OECompras = new EntitiesCompras(); var select = from q in OECompras.com_ordencompra_local_det select q; if (select == null) { Id = 1; } else { var select_pv = (from q in OECompras.com_ordencompra_local_det select q.Secuencia).Max(); Id = Convert.ToInt32(select_pv.ToString()) + 1; } return(Id); } 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 com_ConvenioPreciosPorProducto_Info GetInfo(int IdEmpresa, decimal IdProducto) { try { com_ConvenioPreciosPorProducto_Info info; using (EntitiesCompras db = new EntitiesCompras()) { info = db.com_ConvenioPreciosPorProducto.Where(q => q.IdEmpresa == IdEmpresa && q.IdProducto == IdProducto).Select(q => new com_ConvenioPreciosPorProducto_Info { IdEmpresa = q.IdEmpresa, IdProducto = q.IdProducto, IdProveedor = q.IdProveedor, IdComprador = q.IdComprador, IdTerminoPago = q.IdTerminoPago, IdUnidadMedida = q.IdUnidadMedida, PrecioUnitario = q.PrecioUnitario, PorDescuento = q.PorDescuento, Descuento = q.Descuento, PrecioFinal = q.PrecioFinal, TiempoEntrega = q.TiempoEntrega, FechaFin = q.FechaFin, SaltaPaso2 = q.SaltaPaso2, SaltaPaso3 = q.SaltaPaso3, SaltoPaso4 = q.SaltoPaso4, SaltoPaso5 = q.SaltoPaso5 }).FirstOrDefault(); } return(info); } catch (Exception) { throw; } }
public List <com_comprador_Info> Get_List_comprador(int IdEmpresa) { List <com_comprador_Info> Lst = new List <com_comprador_Info>(); try { using (EntitiesCompras db = new EntitiesCompras()) { var lista = db.com_comprador.Where(q => q.IdEmpresa == IdEmpresa).ToList(); foreach (var q in lista) { Lst.Add(new com_comprador_Info { IdEmpresa = q.IdEmpresa, IdComprador = q.IdComprador, IdUsuario_com = q.IdUsuario_com, Descripcion = q.Descripcion, Estado = q.Estado, Correo = q.Correo, SEstado = q.Estado == "A" ? "ACTIVO" : "**ANULADO**", }); } } return(Lst); } 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 EliminarDetalle_OC(int IdEmpresa, int IdSucursal, decimal IdOrdenCompra, ref string msg) { try { using (EntitiesCompras Entity = new EntitiesCompras()) { int numeroElimindo = Entity.Database.ExecuteSqlCommand("delete from com_ordencompra_local_det where IdEmpresa = " + IdEmpresa + " and IdSucursal = " + IdSucursal + " and IdOrdenCompra = " + IdOrdenCompra ); } 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); oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje); mensaje = ex.ToString(); msg = "Error no se guardó " + ex.Message + " "; throw new Exception(ex.ToString()); } }
public Boolean VerificarExisteCodigo(string CodObra) { try { EntitiesCompras oen = new EntitiesCompras(); var select = from q in oen.com_ListadoMateriales_Det where q.CodObra == CodObra select q; if (select.ToList().Count() >= 1) { 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.InnerException + " " + ex.Message; oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje); throw new Exception(ex.ToString()); } }
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 List <com_departamento_Info> Get_List_Departamento(int IdEmpresa) { List <com_departamento_Info> Lst = new List <com_departamento_Info>(); EntitiesCompras oEnti = new EntitiesCompras(); try { var Query = from q in oEnti.com_departamento where q.IdEmpresa == IdEmpresa select q; foreach (var item in Query) { com_departamento_Info Obj = new com_departamento_Info(); Obj.IdEmpresa = item.IdEmpresa; Obj.IdDepartamento = item.IdDepartamento; Obj.nom_departamento = item.nom_departamento; Obj.Estado = item.Estado; Lst.Add(Obj); } return(Lst); } 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 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()); } }
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 List <com_solicitud_compra_Info> Get_List_Solicitud_x_OC(int IdEmpresa, int IdSucursal, string IdOrdenCompra) { List <com_solicitud_compra_Info> Lst = new List <com_solicitud_compra_Info>(); EntitiesCompras OEComp = new EntitiesCompras(); try { var Select = from q in OEComp.vwcom_ordencompra_local_det_x_com_solicitud_compra_det where q.scd_IdEmpresa == IdEmpresa && q.scd_IdSucursal == IdSucursal && q.oc_NumDocumento == IdOrdenCompra select q; foreach (var item in Select) { com_solicitud_compra_Info SolicitudInfo = new com_solicitud_compra_Info(); SolicitudInfo.IdSolicitudCompra = item.scd_IdSolicitudCompra; Lst.Add(SolicitudInfo); } return(Lst); } 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 decimal GetId(int IdEmpresa, int IdSucursal) { decimal Id = 0; try { EntitiesCompras contex = new EntitiesCompras(); var selecte = contex.com_solicitud_compra.Count(q => q.IdEmpresa == IdEmpresa && q.IdSucursal == IdSucursal); if (selecte == 0) { Id = 1; } else { var select_em = (from q in contex.com_solicitud_compra where q.IdEmpresa == IdEmpresa && q.IdSucursal == IdSucursal select q.IdSolicitudCompra).Max(); Id = Convert.ToDecimal(select_em.ToString()) + 1; } return(Id); } 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 com_CatalogoTipo_Info Get_Info_CatalogoTipo(string id) { try { EntitiesCompras context = new EntitiesCompras(); com_CatalogoTipo_Info Info = new com_CatalogoTipo_Info(); var contenido = context.com_catalogo_tipo.FirstOrDefault(var => var.IdCatalogocompra_tipo == id); if (contenido != null) { Info.IdCatalogocompra_tipo = contenido.IdCatalogocompra_tipo; Info.Descripcion = contenido.Descripcion; Info.Estado = contenido.Estado; } return(Info); } 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 List <com_CatalogoTipo_Info> Get_List_CatalogoTipo() { try { List <com_CatalogoTipo_Info> lista = new List <com_CatalogoTipo_Info>(); EntitiesCompras oEnt = new EntitiesCompras(); var select = from q in oEnt.com_catalogo_tipo select q; foreach (var item in select) { com_CatalogoTipo_Info info = new com_CatalogoTipo_Info(); info.IdCatalogocompra_tipo = item.IdCatalogocompra_tipo; info.Descripcion = item.Descripcion; lista.Add(info); } return(lista); } 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 com_Catalogo_Info Get_Info_EstadoAprobacion(string IdEAprob) { try { com_Catalogo_Info info = new com_Catalogo_Info(); EntitiesCompras oEnti = new EntitiesCompras(); var select = from q in oEnti.vwcom_EstadoAprobacion where q.Codigo == IdEAprob select q; foreach (var item in select) { info.IdTipoCatalogo = item.IdTipoCatalogo; info.CodCatalogo = item.Codigo; info.IdCatalogocompra = item.Id; info.descripcion = item.descripcion; info.estado = item.Estado; info.orden = (item.Orden == null) ? 0 : (Int32)item.Orden; info.name = (item.name == null) ? "" : item.name; info.Nombre = item.descripcion; } return(info); } 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 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; } }
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 List <com_Catalogo_Info> Get_ListEstadoAprobacion_solicitud_compra() { List <com_Catalogo_Info> Lst = new List <com_Catalogo_Info>(); EntitiesCompras oEnti = new EntitiesCompras(); try { var Query = from q in oEnti.vwcom_EstadoAprobacion_sol_compra select q; foreach (var item in Query) { com_Catalogo_Info Obj = new com_Catalogo_Info(); Obj.IdTipoCatalogo = item.IdTipoCatalogo; Obj.CodCatalogo = item.Codigo; Obj.IdCatalogocompra = item.Id; Obj.descripcion = item.descripcion; Obj.estado = item.Estado; Obj.orden = (item.Orden == null) ? 0 : (Int32)item.Orden; Obj.name = (item.name == null) ? "" : item.name; Obj.Nombre = item.descripcion; Lst.Add(Obj); } return(Lst); } 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 List <com_cotizacion_compra_Info> Get_List_cotizacion_compra(int IdEmpresa) { try { List <com_cotizacion_compra_Info> lm = new List <com_cotizacion_compra_Info>(); EntitiesCompras OEEtapa = new EntitiesCompras(); var registros = from A in OEEtapa.vwcom_cotizacion_compra where A.IdEmpresa == IdEmpresa orderby A.IdEmpresa select A; foreach (var item in registros) { com_cotizacion_compra_Info info = new com_cotizacion_compra_Info(); info.IdEmpresa = item.IdEmpresa; info.IdSucursal = Convert.ToInt32(item.IdSucursal); info.IdCotizacion = item.IdCotizacion; info.Observacion = item.Observacion; info.nom_sucursal = item.nom_sucursal; info.estado = item.Estado; info.IdProveedor = Convert.ToInt32(item.IdProveedor); lm.Add(info); } return(lm); } 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.InnerException + " " + ex.Message; oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje); throw new Exception(ex.ToString()); } }
public Boolean ValidarCodigoExiste(string Cod) { try { EntitiesCompras context = new EntitiesCompras(); var Existe = from q in context.com_catalogo where q.CodCatalogo == Cod select q; if (Existe.ToList().Count() > 0) { 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); oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje); mensaje = ex.InnerException + " " + ex.Message; throw new Exception(ex.ToString()); } }
public decimal getIdComprador(int IdEmpresa, ref string mensaje) { decimal Id = 0; try { EntitiesCompras contex = new EntitiesCompras(); var selecte = contex.com_comprador.Count(q => q.IdEmpresa == IdEmpresa); if (selecte == 0) { Id = 1; } else { var select_em = (from q in contex.com_comprador where q.IdEmpresa == IdEmpresa select q.IdComprador).Max(); Id = Convert.ToDecimal(select_em.ToString()) + 1; } return(Id); } 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 string GetId() { try { string Id = ""; EntitiesCompras context = new EntitiesCompras(); var select = from q in context.vwcom_Catalogo_IdAuto_numeric select q; foreach (var item in select) { Id = (string)item.IdCatalogocompra; } return(Id); } 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 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()); } }
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 int GetSecuencia_x_OC(int idempresa, int idsucursal, decimal idOrdenCompra) { try { int Id; EntitiesCompras OECompras = new EntitiesCompras(); var select = from q in OECompras.com_ordencompra_local_det where q.IdEmpresa == idempresa && q.IdSucursal == idsucursal && q.IdOrdenCompra == idOrdenCompra select q; if (select == null) { Id = 1; } else { var select_pv = (from q in OECompras.com_ordencompra_local_det where q.IdEmpresa == idempresa && q.IdSucursal == idsucursal && q.IdOrdenCompra == idOrdenCompra select q.Secuencia).Max(); Id = Convert.ToInt32(select_pv.ToString()) + 1; } return(Id); } 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 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()); } }
public bool ModificarDB(com_ConvenioPreciosPorProducto_Info info) { try { using (EntitiesCompras db = new EntitiesCompras()) { var Entity = db.com_ConvenioPreciosPorProducto.Where(q => q.IdEmpresa == info.IdEmpresa && q.IdProducto == info.IdProducto).FirstOrDefault(); if (Entity == null) { return(false); } Entity.IdProveedor = info.IdProveedor; Entity.IdComprador = info.IdComprador; Entity.IdTerminoPago = info.IdTerminoPago; Entity.IdUnidadMedida = info.IdUnidadMedida; Entity.PrecioUnitario = info.PrecioUnitario; Entity.PorDescuento = info.PorDescuento; Entity.Descuento = info.Descuento; Entity.PrecioFinal = info.PrecioFinal; Entity.TiempoEntrega = info.TiempoEntrega; Entity.FechaFin = info.FechaFin; Entity.SaltaPaso2 = info.SaltaPaso2; Entity.SaltaPaso3 = info.SaltaPaso3; Entity.SaltoPaso4 = info.SaltoPaso4; Entity.SaltoPaso5 = info.SaltoPaso5; db.SaveChanges(); } return(true); } catch (Exception) { throw; } }
public Boolean ValidarIdTipoCatalogo_Descripcion(string IdCatalogocompra_tipo, string Descripcion) { try { using (EntitiesCompras context = new EntitiesCompras()) { var Existe = from q in context.com_catalogo where q.Nombre == Descripcion && q.IdCatalogocompra_tipo == IdCatalogocompra_tipo select q; if (Existe.ToList().Count() > 0) { 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); oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje); mensaje = ex.InnerException + " " + ex.Message; throw new Exception(ex.ToString()); } }
public com_parametro_Info Get_Info_parametro(int IdEmpresa) { try { List <com_parametro_Info> list = new List <com_parametro_Info>(); EntitiesCompras oEnti = new EntitiesCompras(); com_parametro_Info Obj = new com_parametro_Info(); var Query = from q in oEnti.com_parametro where q.IdEmpresa == IdEmpresa select q; foreach (var item in Query) { Obj.IdEmpresa = item.IdEmpresa; Obj.IdEstadoAprobacion_OC = item.IdEstadoAprobacion_OC; Obj.IdMovi_inven_tipo_OC = item.IdMovi_inven_tipo_OC; Obj.IdEstadoAnulacion_OC = item.IdEstadoAnulacion_OC; Obj.IdMovi_inven_tipo_dev_compra = item.IdMovi_inven_tipo_dev_compra; Obj.IdEstadoAprobacion_SolCompra = item.IdEstadoAprobacion_SolCompra; Obj.IdSucursal_x_Aprob_x_SolComp = Convert.ToInt32(item.IdSucursal_x_Aprob_x_SolComp); Obj.IdEstado_cierre = item.IdEstado_cierre; } return(Obj); } 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 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()); } }