Esempio n. 1
0
        private void txt_ci_ruc_Validating(object sender, CancelEventArgs e)
        {
            try
            {
                fa_Vendedor_Bus  vendedor_bus = new fa_Vendedor_Bus();
                fa_Vendedor_Info info_ven     = new fa_Vendedor_Info();
                fa_Vendedor_Bus  busvend2     = new fa_Vendedor_Bus();
                bool             bandVend     = true;
                if (_Accion == Cl_Enumeradores.eTipo_action.grabar)
                {
                    if (PersoB.VericarCedulaExiste(txt_ci_ruc.Text.Trim(), ref mensaje) == true)
                    {
                        persoI             = PersoB.Get_Info_Persona(txt_ci_ruc.Text.Trim());
                        info_ven           = new fa_Vendedor_Info();
                        info_ven.IdEmpresa = param.IdEmpresa;
                        info_ven.ve_cedula = txt_ci_ruc.Text;
                        txt_vendedor.Text  = persoI.pe_nombreCompleto;
                        bandVend           = busvend2.VerificaSiExisteVendedor(info_ven, ref msg);
                        if (bandVend)
                        {
                            info_ven             = busvend2.ConsultarVendedorPorCedula(param.IdEmpresa, txt_ci_ruc.Text);
                            lbl_id_vendedor.Text = info_ven.IdVendedor.ToString();
                            txt_vendedor.Text    = info_ven.Ve_Vendedor;

                            idemp = param.IdEmpresa;
                            id    = info_ven.IdVendedor;
                            set_Lista_Sucursales();

                            _Accion = Cl_Enumeradores.eTipo_action.actualizar;
                            ucGe_Menu.Visible_bntGuardar_y_Salir = true;
                            ucGe_Menu.Visible_btnGuardar         = true;
                        }
                    }
                    else
                    {
                        string msg = "";
                        info_ven                 = new fa_Vendedor_Info();
                        info_ven.IdEmpresa       = param.IdEmpresa;
                        info_ven.IdVendedor      = (this.lbl_id_vendedor.Text == "") ? 0 : Convert.ToInt32(this.lbl_id_vendedor.Text);
                        info_ven.Ve_Vendedor     = this.txt_vendedor.Text;
                        info_ven.ve_cedula       = txt_ci_ruc.Text;
                        info_ven.Estado          = (chk_estado.Checked == true) ? "A" : "I";
                        info_ven.IdUsuario       = param.IdUsuario;
                        info_ven.Fecha_Transac   = DateTime.Now;
                        info_ven.IdUsuarioUltAnu = param.IdUsuario;
                        info_ven.Fecha_UltAnu    = DateTime.Now;
                        info_ven.IdUsuarioUltMod = param.IdUsuario;
                        info_ven.Fecha_UltMod    = DateTime.Now;
                        info_ven.nom_pc          = param.nom_pc;
                        info_ven.ip              = param.ip;
                        bandVend                 = busvend2.VerificaSiExisteVendedor(info_ven, ref msg);

                        if (bandVend == false)
                        {
                            txt_vendedor.Text = "";
                        }
                        else
                        {
                            info_ven             = busvend2.ConsultarVendedorPorCedula(param.IdEmpresa, txt_ci_ruc.Text);
                            lbl_id_vendedor.Text = info_ven.IdVendedor.ToString();
                            txt_vendedor.Text    = info_ven.Ve_Vendedor;

                            _Accion = Cl_Enumeradores.eTipo_action.actualizar;
                            ucGe_Menu.Visible_bntGuardar_y_Salir = true;
                            ucGe_Menu.Visible_btnGuardar         = true;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Log_Error_bus.Log_Error(ex.ToString());
                MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }