Boolean GuardarDatos() { try { Boolean bolResult = true; tb_Sucursal_Bus bus_sucursal = new tb_Sucursal_Bus(); string msg = ""; int id = 0; if (validarDatos()) { get_Sucursal(); switch (_Accion) { case Cl_Enumeradores.eTipo_action.grabar: //if (bus_sucursal.ValidarCodigoExiste(param.IdEmpresa, info.Su_Ruc, info.Su_CodigoEstablecimiento) != false) //{ if (bus_sucursal.GrabarDB(info, ref id, ref msg)) { this.lbl_id_sucursal.Text = id.ToString(); //this.lbl_title_id_sucursal.Visible = true; //this.lbl_id_sucursal.Visible = true; MessageBox.Show(msg, "SISTEMA", MessageBoxButtons.OK, MessageBoxIcon.Information); //ucGe_Menu.Visible_bntGuardar_y_Salir = false; //ucGe_Menu.Visible_btnGuardar = false; LimpiarDatos(); bolResult = true; } else { this.lbl_title_id_sucursal.Visible = false; this.lbl_id_sucursal.Visible = false; bolResult = false; MessageBox.Show(msg, "SISTEMA", MessageBoxButtons.OK, MessageBoxIcon.Error); } this.txt_vendedor.Enabled = true; this.chk_estado.Enabled = true; //} //else //{ // MessageBox.Show("El codigo Ingresado Ya existe \nPor favor ingrese uno diferente"); // bolResult = false; //} break; case Cl_Enumeradores.eTipo_action.actualizar: if (bus_sucursal.ModificarDB(info, ref msg)) { MessageBox.Show(msg, "SISTEMA", MessageBoxButtons.OK, MessageBoxIcon.Information); //ucGe_Menu.Visible_bntGuardar_y_Salir = false; //ucGe_Menu.Visible_btnGuardar = false; LimpiarDatos(); bolResult = true; } else { bolResult = false; MessageBox.Show(msg, "SISTEMA", MessageBoxButtons.OK, MessageBoxIcon.Error); } this.txt_vendedor.Enabled = false; this.chk_estado.Enabled = false; break; } } else { bolResult = false; } return(bolResult); } catch (Exception ex) { Log_Error_bus.Log_Error(ex.ToString()); MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } }