public ba_tipo_nota_Info Get_Info_tipo_nota(int IdEmpresa, int idTipoNota) { try { EntitiesBanco context = new EntitiesBanco(); ba_tipo_nota_Info Info = new ba_tipo_nota_Info(); var address = context.ba_tipo_nota.FirstOrDefault(var => var.IdEmpresa == IdEmpresa && var.IdTipoNota == idTipoNota); if (address != null) { Info.IdEmpresa = address.IdEmpresa; Info.IdTipoNota = address.IdTipoNota; Info.Tipo = address.Tipo; Info.Descripcion = address.Descripcion; Info.IdCtaCble = address.IdCtaCble; Info.IdCentroCosto = address.IdCentroCosto; Info.Estado = address.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 ba_tipo_nota_Info get_info(int IdEmpresa, int IdTipoNota) { try { ba_tipo_nota_Info info = new ba_tipo_nota_Info(); using (Entities_banco Context = new Entities_banco()) { ba_tipo_nota Entity = Context.ba_tipo_nota.FirstOrDefault(q => q.IdEmpresa == IdEmpresa && q.IdTipoNota == IdTipoNota); if (Entity == null) { return(null); } info = new ba_tipo_nota_Info { IdEmpresa = Entity.IdEmpresa, IdTipoNota = Entity.IdTipoNota, IdCentroCosto = Entity.IdCentroCosto, IdCtaCble = Entity.IdCtaCble, Descripcion = Entity.Descripcion, Estado = Entity.Estado, Tipo = Entity.Tipo }; } return(info); } catch (Exception) { throw; } }
public Boolean ValidarObjeto(ba_tipo_nota_Info Info, ref string MensajeError) { try { Boolean res = true; if (Info.IdEmpresa == 0) { MensajeError = "el objeto esta errado los PK IdEmpresa , IdTipoCbte no pueden estar en cero"; return(false); } if (Info.IdCentroCosto == "") { Info.IdCentroCosto = null; } return(res); } catch (Exception ex) { Core.Erp.Info.Log_Exception.LoggingManager.Logger.Log(Core.Erp.Info.Log_Exception.LoggingCategory.Error, ex.Message); throw new Core.Erp.Info.Log_Exception.DalException(string.Format("", "ValidarObjeto", ex.Message), ex) { EntityType = typeof(ba_tipo_nota_Bus) }; } }
public bool guardarDB(ba_tipo_nota_Info info) { try { using (Entities_banco Context = new Entities_banco()) { ba_tipo_nota Entity = new ba_tipo_nota { IdEmpresa = info.IdEmpresa, IdTipoNota = info.IdTipoNota = get_id(info.IdEmpresa), IdCentroCosto = info.IdCentroCosto, IdCtaCble = info.IdCtaCble, Descripcion = info.Descripcion, Estado = info.Estado = "A", Tipo = info.Tipo }; Context.ba_tipo_nota.Add(Entity); Context.SaveChanges(); } return(true); } catch (Exception) { throw; } }
public bool modificarDB(ba_tipo_nota_Info info) { try { using (Entities_banco Context = new Entities_banco()) { ba_tipo_nota Entity = Context.ba_tipo_nota.FirstOrDefault(q => q.IdEmpresa == info.IdEmpresa && q.IdTipoNota == info.IdTipoNota); if (Entity == null) { return(false); } Entity.Descripcion = info.Descripcion; Entity.Tipo = info.Tipo; Entity.IdCtaCble = info.IdCtaCble; Context.SaveChanges(); } return(true); } catch (Exception) { throw; } }
public ActionResult Index() { #region Validar Session if (string.IsNullOrEmpty(SessionFixed.IdTransaccionSession)) { return(RedirectToAction("Login", new { Area = "", Controller = "Account" })); } SessionFixed.IdTransaccionSession = (Convert.ToDecimal(SessionFixed.IdTransaccionSession) + 1).ToString(); SessionFixed.IdTransaccionSessionActual = SessionFixed.IdTransaccionSession; #endregion #region Permisos seg_Menu_x_Empresa_x_Usuario_Info info = bus_permisos.get_list_menu_accion(Convert.ToInt32(SessionFixed.IdEmpresa), SessionFixed.IdUsuario, "Banco", "TipoNotaBanco", "Index"); ViewBag.Nuevo = info.Nuevo; ViewBag.Modificar = info.Modificar; ViewBag.Anular = info.Anular; #endregion ba_tipo_nota_Info model = new ba_tipo_nota_Info { IdTransaccionSession = Convert.ToDecimal(SessionFixed.IdTransaccionSession), IdEmpresa = Convert.ToInt32(SessionFixed.IdEmpresa) }; var lst = bus_tipo.get_list(model.IdEmpresa, "", true); Lista_TipoNota.set_list(lst, model.IdTransaccionSession); return(View(model)); }
public ba_tipo_nota_Info get_TipoNotaInfo() { try { if (cmb_TipoNota.EditValue != null) { if (Convert.ToInt32(cmb_TipoNota.EditValue) != 0) { if (list_TipoNota.Count() > 0) { InfoTipoNota = list_TipoNota.First(v => v.IdTipoNota == Convert.ToInt32(cmb_TipoNota.EditValue)); } } } return(InfoTipoNota); } catch (Exception ex) { string NameMetodo = System.Reflection.MethodBase.GetCurrentMethod().Name; MessageBox.Show(NameMetodo + " - " + ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); Log_Error_bus.Log_Error(NameMetodo + " - " + ex.ToString()); return(new ba_tipo_nota_Info()); } }
public Boolean GuardarDB(ba_tipo_nota_Info Info) { try { EntitiesBanco context = new EntitiesBanco(); var address = new ba_tipo_nota(); address.IdEmpresa = Info.IdEmpresa; address.IdTipoNota = Info.IdTipoNota = GetId(Info.IdEmpresa); address.Tipo = Info.Tipo; address.Descripcion = Info.Descripcion; address.IdCtaCble = Info.IdCtaCble; address.IdCentroCosto = Info.IdCentroCosto; address.Estado = Info.Estado; context.ba_tipo_nota.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 AnularDB(ba_tipo_nota_Info Info, ref string msg) { try { EntitiesBanco context = new EntitiesBanco(); var address = context.ba_tipo_nota.FirstOrDefault(var => var.IdEmpresa == Info.IdEmpresa && var.IdTipoNota == Info.IdTipoNota); if (address != null) { address.Tipo = Info.Tipo; address.Descripcion = Info.Descripcion; address.IdCtaCble = Info.IdCtaCble; address.IdCentroCosto = Info.IdCentroCosto; address.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); msg = ex.ToString() + " " + ex.Message; oDataLog.Guardar_Log_Error(Log_Error_sis, ref msg); msg = "Se ha producido el siguiente error: " + ex.Message; throw new Exception(ex.ToString()); } }
public ActionResult Consultar(int IdEmpresa = 0, int IdTipoNota = 0, bool Exito = false) { ba_tipo_nota_Info model = bus_tipo.get_info(IdEmpresa, IdTipoNota); if (model == null) { return(RedirectToAction("Index")); } #region Permisos seg_Menu_x_Empresa_x_Usuario_Info info = bus_permisos.get_list_menu_accion(Convert.ToInt32(SessionFixed.IdEmpresa), SessionFixed.IdUsuario, "Banco", "TipoNotaBanco", "Index"); if (model.Estado == "I") { info.Modificar = false; info.Anular = false; } ViewBag.Nuevo = info.Nuevo; ViewBag.Modificar = info.Modificar; ViewBag.Anular = info.Anular; #endregion if (Exito) { ViewBag.MensajeSuccess = MensajeSuccess; } cargar_combos(IdEmpresa); return(View(model)); }
public ActionResult Modificar(ba_tipo_nota_Info model) { if (!bus_tipo.modificarDB(model)) { cargar_combos(model.IdEmpresa); return(View(model)); } return(RedirectToAction("Consultar", new { IdEmpresa = model.IdEmpresa, IdTipoNota = model.IdTipoNota, Exito = true })); }
public ActionResult Anular(ba_tipo_nota_Info model) { if (!bus_tipo.anularDB(model)) { cargar_combos(model.IdEmpresa); return(View(model)); } return(RedirectToAction("Index")); }
public ActionResult Nuevo(int IdEmpresa = 0) { ba_tipo_nota_Info model = new ba_tipo_nota_Info { IdEmpresa = IdEmpresa }; cargar_combos(IdEmpresa); return(View(model)); }
public bool anularDB(ba_tipo_nota_Info info) { try { return(odata.anularDB(info)); } catch (Exception) { throw; } }
public ActionResult Modificar(int IdEmpresa = 0, int IdTipoNota = 0) { ba_tipo_nota_Info model = bus_tipo.get_info(IdEmpresa, IdTipoNota); if (model == null) { return(RedirectToAction("Index")); } cargar_combos(IdEmpresa); return(View(model)); }
private void gridView_CbteBan_CellValueChanged(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e) { try { if (e.Column == colIdTipoNota) { ba_tipo_nota_Info tipo = new ba_tipo_nota_Info(); ba_Cbte_Ban_Info row = (ba_Cbte_Ban_Info)gridView_CbteBan.GetFocusedRow(); int IdTipoNota; IdTipoNota = Convert.ToInt32(e.Value); try { if (row != null) { if (rB_Debito.Checked == true) { tipo = ListTipoNota.FirstOrDefault(q => q.IdTipoNota == IdTipoNota && q.Tipo == "NDBA"); } else if (rB_Credito.Checked == true) { tipo = ListTipoNota.FirstOrDefault(q => q.IdTipoNota == IdTipoNota && q.Tipo == "NCBA"); } if (tipo == null || tipo.IdCtaCble == null) { MessageBox.Show("El motivo seleccionado no tiene asignada una Cta Cble..."); LstBin_CbteBan.ToList().Find(q => q.cb_secuencia == row.cb_secuencia).IdTipoNota = null; gridView_CbteBan.SetFocusedRowCellValue(colError, "S"); } else { gridView_CbteBan.SetFocusedRowCellValue(colError, "N"); } } } catch (Exception ex) { string NameMetodo = System.Reflection.MethodBase.GetCurrentMethod().Name; MessageBox.Show(param.Get_Mensaje_sys(enum_Mensajes_sys.Error_comunicarse_con_sistemas) + ex.Message + " ", param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Error); Log_Error_bus.Log_Error(NameMetodo + " - " + ex.ToString()); gridView_CbteBan.SetFocusedRowCellValue(colError, "S"); LstBin_CbteBan.ToList().Find(q => q.cb_secuencia == row.cb_secuencia).IdTipoNota = null; } } } catch (Exception ex) { string NameMetodo = System.Reflection.MethodBase.GetCurrentMethod().Name; MessageBox.Show(param.Get_Mensaje_sys(enum_Mensajes_sys.Error_comunicarse_con_sistemas) + ex.Message + " ", param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Error); Log_Error_bus.Log_Error(NameMetodo + " - " + ex.ToString()); } }
public void _Info(ba_tipo_nota_Info Info) { try { this.Info = Info; } catch (Exception ex) { string NameMetodo = System.Reflection.MethodBase.GetCurrentMethod().Name; MessageBox.Show(param.Get_Mensaje_sys(enum_Mensajes_sys.Error_comunicarse_con_sistemas) + ex.Message + " ", param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Error); Log_Error_bus.Log_Error(NameMetodo + " - " + ex.ToString()); } }
public Boolean Eliminar(ba_tipo_nota_Info Info, ref string msg) { try { return(Data.AnularDB(Info, ref msg)); } catch (Exception ex) { Core.Erp.Info.Log_Exception.LoggingManager.Logger.Log(Core.Erp.Info.Log_Exception.LoggingCategory.Error, ex.Message); throw new Core.Erp.Info.Log_Exception.DalException(string.Format("", "Get_Info_tipo_nota", ex.Message), ex) { EntityType = typeof(ba_tipo_nota_Bus) }; } }
public Boolean ActualizarDB(ba_tipo_nota_Info Info) { try { return(Data.ActualizarDB(Info)); } catch (Exception ex) { Core.Erp.Info.Log_Exception.LoggingManager.Logger.Log(Core.Erp.Info.Log_Exception.LoggingCategory.Error, ex.Message); throw new Core.Erp.Info.Log_Exception.DalException(string.Format("", "ActualizarDB", ex.Message), ex) { EntityType = typeof(ba_tipo_nota_Bus) }; } }
public ActionResult Nuevo(int IdEmpresa = 0) { #region Permisos seg_Menu_x_Empresa_x_Usuario_Info info = bus_permisos.get_list_menu_accion(Convert.ToInt32(SessionFixed.IdEmpresa), SessionFixed.IdUsuario, "Banco", "TipoNotaBanco", "Index"); if (!info.Nuevo) { return(RedirectToAction("Index")); } #endregion ba_tipo_nota_Info model = new ba_tipo_nota_Info { IdEmpresa = IdEmpresa }; cargar_combos(IdEmpresa); return(View(model)); }
public ActionResult Anular(int IdEmpresa = 0, int IdTipoNota = 0) { #region Permisos seg_Menu_x_Empresa_x_Usuario_Info info = bus_permisos.get_list_menu_accion(Convert.ToInt32(SessionFixed.IdEmpresa), SessionFixed.IdUsuario, "Banco", "TipoNotaBanco", "Index"); if (!info.Anular) { return(RedirectToAction("Index")); } #endregion ba_tipo_nota_Info model = bus_tipo.get_info(IdEmpresa, IdTipoNota); if (model == null) { return(RedirectToAction("Index")); } cargar_combos(IdEmpresa); return(View(model)); }
public List <ba_tipo_nota_Info> Get_List_tipo_nota(int IdEmpresa, string tipo) { try { List <ba_tipo_nota_Info> lista = new List <ba_tipo_nota_Info>(); using (EntitiesBanco Entity = new EntitiesBanco()) { var query = from q in Entity.vwba_tipo_nota where q.IdEmpresa == IdEmpresa && q.Tipo == tipo select q; foreach (var item in query) { ba_tipo_nota_Info info = new ba_tipo_nota_Info(); info.IdEmpresa = item.IdEmpresa; info.IdTipoNota = item.IdTipoNota; info.Tipo = item.Tipo; info.Descripcion = item.Descripcion; info.IdCtaCble = item.IdCtaCble; info.nom_CtaCble = item.nom_CtaCble; info.IdCentroCosto = item.IdCentroCosto; info.nom_CentroCosto = item.nom_CentroCosto; info.Descripcion2 = "[" + item.IdTipoNota + "] " + item.Descripcion; info.Estado = item.Estado; 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 Boolean GuardarDB(ba_tipo_nota_Info Info) { try { Boolean res = false; string mesn = ""; if (ValidarObjeto(Info, ref mesn) == true) { res = Data.GuardarDB(Info); } return(res); } catch (Exception ex) { Core.Erp.Info.Log_Exception.LoggingManager.Logger.Log(Core.Erp.Info.Log_Exception.LoggingCategory.Error, ex.Message); throw new Core.Erp.Info.Log_Exception.DalException(string.Format("", "GuardarDB", ex.Message), ex) { EntityType = typeof(ba_tipo_nota_Bus) }; } }
public bool anularDB(ba_tipo_nota_Info info) { try { using (Entities_banco Context = new Entities_banco()) { ba_tipo_nota Entity = Context.ba_tipo_nota.FirstOrDefault(q => q.IdEmpresa == info.IdEmpresa && q.IdTipoNota == info.IdTipoNota); if (Entity == null) { return(false); } Entity.Estado = info.Estado = "I"; Context.SaveChanges(); } return(true); } catch (Exception) { throw; } }
public ba_tipo_nota_Info get_info_demanda(int IdEmpresa, decimal IdTipoNota) { try { ba_tipo_nota_Info info = new ba_tipo_nota_Info(); using (Entities_banco Context = new Entities_banco()) { info = (from q in Context.ba_tipo_nota where q.IdEmpresa == IdEmpresa && q.IdTipoNota == IdTipoNota select new ba_tipo_nota_Info { Descripcion = q.Descripcion, IdTipoNota = q.IdTipoNota }).FirstOrDefault(); } return(info); } catch (Exception) { throw; } }
private bool valida() { try { Boolean estado = true; string MensajeError = ""; ba_tipo_nota_Info tipo2 = new ba_tipo_nota_Info(); Per_I = Per_B.Get_Info_Periodo(param.IdEmpresa, dt_fechaCbte.Value, ref MensajeError); if (Per_I.pe_estado == "I") { MessageBox.Show("No se procedio a Grabar porque el Periodo se encuentra cerrado ", param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Error); estado = false; return(estado); } CbteCble_B.Get_list_Cbtecble(param.IdEmpresa, ref MensajeError); if (banco_I == null) { MessageBox.Show("Seleccione La Cuenta Bancaria", param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } if (tipo2.IdCtaCble == null) { MessageBox.Show("La Cuenta Bancaria seleccionada no esta relacionada a una cuenta Contable", param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Error); ultraCmbCtaBanco.EditValue = ""; //return false; } string TipoNota = (rB_Debito.Checked == true) ? "NDBA" : "NCBA"; foreach (ba_Cbte_Ban_Info row in LstBin_CbteBan) { #region verifica motivos con sus ctas cbles ba_tipo_nota_Info tipo = new ba_tipo_nota_Info(); try { if (row.IdTipoNota != null) { tipo = ListTipoNota.FirstOrDefault(q => q.IdTipoNota == row.IdTipoNota && q.Tipo == TipoNota); if (tipo == null || tipo.IdCtaCble == null) { MessageBox.Show("No podrá grabar, hay motivos que no tienen asignado la cta cble..."); row._Error = "S"; return(false); } } else { MessageBox.Show("Todos las Notas (Débito/Crédito) deben tener un motivo."); row._Error = "S"; return(false); } } catch (Exception ex) { Log_Error_bus.Log_Error(ex.ToString()); MessageBox.Show("No podrá grabar, hay motivos que no tienen asignado la cta cble..." + "\r Por favor verifique los registros de color rojo."); row._Error = "S"; } #endregion #region valida fecha y valor if (row.cb_Valor <= 0 || row.cb_Valor == null) { MessageBox.Show("Todos las Notas (Débito/Crédito) deben tener un valor mayor a cero."); return(false); } if (row.cb_Fecha == new DateTime() || row.cb_Fecha == null) { MessageBox.Show("Asigne valores validos para la fecha."); return(false); } #endregion } return(true); } catch (Exception ex) { string NameMetodo = System.Reflection.MethodBase.GetCurrentMethod().Name; MessageBox.Show(param.Get_Mensaje_sys(enum_Mensajes_sys.Error_comunicarse_con_sistemas) + ex.Message + " ", param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Error); Log_Error_bus.Log_Error(NameMetodo + " - " + ex.ToString()); return(false); } }
private Boolean AddRow(string data) { try { if (string.IsNullOrWhiteSpace(data)) { return(false); } string[] rowData = data.Split(new char[] { '\r', '\x09' }); ba_Cbte_Ban_Info newRow = new ba_Cbte_Ban_Info(); if (rowData.Count() >= 4) { newRow.cb_Observacion = rowData[3]; string TipoNota = ""; TipoNota = Convert.ToString(rowData[1]); try { if (rB_Debito.Checked == true) { ba_tipo_nota_Info tipo = ListTipoNota.FirstOrDefault(q => q.Descripcion == TipoNota && q.Tipo == "NDBA"); newRow.IdTipoNota = tipo.IdTipoNota; if (String.IsNullOrEmpty(tipo.IdCtaCble)) { newRow._Error = "S"; } } else if (rB_Credito.Checked == true) { ba_tipo_nota_Info tipo = ListTipoNota.FirstOrDefault(q => q.Descripcion == TipoNota && q.Tipo == "NCBA"); newRow.IdTipoNota = tipo.IdTipoNota; if (String.IsNullOrEmpty(tipo.IdCtaCble)) { newRow._Error = "S"; } } } catch (Exception ex) { string NameMetodo = System.Reflection.MethodBase.GetCurrentMethod().Name; MessageBox.Show(param.Get_Mensaje_sys(enum_Mensajes_sys.Error_comunicarse_con_sistemas) + ex.Message + " ", param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Error); Log_Error_bus.Log_Error(NameMetodo + " - " + ex.ToString()); newRow._Error = "S"; error++; } DateTime dt; if (DateTime.TryParse(rowData[0], out dt)) { newRow.cb_Fecha = Convert.ToDateTime(rowData[0]); } else { MessageBox.Show("Por favor ingrese una fecha válida. \n Formato fecha: 30/12/2000"); return(false); } double sad; if (double.TryParse(rowData[2], out sad)) { //newRow.FechaPago = Convert.ToDateTime(rowData[1]); newRow.cb_Valor = Convert.ToDouble(rowData[2]); } else { MessageBox.Show("Por favor ingrese un valor válido. \n Formato númerico"); return(false); } newRow.cb_secuencia = secuencial++; LstBin_CbteBan.Add(newRow); return(true); } else { MessageBox.Show("No hay las columnas necesarias para insertar al registros"); return(false); } } catch (Exception ex) { string NameMetodo = System.Reflection.MethodBase.GetCurrentMethod().Name; MessageBox.Show(param.Get_Mensaje_sys(enum_Mensajes_sys.Error_comunicarse_con_sistemas) + ex.Message + " ", param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Error); Log_Error_bus.Log_Error(NameMetodo + " - " + ex.ToString()); return(false); } }