public Boolean VerificarCodigo(string Codigo, int IdEmpresa) { try { EntitiesImportacion oEnti = new EntitiesImportacion(); var codigo = from q in oEnti.imp_ordencompra_ext where q.CodOrdenCompraExt == Codigo && q.IdEmpresa == IdEmpresa select q; if (codigo.ToList().Count() >= 1) { return(false); } else { 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 AnularDB(imp_gastosxImport_Info Info) { try { EntitiesImportacion oEntities = new EntitiesImportacion(); var contact = oEntities.imp_gastosxImport.FirstOrDefault(var => var.IdGastoImp == Info.IdGastoImp); if (contact != null) { contact.ga_estado = "I"; oEntities.SaveChanges(); oEntities.Dispose(); } 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 List <imp_Tipo_docu_pago_x_Empresa_x_tipocbte_Info> Get_List_Tipo_docu_pago_x_Empresa_x_tipocbte(int IdEmpresa) { List <imp_Tipo_docu_pago_x_Empresa_x_tipocbte_Info> lst = new List <imp_Tipo_docu_pago_x_Empresa_x_tipocbte_Info>(); EntitiesImportacion Imp = new EntitiesImportacion(); try { var Consulta = from q in Imp.imp_Tipo_docu_pago_x_Empresa_x_tipocbte where q.IdEmpresa == IdEmpresa select q; foreach (var item in Consulta) { imp_Tipo_docu_pago_x_Empresa_x_tipocbte_Info obj = new imp_Tipo_docu_pago_x_Empresa_x_tipocbte_Info(); obj.IdTipoCbte = Convert.ToInt32((item.IdTipoCbte == null) ? 0 : item.IdTipoCbte); obj.CodDocu_Pago = item.CodDocu_Pago; obj.IdTipoCbte_Anul = Convert.ToInt32((item.IdTipoCbte_Anul == null) ? 0 : item.IdTipoCbte_Anul); 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() + " " + ex.Message; throw new Exception(ex.ToString()); } }
int GetId() { try { int ID = 0; EntitiesImportacion oEntities = new EntitiesImportacion(); var select = from q in oEntities.imp_gastosxImport select q; if (select.ToList().Count < 1) { ID = 1; } else { var GetiD = (from q in oEntities.imp_gastosxImport select q.IdGastoImp).Max(); ID = Convert.ToInt32(GetiD.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 Boolean ValidarCodigo(String Codigo) { try { if (Codigo == null || Codigo == "") { return(false); } else { EntitiesImportacion oEntities = new EntitiesImportacion(); var contact = oEntities.imp_gastosxImport.FirstOrDefault(var => var.CodGastoImp == Codigo); 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 ModificarDB(imp_Catalogo_tipo_info inf) { try { using (EntitiesImportacion context = new EntitiesImportacion()) { var contact = context.imp_catalogo_tipo.FirstOrDefault(vanio => vanio.IdCatalogoImport_tipo == inf.IdCatalogoImport_tipo); if (contact != null) { contact.Descripcion = inf.Descripcion; 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 GrabarDB(imp_Catalogo_tipo_info inf) { try { using (EntitiesImportacion context = new EntitiesImportacion()) { EntitiesImportacion EDB = new EntitiesImportacion(); var Q = (from per in EDB.imp_catalogo_tipo select per.IdCatalogoImport_tipo).Max() + 1; //if (Q.ToList().Count == 0) //{ var address = new imp_catalogo_tipo(); address.IdCatalogoImport_tipo = Q; address.Descripcion = inf.Descripcion; address.Estado = "A"; context.imp_catalogo_tipo.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 EliminarDB(int IdEmpresa, int IdSucursa, Decimal IdOrdenCompraExterna, decimal idRegistroGasto, ref string mensaje) { try { using (EntitiesImportacion context = new EntitiesImportacion()) { var contact = context.imp_ordencompra_ext_x_imp_gastosxImport.FirstOrDefault(C => C.IdEmpresa == IdEmpresa && C.IdSucusal == IdSucursa && C.IdOrdenCompraExt == IdOrdenCompraExterna && C.IdRegistroGasto == idRegistroGasto); if (contact != null) { context.imp_ordencompra_ext_x_imp_gastosxImport.Remove(contact); 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 imp_Embarcador_Info Get_Info_Embarcador(int IdEmpresa, int IdEmbarcador) { EntitiesImportacion oEnti = new EntitiesImportacion(); imp_Embarcador_Info Info = new imp_Embarcador_Info(); try { var Objeto = oEnti.imp_Embarcador.FirstOrDefault(var => var.IdEmpresa == IdEmpresa && var.IdEmbarcador == IdEmbarcador); if (Objeto != null) { Info.IdEmpresa = Objeto.IdEmpresa; Info.IdEmbarcador = Objeto.IdEmbarcador; Info.em_descripcion = Objeto.em_descripcion; Info.em_direccion = Objeto.em_direccion; Info.em_telefono = Objeto.em_telefono; Info.em_contacto = Objeto.em_contacto; Info.em_email = Objeto.em_email; Info.Estado = Objeto.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.ToString() + " " + ex.Message; throw new Exception(ex.ToString()); } }
public Boolean ModificarDB(List <imp_ordencompra_ext_x_imp_gastosxImport_Info> lst, List <imp_ordencompra_ext_x_imp_gastosxImport_Info> LstAnterior, ref string mensaje) { Boolean res = true; try { using (EntitiesImportacion Contex = new EntitiesImportacion()) { if (LstAnterior != null && LstAnterior.Count > 0) { List <imp_ordencompra_ext_x_imp_gastosxImport_Info> listaactual = Get_List_ordencompra_ext_x_imp_gastosxImport(LstAnterior[0].IdEmpresa, LstAnterior[0].IdSucusal, LstAnterior[0].IdOrdenCompraExt); foreach (var item in listaactual) { imp_ordencompra_ext_x_imp_gastosxImport address = Contex.imp_ordencompra_ext_x_imp_gastosxImport.FirstOrDefault(p => p.IdEmpresa == item.IdEmpresa && p.IdRegistroGasto == item.IdRegistroGasto && p.IdSucusal == item.IdSucusal && p.IdOrdenCompraExt == item.IdOrdenCompraExt); Contex.imp_ordencompra_ext_x_imp_gastosxImport.Remove(address); } Contex.SaveChanges(); } } return(GuardarDB(lst, ref mensaje)); } 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 ActualizarAnulado(imp_ordencompra_ext_x_imp_gastosxImport_Info info, decimal IdCbteCble) { try { using (EntitiesImportacion Contex = new EntitiesImportacion()) { var contact = Contex.imp_ordencompra_ext_x_imp_gastosxImport.FirstOrDefault(var => var.IdEmpresa == info.IdEmpresa && var.IdSucusal == info.IdSucusal && var.IdRegistroGasto == info.IdRegistroGasto); if (contact != null) { contact.IdCbteCble_Anu = IdCbteCble; Contex.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 AnularDB(imp_ordencompra_ext_x_imp_gastosxImport_Info info) { try { using (EntitiesImportacion Contex = new EntitiesImportacion()) { var contact = Contex.imp_ordencompra_ext_x_imp_gastosxImport.FirstOrDefault(obj => obj.IdEmpresa == info.IdEmpresa && obj.IdSucusal == info.IdSucusal && obj.IdOrdenCompraExt == info.IdOrdenCompraExt && obj.IdRegistroGasto == info.IdRegistroGasto); if (contact != null) { contact.Estado = "I"; contact.IdUsuarioUltAnu = info.IdUsuarioUltAnu; contact.Fecha_UltAnu = info.Fecha_UltAnu; contact.IdTipoCbte_Anu = info.IdTipoCbte_Anul; Contex.SaveChanges(); Contex.Dispose(); } } 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 Liquidar(imp_ordencompra_ext_Info Obj, ref string mensaje) { try { using (EntitiesImportacion context = new EntitiesImportacion()) { var contact = context.imp_ordencompra_ext.FirstOrDefault(Impo => Impo.IdEmpresa == Obj.IdEmpresa && Impo.IdOrdenCompraExt == Obj.IdOrdenCompraExt && Impo.IdSucusal == Obj.IdSucusal); if (contact != null) { contact.IdEstadoLiquidacion = Obj.IdEstadoLiquidacion; contact.ci_fecha_liquidacion = Obj.Fecha_Transac; 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 imp_ordencompra_ext_Info Get_Info_ordencompra_ext(int IdEmpresa, string codigoOrdenCompra, int idSucursal) { imp_ordencompra_ext_Info info = new imp_ordencompra_ext_Info(); try { EntitiesImportacion imp = new EntitiesImportacion(); var OrdenCompra = imp.imp_ordencompra_ext.FirstOrDefault(obj => obj.IdEmpresa == IdEmpresa && obj.CodOrdenCompraExt == codigoOrdenCompra && obj.IdSucusal == idSucursal); if (OrdenCompra != null) { info.IdOrdenCompraExt = OrdenCompra.IdOrdenCompraExt; } 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.ToString() + " " + ex.Message; throw new Exception(ex.ToString()); } }
public Boolean EliminarDB(imp_ordencompra_ext_Info Info) { try { List <imp_ordencompra_ext_det_Info> ListaEliminar = new List <imp_ordencompra_ext_det_Info>(); ListaEliminar = Get_List_ordencompra_ext_det(Info); foreach (var item in ListaEliminar) { using (EntitiesImportacion context = new EntitiesImportacion()) { var contact = context.imp_ordencompra_ext_det.FirstOrDefault(obj => obj.IdEmpresa == item.IdEmpresa && obj.IdSucursal == item.IdSucursal && obj.IdOrdenCompraExt == item.IdOrdenCompraExt && obj.Secuencia == item.Secuencia); if (contact != null) { context.imp_ordencompra_ext_det.Remove(contact); context.SaveChanges(); context.Dispose(); } } } 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 AnularDB(imp_Embarcador_Info Info) { try { using (EntitiesImportacion Context = new EntitiesImportacion()) { var contact = Context.imp_Embarcador.FirstOrDefault(var => var.IdEmpresa == Info.IdEmpresa && var.IdEmbarcador == Info.IdEmbarcador); if (contact != null) { 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.ToString() + " " + ex.Message; throw new Exception(ex.ToString()); } }
public Boolean ModificarDB(imp_catalogo_Info info) { try { using (EntitiesImportacion context = new EntitiesImportacion()) { var contact = context.imp_catalogo.FirstOrDefault(cata => cata.IdCatalogoImport == info.IdCatalogoImport && cata.IdCatalogoImport_tipo == info.IdCatalogoImport_tipo); if (contact != null) { contact.IdCatalogoImport = info.IdCatalogoImport; contact.IdCatalogoImport_tipo = info.IdCatalogoImport_tipo; contact.Nombre = info.Nombre; contact.NombreIngles = info.NombreIngles; contact.Abrebiatura = info.Abrebiatura; //contact.Orden = Q; //contact.Estado = "A"; 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 GuardarDB(ref imp_Embarcador_Info Info) { try { List <imp_Embarcador_Info> Lst = new List <imp_Embarcador_Info>(); using (EntitiesImportacion Context = new EntitiesImportacion()) { var Address = new imp_Embarcador(); Info.IdEmbarcador = Address.IdEmbarcador = GetId(Info.IdEmpresa); Address.IdEmpresa = Info.IdEmpresa; Address.em_descripcion = Info.em_descripcion; Address.em_direccion = Info.em_direccion; Address.em_telefono = Info.em_telefono; Address.em_contacto = Info.em_contacto; Address.em_email = Info.em_email; Address.Estado = "A"; Context.imp_Embarcador.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 List <imp_Catalogo_tipo_info> Get_List_Catalogo_tipo() { List <imp_Catalogo_tipo_info> lst = new List <imp_Catalogo_tipo_info>(); EntitiesImportacion oEntImportacion = new EntitiesImportacion(); try { var select = from q in oEntImportacion.imp_catalogo_tipo select q; foreach (var item in select) { imp_Catalogo_tipo_info info = new imp_Catalogo_tipo_info(); info.IdCatalogoImport_tipo = item.IdCatalogoImport_tipo; info.Descripcion = item.Descripcion; info.Estado = item.Estado; lst.Add(info); } 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() + " " + ex.Message; throw new Exception(ex.ToString()); } }
public imp_ordencompra_ext_x_ct_cbtecble_Info Get_Info_ordencompra_ext_x_ct_cbtecble(int IdEmpres, int IdSucursal, decimal IdOrdeCompr, string TipoReg = "") { EntitiesImportacion oEnti = new EntitiesImportacion(); imp_ordencompra_ext_x_ct_cbtecble_Info Info = new imp_ordencompra_ext_x_ct_cbtecble_Info(); try { if (TipoReg != "") { var Item = oEnti.Database.SqlQuery <imp_ordencompra_ext_x_ct_cbtecble_Info> ("select top (1)* from imp_ordencompra_ext_x_ct_cbtecble where imp_IdOrdenCompraExt = " + IdOrdeCompr + " and imp_idEmpresa = " + IdEmpres + " and imp_idsucusal =" + IdSucursal + " order by ct_IdCbteCble desc"); imp_ordencompra_ext_x_ct_cbtecble_Info Objeto = (imp_ordencompra_ext_x_ct_cbtecble_Info)Item.First(); return(Objeto); } else { var Item = oEnti.Database.SqlQuery <imp_ordencompra_ext_x_ct_cbtecble_Info> ("select top (1)* from imp_ordencompra_ext_x_ct_cbtecble where imp_IdOrdenCompraExt = " + IdOrdeCompr + " and imp_idEmpresa = " + IdEmpres + " and imp_idsucusal =" + IdSucursal + "and TipoReg =" + TipoReg + " order by ct_IdCbteCble desc"); imp_ordencompra_ext_x_ct_cbtecble_Info Objeto = (imp_ordencompra_ext_x_ct_cbtecble_Info)Item.First(); return(Objeto); } } 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 List <imp_gastosxImport_Info> Get_List_gastosxImport() { List <imp_gastosxImport_Info> Lst = new List <imp_gastosxImport_Info>(); EntitiesImportacion oEnt = new EntitiesImportacion(); try { var Lista = from q in oEnt.imp_gastosxImport select q; foreach (var item in Lista) { imp_gastosxImport_Info Info = new imp_gastosxImport_Info(); Info.IdGastoImp = item.IdGastoImp; Info.CodGastoImp = item.CodGastoImp; Info.ga_decripcion = item.ga_decripcion; Info.ga_estado = item.ga_estado; Lst.Add(Info); } 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() + " " + ex.Message; throw new Exception(ex.ToString()); } }
public Boolean GuardarDB(imp_ordencompra_ext_x_ct_cbtecble_Info Info, ref string mensaje) { try { using (EntitiesImportacion Context = new EntitiesImportacion()) { var Address = new imp_ordencompra_ext_x_ct_cbtecble(); Address.imp_IdEmpresa = Info.imp_IdEmpresa; Address.imp_IdSucusal = Info.imp_IdSucusal; Address.imp_IdOrdenCompraExt = Info.imp_IdOrdenCompraExt; Address.ct_IdEmpresa = Info.ct_IdEmpresa; Address.ct_IdTipoCbte = Info.ct_IdTipoCbte; Address.ct_IdCbteCble = Info.ct_IdCbteCble; Address.TipoReg = Info.TipoReg; Context.imp_ordencompra_ext_x_ct_cbtecble.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 GuardarDB(ref imp_gastosxImport_Info Info) { try { using (EntitiesImportacion Context = new EntitiesImportacion()) { var Address = new imp_gastosxImport(); Address.CodGastoImp = Info.CodGastoImp; Address.ga_decripcion = Info.ga_decripcion; Address.ga_estado = "A"; Info.IdGastoImp = Address.IdGastoImp = GetId(); Context.imp_gastosxImport.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 imp_ordencompra_ext_x_ct_cbtecble_Info Get_Info_ordencompra_ext_x_ct_cbtecble(int ct_IdEmpresa, int ct_IdTipoCbte, decimal ct_IdCbteCble, ref string mensaje) { EntitiesImportacion oEnti = new EntitiesImportacion(); imp_ordencompra_ext_x_ct_cbtecble_Info Info = new imp_ordencompra_ext_x_ct_cbtecble_Info(); try { string query = "select top (1)* from imp_ordencompra_ext_x_ct_cbtecble c " + " where c.ct_IdEmpresa =" + ct_IdEmpresa + " and c.ct_IdTipoCbte = " + ct_IdTipoCbte + " and c.ct_IdCbteCble = " + ct_IdCbteCble + " order by ct_IdCbteCble desc"; var Item = oEnti.Database.SqlQuery <imp_ordencompra_ext_x_ct_cbtecble_Info> (query); imp_ordencompra_ext_x_ct_cbtecble_Info Objeto = (imp_ordencompra_ext_x_ct_cbtecble_Info)Item.First(); mensaje = "Consulta Correcta"; return(Objeto); } 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 Validar(imp_gastosxImport_Info Info) { try { using (EntitiesImportacion oEntities = new EntitiesImportacion()) { var asd = oEntities.Database.SqlQuery <imp_ordencompra_ext_x_imp_gastosxImport_Det_Info>("select * from imp_ordencompra_ext_x_imp_gastosxImport_det where IdGastoImp = " + Info.IdGastoImp); if (asd.ToList().Count >= 1) { return(false); } else { 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 List <imp_ordencompra_ext_x_ct_cbtecble_Info> Get_List_ordencompra_ext_x_ct_cbtecble(int IdEmpresa, int IdSucursal, decimal IdOrdenCompraExt) { List <imp_ordencompra_ext_x_ct_cbtecble_Info> Lst = new List <imp_ordencompra_ext_x_ct_cbtecble_Info>(); EntitiesImportacion oEnti = new EntitiesImportacion(); try { var Query = from q in oEnti.imp_ordencompra_ext_x_ct_cbtecble where q.imp_IdEmpresa == IdEmpresa && q.imp_IdSucusal == IdSucursal && q.imp_IdOrdenCompraExt == IdOrdenCompraExt select q; foreach (var item in Query) { imp_ordencompra_ext_x_ct_cbtecble_Info Obj = new imp_ordencompra_ext_x_ct_cbtecble_Info(); Obj.imp_IdEmpresa = item.imp_IdEmpresa; Obj.imp_IdSucusal = item.imp_IdSucusal; Obj.imp_IdOrdenCompraExt = item.imp_IdOrdenCompraExt; Obj.ct_IdEmpresa = item.ct_IdEmpresa; Obj.ct_IdTipoCbte = item.ct_IdTipoCbte; Obj.ct_IdCbteCble = item.ct_IdCbteCble; Obj.TipoReg = item.TipoReg; 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() + " " + ex.Message; throw new Exception(ex.ToString()); } }
public Boolean EliminarDB(imp_ordencompra_ext_Info Info) { try { List <imp_ordencompra_ext_x_Condiciones_Pago_Info> ListCondicionPago = new List <imp_ordencompra_ext_x_Condiciones_Pago_Info>(); ListCondicionPago = Get_List_ordencompra_ext_x_Condiciones_Pago(Info); foreach (var item in ListCondicionPago) { using (EntitiesImportacion context = new EntitiesImportacion()) { //var contact = context.imp_ordencompra_ext_x_Condiciones_Pago.First(obj => obj.IdEmpresa == item.IdEmpresa && obj.IdSucusal == item.IdSucursal && obj.IdOrdenCompraExt == item.IdOrdenCompraExt && obj.Secuencia == item.Secuencia); var contact = context.Database.ExecuteSqlCommand("delete from imp_ordencompra_ext_x_Condiciones_Pago where IdOrdenCompraExt ="+ item.IdOrdenCompraExt + "and IdEmpresa = " + item.IdEmpresa + " and IdSucusal = " + item.IdSucursal); //context.Remove(contact); //context.SaveChanges(); //context.Dispose(); } } 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 EliminarDB(int ct_IdEmpresa, decimal ct_IdCbteCble, int ct_IdTipoCbte) { try { using (EntitiesImportacion context = new EntitiesImportacion()) { var contact = context.imp_ordencompra_ext_x_ct_cbtecble.FirstOrDefault(minfo => minfo.ct_IdEmpresa == ct_IdEmpresa && minfo.ct_IdCbteCble == ct_IdCbteCble && minfo.ct_IdTipoCbte == ct_IdTipoCbte); if (contact != null) { context.imp_ordencompra_ext_x_ct_cbtecble.Remove(contact); 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 ModificarDB(List <imp_Tipo_docu_pago_x_Empresa_x_tipocbte_Info> Lst) { try { foreach (var item in Lst) { using (EntitiesImportacion Context = new EntitiesImportacion()) { var contact = Context.imp_Tipo_docu_pago_x_Empresa_x_tipocbte.FirstOrDefault(var => var.IdEmpresa == item.IdEmpresa && var.CodDocu_Pago == item.CodDocu_Pago); if (contact != null) { contact.IdTipoCbte = item.IdTipoCbte; contact.IdTipoCbte_Anul = item.IdTipoCbte_Anul; } } } 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 AnularDB(imp_ordencompra_ext_Info Info) { try { using (EntitiesImportacion context = new EntitiesImportacion()) { var contact = context.imp_ordencompra_ext.FirstOrDefault(Impo => Impo.IdEmpresa == Info.IdEmpresa && Impo.IdOrdenCompraExt == Info.IdOrdenCompraExt && Impo.IdSucusal == Info.IdSucusal); if (contact != null) { contact.Estado = "I"; contact.ci_Observacion = " ***ANULADO***" + contact.ci_Observacion; contact.IdUsuarioUltAnu = Info.IdUsuarioUltAnu; contact.Fecha_UltAnu = DateTime.Now; contact.IdUsuarioUltMod = Info.IdUsuarioUltMod; contact.MotiAnula = Info.MotiAnula; 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()); } }