public FrmInicio()
        {
            String mensaje = NConexion.ChequearConexion();

            if (mensaje == "Y")
            {
                InitializeComponent();
                Iniciar();
            }
            else
            {
                MessageBox.Show("El Sistema de Gestión no se puede iniciar ya que existió un error al conectarse con la Base de Datos. " + mensaje,
                                "Error al iniciar el Sistema de Gestión", MessageBoxButtons.OK, MessageBoxIcon.Error);
                this.Dispose();
            }
        }
        private void LoadDataMatrix()
        {
            SAPbouiCOM.DBDataSource oDBDataSource = oForm.DataSources.DBDataSources.Item("@Z_COMI_COMGRP");
            oDBDataSource.Query();
            oDBDataSource.InsertRecord(oDBDataSource.Size);

            //MatrixExtensions.AddLineMatrixDBDataSource(Matrix0, oDBDataSource);

            int nProxCode = UDOExtensions.GetNextCode("Z_COMI_COMGRP", NConexion.Verifica_Conexion(Program.oCompany));

            oDBDataSource.SetValue("Code", oDBDataSource.Size - 1, nProxCode.ToString());
            oDBDataSource.SetValue("DocEntry", oDBDataSource.Size - 1, nProxCode.ToString());

            Matrix0.LoadFromDataSource();
            Matrix0.CommonSetting.SetCellEditable(oDBDataSource.Size, 3, true);
            MatrixExtensions.SelectMatrixRowSetFocus(ref Matrix0, "Col_2", oDBDataSource.Size);
        }
Esempio n. 3
0
        private void FrmAcceso_Load(object sender, EventArgs e)
        {
            navAcceso.Visible   = false;
            cboSociedad.Enabled = false;
            cboSociedad.Properties.Buttons[0].Visible        = false;
            txtPasword.Properties.Buttons[1].Visible         = false;
            txtPaswordSociedad.Properties.Buttons[1].Visible = false;
            string nombreSkin = ConfigurationManager.AppSettings.Get("NombreSkin");

            if (!string.IsNullOrWhiteSpace(nombreSkin))
            {
                pnlFondo.LookAndFeel.UseDefaultLookAndFeel = false;
                string nombreSkinPaleta = ConfigurationManager.AppSettings.Get("NombreSkinPaleta");
                if (!string.IsNullOrWhiteSpace(nombreSkinPaleta))
                {
                    UserLookAndFeel.Default.SetSkinStyle(nombreSkin, nombreSkinPaleta);
                }
                else
                {
                    UserLookAndFeel.Default.SetSkinStyle(nombreSkin);
                }
                pnlFondo.LookAndFeel.SkinName = UserLookAndFeel.Default.SkinName;
            }

            string idSucursal = ConfigurationManager.AppSettings["IdSucursal"].ToString();

            bool.TryParse(ConfigurationManager.AppSettings.Get("ActivarLogin"), out bool activarLogin);
            bool.TryParse(ConfigurationManager.AppSettings.Get("CambiarSociedad"), out bool cambiarSociedad);
            btnCambiarSociedad.Enabled = cambiarSociedad;

            NConexion objNConexion   = new NConexion();
            bool      conexionValida = objNConexion.ChecarConexion();

            if (conexionValida == true)
            {
                if (activarLogin == false)
                {
                    DialogResult = DialogResult.OK;
                }

                bool sociedadEstablecida = EstablecerSociedad(cboSociedad);
                if (sociedadEstablecida == false)
                {
                    cboSociedad.Properties.NullText = "[Predeterminado]";
                }

                ObtenerSucursales(cboSucursal);

                if (!string.IsNullOrWhiteSpace(idSucursal) & cboSucursal.Properties.DataSource != null)
                {
                    cboSucursal.EditValue = idSucursal;
                    if (string.IsNullOrWhiteSpace(cboSucursal.Text) | cboSucursal.Text == "[Elegir]")
                    {
                        cboSucursal.EditValue = null;
                    }
                }
            }
            else
            {
                string cnnSociedad = ConfigurationManager.ConnectionStrings["cnnSociedad"].ToString();
                if (!string.IsNullOrWhiteSpace(cnnSociedad) == true)
                {
                    cboSociedad.Properties.NullText = string.Empty;
                    cboSucursal.Properties.NullText = string.Empty;
                    cboSucursal.Enabled             = false;
                    txtUsuario.Enabled = false;
                    txtPasword.Enabled = false;
                    txtPasword.Properties.Buttons[0].Visible = false;
                    btnOk.Enabled = false;
                    btnCambiarSociedad.Enabled = false;
                }
                else
                {
                    navAcceso.SelectedPageIndex = 2;
                    ObtenerSkins();
                    ObtenerSociedades(cboSociedadParam);
                }
            }
            navAcceso.Visible = true;
        }