public decimal get_id(int IdEmpresa) { try { decimal ID = 0; using (EntitiesContabilidad_FJ Context = new EntitiesContabilidad_FJ()) { var lst = from q in Context.ct_distribucion_gastos_x_periodo where q.IdEmpresa == IdEmpresa select q; if (lst.Count() == 0) { ID = 1; } else { ID = lst.Max(q => q.IdDistribucion) + 1; } } return(ID); } catch (Exception ex) { string mensaje = ""; 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 bool GuardarDB(ct_distribucion_gastos_x_periodo_Info info) { try { using (EntitiesContabilidad_FJ Context = new EntitiesContabilidad_FJ()) { ct_distribucion_gastos_x_periodo Entity = new ct_distribucion_gastos_x_periodo(); Entity.IdEmpresa = info.IdEmpresa; Entity.IdDistribucion = info.IdDistribucion = get_id(info.IdEmpresa); Entity.IdPeriodo = info.IdPeriodo; Entity.Fecha = info.Fecha; Entity.Estado = info.Estado; Entity.Observacion = info.Observacion; Context.ct_distribucion_gastos_x_periodo.Add(Entity); Context.SaveChanges(); } return(true); } catch (Exception ex) { string mensaje = ""; 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 bool ModificarDB(ct_punto_cargo_FJ_Info info) { try { using (EntitiesContabilidad_FJ Context = new EntitiesContabilidad_FJ()) { ct_punto_cargo_FJ Entity = Context.ct_punto_cargo_FJ.First(q => q.IdEmpresa == info.IdEmpresa && q.IdPunto_cargo == info.IdPunto_cargo); if (Entity != null) { Entity.IdCentroCosto = info.IdCentroCosto == "" ? null : info.IdCentroCosto; Entity.IdCentroCosto_sub_centro_costo = info.IdCentroCosto_sub_centro_costo == "" ? null : info.IdCentroCosto_sub_centro_costo; Context.SaveChanges(); } else { GuardarDB(info); } } 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 bool AnularDB(int IdEmpresa, decimal IdDistribucion) { try { using (EntitiesContabilidad_FJ Context = new EntitiesContabilidad_FJ()) { ct_distribucion_gastos_x_periodo Entity = Context.ct_distribucion_gastos_x_periodo.FirstOrDefault(q => q.IdEmpresa == IdEmpresa && q.IdDistribucion == IdDistribucion); if (Entity != null) { Entity.Estado = false; Context.SaveChanges(); } } return(true); } catch (Exception ex) { string mensaje = ""; 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 bool GuardarDB(ct_distribucion_gastos_x_periodo_det_gastos_Info info) { try { using (EntitiesContabilidad_FJ Context = new EntitiesContabilidad_FJ()) { ct_distribucion_gastos_x_periodo_det_gastos Entity = new ct_distribucion_gastos_x_periodo_det_gastos(); Entity.IdEmpresa = info.IdEmpresa; Entity.IdDistribucion = info.IdDistribucion; Entity.Secuencia = info.Secuencia; Entity.IdCtaCble = info.IdCtaCble; Entity.Saldo = info.Saldo; Entity.Checked = info.Checked; Context.ct_distribucion_gastos_x_periodo_det_gastos.Add(Entity); Context.SaveChanges(); } return(true); } catch (Exception ex) { string mensaje = ""; 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 ct_punto_cargo_Info Get_info_punto_Cargo_con_subcentro(int IdEmpresa, String codPunto_cargo) { try { ct_punto_cargo_Info Obj = new ct_punto_cargo_Info(); EntitiesContabilidad_FJ oEnti = new EntitiesContabilidad_FJ(); var Query = from q in oEnti.vwct_punto_cargo_x_Af_Activo_fijo where q.IdEmpresa == IdEmpresa && q.codPunto_cargo == codPunto_cargo select q; foreach (var item in Query) { Obj.IdEmpresa = item.IdEmpresa; Obj.IdPunto_cargo = item.IdPunto_cargo; Obj.codPunto_cargo = item.codPunto_cargo; Obj.nom_punto_cargo = item.nom_punto_cargo; Obj.nom_punto_cargo2 = "[" + item.IdPunto_cargo.ToString() + "] " + item.nom_punto_cargo; Obj.IdPunto_cargo_grupo = item.IdPunto_cargo_grupo; Obj.Estado = item.Estado.TrimEnd(); Obj.IdCentroCosto_Scc = item.IdCentroCosto_Scc; Obj.IdCentroCosto_sub_centro_costo_Scc = item.IdCentroCosto_sub_centro_costo_Scc; } 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 ct_punto_cargo_FJ_Info Get_info_punto_cargo(int IdEmpresa, int IdPunto_cargo) { try { ct_punto_cargo_FJ_Info info = new ct_punto_cargo_FJ_Info(); using (EntitiesContabilidad_FJ Context = new EntitiesContabilidad_FJ()) { var lst = from q in Context.vwct_punto_cargo_x_Af_Activo_fijo where q.IdEmpresa == IdEmpresa && q.IdPunto_cargo == IdPunto_cargo select q; foreach (var item in lst) { info.IdEmpresa = item.IdEmpresa; info.IdPunto_cargo = item.IdPunto_cargo; info.IdCentroCosto = item.IdCentroCosto_Scc; info.IdCentroCosto_sub_centro_costo = item.IdCentroCosto_sub_centro_costo_Scc; } } 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(); throw new Exception(ex.ToString()); } }
public List <ct_distribucion_gastos_x_periodo_det_Info> get_list(int IdEmpresa, int IdPeriodo) { try { List <ct_distribucion_gastos_x_periodo_det_Info> Lista; using (EntitiesContabilidad_FJ Context = new EntitiesContabilidad_FJ()) { Lista = (from q in Context.vwct_distribucion_gastos_x_periodo_det_para_distribuir where q.IdEmpresa == IdEmpresa && q.IdPeriodo == IdPeriodo select new ct_distribucion_gastos_x_periodo_det_Info { IdEmpresa = q.IdEmpresa, IdCtaCble = q.IdCtaCble, pc_Cuenta = q.pc_Cuenta, valor = q.dc_Valor }).ToList(); } return(Lista); } catch (Exception ex) { string mensaje = ""; 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 <ct_distribucion_gastos_x_periodo_Info> get_list(int IdEmpresa, DateTime Fecha_ini, DateTime Fecha_fin) { try { int IdPeriodo_ini = Convert.ToInt32(Fecha_ini.Date.Year.ToString() + Fecha_ini.Date.Month.ToString("00")); int IdPeriodo_fin = Convert.ToInt32(Fecha_fin.Date.Year.ToString() + Fecha_fin.Date.Month.ToString("00")); List <ct_distribucion_gastos_x_periodo_Info> Lista = new List <ct_distribucion_gastos_x_periodo_Info>(); using (EntitiesContabilidad_FJ Context = new EntitiesContabilidad_FJ()) { var lst = from q in Context.ct_distribucion_gastos_x_periodo where q.IdEmpresa == IdEmpresa && IdPeriodo_ini <= q.IdPeriodo && q.IdPeriodo <= IdPeriodo_fin select q; foreach (var item in lst) { ct_distribucion_gastos_x_periodo_Info info = new ct_distribucion_gastos_x_periodo_Info(); info.IdEmpresa = item.IdEmpresa; info.IdDistribucion = item.IdDistribucion; info.IdPeriodo = item.IdPeriodo; info.Fecha = item.Fecha; info.Observacion = item.Observacion; info.Estado = item.Estado; info.IdEmpresa_ct = item.IdEmpresa_ct; info.IdTipoCbte_ct = item.IdTipoCbte_ct; info.IdCbteCble_ct = item.IdCbteCble_ct; Lista.Add(info); } } return(Lista); } catch (Exception ex) { string mensaje = ""; 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 <ct_punto_cargo_Info> Get_List_punto_Cargo_con_subcentro(int IdEmpresa) { List <ct_punto_cargo_Info> Lst = new List <ct_punto_cargo_Info>(); try { using (EntitiesContabilidad_FJ oEnti = new EntitiesContabilidad_FJ()) { var Query = from q in oEnti.vwct_punto_cargo_x_Af_Activo_fijo where q.IdEmpresa == IdEmpresa && q.Estado == "A" select q; foreach (var item in Query) { ct_punto_cargo_Info Obj = new ct_punto_cargo_Info(); Obj.IdEmpresa = item.IdEmpresa; Obj.IdPunto_cargo = item.IdPunto_cargo; Obj.codPunto_cargo = item.codPunto_cargo; Obj.nom_punto_cargo = item.nom_punto_cargo; Obj.nom_punto_cargo2 = "[" + item.IdPunto_cargo.ToString() + "] " + item.nom_punto_cargo; Obj.IdPunto_cargo_grupo = item.IdPunto_cargo_grupo; Obj.Estado = item.Estado; Obj.IdCentroCosto_Scc = item.IdCentroCosto_Scc; Obj.IdCentroCosto_sub_centro_costo_Scc = item.IdCentroCosto_sub_centro_costo_Scc; Obj.info_punto_cargo_Fj.nom_centro = item.nom_centro; Obj.info_punto_cargo_Fj.nom_subcentro = item.nom_subcentro; Obj.IdActivoFijo = item.IdActivoFijo; 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 List <ct_Centro_costo_Info> Get_list_Centro_Costo_x_cliente_Consulta(int IdEmpresa) { try { List <ct_Centro_costo_Info> lM = new List <ct_Centro_costo_Info>(); using (EntitiesContabilidad_FJ Context = new EntitiesContabilidad_FJ()) { var select = from q in Context.vwct_centro_costo_x_cliente where q.IdEmpresa_cc == IdEmpresa select q; foreach (var item in select) { ct_Centro_costo_Info Cln_cc = new ct_Centro_costo_Info(); Cln_cc.IdEmpresa = item.IdEmpresa_cc; Cln_cc.IdCentroCosto = item.IdCentroCosto_cc; Cln_cc.pc_Estado = item.pc_Estado; Cln_cc.Centro_costo = item.nom_Centro_costo; Cln_cc.pe_cedulaRuc = item.pe_cedulaRuc; Cln_cc.pe_direccion = item.pe_direccion; Cln_cc.Descripcion_Ciudad = item.Descripcion_Ciudad; Cln_cc.pe_celular = item.pe_celular; Cln_cc.pe_correo = item.pe_correo; Cln_cc.nom_Cliente = item.nom_Cliente; Cln_cc.IdCliente_cli = item.IdCliente_cli == null ? 0 : (int)item.IdCliente_cli; lM.Add(Cln_cc); } } return(lM); } catch (Exception ex) { string MensajeError = ex.Message; 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(), "", MensajeError, "", "", "", "", "", DateTime.Now); oDataLog.Guardar_Log_Error(Log_Error_sis, ref MensajeError); MensajeError = ex.ToString(); throw new Exception(ex.ToString()); } }
public bool eliminarDB(int IdEmpresa, decimal IdDistribución, int Secuencia) { try { using (EntitiesContabilidad_FJ Context = new EntitiesContabilidad_FJ()) { Context.Database.ExecuteSqlCommand("delete Fj_servindustrias.ct_distribucion_gastos_x_periodo_det where IdEmpresa = " + IdEmpresa + " and IdDistribucion = " + IdDistribución + " and Secuencia = " + Secuencia); } return(true); } catch (Exception ex) { string mensaje = ""; 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 bool GuardarDB(ct_punto_cargo_FJ_Info info) { try { using (EntitiesContabilidad_FJ Context = new EntitiesContabilidad_FJ()) { var lst = from q in Context.ct_punto_cargo_FJ where q.IdEmpresa == info.IdEmpresa && q.IdPunto_cargo == info.IdPunto_cargo select q; if (lst.Count() == 0) { ct_punto_cargo_FJ Entity = new ct_punto_cargo_FJ(); Entity.IdEmpresa = info.IdEmpresa; Entity.IdPunto_cargo = info.IdPunto_cargo; Entity.IdCentroCosto = info.IdCentroCosto == "" ? null : info.IdCentroCosto; Entity.IdCentroCosto_sub_centro_costo = info.IdCentroCosto_sub_centro_costo == "" ? null : info.IdCentroCosto_sub_centro_costo; Context.ct_punto_cargo_FJ.Add(Entity); Context.SaveChanges(); } else { ModificarDB(info); } } 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 <ct_distribucion_gastos_x_periodo_det_gastos_Info> get_list(int IdEmpresa, decimal IdDistribucion) { try { List <ct_distribucion_gastos_x_periodo_det_gastos_Info> Lista = new List <ct_distribucion_gastos_x_periodo_det_gastos_Info>(); using (EntitiesContabilidad_FJ Context = new EntitiesContabilidad_FJ()) { var lst = from q in Context.ct_distribucion_gastos_x_periodo_det_gastos where q.IdEmpresa == IdEmpresa && q.IdDistribucion == IdDistribucion select q; foreach (var item in lst) { ct_distribucion_gastos_x_periodo_det_gastos_Info info = new ct_distribucion_gastos_x_periodo_det_gastos_Info(); info.IdEmpresa = item.IdEmpresa; info.IdDistribucion = item.IdDistribucion; info.Secuencia = item.Secuencia; info.IdCtaCble = item.IdCtaCble; info.Saldo = item.Saldo; info.Checked = item.Checked; Lista.Add(info); } } return(Lista); } catch (Exception ex) { string mensaje = ""; 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 <ct_distribucion_gastos_x_periodo_det_gastos_Info> get_list_para_distribucion(int IdEmpresa, int IdPeriodo) { try { List <ct_distribucion_gastos_x_periodo_det_gastos_Info> Lista = new List <ct_distribucion_gastos_x_periodo_det_gastos_Info>(); using (EntitiesContabilidad_FJ Context = new EntitiesContabilidad_FJ()) { var lst = from q in Context.vwct_distribucion_gastos_x_periodo_det_gastos_para_distribuir where q.IdEmpresa == IdEmpresa && q.IdPeriodo == IdPeriodo select q; foreach (var item in lst) { ct_distribucion_gastos_x_periodo_det_gastos_Info info = new ct_distribucion_gastos_x_periodo_det_gastos_Info(); info.IdEmpresa = item.IdEmpresa; info.IdCtaCble = item.IdCtaCble; info.pc_Cuenta = item.pc_Cuenta; info.Saldo = item.dc_Valor == null ? 0 : Convert.ToDouble(item.dc_Valor); info.Checked = true; Lista.Add(info); } } return(Lista); } catch (Exception ex) { string mensaje = ""; 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 <ct_distribucion_gastos_x_periodo_det_Info> get_list(int IdEmpresa, decimal IdDistribucion) { try { List <ct_distribucion_gastos_x_periodo_det_Info> Lista; using (EntitiesContabilidad_FJ Context = new EntitiesContabilidad_FJ()) { Lista = (from q in Context.vwct_distribucion_gastos_x_periodo_det where q.IdEmpresa == IdEmpresa && q.IdDistribucion == IdDistribucion select new ct_distribucion_gastos_x_periodo_det_Info { IdEmpresa = q.IdEmpresa, IdDistribucion = q.IdDistribucion, Secuencia = q.Secuencia, IdCtaCble = q.IdCtaCble, IdPunto_cargo = q.IdPunto_cargo, valor = q.valor, pc_Cuenta = q.pc_Cuenta, nom_punto_cargo = q.nom_punto_cargo }).ToList(); } return(Lista); } catch (Exception ex) { string mensaje = ""; 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()); } }