public bool GuardarDB(fa_catalogo_Info Info, ref string IdCatalogo, ref string msjError) { try { Boolean resultOpe = true; if (ValidarCodigoExiste(Info.IdCatalogo) == false) { if (ValidarIdTipoCatalogo_Descripcion(Info.IdCatalogo_tipo, Info.Nombre) == false) { resultOpe = Data.GuardarDB(Info, ref IdCatalogo, ref msjError); } else { msjError = "La descripción asignada ya existe"; resultOpe = false; } } else { msjError = "El código ingresado ya se encuentra asignado \n Por favor ingrese uno nuevo"; resultOpe = false; } return(resultOpe); } 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(fa_catalogo_Bus) }; } }
public bool anularDB(fa_catalogo_Info info) { try { using (Entities_facturacion Context = new Entities_facturacion()) { fa_catalogo Entity = Context.fa_catalogo.Where(q => q.IdCatalogo == info.IdCatalogo).FirstOrDefault(); if (Entity == null) { return(false); } Entity.Estado = info.Estado = "I"; Entity.IdUsuarioUltAnu = info.IdUsuarioUltAnu; Entity.Fecha_UltAnu = DateTime.Now; Context.SaveChanges(); } return(true); } catch (Exception) { throw; } }
public bool ModificarDB(fa_catalogo_Info info, ref string msjError) { try { EntitiesFacturacion context = new EntitiesFacturacion(); var contenido = context.fa_catalogo.FirstOrDefault(var => var.IdCatalogo == info.IdCatalogo); if (contenido != null) { contenido.Nombre = info.Nombre; contenido.Orden = info.Orden; contenido.IdUsuarioUltMod = info.IdUsuarioUltMod; contenido.FechaUltMod = info.FechaUltMod; contenido.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); mensaje = ex.ToString(); oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje); msjError = mensaje; throw new Exception(ex.ToString()); } }
public fa_catalogo_Info get_info(string IdCatalogo) { try { fa_catalogo_Info info; using (Entities_facturacion Context = new Entities_facturacion()) { fa_catalogo Entity = Context.fa_catalogo.Where(q => q.IdCatalogo == IdCatalogo).FirstOrDefault(); if (Entity == null) { return(null); } info = new fa_catalogo_Info { IdCatalogo_tipo = Entity.IdCatalogo_tipo, IdCatalogo = Entity.IdCatalogo, Abrebiatura = Entity.Abrebiatura, Nombre = Entity.Nombre, Orden = Entity.Orden, Estado = Entity.Estado }; } return(info); } catch (Exception) { throw; } }
public Boolean GuardarDB(fa_catalogo_Info Info, ref string IdCatalogo, ref string msjError) { try { using (EntitiesFacturacion Context = new EntitiesFacturacion()) { var Address = new fa_catalogo(); Address.IdCatalogo = IdCatalogo = GetId(); Address.IdCatalogo_tipo = Info.IdCatalogo_tipo; Address.Nombre = Info.Nombre; Address.Estado = Info.Estado; Address.Orden = Info.Orden; Address.IdUsuario = Info.IdUsuario; Address.nom_pc = Info.nom_pc; Address.ip = Info.ip; Context.fa_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); mensaje = ex.ToString(); oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje); msjError = mensaje; throw new Exception(ex.ToString()); } }
public bool guardarDB(fa_catalogo_Info info) { try { using (Entities_facturacion Context = new Entities_facturacion()) { fa_catalogo Entity = new fa_catalogo { IdCatalogo_tipo = info.IdCatalogo_tipo, IdCatalogo = info.IdCatalogo, Nombre = info.Nombre, Orden = info.Orden, Abrebiatura = info.Abrebiatura, Estado = info.Estado = "A", IdUsuario = info.IdUsuario }; Context.fa_catalogo.Add(Entity); Context.SaveChanges(); } return(true); } catch (Exception) { throw; } }
void ucGe_Menu_Mantenimiento_x_usuario_event_btnconsultar_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { try { fa_catalogo_Info Info = (fa_catalogo_Info)this.gridViewCatalogo.GetFocusedRow(); if (Info == null) { MessageBox.Show("Seleccione una fila", "Sistemas", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else { frmFa_Catalogo_Mant frm = new frmFa_Catalogo_Mant((int)lstbox_TipoCatalogo.SelectedValue); frm.setAccion(Cl_Enumeradores.eTipo_action.consultar); frm.setInfo = Info; frm.event_frmFA_Catalogo_Mant_FormClosing += frm_event_frmFA_Catalogo_Mant_FormClosing; frm.Text = frm.Text + " ***CONSULTAR REGISTRO***"; frm.Show(); } } catch (Exception ex) { Log_Error_bus.Log_Error(ex.ToString()); MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public ActionResult Index(int IdCatalogo_tipo = 0) { ViewBag.IdCatalogo_tipo = IdCatalogo_tipo; #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, "Facturacion", "CatalogoTipoFacturacion", "Index"); ViewBag.Nuevo = info.Nuevo; ViewBag.Modificar = info.Modificar; ViewBag.Anular = info.Anular; #endregion fa_catalogo_Info model = new fa_catalogo_Info { IdTransaccionSession = Convert.ToDecimal(SessionFixed.IdTransaccionSession), IdCatalogo_tipo = IdCatalogo_tipo, }; var lst = bus_catalogo.get_list(IdCatalogo_tipo, true); Lista_Catalogo.set_list(lst, model.IdTransaccionSession); return(View(model)); }
public ActionResult Consultar(int IdCatalogo_tipo = 0, string IdCatalogo = "", bool Exito = false) { fa_catalogo_Info model = bus_catalogo.get_info(IdCatalogo); if (model == null) { return(RedirectToAction("Index", new { IdCatalogo_tipo = IdCatalogo_tipo })); } #region Permisos seg_Menu_x_Empresa_x_Usuario_Info info = bus_permisos.get_list_menu_accion(Convert.ToInt32(SessionFixed.IdEmpresa), SessionFixed.IdUsuario, "Facturacion", "CatalogoTipoFacturacion", "Index"); if (model.Estado == "I") { info.Modificar = false; info.Anular = false; } model.Nuevo = (info.Nuevo == true ? 1 : 0); model.Modificar = (info.Modificar == true ? 1 : 0); model.Anular = (info.Anular == true ? 1 : 0); #endregion if (Exito) { ViewBag.MensajeSuccess = MensajeSuccess; } ViewBag.IdCatalogo_tipo = model.IdCatalogo_tipo; cargar_combos(); return(View(model)); }
public bool modificarDB(fa_catalogo_Info info) { try { using (Entities_facturacion Context = new Entities_facturacion()) { fa_catalogo Entity = Context.fa_catalogo.Where(q => q.IdCatalogo == info.IdCatalogo).FirstOrDefault(); if (Entity == null) { return(false); } Entity.Nombre = info.Nombre; Entity.Orden = info.Orden; Entity.Abrebiatura = info.Abrebiatura; Entity.IdUsuarioUltMod = info.IdUsuarioUltMod; Entity.FechaUltMod = DateTime.Now; Context.SaveChanges(); } return(true); } catch (Exception) { throw; } }
public Boolean AnularDB(fa_catalogo_Info Info, ref string msjError) { try { using (EntitiesFacturacion context = new EntitiesFacturacion()) { var contact = context.fa_catalogo.FirstOrDefault(var => var.IdCatalogo == Info.IdCatalogo && var.IdCatalogo_tipo == Info.IdCatalogo_tipo); if (contact != null) { contact.Estado = "I"; contact.IdUsuarioUltAnu = Info.IdUsuarioUltAnu; contact.Fecha_UltAnu = Info.Fecha_UltAnu; 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); mensaje = ex.ToString(); oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje); msjError = mensaje; throw new Exception(ex.ToString()); } }
public ActionResult Modificar(fa_catalogo_Info model) { if (!bus_catalogo.modificarDB(model)) { ViewBag.IdCatalogo_tipo = model.IdCatalogo_tipo; cargar_combos(); return(View(model)); } return(RedirectToAction("Index", new { IdCatalogo_tipo = model.IdCatalogo_tipo })); }
public bool anularDB(fa_catalogo_Info info) { try { return(odata.anularDB(info)); } catch (Exception) { throw; } }
public ActionResult Nuevo(int IdCatalogo_tipo = 0) { fa_catalogo_Info model = new fa_catalogo_Info { IdCatalogo_tipo = IdCatalogo_tipo }; ViewBag.IdCatalogo_tipo = IdCatalogo_tipo; cargar_combos(); return(View(model)); }
public ActionResult Anular(int IdCatalogo_tipo = 0, string IdCatalogo = "") { fa_catalogo_Info model = bus_catalogo.get_info(IdCatalogo); if (model == null) { return(RedirectToAction("Index", new { IdCatalogo_tipo = IdCatalogo_tipo })); } ViewBag.IdCatalogo_tipo = model.IdCatalogo_tipo; cargar_combos(); return(View(model)); }
public bool AnularDB(fa_catalogo_Info Info, ref string msjError) { try { return(Data.AnularDB(Info, ref msjError)); } 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("", "Anular", ex.Message), ex) { EntityType = typeof(fa_catalogo_Bus) }; } }
public List <fa_catalogo_Info> Get_List_catalogo(int IdCatalogoTipo) { try { List <fa_catalogo_Info> Lst = new List <fa_catalogo_Info>(); EntitiesFacturacion oEnti = new EntitiesFacturacion(); var Query = from q in oEnti.fa_catalogo where q.IdCatalogo_tipo == IdCatalogoTipo select q; fa_catalogo_Info Obj = new fa_catalogo_Info(); Obj.IdCatalogo = "0"; Obj.IdCatalogo_tipo = IdCatalogoTipo; Obj.Nombre = "Todos"; Lst.Add(Obj); foreach (var item in Query) { Obj = new fa_catalogo_Info(); Obj.IdCatalogo = item.IdCatalogo; Obj.IdCatalogo_tipo = item.IdCatalogo_tipo; Obj.Nombre = item.Nombre; Obj.Estado = item.Estado; Obj.Abrebiatura = item.Abrebiatura; Obj.NombreIngles = item.NombreIngles; Obj.Orden = item.Orden; Obj.IdUsuario = item.IdUsuario; Obj.IdUsuarioUltMod = item.IdUsuarioUltMod; Obj.FechaUltMod = item.FechaUltMod; Obj.nom_pc = item.nom_pc; Obj.ip = item.ip; Obj.IdUsuarioUltAnu = item.IdUsuarioUltAnu; Obj.Fecha_UltAnu = item.Fecha_UltAnu; Obj.MotiAnula = item.MotiAnula; 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); mensaje = ex.ToString(); oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje); throw new Exception(ex.ToString()); } }
public ActionResult Nuevo(int IdCatalogo_tipo = 0) { #region Permisos seg_Menu_x_Empresa_x_Usuario_Info info = bus_permisos.get_list_menu_accion(Convert.ToInt32(SessionFixed.IdEmpresa), SessionFixed.IdUsuario, "Facturacion", "CatalogoTipoFacturacion", "Index"); if (!info.Nuevo) { return(RedirectToAction("Index")); } #endregion fa_catalogo_Info model = new fa_catalogo_Info { IdCatalogo_tipo = IdCatalogo_tipo }; ViewBag.IdCatalogo_tipo = IdCatalogo_tipo; cargar_combos(); return(View(model)); }
public fa_catalogo_Info get_CatalogosInfo() { try { if (cmbCatalogo.EditValue != null) { InfoCatalogo = listCatalogo.Where(v => v.IdCatalogo == Convert.ToString(cmbCatalogo.EditValue)).FirstOrDefault(); } return(InfoCatalogo); } 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(null); } }
public ActionResult Anular(int IdCatalogo_tipo = 0, string IdCatalogo = "") { #region Permisos seg_Menu_x_Empresa_x_Usuario_Info info = bus_permisos.get_list_menu_accion(Convert.ToInt32(SessionFixed.IdEmpresa), SessionFixed.IdUsuario, "Facturacion", "CatalogoTipoFacturacion", "Index"); if (!info.Anular) { return(RedirectToAction("Index")); } #endregion fa_catalogo_Info model = bus_catalogo.get_info(IdCatalogo); if (model == null) { return(RedirectToAction("Index", new { IdCatalogo_tipo = IdCatalogo_tipo })); } ViewBag.IdCatalogo_tipo = model.IdCatalogo_tipo; cargar_combos(); return(View(model)); }
public ActionResult Nuevo(fa_catalogo_Info model) { if (bus_catalogo.validar_existe_IdCatalogo(model.IdCatalogo)) { ViewBag.mensaje = "El código ya se encuentra registrado"; ViewBag.IdCatalogo_tipo = model.IdCatalogo_tipo; cargar_combos(); return(View(model)); } if (!bus_catalogo.guardarDB(model)) { ViewBag.IdCatalogo_tipo = model.IdCatalogo_tipo; cargar_combos(); return(View(model)); } return(RedirectToAction("Index", new { IdCatalogo_tipo = model.IdCatalogo_tipo })); }
private List <fa_catalogo_Info> lstNaturaleza() { try { List <fa_catalogo_Info> lstInfo = new List <fa_catalogo_Info>(); fa_catalogo_Info Info = new fa_catalogo_Info(); Info.IdCatalogo = Cl_Enumeradores.eTipoNaturalezaProducto.PRD_X_TODO.ToString(); lstInfo.Add(Info); Info = new fa_catalogo_Info(); Info.IdCatalogo = Cl_Enumeradores.eTipoNaturalezaProducto.PRD_X_ACFIJ.ToString(); lstInfo.Add(Info); return(lstInfo); } catch (Exception ex) { Log_Error_bus.Log_Error(ex.ToString()); MessageBox.Show(ex.ToString(), param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Error); return(new List <fa_catalogo_Info>()); } }
private List <fa_catalogo_Info> lstNaturaleza() { try { List <fa_catalogo_Info> lstInfo = new List <fa_catalogo_Info>(); fa_catalogo_Info Info = new fa_catalogo_Info(); Info.IdCatalogo = Cl_Enumeradores.eTipoNaturalezaProducto.PRD_X_TODO.ToString(); lstInfo.Add(Info); Info = new fa_catalogo_Info(); Info.IdCatalogo = Cl_Enumeradores.eTipoNaturalezaProducto.PRD_X_VENT.ToString(); lstInfo.Add(Info); return(lstInfo); } 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 List <fa_catalogo_Info>()); } }