public SingleResponse <ClienteProductoModel> ConsultarResponsable(ClienteProductoModel clienteProductoModel) { SingleResponse <ClienteProductoModel> response = new SingleResponse <ClienteProductoModel>(); try { IList <ClienteProductoModel> listClientes = iGestionDataAccess.ConsultarResponsable(clienteProductoModel); if (listClientes.Count > 0) { response.Done(listClientes[0], string.Empty); } else { response.Error(new DomainException(CodesTickets.ERR_00_02)); } } catch (DalException e) { response.Error(e); } catch (DomainValidationsException e) { response.SetValidations(e.Validations); } catch (DomainException e) { response.Error(e); } catch (Exception e) { response.Error(new DomainException(CodesTickets.ERR_00_02, e)); } return(response); }
public SingleResponse <bool> ConsultarSiEsClienteFlotillas(ClienteProductoModel clienteProductoModel) { SingleResponse <bool> response = new SingleResponse <bool>(); try { bool isFlotillas = iGestionDataAccess.ConsultarSiEsClienteFlotillas(clienteProductoModel); response.Done(isFlotillas, string.Empty); } catch (DalException e) { response.Error(e); } catch (DomainValidationsException e) { response.SetValidations(e.Validations); } catch (DomainException e) { response.Error(e); } catch (Exception e) { response.Error(new DomainException(CodesTickets.ERR_00_02, e)); } return(response); }
public IList <ClienteProductoModel> ConsultarCaratula(ClienteProductoModel clienteProductoModel) { try { iGenericDataAccess.OpenConnection(); IList <VwTicSelCaratulas> lista = iGenericDataAccess.Consultar(new VwTicSelCaratulas() { IdCliente = clienteProductoModel.IdCliente }, new OptionsQueryZero() { ExcludeNumericsDefaults = true, ExcludeBool = true }); iGenericDataAccess.CloseConnection(); IList <ClienteProductoModel> clientesList = lista.Select( x => new ClienteProductoModel() { IdCliente = x.IdCliente, PolizaCaratula = x.PolizaCaratula, FormaPago = x.FormaPago, TipoString = x.TipoVehiculo, TipoCobranzaString = x.TipoCobranza }).ToList(); return(clientesList); } catch (Exception e) { iGenericDataAccess.CloseConnection(); throw new DalException(CodesTickets.ERR_00_07, e); } }
public IList <ClienteProductoModel> ConsultarTiposTickets(ClienteProductoModel clienteProductoModel) { try { iGenericDataAccess.OpenConnection(); IList <VwNueListaClientesProducto> lista = iGenericDataAccess.ExecuteQuery <VwNueListaClientesProducto>( CQuerysTickets.QryTiposTickets.Replace( "{{IdCliente}}", clienteProductoModel.IdCliente.ToString() ) ); iGenericDataAccess.CloseConnection(); IList <ClienteProductoModel> clientesList = lista.Select( x => new ClienteProductoModel() { IdCliente = x.IdCliente, NombreCliente = x.NombreCliente, IdTipoTicket = x.IdTipoTicket, DescripcionTipoTicket = x.DescripcionTipoTicket, HorasAtencion = x.HorasAtencion }).ToList(); return(clientesList); } catch (Exception e) { iGenericDataAccess.CloseConnection(); throw new DalException(CodesTickets.ERR_00_09, e); } }
public SingleResponse <IList <ClienteProductoModel> > ConsultarTiposTickets( ClienteProductoModel clienteProductoModel) { SingleResponse <IList <ClienteProductoModel> > response = new SingleResponse <IList <ClienteProductoModel> >(); try { IList <ClienteProductoModel> listClientes = iGestionDataAccess.ConsultarTiposTickets(clienteProductoModel); IList <ClienteProductoModel> clientesAgrupado = listClientes.GroupBy( cliente => new { cliente.IdCliente, cliente.DescripcionTipoTicket, cliente.IdTipoTicket, cliente.HorasAtencion }, (key, group) => new { key.IdCliente, key.DescripcionTipoTicket, key.IdTipoTicket, key.HorasAtencion }).Select(x => new ClienteProductoModel() { IdCliente = x.IdCliente, DescripcionTipoTicket = x.DescripcionTipoTicket, IdTipoTicket = x.IdTipoTicket, HorasAtencion = x.HorasAtencion } ).ToList(); response.Done(clientesAgrupado, string.Empty); } catch (DalException e) { response.Error(e); } catch (DomainValidationsException e) { response.SetValidations(e.Validations); } catch (DomainException e) { response.Error(e); } catch (Exception e) { response.Error(new DomainException(CodesTickets.ERR_00_02, e)); } return(response); }
public SingleResponse <IList <ClienteProductoModel> > ConsultarCaratula(ClienteProductoModel clienteProductoModel) { SingleResponse <IList <ClienteProductoModel> > response = new SingleResponse <IList <ClienteProductoModel> >(); try { IList <ClienteProductoModel> listClientes = iGestionDataAccess.ConsultarCaratula(clienteProductoModel); IList <ClienteProductoModel> clientesAgrupado = listClientes.GroupBy(cliente => new { cliente.IdCliente, cliente.PolizaCaratula, cliente.FormaPago, cliente.TipoString, cliente.TipoCobranzaString }, (key, group) => new { key.IdCliente, key.PolizaCaratula, key.FormaPago, key.TipoString, key.TipoCobranzaString }).Select(x => new ClienteProductoModel() { IdCliente = x.IdCliente, PolizaCaratula = x.PolizaCaratula, FormaPago = x.FormaPago, TipoString = x.TipoString, TipoCobranzaString = x.TipoCobranzaString } ).ToList(); response.Done(clientesAgrupado, string.Empty); } catch (DalException e) { response.Error(e); } catch (DomainValidationsException e) { response.SetValidations(e.Validations); } catch (DomainException e) { response.Error(e); } catch (Exception e) { response.Error(new DomainException(CodesTickets.ERR_00_02, e)); } return(response); }
public IList <ClienteProductoModel> ConsultarClientes(ClienteProductoModel clienteProductoModel) { try { iGenericDataAccess.OpenConnection(); //Se cambia para optimizar la consulta. IList <VwNueListaClientesProducto> lista = iGenericDataAccess .ExecuteQuery <VwNueListaClientesProducto>( "SELECT " + "total.Nombre as NombreCliente" + ", total.idCliente as IdCliente" + " FROM" + "(" + " SELECT " + " p.Nombre " + " , ttC.idCliente " + " , ROW_NUMBER() over(order by ttC.idCliente) as RowNumber " + " , RANK()over(order by ttC.idCliente) as Rank " + " FROM dbo.TiposTicketsClientes ttC " + " INNER JOIN( " + " SELECT " + " pD.Valor " + " FROM " + " dbo.PerfilDatos pD " + " Where ISNUMERIC(pD.Valor) = 1 " + " AND pD.Opcion = 1169 " + " AND pd.PersonaID = " + clienteProductoModel.GetIdUsuarioSesion() + " AND pd.PerfilID =" + clienteProductoModel.GetIdPerfilUsuarioSesion() + " " + " ) as pD " + " ON " + " ttC.IdCliente = pD.Valor " + " INNER JOIN dbo.nePersonas p " + " ON p.PersonaID = pD.Valor and p.Tipo=212 " + " ) as total" + " where Rank = RowNumber AND total.Nombre LIKE \'%" + clienteProductoModel.NombreCliente + "%\'"); iGenericDataAccess.CloseConnection(); IList <ClienteProductoModel> clientesList = lista.Select( x => new ClienteProductoModel() { IdCliente = x.IdCliente, NombreCliente = x.NombreCliente }).ToList(); return(clientesList); } catch (Exception e) { iGenericDataAccess.CloseConnection(); throw new DalException(CodesTickets.ERR_00_04, e); } }
public IList <ClienteProductoModel> ConsultarClientesConfigurarParametros(ClienteProductoModel clienteProductoModel) { try { iGenericDataAccess.OpenConnection(); IList <VwNueListaClientesProducto> lista = iGenericDataAccess.ExecuteQuery <VwNueListaClientesProducto>("SELECT " + " total.Nombre as NombreCliente " + " , total.idCliente as IdCliente " + " FROM " + " ( " + " SELECT " + " p.Nombre " + " , pD.idCliente " + " , ROW_NUMBER() over(order by pD.idCliente) as RowNumber " + " , RANK()over(order by pD.idCliente) as Rank " + " FROM( " + " SELECT " + " p.Nombre " + " , p.PersonaID " + " , p.Tipo " + " From dbo.nePersonas p " + " WHERE p.Tipo = 212 AND Nombre LIKE '%" + clienteProductoModel.NombreCliente + "%' " + " ) as p " + " INNER JOIN( " + " SELECT " + " pD.Valor as idCliente " + " FROM " + " dbo.PerfilDatos pD " + " Where ISNUMERIC(pD.Valor) = 1 " + " AND pD.Opcion = 1169 " + " AND pD.PerfilID = " + clienteProductoModel.GetIdPerfilUsuarioSesion() + " AND pD.PersonaID = " + clienteProductoModel.GetIdUsuarioSesion() + " " + " ) as pD " + " ON p.PersonaID = pD.idCliente " + " ) as total " + " where Rank = RowNumber "); iGenericDataAccess.CloseConnection(); IList <ClienteProductoModel> listClienList = lista.Select(x => new ClienteProductoModel() { IdCliente = x.IdCliente, NombreCliente = x.NombreCliente }).ToList(); return(listClienList); } catch (Exception e) { iGenericDataAccess.CloseConnection(); throw new DalException(CodesConfigParamTickets.ERR_08_02, e); } }
public SingleResponse <IList <ClienteProductoModel> > ConsultarClientesConfigurarParametros(ClienteProductoModel clienteProductoModel) { SingleResponse <IList <ClienteProductoModel> > response = new SingleResponse <IList <ClienteProductoModel> >(); try { IList <ClienteProductoModel> listaClienteProducto = iConfigurarParametrosTicketsDataAccess.ConsultarClientesConfigurarParametros(clienteProductoModel); var qry = listaClienteProducto.GroupBy(cm => new { cm.IdCliente, cm.NombreCliente }, (key, group) => new { Key1 = key.IdCliente, Key2 = key.NombreCliente }); List <ClienteProductoModel> clientesAgrupados = new List <ClienteProductoModel>(); foreach (var cliente in qry) { ClienteProductoModel clienteProductoModel2 = new ClienteProductoModel { IdCliente = cliente.Key1, NombreCliente = cliente.Key2 }; clientesAgrupados.Add(clienteProductoModel2); } response.Done(clientesAgrupados, string.Empty); } catch (DalException e) { response.Error(e); } catch (DomainValidationsException e) { response.SetValidations(e.Validations); } catch (DomainException e) { response.Error(e); } catch (Exception e) { response.Error(new DomainException(CodesConfigParamTickets.ERR_08_03, e)); } return(response); }
public SingleResponse <IList <ClienteProductoModel> > ConsultarClientes(ClienteProductoModel clienteProductoModel) { SingleResponse <IList <ClienteProductoModel> > response = new SingleResponse <IList <ClienteProductoModel> >(); try { IList <ClienteProductoModel> listClientes = iGestionDataAccess.ConsultarClientes(clienteProductoModel); List <ClienteProductoModel> clientesAgrupados = listClientes.GroupBy(cm => new { cm.IdCliente, cm.NombreCliente }, (key, group) => new { key.IdCliente, key.NombreCliente }).Select(x => new ClienteProductoModel() { IdCliente = x.IdCliente, NombreCliente = x.NombreCliente } ).ToList(); response.Done(clientesAgrupados, string.Empty); } catch (DalException e) { response.Error(e); } catch (DomainValidationsException e) { response.SetValidations(e.Validations); } catch (DomainException e) { response.Error(e); } catch (Exception e) { response.Error(new DomainException(CodesTickets.ERR_00_02, e)); } return(response); }
private void buttonUpdate_Click(object sender, EventArgs e) { ClienteProductoModel cliProdModel = new ClienteProductoModel(); cliProdModel.rutCliente = frmclienteprecio.labelRutCli.Text.ToUpper(); cliProdModel.idProducto = Convert.ToInt32(labelIdProducto.Text); cliProdModel.precioNeto = Convert.ToDecimal(textBoxPrcNeto.Text); cliProdModel.precioVenta = Convert.ToInt32(textBoxprcVenta.Text); try { cliProdModel.update(cliProdModel); MessageBox.Show("El Productos " + textBoxNomProd.Text + " se actualizó con éxito"); frmclienteprecio.actulizaDataGrid(); this.Close(); } catch (Exception ex) { Console.WriteLine("Error en buttonUpdate" + ex.Message); } }
public IList <ClienteProductoModel> ConsultarResponsable(ClienteProductoModel clienteProductoModel) { try { iGenericDataAccess.OpenConnection(); //bool clienteFlotilla = ConsultarSiEsClienteFlotillas(clienteProductoModel); IList <VwNueListaClientesProducto> lista; lista = iGenericDataAccess .ExecuteQuery <VwNueListaClientesProducto>(" SELECT " + " TTC.IdCliente IdCliente" + " , TTC.IdPersonaResponsable IdResponsable" + " , nP.Nombre + ' ' + ISNULL(nP.Paterno, '') + ' ' + ISNULL(nP.Materno, '') NombreCompletoResponsable" + " , nP.Mail MailResponsable" + " FROM " + " TiposTicketsClientes as TTC" + " INNER JOIN nePersonas nP" + " on TTC.TipoId = " + clienteProductoModel.IdTipoTicket + " " + " AND nP.PersonaID = TTC.IdPersonaResponsable " + " AND TTC.IdCliente = " + clienteProductoModel.IdCliente); iGenericDataAccess.CloseConnection(); IList <ClienteProductoModel> clientesList = lista.Select( x => new ClienteProductoModel() { IdCliente = x.IdCliente, IdResponsable = x.IdResponsable, NombreCompletoResponsable = x.NombreCompletoResponsable, MailResponsable = x.MailResponsable }).ToList(); return(clientesList); } catch (Exception e) { iGenericDataAccess.CloseConnection(); throw new DalException(CodesTickets.ERR_00_08, e); } }
public bool ConsultarSiEsClienteFlotillas(ClienteProductoModel clienteProductoModel) { try { iGenericDataAccess.OpenConnection(); IList <VwNueListaClientesProducto> lista = iGenericDataAccess.ExecuteQuery <VwNueListaClientesProducto>("Select " + " COUNT(valorB) Contador " + " from " + " RelacionDatos " + " Where ISNUMERIC(ValorB) = 1 AND ValorB = 118 AND ValorA = " + clienteProductoModel.IdCliente); if (lista.Count > 0) { return(lista.FirstOrDefault().Contador > 0); } return(false); } catch (Exception e) { iGenericDataAccess.CloseConnection(); throw new DalException(CodesTickets.ERR_00_06, e); } }
public SingleResponse <bool> ConsultarSiEsClienteFlotillas(ClienteProductoModel clienteProductoModel) { return(iGestionBussiness.ConsultarSiEsClienteFlotillas(clienteProductoModel)); }
public SingleResponse <ClienteProductoModel> ConsultarResponsable(ClienteProductoModel clienteProductoModel) { return(iGestionBussiness.ConsultarResponsable(clienteProductoModel)); }
public SingleResponse <IList <ClienteProductoModel> > ConsultarTiposTickets(ClienteProductoModel clienteProductoModel) { return(iGestionBussiness.ConsultarTiposTickets(clienteProductoModel)); }
public SingleResponse <IList <ClienteProductoModel> > ConsultarCaratula(ClienteProductoModel clienteProductoModel) { return(iGestionBussiness.ConsultarCaratula(clienteProductoModel)); }
public SingleResponse <IList <ClienteProductoModel> > ConsultarClientesConfigurarParametros(ClienteProductoModel clienteProductoModel) { return(iConfigurarParametrosTicketsBusiness.ConsultarClientesConfigurarParametros(clienteProductoModel)); }