public CCarrito(string szConnectionString) { m_Lineas = new List <CLineaCarrito>(); DatosCarrito = new CDatosCarrito(); objCliente = new CLIENTE9(); ConnectionString = szConnectionString; }
private CLIENTE9 EstablecerCliente(CLIENTE9 cliente) { Session[szVarClienteZapa] = cliente; // Comprobar si es Cliente 9; // TODO: Mostrarlo en pantalla return(cliente); }
private bool BuscarCliente(string sTexto) { bool bRet = true; try { Int64 idCarrito = Int64.Parse(Session[szVarIdCarrito].ToString()); // Que cosa más sucia por dios objVenta = new ProcesarVenta(); objVenta.ConexString = System.Configuration.ConfigurationManager.ConnectionStrings["MC_TDAConnectionString"].ToString(); List <CLIENTE9> listaClientesZAPA = objVenta.GetCliente(sTexto, Contexto.FechaSesion, idCarrito, Contexto.IdTienda); if (listaClientesZAPA.Count == 0) { // No encontrado MostrarMensaje("No se han encontrado coincidencias.", true); bRet = false; } else { if (listaClientesZAPA.Count == 1) { //CalculoPromocion_Carrito(); // <- veremos a ver con esto que hacemos... CLIENTE9 cliente = EstablecerCliente(listaClientesZAPA[0]); ws.cls_Cliente9 c9 = new ws.cls_Cliente9(); ws.cls_Cliente9.ConsultaBeneficios objConsultaBeneficios = new ws.cls_Cliente9.ConsultaBeneficios(); objConsultaBeneficios.idTargeta = sTexto; objConsultaBeneficios.idTienda = AVE.Contexto.IdTienda; objConsultaBeneficios.idTerminal = AVE.Contexto.IdTerminal; int pares = 0; int Bolsas = 0; //if (c9.GetblnHomologadoC9(sTarjeta, cliente.Id_Cliente)) //if ConsultaWsBeneficios( } else { MostrarListaCliente(listaClientesZAPA); // Aqui se devuelve false porque todavía no se encontró un cliente. // solo se asigna al seleccionarlo de la lista. bRet = false; } } } catch (Exception ex) { bRet = false; MostrarMensaje(ex.Message, true); } return(bRet); }
private bool AñadirCliente9(string sTexto) { bool bRet = false; try { ws.cls_Cliente9 c9 = new ws.cls_Cliente9(); ws.cls_Cliente9.ConsultaBeneficios cb = new ws.cls_Cliente9.ConsultaBeneficios(); cb.idTargeta = sTexto; cb.idTienda = AVE.Contexto.IdTienda; cb.idTerminal = AVE.Contexto.IdTerminal; CLIENTE9 cliente9 = new CLIENTE9(); String ret = c9.InvokeWS_ConsultaBeneficios(ref cb); if (!String.IsNullOrEmpty(ret)) { ret = ret.Replace("Puntos Net", "Cliente 9"); bRet = false; } else { //if (!c9.GetblnHomologadoC9(sTexto, Cliente.Id_Cliente)) //{ // throw new // Exception("Tarjeta no homologada en Zapagestion."); //} //else //{ cliente9.Aniversario = cb.aniversario; cliente9.Fecha = Convert.ToDateTime(HttpContext.Current.Session[Constantes.Session.FechaSesion].ToString()).AddHours(DateTime.Now.Hour).AddMinutes(DateTime.Now.Minute).AddSeconds(DateTime.Now.Second); cliente9.Cumpleaños = cb.cumpleanos; cliente9.Email = cb.mail; cliente9.Cliente = cb.nombre; cliente9.CandidataShoeLover = (cb.shoelover == "true" ? "SI" : "NO"); cliente9.Empleado_cliente = null; cliente9.NumTarjetaNew = String.Empty; cliente9.ParesRedimidos = 0; cliente9.PuntosRedimidos = 0; cliente9.SaldoPuntosAnt = Convert.ToDouble(cb.puntos); cliente9.SaldoPuntosAct = 0; cliente9.ParesRedimidos = 0; cliente9.PuntosObtenidos = 0; cliente9.ParesAcumuladosAnt = Convert.ToDouble(cb.paresAcumulados); cliente9.NumTarjeta = cb.idTargeta; cliente9.dblSaldoBolsa5 = cb.dblSaldoBolsa5; cliente9.dblSaldoPares9 = cb.dblSaldoPares9; cliente9.NumConfirmaBolsa5 = Int16.Parse(cb.bolsasAcumuladas); cliente9.NivelActual = cb.strNivelActual; cliente9.BolsasAcumuladasAnt = double.Parse(cb.bolsasAcumuladas); cliente9.BenC9 = "1"; cliente9.BolsaPagada = 0; cliente9.ParPagado = 0; cliente9.PuntosPagados = 0; //ACL cliente9.CandidatoBasico = cb.strCandBasicoC9; cliente9.CandidatoFirstShoeLover = cb.strCandFirstC9; //} // Beneficios cliente 9 int pares = 0; int Bolsas = 0; double paresAcumulados = (Int16.Parse(cb.paresAcumulados) - (cliente9.ParPagado * 8)); double bolsasAcumuladas = (Int16.Parse(cb.bolsasAcumuladas) - (cliente9.BolsaPagada * 4)); if (Int16.Parse(cb.paresAcumulados) > 0) { pares = (Int16.Parse(cb.paresAcumulados) / 8); } if (Int16.Parse(cb.bolsasAcumuladas) > 0) { Bolsas = (Int16.Parse(cb.bolsasAcumuladas) / 4); } CDatosCliente9 datoscliente9 = new CDatosCliente9(cliente9); datoscliente9.pares = pares; datoscliente9.Bolsa = Bolsas; // puntos 9 //Label10.Text = (double.Parse(cb.puntos) - cliente9.PuntosPagados).ToString(); datoscliente9.Puntos9 = (double.Parse(cb.puntos) - cliente9.PuntosPagados); //Pares acumulados //Label13.Text = cb.paresAcumulados + "(" + pares.ToString() + ")"; datoscliente9.ParesAcumulados = double.Parse(cb.paresAcumulados); // bolsas acumuladas //Label14.Text = cb.bolsasAcumuladas + "(" + Bolsas.ToString() + ")"; datoscliente9.BolsasAcumuladas = double.Parse(cb.bolsasAcumuladas); this.DatosCliente9 = datoscliente9; bRet = true; } } catch (Exception ex) { bRet = false; throw (ex); } return(bRet); }
// Recibe un texto e intenta cargar el cliente desde el. // TODO: Sobrecargas para saber que se está buscando. // Devuelve el numero de clientes que se encontraron, y la lista objclient rellena en caso de haber varios public int AñadirCliente(string sTexto, ref List <CLIENTE9> pObjListaClientes) { int iRetVal; DLLGestionVenta.ProcesarVenta objVenta; objVenta = new DLLGestionVenta.ProcesarVenta(); objVenta.ConexString = this.ConnectionString; pObjListaClientes = objVenta.GetCliente(sTexto, Contexto.FechaSesion, this.IdCarrito, Contexto.IdTienda); iRetVal = pObjListaClientes.Count; if (pObjListaClientes.Count > 0) { if (pObjListaClientes.Count == 1) { objCliente = pObjListaClientes[0]; //CalculoPromocion_Carrito(); //cargaCarrito(); //poneTotales(); //CargarPagosCarritos(); //Nombre.Text = objclient[0].Cliente; //Email.Text = objclient[0].Email.ToString(); //txtemail.Text = objclient[0].Email.ToString(); //Shoelover.Text = objclient[0].NivelActual; //nomcliente.Text = objclient[0].Id_Cliente.ToString(); //CLiente.Visible = true; //RadioButton1.CssClass = "Ocultarcontrol"; //LstClientes.CssClass = "ocul1"; //nomcliente.CssClass = "visi1"; //BtnCliente.Visible = true; if (pObjListaClientes[0].NivelActual.ToString().Length > 0) { // RadioButtonlTipoPago.Items[0].Attributes.Add("class", "visi1"); } else { // RadioButtonlTipoPago.Items[0].Attributes.Add("class", "ocul1"); } if (pObjListaClientes[0].Empleado_cliente != null) { if (pObjListaClientes[0].Empleado_cliente.EsEmpleado) { //RadioButton1.CssClass = "VisibleControl"; //RadioButton1.Enabled = false; //RadioButtonlTipoPago.Items[0].Attributes.Add("class", "ocul1"); //HiddenTipoCliente.Value = "E"; //if (objclient[0].Empleado_cliente.NumNotaempleado >= objclient[0].Empleado_cliente.NotaEmpleadoGastadas) //{ // RadioButton1.Enabled = true; // RadioButton1.Focus(); //} } } } else { CLIENTE9 objclientAux; objclientAux = new CLIENTE9(); objclientAux.Id_Cliente = -1; objclientAux.Cliente = ""; //RadioButton1.CssClass = "Ocultarcontrol"; pObjListaClientes.Insert(0, objclientAux); objCliente = pObjListaClientes[0]; //LstClientes.DataTextField = "Cliente"; //LstClientes.DataValueField = "ID_Cliente"; //LstClientes.DataSource = objclient; //LstClientes.DataBind(); //nomcliente.CssClass = "ocul1"; //RadioButton1.CssClass = "VisibleControl"; //LstClientes.CssClass = "visi1"; //RadioButton1.CssClass = "Ocultarcontrol"; //Nombre.Text = ""; //Email.Text = ""; //Shoelover.Text = ""; //nomcliente.Text = ""; //CLiente.Visible = false; //BtnCliente.Visible = false; //RadioButton1.CssClass = "Ocultarcontrol"; //RadioButtonlTipoPago.Items[0].Attributes.Add("class", "ocul1"); } } else { objCliente = new CLIENTE9(); //Nombre.Text = ""; //Email.Text = ""; //Shoelover.Text = ""; //nomcliente.Text = ""; //CLiente.Visible = false; //RadioButton1.CssClass = "Ocultarcontrol"; //RadioButtonlTipoPago.Items[0].Attributes.Add("class", "ocul1"); } return(iRetVal); }
public CDatosCliente9(CLIENTE9 pCliente9) { Cliente9 = pCliente9; }
private void CargaCliente9(string sTarjeta) { CLIENTE9 objCliente; ws.cls_Cliente9 c9 = new ws.cls_Cliente9(); ws.cls_Cliente9.ConsultaBeneficios cb = new ws.cls_Cliente9.ConsultaBeneficios(); cb.idTargeta = sTarjeta; cb.idTienda = AVE.Contexto.IdTienda; cb.idTerminal = AVE.Contexto.IdTerminal; //nomcliente.Text = TarjetaCliente.Text.ToString(); //GetClienteActual(); //CalculoPromocion_CarritoCliente(); //cargaCarrito(); //poneTotales(); //CargarPagosCarritos(); String ret = c9.InvokeWS_ConsultaBeneficios(ref cb); if (!String.IsNullOrEmpty(ret)) { ret = ret.Replace("Puntos Net", "Cliente 9"); //Label10.Text = "0"; //Label11.Text = "0"; //Label12.Text = "0"; //Label13.Text = "0(0)"; //Label14.Text = "0(0)"; //RadioButton3.Enabled = false; //RadioButton4.Enabled = false; } if (Session[szClienteNine] == null) { objCliente = new CLIENTE9(); objCliente.Aniversario = cb.aniversario; objCliente.Fecha = Convert.ToDateTime(HttpContext.Current.Session[Constantes.Session.FechaSesion].ToString()).AddHours(DateTime.Now.Hour).AddMinutes(DateTime.Now.Minute).AddSeconds(DateTime.Now.Second); objCliente.Cumpleaños = cb.cumpleanos; objCliente.Email = cb.mail; objCliente.Cliente = cb.nombre; objCliente.CandidataShoeLover = (cb.shoelover == "true" ? "SI" : "NO"); objCliente.Empleado_cliente = null; objCliente.NumTarjetaNew = String.Empty; objCliente.ParesRedimidos = 0; objCliente.PuntosRedimidos = 0; objCliente.SaldoPuntosAnt = Convert.ToDouble(cb.puntos); objCliente.SaldoPuntosAct = 0; objCliente.ParesRedimidos = 0; objCliente.PuntosObtenidos = 0; objCliente.ParesAcumuladosAnt = Convert.ToDouble(cb.paresAcumulados); objCliente.NumTarjeta = cb.idTargeta; objCliente.dblSaldoBolsa5 = cb.dblSaldoBolsa5; objCliente.dblSaldoPares9 = cb.dblSaldoPares9; objCliente.NumConfirmaBolsa5 = Int16.Parse(cb.bolsasAcumuladas); objCliente.NivelActual = cb.strNivelActual; objCliente.BolsasAcumuladasAnt = double.Parse(cb.bolsasAcumuladas); objCliente.BenC9 = "1"; objCliente.BolsaPagada = 0; objCliente.ParPagado = 0; objCliente.PuntosPagados = 0; Session[szClienteNine] = objCliente; } else { objCliente = ((CLIENTE9)Session[szClienteNine]); } double pares; int paresRegalado; double Bolsa; int BolsaRegalado; //TarjetaCliente.Text = objCliente.NumTarjeta.ToString(); //nomcliente.Text = TarjetaCliente.Text; //HiddenTipoCliente.Value = "9"; Label10.Text = (objCliente.SaldoPuntosAnt - objCliente.PuntosPagados).ToString(); pares = objCliente.ParesAcumuladosAnt - (objCliente.ParPagado * 8); paresRegalado = (pares < 8 ? 0 : int.Parse(Math.Truncate(pares / 8).ToString())); Bolsa = objCliente.BolsasAcumuladasAnt - (objCliente.BolsaPagada * 4); BolsaRegalado = (Bolsa < 4 ? 0 : int.Parse(Math.Truncate(Bolsa / 4).ToString())); Label11.Text = (paresRegalado > 0 ? objCliente.dblSaldoPares9.ToString() : "0"); Label12.Text = (BolsaRegalado > 0 ? objCliente.dblSaldoBolsa5.ToString() : "0"); Label13.Text = pares.ToString() + "(" + paresRegalado.ToString() + ")"; Label14.Text = Bolsa + "(" + BolsaRegalado.ToString() + ")"; //VALIDAMOS PARES optParesAcumulados.Enabled = (Int64.Parse(paresRegalado.ToString()) > 0 && c9.GetPAR9(ObjCarrito.IdCarrito, Int64.Parse(pares.ToString()))); //VALIDAMOS BOLSA5 optBolsasAcumuladas.Enabled = (Int64.Parse(BolsaRegalado.ToString()) > 0 && c9.GetBOLSA5(ObjCarrito.IdCarrito, objCliente.NivelActual, Int64.Parse(Bolsa.ToString()))); }
private bool BuscarClienteNine(string sTarjeta) { bool bRet = true; try { ws.cls_Cliente9 c9 = new ws.cls_Cliente9(); ws.cls_Cliente9.ConsultaBeneficios objConsultaBeneficios = new ws.cls_Cliente9.ConsultaBeneficios(); objConsultaBeneficios.idTargeta = sTarjeta; objConsultaBeneficios.idTienda = AVE.Contexto.IdTienda; objConsultaBeneficios.idTerminal = AVE.Contexto.IdTerminal; int pares = 0; int Bolsas = 0; String ret = c9.InvokeWS_ConsultaBeneficios(ref objConsultaBeneficios); if (!String.IsNullOrEmpty(ret)) { ret = ret.Replace("Puntos Net", "Cliente 9"); } else { if (Session[szVarClienteZapa] != null) { //ScriptManager.RegisterStartupScript(this, typeof(Page), "homolagadoZapa", "alert('La tarjeta no esta homolagada en Zapagestion.');", true); // Hay que saber si la tarjeta es válida pero no está homologada. ¿ Formato del numero tarjeta ? throw new Exception("No encontrado."); } // Si hay un cliente y lo encontró a traves de la tarjeta CLIENTE9 cliente = (CLIENTE9)Session[szVarClienteZapa]; if (c9.GetblnHomologadoC9(sTarjeta, cliente.Id_Cliente)) { CLIENTE9 objCliente; if (Session["ClienteNine"] == null) { #region "crear nuevo cliente9 en Session[ClienteNine]" objCliente = new CLIENTE9(); objCliente.Aniversario = objConsultaBeneficios.aniversario; objCliente.Fecha = Convert.ToDateTime(HttpContext.Current.Session[Constantes.Session.FechaSesion].ToString()).AddHours(DateTime.Now.Hour).AddMinutes(DateTime.Now.Minute).AddSeconds(DateTime.Now.Second); objCliente.Cumpleaños = objConsultaBeneficios.cumpleanos; objCliente.Email = objConsultaBeneficios.mail; objCliente.Cliente = objConsultaBeneficios.nombre; objCliente.CandidataShoeLover = (objConsultaBeneficios.shoelover == "true" ? "SI" : "NO"); objCliente.Empleado_cliente = null; objCliente.NumTarjetaNew = String.Empty; objCliente.ParesRedimidos = 0; objCliente.PuntosRedimidos = 0; objCliente.SaldoPuntosAnt = Convert.ToDouble(objConsultaBeneficios.puntos); objCliente.SaldoPuntosAct = 0; objCliente.ParesRedimidos = 0; objCliente.PuntosObtenidos = 0; objCliente.ParesAcumuladosAnt = Convert.ToDouble(objConsultaBeneficios.paresAcumulados); objCliente.NumTarjeta = objConsultaBeneficios.idTargeta; objCliente.dblSaldoBolsa5 = objConsultaBeneficios.dblSaldoBolsa5; objCliente.dblSaldoPares9 = objConsultaBeneficios.dblSaldoPares9; objCliente.NumConfirmaBolsa5 = Int16.Parse(objConsultaBeneficios.bolsasAcumuladas); objCliente.NivelActual = objConsultaBeneficios.strNivelActual; objCliente.BolsasAcumuladasAnt = double.Parse(objConsultaBeneficios.bolsasAcumuladas); objCliente.BenC9 = "1"; objCliente.BolsaPagada = 0; objCliente.ParPagado = 0; objCliente.PuntosPagados = 0; Session["ClienteNine"] = objCliente; #endregion } else { objCliente = (CLIENTE9)Session["ClienteNine"]; } objConsultaBeneficios.paresAcumulados = (Int16.Parse(objConsultaBeneficios.paresAcumulados) - (objCliente.ParPagado * 8)).ToString(); objConsultaBeneficios.bolsasAcumuladas = (Int16.Parse(objConsultaBeneficios.bolsasAcumuladas) - (objCliente.BolsaPagada * 4)).ToString(); if (Int16.Parse(objConsultaBeneficios.paresAcumulados) > 0) { pares = (Int16.Parse(objConsultaBeneficios.paresAcumulados) / 8); } if (Int16.Parse(objConsultaBeneficios.bolsasAcumuladas) > 0) { Bolsas = (Int16.Parse(objConsultaBeneficios.bolsasAcumuladas) / 4); } //Label10.Text = (double.Parse(cb.puntos) - objCliente.PuntosPagados).ToString(); //Label11.Text = (Int16.Parse(cb.paresAcumulados) > 0 ? cb.promedioPar : "0"); //Label12.Text = (Int16.Parse(cb.bolsasAcumuladas) > 0 ? cb.promedioBolsa : "0"); //Label13.Text = cb.paresAcumulados + "(" + pares.ToString() + ")"; //Label14.Text = cb.bolsasAcumuladas + "(" + Bolsas.ToString() + ")"; //VALIDAMOS PAR9 //if (Int64.Parse(pares.ToString()) > 0 & c9.GetPAR9(Int64.Parse(Session["IdCarrito"].ToString()))) //{ // RadioButton3.Enabled = true; // objCliente.ParValido = true; //} //else //{ // RadioButton3.Enabled = false; // objCliente.ParValido = false; //} ////VALIDAMOS BOLSA5 //if (Int64.Parse(Bolsas.ToString()) > 0 & c9.GetBOLSA5(Int64.Parse(Session["IdCarrito"].ToString()))) //{ // objCliente.BolsaValido = true; // RadioButton4.Enabled = true; //} //else //{ // RadioButton4.Enabled = false; // objCliente.BolsaValido = false; //} } else { ScriptManager.RegisterStartupScript(this, typeof(Page), "homolagado", "alert('La Tarjeta introducida no esta homologada.');", true); // Cliente } } //nomcliente.Text = TarjetaCliente.Text.ToString(); //BCliente_Click(sender, e); //if (Session["ClienteNine"] != null && nomcliente.Text.ToString().Length > 0) { ((CLIENTE9)Session["ClienteNine"]).Id_Cliente = int.Parse(nomcliente.Text.ToString()); } } catch (Exception ex) { bRet = false; MostrarMensaje(ex.Message, true); } return(bRet); }