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, "Inventario", "Presentacion", "Index"); ViewBag.Nuevo = info.Nuevo; #endregion in_presentacion_Info model = new in_presentacion_Info { IdEmpresa = Convert.ToInt32(SessionFixed.IdEmpresa), IdTransaccionSession = Convert.ToDecimal(SessionFixed.IdTransaccionSession), }; var lst = bus_presentacion.get_list(model.IdEmpresa, true); Lista_Presentacion.set_list(lst, model.IdTransaccionSession); return(View(model)); }
public in_presentacion_Info get_info(int IdEmpresa, string IdPresentacion) { try { in_presentacion_Info info = new in_presentacion_Info(); using (Entities_inventario Context = new Entities_inventario()) { in_presentacion Entity = Context.in_presentacion.FirstOrDefault(q => q.IdEmpresa == IdEmpresa && q.IdPresentacion == IdPresentacion); if (Entity == null) { return(null); } info = new in_presentacion_Info { IdEmpresa = Entity.IdEmpresa, IdPresentacion = Entity.IdPresentacion, nom_presentacion = Entity.nom_presentacion, estado = Entity.estado }; } return(info); } catch (Exception) { throw; } }
public Boolean EliminarDB(in_presentacion_Info info) { try { using (EntitiesInventario context = new EntitiesInventario()) { var contact = context.in_presentacion.FirstOrDefault(catalogo => catalogo.IdEmpresa == info.IdEmpresa && catalogo.IdPresentacion == info.IdPresentacion); 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 ActionResult Consultar(int IdEmpresa = 0, string IdPresentacion = "", bool Exito = false) { in_presentacion_Info model = bus_presentacion.get_info(IdEmpresa, IdPresentacion); 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, "Inventario", "Presentacion", "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; } return(View(model)); }
public Boolean ModificarDB(in_presentacion_Info info) { try { using (EntitiesInventario oEnti = new EntitiesInventario()) { var registro = oEnti.in_presentacion.FirstOrDefault(cata => cata.IdEmpresa == info.IdEmpresa && cata.IdPresentacion == info.IdPresentacion); if (registro != null) { registro.nom_presentacion = info.nom_presentacion; registro.estado = info.estado; //registro.IdUsuarioUltMod = info.IdUsuarioUltMod; //registro.FechaUltMod = info.FechaUltMod; oEnti.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 ActionResult Anular(in_presentacion_Info model) { if (!bus_presentacion.anularDB(model)) { return(View(model)); } return(RedirectToAction("Index")); }
public ActionResult Modificar(in_presentacion_Info model) { if (!bus_presentacion.modificarDB(model)) { return(View(model)); } return(RedirectToAction("Consultar", new { IdEmpresa = model.IdEmpresa, IdPresentacion = model.IdPresentacion, Exito = true })); }
public ActionResult Nuevo(int IdEmpresa = 0) { in_presentacion_Info model = new in_presentacion_Info { IdEmpresa = IdEmpresa }; return(View(model)); }
public ActionResult Anular(int IdEmpresa = 0, string IdPresentacion = "") { in_presentacion_Info model = bus_presentacion.get_info(IdEmpresa, IdPresentacion); if (model == null) { return(RedirectToAction("Index")); } return(View(model)); }
public bool anularDB(in_presentacion_Info info) { try { return(odata.anularDB(info)); } catch (Exception) { throw; } }
public ActionResult Nuevo(in_presentacion_Info model) { if (bus_presentacion.validar_existe_IdPresentacion(Convert.ToInt32(model.IdEmpresa), model.IdPresentacion)) { ViewBag.mensaje = "El código ya se encuentra registrado"; return(View(model)); } if (!bus_presentacion.guardarDB(model)) { return(View(model)); } return(RedirectToAction("Consultar", new { IdEmpresa = model.IdEmpresa, IdPresentacion = model.IdPresentacion, Exito = true })); }
public ActionResult Nuevo(in_presentacion_Info model) { if (bus_presentacion.validar_existe_IdPresentacion(model.IdPresentacion)) { ViewBag.mensaje = "El código ya se encuentra registrado"; return(View(model)); } if (!bus_presentacion.guardarDB(model)) { return(View(model)); } return(RedirectToAction("Index")); }
void LimpiarDatos() { try { txt_codigo.Text = ""; txt_nombre.Text = ""; InfoPresentacion = new in_presentacion_Info(); } catch (Exception ex) { Log_Error_bus.Log_Error(ex.ToString()); MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public Boolean ModificarDB(in_presentacion_Info info) { try { return(oData.ModificarDB(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("", "ModificarDB", ex.Message), ex) { EntityType = typeof(in_Catalogo_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, "Inventario", "Presentacion", "Index"); if (!info.Nuevo) { return(RedirectToAction("Index")); } #endregion in_presentacion_Info model = new in_presentacion_Info { IdEmpresa = IdEmpresa }; return(View(model)); }
public ActionResult Anular(int IdEmpresa = 0, string IdPresentacion = "") { #region Permisos seg_Menu_x_Empresa_x_Usuario_Info info = bus_permisos.get_list_menu_accion(Convert.ToInt32(SessionFixed.IdEmpresa), SessionFixed.IdUsuario, "Inventario", "Presentacion", "Index"); if (!info.Anular) { return(RedirectToAction("Index")); } #endregion in_presentacion_Info model = bus_presentacion.get_info(IdEmpresa, IdPresentacion); if (model == null) { return(RedirectToAction("Index")); } return(View(model)); }
public in_presentacion_Info GetInfo_Presentacion() { try { InfoPresentacion = new in_presentacion_Info(); InfoPresentacion.IdEmpresa = param.IdEmpresa; InfoPresentacion.IdPresentacion = txt_codigo.Text.Trim(); InfoPresentacion.nom_presentacion = txt_nombre.Text.Trim(); InfoPresentacion.estado = (ckbActivo.Checked == true) ? "A" : "I"; return(InfoPresentacion); } catch (Exception ex) { Log_Error_bus.Log_Error(ex.ToString()); MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return(new in_presentacion_Info()); } }
public bool anularDB(in_presentacion_Info info) { try { using (Entities_inventario Context = new Entities_inventario()) { in_presentacion Entity = Context.in_presentacion.FirstOrDefault(q => q.IdEmpresa == info.IdEmpresa && q.IdPresentacion == info.IdPresentacion); if (Entity == null) { return(false); } Entity.estado = info.estado = "I"; Context.SaveChanges(); } return(true); } catch (Exception) { throw; } }
public Boolean GuardarDB(in_presentacion_Info info, ref string Mensaje) { try { using (EntitiesInventario oEnti = new EntitiesInventario()) { var Q = from per in oEnti.in_presentacion where per.IdEmpresa == info.IdEmpresa && per.IdPresentacion == info.IdPresentacion select per; if (Q.ToList().Count == 0) { var registo = new in_presentacion(); registo.IdEmpresa = info.IdEmpresa; registo.IdPresentacion = (info.IdPresentacion == "" || info.IdPresentacion == null) ? Convert.ToString(GetId(info.IdEmpresa)) : info.IdPresentacion; registo.nom_presentacion = info.nom_presentacion.Trim(); registo.estado = "A"; oEnti.in_presentacion.Add(registo); oEnti.SaveChanges(); Mensaje = "Registro Ingresado Correctamente"; } } 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; Mensaje = "Error al ingresar el registro "; throw new Exception(ex.ToString()); } }
public string Get_IdPresentacion() { try { if (cmbPresentacion.EditValue != null && lstInfo.Count() > 0) { Info = lstInfo.First(v => v.IdPresentacion == Convert.ToString(cmbPresentacion.EditValue)); } else { return(""); } return(Info.IdPresentacion); } 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(""); } }
public bool guardarDB(in_presentacion_Info info) { try { using (Entities_inventario Context = new Entities_inventario()) { in_presentacion Entity = new in_presentacion { IdEmpresa = info.IdEmpresa, IdPresentacion = info.IdPresentacion, nom_presentacion = info.nom_presentacion, estado = info.estado = "A" }; Context.in_presentacion.Add(Entity); Context.SaveChanges(); } return(true); } catch (Exception) { throw; } }
public List <in_presentacion_Info> Get_List_presentacion(int IdEmpresa) { List <in_presentacion_Info> lista = new List <in_presentacion_Info>(); EntitiesInventario oEnt = new EntitiesInventario(); try { var select = from q in oEnt.in_presentacion where q.IdEmpresa == IdEmpresa select q; foreach (var item in select) { in_presentacion_Info info = new in_presentacion_Info(); info.IdEmpresa = item.IdEmpresa; info.IdPresentacion = item.IdPresentacion; info.nom_presentacion = item.nom_presentacion; 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.ToString() + " " + ex.Message; throw new Exception(ex.ToString()); } }
public List <in_presentacion_Info> ProcesarDataTablein_Presentacion_Info(DataTable ds, int IdEmpresa, ref string MensajeError) { List <in_presentacion_Info> lista = new List <in_presentacion_Info>(); lista.Clear(); try { //VALIDAR QUE TENGA MAS DE 2 COLUMNAS if (ds.Columns.Count <= 3) { //RECORRE EL DATATABLE REGISTRO X REGISTRO if (ds.Rows.Count > 0) { foreach (DataRow row in ds.Rows) { in_presentacion_Info info = new in_presentacion_Info(); info.IdEmpresa = IdEmpresa; info.estado = "A"; for (int col = 0; col < ds.Columns.Count + 1; col++) { switch (col) { case 0: //IdProducto info.IdPresentacion = Convert.ToString(row[col]); break; case 1: //Codigo info.nom_presentacion = Convert.ToString(row[col]); break; default: break; } } lista.Add(info); } } else { MensajeError = "Por favor verifique que el archivo contenga Datos."; lista = new List <in_presentacion_Info>(); } } else { MensajeError = "Por favor verifique que el archivo tenga el formato correcto.\r Son 2 columnas."; lista = new List <in_presentacion_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("", "ProcesarDataTablein_Producto_Info", ex.Message), ex) { EntityType = typeof(in_producto_Bus) }; } return(lista); }
public void SetInfo_Presentacion(in_presentacion_Info _Info) { InfoPresentacion = _Info; }