Пример #1
0
        private void btnGuardar_Click(object sender, EventArgs e)
        {
            try
            {
                if ((int)txtCveCliente.EditValue == 0)
                {
                    FinancieraCliente clie = new FinancieraCliente
                    {
                        Nombre            = txtNombre.Text,
                        Ingresos          = Convert.ToDecimal(txtIngresos.EditValue),
                        Domicilio         = txtDireccion.Text,
                        Poblacion         = txtPoblacion.Text,
                        Telefono          = txtTelefono.Text,
                        Celular           = txtCelular.Text,
                        EstadoCivil       = rgpoEstadoCivil.EditValue.ToString(),
                        Conyuge           = txtConyuge.Text,
                        IngresosConyuge   = Convert.ToDecimal(txtIngresosConyuge.EditValue),
                        CelularConyuge    = txtCelularConyuge.Text,
                        FechaModificacion = DateTime.Today.Date,
                    };
                    txtCveCliente.EditValue = new LogicaClientes().AgregarClienteFinanciera(clie);
                    EventDevolverClave(Convert.ToInt32(txtCveCliente.EditValue));
                }
                else
                {
                    FinancieraCliente cliMod =
                        _entidades.FinancieraClientes.First(c => c.Clave == Convert.ToInt32(txtCveCliente.EditValue));
                    FinancieraCliente clie = new FinancieraCliente
                    {
                        Clave             = cliMod.Clave,
                        Nombre            = txtNombre.Text,
                        Ingresos          = Convert.ToDecimal(txtIngresos.EditValue),
                        Domicilio         = txtDireccion.Text,
                        Poblacion         = txtPoblacion.Text,
                        Telefono          = txtTelefono.Text,
                        Celular           = txtCelular.Text,
                        EstadoCivil       = rgpoEstadoCivil.EditValue.ToString(),
                        Conyuge           = txtConyuge.Text,
                        IngresosConyuge   = Convert.ToDecimal(txtIngresosConyuge.EditValue),
                        CelularConyuge    = txtCelularConyuge.Text,
                        FechaModificacion = DateTime.Today.Date,
                    };
                    new LogicaClientes().ModificarClienteFinanciera(clie, cliMod);

                    if (EventDevolverClave != null)
                    {
                        EventDevolverClave(cliMod.Clave);
                    }
                }
                Close();
            }
            catch (ValidationException vex)
            {
                XtraMessageBox.Show(vex.Message, "Validando Datos", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            catch (Exception ex)
            {
                XtraMessageBox.Show(ex.Message, "Error al Guardar", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Пример #2
0
 public void ModificarClienteFinanciera(FinancieraCliente cliMod, FinancieraCliente cliOri)
 {
     if (cliMod.Nombre == string.Empty)
     {
         throw new ValidationException("Indique el nombre del Cliente");
     }
     if (cliMod.Domicilio == string.Empty)
     {
         throw new ValidationException("Indique la direccion Cliente");
     }
     if (cliMod.Poblacion == string.Empty)
     {
         throw new ValidationException("Indique el poblado del Cliente");
     }
     //if (cliMod.Telefono == string.Empty && cliMod.Celular == string.Empty)
     //    throw new ValidationException("Indique un numero de Telefono o Celular");
     if (cliMod.EstadoCivil == string.Empty)
     {
         throw new ValidationException("Indique estado civíl del Cliente");
     }
     //if (cliMod.EstadoCivil == "Casada(o)")
     //{
     //    if (cliMod.Conyuge == string.Empty)
     //        throw new ValidationException("Indique nombre del conyuge");
     //}
     mapeoFinanciamiento.FinancieraClientes.Attach(cliMod, cliOri);
     mapeoFinanciamiento.SubmitChanges();
 }
Пример #3
0
        public int AgregarClienteFinanciera(FinancieraCliente cli)
        {
            if (cli.Nombre == string.Empty)
            {
                throw new ValidationException("Indique el nombre del Cliente");
            }
            if (cli.Domicilio == string.Empty)
            {
                throw new ValidationException("Indique la direccion Cliente");
            }
            if (cli.Poblacion == string.Empty)
            {
                throw new ValidationException("Indique el poblado del Cliente");
            }
            //if (cli.Telefono == string.Empty && cli.Celular == string.Empty)
            //    throw new ValidationException("Indique un numero de Telefono o Celular");
            if (cli.EstadoCivil == string.Empty)
            {
                throw new ValidationException("Indique estado civíl del Cliente");
            }
            //if (cli.EstadoCivil == "Casada(o)")
            //{
            //    if (cli.Conyuge==string.Empty)
            //    throw new ValidationException("Indique nombre del conyuge");
            //}

            mapeoFinanciamiento.FinancieraClientes.InsertOnSubmit(cli);
            mapeoFinanciamiento.SubmitChanges();
            return(cli.Clave);
        }
Пример #4
0
        public void ClienteDevuelto(string clave)
        {
            FinancieraCliente cli = _entidades.FinancieraClientes.First(cl => cl.Clave == Convert.ToInt32(clave));

            txtCveCliente.EditValue     = cli.Clave;
            txtNombre.EditValue         = cli.Nombre;
            txtDireccion.EditValue      = cli.Domicilio;
            txtPoblacion.EditValue      = cli.Poblacion;
            txtTelefono.EditValue       = cli.Telefono;
            txtCelular.EditValue        = cli.Celular;
            rgpoEstadoCivil.EditValue   = cli.EstadoCivil;
            txtIngresos.EditValue       = cli.Ingresos;
            txtConyuge.EditValue        = cli.Conyuge;
            txtIngresos.EditValue       = cli.IngresosConyuge;
            txtCelularConyuge.EditValue = cli.CelularConyuge;

            new ManejadorControles().DesectivarTextBox(gpoContenedor, true);
        }
Пример #5
0
        private void ClienteDevuelto(int clave)
        {
            FinancieraCliente cli = _entidades.FinancieraClientes.First(cl => cl.Clave == clave);

            if (dtIntegrantesGrupo.Rows.Cast <DataRow>().Any(fila => (int)fila[0] == cli.Clave))
            {
                XtraMessageBox.Show(cli.Nombre + "\n Ya se encuentra en la lista del grupo", "Validando Datos", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            IQueryable <FinancieraGruposDetalle> detgrupo =
                _entidades.FinancieraGruposDetalles.Where(
                    dg => dg.CveCliente == cli.Clave && dg.CveGrupo != Convert.ToInt32(txtCveGrupo.EditValue));

            if (detgrupo.Any())
            {
                XtraMessageBox.Show(cli.Nombre + "\n Ya es parte de un grupo no puede agregarlo en este", "Validando Datos", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            dtIntegrantesGrupo.Rows.Add(new object[] { cli.Clave, cli.Nombre, cli.Ingresos, 0, 0 });
        }
Пример #6
0
        private void ClienteDevuelto(string clave)
        {
            FinancieraCliente cli = _entidades.FinancieraClientes.First(cl => cl.Clave == Convert.ToInt32(clave));

            if (dtIntegrantesGrupo.Rows.Cast <DataRow>().Any(fila => (int)fila[0] == cli.Clave))
            {
                XtraMessageBox.Show(cli.Nombre + "\n Ya se encuentra en la lista del grupo", "Validando Datos", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            IQueryable <FinancieraGruposDetalle> detgrupo =
                _entidades.FinancieraGruposDetalles.Where(
                    dg => dg.CveCliente == cli.Clave && dg.CveGrupo != Convert.ToInt32(txtCveGrupo.EditValue));

            if (detgrupo.Any())
            {
                if (Enumerable.Any(detgrupo, det => det.FinancieraGrupo.Estado != "INACTIVO"))
                {
                    XtraMessageBox.Show(cli.Nombre + "\n Ya es parte de un grupo  no puede agregarlo en este", "Validando Datos", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
                if (Enumerable.Any(detgrupo, det => det.FinancieraGrupo.Estado == "INACTIVO"))
                {
                    if (
                        XtraMessageBox.Show(
                            cli.Nombre +
                            "\n Ya es parte de un grupo desea incluirlo en este\nSe Borrara Automaticamente del grupo Anterior",
                            "Validando Datos", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        _entidades.FinancieraGruposDetalles.DeleteOnSubmit(detgrupo.Single(d => d.CveCliente == cli.Clave));
                    }
                    else
                    {
                        return;
                    }
                }
            }
            dtIntegrantesGrupo.Rows.Add(new object[] { cli.Clave, cli.Nombre, 0, 0, 0 });
        }