private void _vista_UsuarioDeseaModificarPromo(object sender, PromoArgumento e) { try { var op = PromoServicio.ModificarPromo(e); if (op.Resultado == ResultadoOperacionTipo.Exito) { _vista.PromosPorEscala = PromoServicio.ObtenerPromoPorTipo(new PromoArgumento { Promo = new Promo { PROMO_TYPE = "BONUS_BY_SCALE" } }); _vista.PromosPorMultiplo = PromoServicio.ObtenerPromoPorTipo(new PromoArgumento { Promo = new Promo { PROMO_TYPE = "BONUS_BY_MULTIPLE" } }); _vista.PromosPorCombo = PromoServicio.ObtenerPromoPorTipo(new PromoArgumento { Promo = new Promo { PROMO_TYPE = "BONUS_BY_COMBO" } }); } else { _vista.EstablecerError(op.Mensaje, sender); } } catch (Exception ex) { _vista.EstablecerError(ex.Message, sender); } }
private void _vista_UsuarioDeseaAgregarPromo(object sender, PromoArgumento e) { try { Operacion op; bool isNewPromo = e.Promo.PROMO_ID == null || e.Promo.PROMO_ID == 0; if (isNewPromo) { op = PromoServicio.AgregarPromo(e); } else { op = PromoServicio.ModificarPromo(e); } if (op.Resultado == ResultadoOperacionTipo.Error) { _vista.EstablecerError(op.Mensaje, sender); } else { _vista.PromocionesPorPrecioEspecial = PromoServicio.ObtenerPromoPorTipo(e); _vista.idPromocion = int.Parse(e.Promo.PROMO_ID.ToString()); if (isNewPromo) { _vista.TerminoProceso("cpEnviarDatosPromocio", new string[] { op.DbData.ToString(), e.Promo.PROMO_NAME.ToString() }, sender); } } } catch (Exception ex) { _vista.EstablecerError(ex.Message, sender); } }
private void AsociarSkuDeVentaPorMultiploAPromocionDeVentaPorMultiplo(PromoArgumento e, object sender, bool esPromocionNueva) { try { e.VentasPorMultiploDePromo = e.VentasPorMultiploDePromo.Select(skuDeVentaPorMultiplo => { skuDeVentaPorMultiplo.PROMO_ID = e.Promo.PROMO_ID.Value; return(skuDeVentaPorMultiplo); }).ToList(); var listaDeErrores = (from skuDeVentaPorMultiploDePromo in e.VentasPorMultiploDePromo select PromoDeVentaPorMultiploServicio.AsociarSkuDeVentaPorMultiploAPromocionDeVentaPorMultiplo(skuDeVentaPorMultiploDePromo) into op where op.Resultado == ResultadoOperacionTipo.Error select op.Mensaje).ToList(); if (listaDeErrores.Count > 0) { _vista.MostrarListaDeErrores(listaDeErrores, sender); } else { _vista_UsuarioDeseaObtenerSkusDeVentaPorMultiploAsociadosAPromocionDeVentaPorMultiplo(sender, e); _vista.TerminoProceso( esPromocionNueva ? "cpUsuarioTerminoDeAgregarPromocionYAsociarSkuDeVentaPorMultiploAPromocionDeVentaPorMultiplo" : "cpUsuarioTerminoDeAsociarSkuDeVentaPorMultiploAPromocionDeVentaPorMultiplo", e.Promo, sender); } } catch (Exception exception) { _vista.EstablecerError(exception.Message, sender); } }
private void _vista_UsuarioDeseaObtenerSkusSinAsociarAPromo(object sender, PromoArgumento e) { try { try { var listaSkusDisponibles = SkuServicio.ObtenerSkuConUnidadDeMedida(); var indice = 1; foreach (var sku in listaSkusDisponibles) { sku.SKU = indice; indice++; } _vista.SkusSinAsociar = listaSkusDisponibles; } catch (Exception exception) { _vista.EstablecerError(exception.Message, sender); } } catch (Exception ex) { _vista.EstablecerError(ex.Message, sender); } }
/// <summary> /// EliminarPromocionDeVentaPorMultiplo /// </summary> /// <param name="promoArgumento"></param> /// <returns></returns> public Operacion EliminarPromocionDeVentaPorMultiplo(PromoArgumento promoArgumento) { try { DbParameter[] parameters = { new OAParameter { ParameterName = "@PROMO_ID", Value = promoArgumento.Promo.PROMO_ID } }; return(BaseDeDatosServicio.ExecuteQuery <Operacion>("SWIFT_SP_DELETE_FULL_PROMOTION_OF_SALES_BY_MULTIPLE", CommandType.StoredProcedure, parameters)[0]); } catch (DbException e) { return(new Operacion { Codigo = e.ErrorCode, Mensaje = e.HumanReadMessage(), Resultado = ResultadoOperacionTipo.Error }); } catch (Exception ex) { return(new Operacion { Codigo = -1, Mensaje = ex.Message, Resultado = ResultadoOperacionTipo.Error }); } }
/// <summary> /// UiVistaDePromocionesDeVentaPorMultiplo_OnCustomCallback(object sender, ASPxGridViewCustomCallbackEventArgs e) /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void UiVistaDePromocionesDeVentaPorMultiplo_OnCustomCallback(object sender, ASPxGridViewCustomCallbackEventArgs e) { if (!ValidarConexionYUsuarioLogueado(sender)) { return; } try { switch (e.Parameters.Split('|')[0]) { case "GuardarPromocionDeVentaPorMultiplo": var promoArgumento = new PromoArgumento { Promo = new Promo { PROMO_ID = UiTxtCodigoDePromocionDeVentaPorMultiplo.Value == null ? 0 : int.Parse(UiTxtCodigoDePromocionDeVentaPorMultiplo.Value.ToString()) , PROMO_NAME = UiTxtNombreDePromocionDeVentaPorMultiplo.Value.ToString() , PROMO_TYPE = "SALES_BY_MULTIPLE" } }; if (promoArgumento.Promo.PROMO_ID == 0) { UsuarioDeseaAgregarPromocionDeVentaPorMultiplo?.Invoke(sender, promoArgumento); } else { UsuarioDeseaModificarPromocionDeVentaPorMultiplo?.Invoke(sender, promoArgumento); } break; case "RecargarPromocionesDeVentaPorMultiplo": UsuarioDeseaObtenerPromocionesDeVentaPorMultiplo?.Invoke(sender, null); break; case "EliminarPromocionDeVentaPorMultiplo": UsuarioDeseaEliminarPromocionDeVentaPorMultiplo?.Invoke(sender, new PromoArgumento { Promo = new Promo { PROMO_ID = int.Parse(UiTxtCodigoDePromocionDeVentaPorMultiplo.Value.ToString()) } }); break; } } catch (Exception exception) { EstablecerError(exception.Message, sender); } }
private void _vista_UsuarioDeseaAgregarPromoDeBonoPorEscala(object sender, PromoArgumento e) { try { Operacion op; string promoId; if (e.Promo.PROMO_ID == null || e.Promo.PROMO_ID == 0) { op = PromoServicio.AgregarPromo(e); } else { op = PromoServicio.ModificarPromo(e); } if (op.Resultado == ResultadoOperacionTipo.Exito) { _vista.PromosPorEscala = PromoServicio.ObtenerPromoPorTipo(new PromoArgumento { Promo = new Promo { PROMO_TYPE = "BONUS_BY_SCALE" } }); promoId = op.DbData; var listaDeErrores = new List <string>(); foreach (var bonificacion in e.BonificacionesPorEscala) { bonificacion.PROMO_ID = int.Parse(promoId); op = PromoServicio.AgregarPromoDeBonoPorEscala(bonificacion); if (op.Resultado == ResultadoOperacionTipo.Error) { listaDeErrores.Add(op.Mensaje); } } if (listaDeErrores.Count > 0) { _vista.MostrarListaDeErrores(listaDeErrores, sender); } _vista.BonosPorEscalaDePromo = PromoServicio.ObtenerBonoDePromoDeBonoPorEscala(new PromoArgumento { Promo = new Promo { PROMO_ID = int.Parse(promoId) }, BonoPorEscalaDePromo = new BonoPorEscalaDePromo() }); _vista.TerminoProceso("cpTerminoDeAgregarBonificacionPorEscala", promoId, sender); } else { _vista.EstablecerError(op.Mensaje, sender); } } catch (Exception ex) { _vista.EstablecerError(ex.Message, sender); } }
private void _vista_UsuarioDeseaObtenerSkusAsociadosAPromo(object sender, PromoArgumento e) { try { _vista.SkusAsociadosAPromo = PromoServicio.ObtenerSkusAsociadosADescuentoPorPrecioEspecial(e); } catch (Exception ex) { _vista.EstablecerError(ex.Message, sender); } }
private void _vista_UsuarioDeseaEliminarBonoPorComboDePromo(object sender, PromoArgumento e) { try { var op = PromoServicio.EliminarBonoPorComboDePromo(e); if (op.Resultado != ResultadoOperacionTipo.Exito) { _vista.EstablecerError(op.Mensaje, sender); } } catch (Exception ex) { _vista.EstablecerError(ex.Message, sender); } }
private void _vista_UsuarioDeseaObtenerPromosParaBonoPorCombo(object sender, PromoArgumento e) { try { _vista.PromosPorCombo = PromoServicio.ObtenerPromoPorTipo(new PromoArgumento { Promo = new Promo { PROMO_TYPE = "BONUS_BY_COMBO" } }); } catch (Exception ex) { _vista.EstablecerError(ex.Message, sender); } }
private void _vista_UsuarioDeseaModificarPromoDeBonoPorEscala(object sender, PromoArgumento e) { try { var listaDeErrores = (from bonificacion in e.BonificacionesPorEscala select PromoServicio.ModificarPromoDeBonoPorEscala(bonificacion) into op where op.Resultado == ResultadoOperacionTipo.Error select op.Mensaje).ToList(); if (listaDeErrores.Count > 0) { _vista.MostrarListaDeErrores(listaDeErrores, sender); } } catch (Exception ex) { _vista.EstablecerError(ex.Message, sender); } }
private void _vista_UsuarioDeseaAgregarSkusAPromo(object sender, PromoArgumento e) { try { Operacion op; bool isNewPromo = e.Promo.PROMO_ID == null || e.Promo.PROMO_ID == 0; if (isNewPromo) { op = PromoServicio.AgregarPromo(e); } else { op = PromoServicio.ModificarPromo(e); } if (op.Resultado != ResultadoOperacionTipo.Exito) { _vista.EstablecerError(op.Mensaje, sender); return; } else { if (isNewPromo) { e.Promo.PROMO_ID = int.Parse(op.DbData); } var opF = PromoServicio.AgregarSkusAPromoPorPrecioEspecial(e); if (opF.Resultado != ResultadoOperacionTipo.Exito) { listaDeErrores.Add("El Sku " + e.DescuentoPorPrecioEspecial.CODE_SKU + opF.Mensaje.ToString()); _vista.listadoError = listaDeErrores; } else { _vista.PromocionesPorPrecioEspecial = PromoServicio.ObtenerPromoPorTipo(e); _vista.idPromocion = int.Parse(e.Promo.PROMO_ID.ToString()); if (isNewPromo) { _vista.TerminoProceso("cpEnviarDatosPromocio", new string[] { op.DbData.ToString(), e.Promo.PROMO_NAME.ToString() }, sender); } } } } catch (Exception ex) { _vista.EstablecerError(ex.Message, sender); } }
private void _vista_UsuarioDeseaEliminarPromoDeBonoPorCombo(object sender, PromoArgumento e) { try { var op = PromoServicio.EliminarPromoDeBonoPorCombo(e); if (op.Resultado != ResultadoOperacionTipo.Exito) { _vista.EstablecerError(op.Mensaje, sender); } else { _vista.TerminoProceso("cpTerminoDeEliminarPromoDeBonificacionPorCombo", null, sender); } } catch (Exception ex) { _vista.EstablecerError(ex.Message, sender); } }
private void AgregarPromoDeDescuntoPorEscala(object sender, PromoArgumento e, int promoId) { try { e.DescuentosPorEscala = e.DescuentosPorEscala.Select(descuento => { descuento.PROMO_ID = promoId; return(descuento); }).ToList(); var listaDeErrores = (from descuentoPorEscala in e.DescuentosPorEscala select PromoServicio.AgregarPromoDeDescuentoPorEscala(descuentoPorEscala) into op where op.Resultado == ResultadoOperacionTipo.Error select op.Mensaje).ToList(); if (listaDeErrores.Count > 0) { _vista.MostrarListaDeErrores(listaDeErrores, sender); } e.Promo.PROMO_ID = promoId; _vista.TerminoProceso("cpTerminoDeAgregarPromocionDeDescuentoPorEscala", e.Promo, sender); } catch (Exception exception) { _vista.EstablecerError(exception.Message, sender); } }
private void _vista_UsuarioDeseaEliminarTodosLosSkusDeLaPromo(object sender, PromoArgumento e) { try { var resultado = PromoServicio.EliminarTodosSkusAPromoPorPrecioEspecial(e); if (resultado.Resultado == ResultadoOperacionTipo.Error) { _vista.EstablecerError(resultado.Mensaje, sender); } else { _vista.SkusAsociadosAPromo = PromoServicio.ObtenerSkusAsociadosADescuentoPorPrecioEspecial(e); } } catch (Exception ex) { _vista.EstablecerError(ex.Message, sender); } }
private void _vista_UsuarioDeseaAgregarPromoDeBonoPorCombo(object sender, PromoArgumento e) { try { var op = PromoServicio.AgregarPromo(e); if (op.Resultado == ResultadoOperacionTipo.Exito) { _vista.IdPromocion = int.Parse(op.DbData); _vista.TerminoProceso("cpTerminoDeAgregarPromo", op.DbData, sender); } else { _vista.EstablecerError(op.Mensaje, sender); } } catch (Exception ex) { _vista.EstablecerError(ex.Message, sender); } }
private void _vista_UsuarioDeseaObtenerSkusParaBonificar(object sender, PromoArgumento e) { try { var lista = SkuServicio.ObtenerSkuConUnidadDeMedida(); var indice = 1; foreach (var sku in lista) { sku.SKU = indice; indice++; } _vista.SkusParaBonificarBonoPorEscala = lista; _vista.SkusParaBonificarBonoPorMultiplo = lista; _vista.SkusParaBonificarPorMontoGeneral = lista; } catch (Exception ex) { _vista.EstablecerError(ex.Message, sender); } }
private void _vista_UsuarioDeseaEliminarPromo(object sender, PromoArgumento e) { try { var resultado = PromoServicio.EliminarPromo(e); if (resultado.Resultado == ResultadoOperacionTipo.Error) { _vista.EstablecerError(resultado.Mensaje, sender); } else { _vista.PromocionesPorPrecioEspecial = PromoServicio.ObtenerPromoPorTipo(e); _vista.SkusAsociadosAPromo = PromoServicio.ObtenerSkusAsociadosADescuentoPorPrecioEspecial(e); _vista.TerminoProceso("cpLimpiarControles", 0, sender); } } catch (Exception ex) { _vista.EstablecerError(ex.Message, sender); } }
private void _vista_UsuarioDeseaObtenerSkusDeVentaPorMultiploAsociadosAPromocionDeVentaPorMultiplo(object sender, PromoArgumento e) { try { _vista.SkusAsociadosAPromocionDeVentaPorMultiplo = PromoDeVentaPorMultiploServicio.ObtenerSkusDeVentaPorMultiploAsociadosAPromocionDeVentaPorMultiplo(e); } catch (Exception exception) { _vista.EstablecerError(exception.Message, sender); } }
private void _vista_UsuarioDeseaAsociarSkuDeVentaPorMultiploAPromocionDeVentaPorMultiplo(object sender, PromoArgumento e) { try { var esPromocionNueva = false; if (e.Promo.PROMO_ID == null || e.Promo.PROMO_ID == 0) { esPromocionNueva = true; var operacion = PromoServicio.AgregarPromo(e); if (operacion.Resultado == ResultadoOperacionTipo.Exito) { e.Promo.PROMO_ID = int.Parse(operacion.DbData); } else { _vista.EstablecerError(operacion.Mensaje, sender); return; } } AsociarSkuDeVentaPorMultiploAPromocionDeVentaPorMultiplo(e, sender, esPromocionNueva); } catch (Exception exception) { _vista.EstablecerError(exception.Message, sender); } }
private void _vista_UsuarioDeseaEliminarPromocionDeVentaPorMultiplo(object sender, PromoArgumento e) { try { var op = PromoDeVentaPorMultiploServicio.EliminarPromocionDeVentaPorMultiplo(e); if (op.Resultado == ResultadoOperacionTipo.Exito) { _vista_UsuarioDeseaObtenerPromocionesDeVentaPorMultiplo(sender, e); _vista.TerminoProceso("cpUsuarioTerminoDeElimnarPromocionDeVentaPorMultiplo", null, sender); } else { _vista.EstablecerError(op.Mensaje, sender); } } catch (Exception exception) { _vista.EstablecerError(exception.Message, sender); } }
private void _vista_UsuarioDeseaAgregarPromocionDeVentaPorMultiplo(object sender, PromoArgumento e) { try { var op = PromoServicio.AgregarPromo(e); if (op.Resultado == ResultadoOperacionTipo.Exito) { e.Promo.PROMO_ID = int.Parse(op.DbData); _vista_UsuarioDeseaObtenerPromocionesDeVentaPorMultiplo(sender, e); _vista.TerminoProceso("cpUsuarioTerminoDeCrearPromocionDeVentaPorMultiplo", e.Promo, sender); } else { _vista.EstablecerError(op.Mensaje, sender); } } catch (Exception exception) { _vista.EstablecerError(exception.Message, sender); } }
private void _vista_UsuarioDeseaEliminarPromoDeBonoPorMontoGeneral(object sender, PromoArgumento e) { try { var op = PromoServicio.EliminarPromoDeBonoPorMontoGeneral(e); if (op.Resultado != ResultadoOperacionTipo.Exito) { _vista.EstablecerError(op.Mensaje, sender); } else { _vista.PromosDeBonificacionPorMontoGeneral = PromoServicio.ObtenerPromoPorTipo(new PromoArgumento { Promo = new Promo { PROMO_TYPE = "BONUS_BY_GENERAL_AMOUNT" } }); _vista.TerminoProceso("cpTerminoDeEliminarPromoDeBonificacionPorMontoGeneral", null, sender); } } catch (Exception ex) { _vista.EstablecerError(ex.Message, sender); } }
private void _vista_UsuarioDeseaAgregarBonoPorMontoGeneralDePromo(object sender, PromoArgumento e) { try { Operacion op; if (e.Promo.PROMO_ID == null || e.Promo.PROMO_ID == 0) { op = PromoServicio.AgregarPromo(e); } else { op = PromoServicio.ModificarPromo(e); } if (op.Resultado == ResultadoOperacionTipo.Exito) { e.Promo.PROMO_ID = int.Parse(op.DbData); _vista.PromosDeBonificacionPorMontoGeneral = PromoServicio.ObtenerPromoPorTipo(new PromoArgumento { Promo = new Promo { PROMO_TYPE = "BONUS_BY_GENERAL_AMOUNT" } }); op = PromoServicio.AgregarBonoPorMontoGeneralAPromo(e); if (op.Resultado == ResultadoOperacionTipo.Exito) { _vista.BonificacionesPorMontoGeneralDePromo = PromoServicio.ObtenerBonosPorMontoGeneralDePromo(e); _vista.TerminoProceso("cpUsuarioTerminoDeAgregarBonoPorMontoGeneralAPromo", e.Promo.PROMO_ID, sender); } else { _vista.EstablecerError(op.Mensaje, sender); } } else { _vista.EstablecerError(op.Mensaje, sender); } } catch (Exception exception) { _vista.EstablecerError(exception.Message, sender); } }
private void _vista_UsuarioDeseaObtenerBonoDePromoDeBonoPorEscala(object sender, PromoArgumento e) { try { _vista.BonosPorEscalaDePromo = PromoServicio.ObtenerBonoDePromoDeBonoPorEscala(e); } catch (Exception ex) { _vista.EstablecerError(ex.Message, sender); } }
private void _vista_UsuarioDeseaModificarBonoPorMontoGeneralDePromo(object sender, PromoArgumento e) { try { var listaDeErrores = (from bonificacionPorMontoGeneral in e.BonificacionesPorMontoGeneral select PromoServicio.ModificarBonoPorMontoGeneralDePromo(bonificacionPorMontoGeneral) into op where op.Resultado == ResultadoOperacionTipo.Error select op.Mensaje).ToList(); if (listaDeErrores.Count > 0) { _vista.MostrarListaDeErrores(listaDeErrores, sender); } else { _vista.BonificacionesPorMontoGeneralDePromo = PromoServicio.ObtenerBonosPorMontoGeneralDePromo(e); } } catch (Exception exception) { _vista.EstablecerError(exception.Message, sender); } }
private void _vista_UsuarioDeseaObtenerSkusABonificarDeComboDePromocionPorCombo(object sender, PromoArgumento e) { try { _vista.SkusABonificarDeComboDeBonoPorCombo = PromoServicio.ObtenerSkusABonificarDeComboDeBonoPorCombo(e); } catch (Exception ex) { _vista.EstablecerError(ex.Message, sender); } }
private void _vista_UsuarioDeseaObtenerPromosParaBonoPorEscala(object sender, PromoArgumento e) { _vista.PromosPorEscala = PromoServicio.ObtenerPromoPorTipo(new PromoArgumento { Promo = new Promo { PROMO_TYPE = "BONUS_BY_SCALE" } }); }
private void _vista_UsuarioDeseaObtenerBonoDePromoDeBonoPorMultiplo(object sender, PromoArgumento e) { try { _vista.BonosPorMultiploDePromo = PromoServicio.ObtenerBonoDePromoDeBonoPorMultiplo(e); _vista.PromosPorMultiplo = PromoServicio.ObtenerPromoPorTipo(new PromoArgumento { Promo = new Promo { PROMO_TYPE = "BONUS_BY_MULTIPLE" } }); } catch (Exception ex) { _vista.EstablecerError(ex.Message, sender); } }
private void _vista_UsuarioDeseaEliminarPromocionEnBonoPorMultiplo(object sender, PromoArgumento e) { try { var op = PromoServicio.EliminarPromoDeBonoPorMultiploCompleta(e); if (op.Resultado != ResultadoOperacionTipo.Exito) { _vista.EstablecerError(op.Mensaje, sender); } else { _vista.PromosPorMultiplo = PromoServicio.ObtenerPromoPorTipo(new PromoArgumento { Promo = new Promo { PROMO_TYPE = "BONUS_BY_MULTIPLE" } }); _vista.TerminoProceso("cpTerminoDeEliminarPromoBonificacionPorMultiplo", null, sender); } } catch (Exception ex) { _vista.EstablecerError(ex.Message, sender); } }