Ejemplo n.º 1
0
        public Boolean MergeDB(fa_Cliente_Info info_Cliente)
        {
            try
            {
                Boolean result = false;
                result = AnularDB(info_Cliente.IdEmpresa, info_Cliente.IdCliente);
                foreach (var item in info_Cliente.list_punto_emision_x_cliente)
                {
                    item.IdEmpresa = info_Cliente.IdEmpresa;
                    item.IdCliente = info_Cliente.IdCliente;

                    if (item.IdPuntoEmision == 0)
                    {
                        result = GuardarDB(item);
                    }
                    else
                    {
                        result = ModificarDB(item);
                    }
                }
                return(result);
            }
            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("", "MergeDB", ex.Message), ex)
                      {
                          EntityType = typeof(fa_cliente_pto_emision_cliente_Bus)
                      };
            }
        }
 private void cmb_cliente_event_cmb_cliente_EditValueChanged(object sender, EventArgs e)
 {
     try
     {
         fa_Cliente_Info cliente = cmb_cliente.get_ClienteInfo();
         lst_contacto = new List <fa_cliente_contactos_Info>();
         if (cliente != null && cliente.IdEmpresa != 0 && cmb_punto_venta.EditValue != null)
         {
             ucFa_FormaPago_x_Factura.set_forma_pago(cliente.FormaPago);
             cmb_termino_pago.EditValue = cliente.IdTipoCredito;
             fa_PuntoVta_Info row_punto_venta = lst_punto_venta.FirstOrDefault(q => q.IdPuntoVta == Convert.ToDecimal(cmb_punto_venta.EditValue));
             blst_det     = new BindingList <fa_proforma_det_Info>(bus_proforma_det.get_list_para_facturar(param.IdEmpresa, row_punto_venta.IdSucursal, Convert.ToInt32(row_punto_venta.IdBodega), cliente.IdCliente));
             lst_contacto = bus_contacto.get_list(param.IdEmpresa, cliente.IdCliente);
             if (lst_contacto.Count != 0)
             {
                 cmb_contacto.EditValue = lst_contacto.First().IdContacto;
             }
         }
         else
         {
             blst_det = new BindingList <fa_proforma_det_Info>();
         }
         gridControl_detalle.DataSource     = blst_det;
         cmb_contacto.Properties.DataSource = lst_contacto;
     }
     catch (Exception ex)
     {
         Log_Error_bus.Log_Error(ex.ToString());
         MessageBox.Show(ex.ToString(), param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
        void LimpiarDatos()
        {
            try
            {
                info = new fa_Cliente_Info();
                info.Persona_Info           = new tb_persona_Info();
                info_persona                = new tb_persona_Info();
                _Accion                     = Cl_Enumeradores.eTipo_action.grabar;
                this.lbl_id_cliente.Text    = "";
                this.lbl_id_persona.Text    = "";
                id_persona                  = 0;
                this.txt_plazo.Text         = "";
                this.txt_cupo_asignado.Text = "";
                this.txt_razon_social.Text  = "";

                this.txt_apellidos.Text    = "";
                this.txt_nombres.Text      = "";
                this.txt_razon_social.Text = "";

                cmb_nivel_precio.EditValue = "1";
                this.txt_cedula.Text       = "";
                this.chk_Estado.Checked    = true;
            }
            catch (Exception ex)
            {
                Log_Error_bus.Log_Error(ex.ToString());
                MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Ejemplo n.º 4
0
        private void modificarToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                frmFa_Clientes_Mant frm     = new frmFa_Clientes_Mant();
                fa_Cliente_Info     Cliente = new fa_Cliente_Info();
                if (Lista_Clientes.Count > 0)
                {
                    Cliente = Lista_Clientes.First(var => var.IdCliente == Convert.ToDecimal(cmb_cliente.EditValue));
                    frm.set_Accion(Info.General.Cl_Enumeradores.eTipo_action.actualizar);
                }
                else
                {
                    frm.set_Accion(Info.General.Cl_Enumeradores.eTipo_action.grabar);
                }

                frm.set_Cliente(Cliente);
                frm.ShowDialog();
                frm.event_frmFA_Clientes_Mant_FormClosing += new frmFa_Clientes_Mant.Delegate_frmFA_Clientes_Mant_FormClosing(frm_event_frmFA_Clientes_Mant_FormClosing);
            }
            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());
            }
        }
Ejemplo n.º 5
0
        private void get_info_CentroCosto_x_Cliente()
        {
            try
            {
                if (cmbCliente.EditValue != null && cmbCliente.EditValue != "Vacio")
                {
                    Info_Cliente = listCliente.FirstOrDefault(v => v.IdCliente == Convert.ToDecimal(cmbCliente.EditValue));
                }

                Cl_x_cc_Info.IdCentroCosto_cc = Info_centro_costo.IdCentroCosto;
                Cl_x_cc_Info.IdEmpresa_cc     = Info_centro_costo.IdEmpresa;
                if (cmbCliente.EditValue != null)
                {
                    Cl_x_cc_Info.IdCliente_cli = Info_Cliente.IdCliente;
                    Cl_x_cc_Info.IdEmpresa_cli = Info_Cliente.IdEmpresa;
                    Cl_x_cc_Info.nom_Cliente   = Info_Cliente.Persona_Info.pe_razonSocial;
                }
                Cl_x_cc_Info.nom_Centro_costo = Info_centro_costo.Centro_costo;
                Cl_x_cc_Info.Observacion      = "";
            }
            catch (Exception ex)
            {
                string NameMetodo = System.Reflection.MethodBase.GetCurrentMethod().Name;
                NameMetodo = NameMetodo + " - " + ex.ToString();
                Log_Error_bus.Log_Error(NameMetodo + " - " + ex.ToString());
                MessageBox.Show(NameMetodo + " " + param.Get_Mensaje_sys(enum_Mensajes_sys.Error_comunicarse_con_sistemas)
                                , param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Ejemplo n.º 6
0
        public fa_Cliente_Info Get_Info_Cliente()
        {
            try
            {
                fa_Cliente_Info InfoCliente = new fa_Cliente_Info();


                if (cmb_beneficiario.EditValue != null && IdTipo_Persona == Cl_Enumeradores.eTipoPersona.CLIENTE)
                {
                    Info_Beneficiario = list_Beneficiario.FirstOrDefault(v => v.IdBeneficiario == Convert.ToString(cmb_beneficiario.EditValue));
                    fa_Cliente_Bus BusProvee = new fa_Cliente_Bus();

                    InfoCliente = BusProvee.Get_Info_Cliente(param.IdEmpresa, Info_Beneficiario.IdEntidad);
                }



                return(InfoCliente);
            }
            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(new fa_Cliente_Info());
            }
        }
Ejemplo n.º 7
0
        public fa_Cliente_Info Get_info_cliente_x_codigo_para_saldo_inicial(int IdEmpresa, string cod_cliente, ref string mensajeError)
        {
            try
            {
                fa_Cliente_Info info = new fa_Cliente_Info();

                using (EntitiesFacturacion Context = new EntitiesFacturacion())
                {
                    var lst = from q in Context.vwfa_cliente
                              where q.Codigo == cod_cliente &&
                              q.IdEmpresa == IdEmpresa
                              select q;

                    foreach (var item in lst)
                    {
                        info.IdEmpresa     = item.IdEmpresa;
                        info.IdCliente     = item.IdCliente;
                        info.Codigo        = item.Codigo;
                        info.IdCtaCble_cxc = item.IdCtaCble_cxc;
                        info.Persona_Info.pe_nombreCompleto = item.pe_nombreCompleto;
                    }
                }
                return(info);
            }
            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);
                mensaje = ex.ToString();
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
                throw new Exception(ex.ToString());
            }
        }
        private void txt_cedula_Leave(object sender, EventArgs e)
        {
            try
            {
                tb_persona_Info select = bus_persona.Get_Info_Persona(txt_cedula.Text.TrimStart().TrimEnd());
                if (select != null && select.IdPersona != 0)
                {
                    id_persona = select.IdPersona;

                    fa_Cliente_Info select_id = bus_cliente.Get_info_Cliente_x_IdPersona(param.IdEmpresa, id_persona);

                    if (select_id != null && select_id.IdCliente != 0)
                    {
                        IdCliente_Registrado = true;
                        MessageBox.Show("Cliente ya existe en la Base de Datos", param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Error);

                        fa_Cliente_Info tmp = new fa_Cliente_Info();
                        tmp      = select_id;
                        info_tmp = new fa_Cliente_Info();
                        info_tmp = select_id;
                        set_Cliente(bus_cliente.Get_Info_Cliente(tmp.IdEmpresa, tmp.IdCliente));
                        set_Cliente_in_controls();

                        if (_Accion == Cl_Enumeradores.eTipo_action.grabar)
                        {
                            _Accion = Cl_Enumeradores.eTipo_action.actualizar;
                            {
                                ucGe_Menu.Visible_btnGuardar = true;;
                                txt_cedula.ReadOnly          = true;
                            }
                        }
                    }
                    else
                    {
                        IdCliente_Registrado = false;
                    }


                    this.lbl_id_persona.Text = Convert.ToString(select.IdPersona);
                    id_persona                 = select.IdPersona;
                    this.txt_nombres.Text      = Convert.ToString(select.pe_nombre);
                    this.txt_apellidos.Text    = Convert.ToString(select.pe_apellido);
                    this.chk_Estado.Checked    = (select.pe_estado == "A") ? true : false;
                    this.txt_razon_social.Text = Convert.ToString(select.pe_razonSocial);
                }
                else
                {
                    id_persona = 0;
                    this.txt_nombres.Focus();
                }
            }
            catch (Exception ex)
            {
                Log_Error_bus.Log_Error(ex.ToString());
                MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Ejemplo n.º 9
0
        private void Preparar_Formulario(Cl_Enumeradores.eTipo_action iAccion)
        {
            try
            {
                string mensajeFrm = "";
                Info_Cliente = new fa_Cliente_Info();

                switch (iAccion)
                {
                case Cl_Enumeradores.eTipo_action.grabar:
                    mensajeFrm = "REGISTRO NUEVO";
                    break;

                case Cl_Enumeradores.eTipo_action.actualizar:
                    mensajeFrm   = "MODIFICAR REGISTRO";
                    Info_Cliente = (fa_Cliente_Info)gridView_Clientes.GetFocusedRow();
                    break;

                case Cl_Enumeradores.eTipo_action.Anular:
                    mensajeFrm   = "ANULAR REGISTRO";
                    Info_Cliente = (fa_Cliente_Info)gridView_Clientes.GetFocusedRow();
                    break;

                case Cl_Enumeradores.eTipo_action.consultar:
                    mensajeFrm   = "CONSULTAR REGISTRO";
                    Info_Cliente = (fa_Cliente_Info)gridView_Clientes.GetFocusedRow();
                    break;

                default:
                    break;
                }

                if (Info_Cliente != null)
                {
                    frm      = new frmFa_Clientes_Mant();
                    frm.Text = frm.Text + "***" + mensajeFrm + "***";
                    frm.set_Accion(iAccion);
                    frm.MdiParent = this.MdiParent;
                    frm.set_Cliente(Info_Cliente);
                    frm.Show();

                    frm.event_frmFA_Clientes_Mant_FormClosing += frm_event_frmFA_Clientes_Mant_FormClosing;
                }
                else
                {
                    MessageBox.Show("Seleccione un Registro ", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return;
                }
            }
            catch (Exception ex)
            {
                Log_Error_bus.Log_Error(ex.ToString());
                MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Ejemplo n.º 10
0
 public void Set_Info_Cliente(fa_Cliente_Info _InfoCliente)
 {
     try
     {
         InfoCliente = _InfoCliente;
     }
     catch (Exception ex)
     {
         Log_Error_bus.Log_Error(ex.ToString());
         MessageBox.Show("Error comunicarse con Sistemas " + ex.Message + " ", param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Ejemplo n.º 11
0
        public Boolean GrabarDB(fa_Cliente_Info info, ref decimal IdPersona, ref decimal id, ref string msg)
        {
            try
            {
                Boolean Result = true;

                if (!bus_persona.VericarCedulaExiste(info.Persona_Info.pe_cedulaRuc, ref msg))
                {
                    Result         = bus_persona.GrabarDB(info.Persona_Info, ref IdPersona, ref msg);
                    info.IdPersona = IdPersona;
                }
                else
                {
                    Result         = bus_persona.ModificarDB(info.Persona_Info, ref msg);
                    info.IdPersona = info.Persona_Info.IdPersona;
                }

                if (Result)
                {
                    Result = data.GrabarDB(info, ref id, ref msg);
                    // si se grabo el cliente
                    if (Result == true)
                    {
                        if (info.Persona_Info.list_direcciones_x_persona.Count() > 0)
                        {
                            tb_persona_direccion_Bus bus_direccion_x_persona = new tb_persona_direccion_Bus();
                            bus_direccion_x_persona.GuardarDB(info.Persona_Info.list_direcciones_x_persona, info.IdPersona, ref msg);
                        }

                        if (info.list_contactos_x_cliente.Count() > 0)
                        {
                            fa_cliente_contactos_Bus BusClie_conta = new fa_cliente_contactos_Bus();
                            BusClie_conta.GuardarDB(info.list_contactos_x_cliente, ref msg);
                        }
                        if (info.list_punto_emision_x_cliente.Count > 0)
                        {
                            fa_cliente_pto_emision_cliente_Bus bus_Punto_emision = new fa_cliente_pto_emision_cliente_Bus();
                            bus_Punto_emision.MergeDB(info);
                        }
                    }
                }
                return(Result);
            }
            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("", "GrabarDB", ex.Message), ex)
                      {
                          EntityType = typeof(fa_catalogo_tipo_Bus)
                      };
            }
        }
 public void set_Cliente(fa_Cliente_Info obj)
 {
     try
     {
         info = new fa_Cliente_Info();
         info = obj;
     }
     catch (Exception ex)
     {
         Log_Error_bus.Log_Error(ex.ToString());
         MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Ejemplo n.º 13
0
 void UCFa_ClienteCmb_event_cmb_cliente_EditValueChanged(object sender, EventArgs e)
 {
     try
     {
         if (cmb_cliente.EditValue != null)
         {
             InfoCliente = listCliente.FirstOrDefault(w => w.IdCliente == Convert.ToDecimal(cmb_cliente.EditValue) && w.IdEmpresa == param.IdEmpresa);
         }
     }
     catch (Exception ex)
     {
     }
 }
Ejemplo n.º 14
0
 private void gridView_Clientes_RowClick(object sender, DevExpress.XtraGrid.Views.Grid.RowClickEventArgs e)
 {
     try
     {
         Info_Cliente = new fa_Cliente_Info();
         Info_Cliente = GetSelectedRow((DevExpress.XtraGrid.Views.Grid.GridView)sender);
     }
     catch (Exception ex)
     {
         Log_Error_bus.Log_Error(ex.ToString());
         MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Ejemplo n.º 15
0
        public Boolean GrabarDB(fa_Cliente_Info info, ref decimal IdPersona, ref decimal id, ref string msg)
        {
            try
            {
                Boolean Result = true;

                if (!bus_persona.VericarCedulaExiste(info.Persona_Info.pe_cedulaRuc, ref msg))
                {
                    Result         = bus_persona.GrabarDB(info.Persona_Info, ref IdPersona, ref msg);
                    info.IdPersona = IdPersona;
                }
                else
                {
                    decimal idper = bus_persona.Get_Info_Persona(info.Persona_Info.pe_cedulaRuc).IdPersona;
                    info.Persona_Info.IdPersona = idper;
                    Result         = bus_persona.ModificarDB(info.Persona_Info, ref msg);
                    info.IdPersona = info.Persona_Info.IdPersona;
                }

                if (Result)
                {
                    Result = data.GrabarDB(info, ref id, ref msg);
                    // si se grabo el cliente
                    if (Result == true)
                    {
                        if (info.Persona_Info.list_direcciones_x_persona.Count() > 0)
                        {
                            tb_persona_direccion_Bus bus_direccion_x_persona = new tb_persona_direccion_Bus();
                            bus_direccion_x_persona.GuardarDB(info.Persona_Info.list_direcciones_x_persona, info.IdPersona, ref msg);
                        }
                    }
                }

                if (Result)
                {
                    info.listaContactos.ForEach(q => { q.IdEmpresa = info.IdEmpresa; q.IdCliente = info.IdCliente; });
                    bus_cliente_contaco.GuardarDB(info.listaContactos);
                }
                return(Result);
            }
            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("", "GrabarDB", ex.Message), ex)
                      {
                          EntityType = typeof(fa_catalogo_tipo_Bus)
                      };
            }
        }
Ejemplo n.º 16
0
        public void set_Cliente(fa_Cliente_Info obj)
        {
            try
            {
                info = new fa_Cliente_Info();
                lbl_id_cliente.Text    = obj.IdCliente.ToString();
                lbl_id_persona.Text    = obj.IdPersona.ToString();
                txt_nombres.Text       = obj.Persona_Info.pe_nombre.Trim();
                txt_apellidos.Text     = obj.Persona_Info.pe_apellido.Trim();
                txt_cedula.Text        = obj.Persona_Info.pe_cedulaRuc.Trim();
                txt_direccion.Text     = obj.Persona_Info.pe_direccion.Trim();
                chk_Estado.Checked     = (obj.Estado == "A") ? true : false;
                txt_razon_social.Text  = obj.Persona_Info.pe_razonSocial.Trim();   //55
                txt_telefono_ofic.Text = obj.Persona_Info.pe_telefonoOfic.Trim();
                txtcorreo.Text         = info.cl_Mail_Garante;
                ucGe_Sucursal_combo1.set_SucursalInfo(obj.IdSucursal);
                cmb_Tipo.EditValue   = obj.Idtipo_cliente;
                txtcorreo.Text       = obj.cl_Mail_Rep_Legal;
                txt_observacion.Text = obj.cl_observacion;

                txt_casilla.Text = obj.cl_casilla;
                txt_fax.Text     = obj.cl_fax;

                ucGe_PaisProvinciaCiudad.set_InfoPais(obj.IdPais);
                ucGe_PaisProvinciaCiudad.set_InfoProvincia(obj.IdProvincia);
                ucGe_PaisProvinciaCiudad.set_InfoCiudad(obj.IdCiudad);

                cmb_actividad_economica.EditValue = "ACTCOMCL_001";
                UC_Doc_per.set_TipoDoc_Personales(obj.Persona_Info.IdTipoDocumento);
                if (obj.Persona_Info.IdTipoDocumento == "CED" || obj.Persona_Info.IdTipoDocumento == "PAS")
                {
                    cmbSexo.Visible          = true;
                    CmbEstadoCivil.Visible   = true;
                    cmbSexo.EditValue        = obj.Persona_Info.pe_sexo;
                    CmbEstadoCivil.EditValue = obj.Persona_Info.IdEstadoCivil;
                }
                else
                {
                    cmbSexo.Visible        = false;
                    CmbEstadoCivil.Visible = false;
                }
                txtcorreo.Text = obj.Mail_Principal;
                info           = obj;
            }
            catch (Exception ex)
            {
                Log_Error_bus.Log_Error(ex.ToString());
            }
        }
Ejemplo n.º 17
0
        private List <fa_Cliente_Tabla_Info> Grid_Cliente(int sucursal)
        {
            try
            {
                List <fa_Cliente_Tabla_Info> lm = new List <fa_Cliente_Tabla_Info>();
                fa_Cliente_Info info_cliente    = new fa_Cliente_Info();

                return(lm);
            }
            catch (Exception ex)
            {
                Log_Error_bus.Log_Error(ex.ToString());
                return(new List <fa_Cliente_Tabla_Info>());
            }
        }
Ejemplo n.º 18
0
 public Boolean ConsultarClienteVendedor(int IdEmpresa, ref fa_Cliente_Info Cliente, ref fa_Vendedor_Info Vendedor)
 {
     try
     {
         return(data.ConsultarClienteVendedor(IdEmpresa, ref Cliente, ref Vendedor));
     }
     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("", "ConsultarClienteVendedor", ex.Message), ex)
               {
                   EntityType = typeof(fa_catalogo_tipo_Bus)
               };
     }
 }
Ejemplo n.º 19
0
 public fa_Cliente_Info get_ClienteInfo()
 {
     try
     {
         InfoCliente = new fa_Cliente_Info();
         if (cmb_cliente.EditValue != null)
         {
             InfoCliente = listCliente.FirstOrDefault(v => v.IdCliente == Convert.ToInt32(cmb_cliente.EditValue));
         }
         return(InfoCliente);
     }
     catch (Exception ex)
     {
         return(new fa_Cliente_Info());
     }
 }
Ejemplo n.º 20
0
 public fa_Cliente_Info Get_Info_Cliente(int Idempresa, decimal IdCliente)
 {
     try
     {
         fa_Cliente_Info info = new fa_Cliente_Info();
         info = data.Get_Info_Cliente(Idempresa, IdCliente);
         return(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("", "Get_Info_Cliente", ex.Message), ex)
               {
                   EntityType = typeof(fa_catalogo_tipo_Bus)
               };
     }
 }
Ejemplo n.º 21
0
        public Boolean ModificarDB(fa_Cliente_Info info, ref string msg)
        {
            try
            {
                Boolean respuesta = false;
                respuesta = bus_persona.ModificarDB(info.Persona_Info, ref msg);

                if (respuesta)
                {
                    //modificacion datos cliente
                    respuesta = data.ModificarDB(info, ref msg);

                    if (respuesta == true)
                    {
                        if (info.Persona_Info.list_direcciones_x_persona.Count() > 0)
                        {
                            tb_persona_direccion_Bus bus_direccion_x_persona = new tb_persona_direccion_Bus();
                            bus_direccion_x_persona.EliminarDB(info.IdPersona, ref msg);
                            bus_direccion_x_persona.GuardarDB(info.Persona_Info.list_direcciones_x_persona, info.IdPersona, ref msg);
                        }

                        if (info.list_contactos_x_cliente.Count() > 0)
                        {
                            fa_cliente_contactos_Bus BusClie_conta = new fa_cliente_contactos_Bus();
                            BusClie_conta.EliminarDB(info.IdEmpresa, info.IdCliente, ref msg);
                            BusClie_conta.GuardarDB(info.list_contactos_x_cliente, ref msg);
                        }
                        if (info.list_punto_emision_x_cliente.Count > 0)
                        {
                            fa_cliente_pto_emision_cliente_Bus bus_Punto_emision = new fa_cliente_pto_emision_cliente_Bus();
                            bus_Punto_emision.MergeDB(info);
                        }
                    }
                }
                return(respuesta);
            }
            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(fa_catalogo_tipo_Bus)
                      };
            }
        }
Ejemplo n.º 22
0
 private void cmbCliente_EditValueChanged(object sender, EventArgs e)
 {
     try
     {
         Info = new fa_Cliente_Info();
         Info = (fa_Cliente_Info)cmbCliente.Properties.View.GetFocusedRow();
         this.txt_Ruc.Text       = Info.Persona_Info.pe_cedulaRuc;
         this.txt_Direccion.Text = Info.Persona_Info.pe_direccion;
         this.txt_Telefonos.Text = Info.Persona_Info.pe_telefonoOfic;
         this.Event_cmbCliente_EditValueChanged(sender, e);
     }
     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());
     }
 }
Ejemplo n.º 23
0
 private void limpiarFj()
 {
     try
     {
         txt_codigo.Text    = string.Empty;
         txt_nombre.Text    = string.Empty;
         txt_nombre.Enabled = true;
         Info_Cliente       = new fa_Cliente_Info();
     }
     catch (Exception ex)
     {
         string NameMetodo = System.Reflection.MethodBase.GetCurrentMethod().Name;
         NameMetodo = NameMetodo + " - " + ex.ToString();
         Log_Error_bus.Log_Error(NameMetodo + " - " + ex.ToString());
         MessageBox.Show(NameMetodo + " " + param.Get_Mensaje_sys(enum_Mensajes_sys.Error_comunicarse_con_sistemas)
                         , param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
        private void cmb_Cliente_EditValueChanged(object sender, EventArgs e)
        {
            try
            {
                if (cmb_Cliente.EditValue != null)
                {
                    decimal idCliente = Convert.ToDecimal(cmb_Cliente.EditValue);
                    info_Cliente = bus_Cliente.Get_Info_Cliente(param.IdEmpresa, idCliente);
                    info_Cliente_x_centro_costo = list_Cliente_x_Centro_costo.FirstOrDefault(q => q.IdEmpresa_cli == info_Cliente.IdEmpresa && q.IdCliente_cli == idCliente);
                }
                else
                {
                    info_Cliente = null;
                    info_Cliente_x_centro_costo = null;
                }

                if (foco_Cliente)
                {
                    if (cmb_Cliente.EditValue != null)
                    {
                        if (info_Cliente_x_centro_costo != null)
                        {
                            cmb_Centro_costo.EditValue = info_Cliente_x_centro_costo.IdCentroCosto_cc;
                        }
                        else
                        {
                            cmb_Centro_costo.EditValue = null;
                        }
                    }
                    else
                    {
                        cmb_Centro_costo.EditValue = null;
                    }
                }
                event_delegate_cmb_Cliente_EditValueChanged(sender, e);
            }
            catch (Exception ex)
            {
                string NameMetodo = System.Reflection.MethodBase.GetCurrentMethod().Name;
                MessageBox.Show(param.Get_Mensaje_sys(enum_Mensajes_sys.Error_comunicarse_con_sistemas) + ex.Message + " ", param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Error);
                Log_Error_bus.Log_Error(NameMetodo + " - " + ex.ToString());
            }
        }
Ejemplo n.º 25
0
        public Boolean EliminarDB(fa_Cliente_Info info, ref string msg)
        {
            try
            {
                EntitiesFacturacion OEPTipoNota = new EntitiesFacturacion();
                var select = from q in OEPTipoNota.fa_cliente
                             where q.IdEmpresa == info.IdEmpresa && q.IdCliente == info.IdCliente
                             select q;

                if (select.ToList().Count > 0)
                {
                    using (EntitiesFacturacion context = new EntitiesFacturacion())
                    {
                        var contact = context.fa_cliente.FirstOrDefault(obj => obj.IdEmpresa == info.IdEmpresa && obj.IdCliente == info.IdCliente);
                        if (contact != null)
                        {
                            contact.IdUsuarioUltAnu = info.IdUsuarioUltAnu;
                            contact.Fecha_UltAnu    = info.Fecha_UltAnu;
                            contact.Estado          = "I";
                            context.SaveChanges();
                            msg = "Se ha procedido anular el registro del Cliente #: " + info.IdCliente.ToString() + " exitosamente";
                        }
                    }
                    return(true);
                }
                else
                {
                    msg = "No es posible anular el registro del Cliente #: " + info.IdCliente.ToString() + " debido a que ya se encuentra anulado.";
                    return(false);
                }
            }
            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);
                msg = ex.ToString();
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref msg);
                throw new Exception(ex.ToString());
            }
        }
Ejemplo n.º 26
0
 public fa_Cliente_Info Get_info_Cliente_x_IdPersona(int Idempresa, decimal IdPersona)
 {
     try
     {
         fa_Cliente_Info info = new fa_Cliente_Info();
         info = data.Get_Info_Cliente_x_IdPersona(Idempresa, IdPersona);
         if (info != null)
         {
             info.list_punto_emision_x_cliente = bus_Punto_emision.Get_List(info.IdEmpresa, info.IdCliente);
         }
         return(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("", "Get_info_Cliente_x_IdPersona", ex.Message), ex)
               {
                   EntityType = typeof(fa_catalogo_tipo_Bus)
               };
     }
 }
Ejemplo n.º 27
0
 private void cmb_cliente_EditValueChanged(object sender, EventArgs e)
 {
     try
     {
         fa_Cliente_Info Cliente = new fa_Cliente_Info();
         Cliente = Lista_Clientes.FirstOrDefault(var => var.IdCliente == Convert.ToDecimal((cmb_cliente.EditValue == null) ? 0 : cmb_cliente.EditValue));
         if (Cliente != null)
         {
             this.txt_Ruc.Text       = Cliente.Persona_Info.pe_cedulaRuc;
             this.txt_Direccion.Text = Cliente.Persona_Info.pe_direccion;
             this.txt_Telefonos.Text = Cliente.Persona_Info.pe_telefonoOfic;
             Event_cmb_cliente_EditValueChanged(new object(), new EventArgs());
         }
     }
     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());
     }
 }
        private void cmb_cliente_event_cmb_cliente_EditValueChanged(object sender, EventArgs e)
        {
            try
            {
                fa_Cliente_Info cliente = cmb_cliente.get_ClienteInfo();

                if (cliente != null && cliente.IdEmpresa != 0)
                {
                    cmb_termino_pago.EditValue = cliente.IdTipoCredito;
                    txt_atencion_a.Text        = cliente.Persona_Info.pe_nombreCompleto;
                }
            }
            catch (Exception ex)
            {
                string NameMetodo = System.Reflection.MethodBase.GetCurrentMethod().Name;
                NameMetodo = NameMetodo + " - " + ex.ToString();
                MessageBox.Show(NameMetodo + " " + param.Get_Mensaje_sys(enum_Mensajes_sys.Error_comunicarse_con_sistemas)
                                , param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Error);
                Log_Error_bus.Log_Error(NameMetodo + " - " + ex.ToString());
            }
        }
Ejemplo n.º 29
0
 public void set_ClienteInfo(int IdEmpresa, decimal IdCliente)
 {
     try
     {
         InfoClient            = BusClient.Get_Info_Cliente(IdEmpresa, IdCliente);
         txtapellido.Text      = InfoClient.Persona_Info.pe_apellido;
         txtcentrcostant.Text  = InfoClient.IdCentroCosto_Anticipo;
         txtcentrocostcxc.Text = InfoClient.IdCentroCosto_CXC;
         txtcodigo.Text        = InfoClient.Codigo;
         txtctacbleant.Text    = InfoClient.IdCtaCble_Anti;
         txtctacblecxc.Text    = InfoClient.IdCtaCble_cxc;
         txtdireccion.Text     = InfoClient.Persona_Info.pe_direccion;
         txtdocumento.Text     = InfoClient.Persona_Info.pe_cedulaRuc;
         txtfax.Text           = InfoClient.cl_fax;
         txtidpersona.Text     = Convert.ToString(InfoClient.IdPersona);
         txtidcliente.Text     = Convert.ToString(InfoClient.IdCliente);
         txtmail.Text          = InfoClient.Mail_Principal;
         txtnomcliente.Text    = InfoClient.Nombre_Cliente;
         txtobservacion.Text   = InfoClient.cl_observacion;
         txtrazonsocial.Text   = InfoClient.Persona_Info.pe_razonSocial;
         txtsucursal.Text      = InfoClient.nomSucursal;
         txttelefono.Text      = InfoClient.Persona_Info.pe_telefonoCasa;
         txtubicacion.Text     = InfoClient.Ubicacion;
         txtdesc.Text          = Convert.ToString(InfoClient.cl_porcentaje_descuento);
         txtcredasig.Text      = Convert.ToString(InfoClient.cl_Cupo);
         txtcredmax.Text       = Convert.ToString(InfoClient.cl_plazo);
         if (InfoClient.Estado == "I")
         {
             lblAnulado.Visible = true;
         }
         else
         {
             lblAnulado.Visible = false;
         }
     }
     catch (Exception ex)
     {
         Log_Error_bus.Log_Error(ex.ToString());
     }
 }
Ejemplo n.º 30
0
        public Boolean EliminarDB(fa_Cliente_Info info, ref string msg)
        {
            try
            {
                fa_cliente_pto_emision_cliente_Bus bus_Punto_emision = new fa_cliente_pto_emision_cliente_Bus();
                Boolean result = false;

                if (data.EliminarDB(info, ref msg))
                {
                    result = bus_Punto_emision.AnularDB(info.IdEmpresa, info.IdCliente);
                }
                return(result);
            }
            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("", "EliminarDB", ex.Message), ex)
                      {
                          EntityType = typeof(fa_catalogo_tipo_Bus)
                      };
            }
        }