Пример #1
0
        private void FxModule(int pCounter)
        {
            long   lModuleId;
            string lExecutable;

            try
            {
                lModuleId   = long.Parse(ObjDtModule.Rows[pCounter][3].ToString());
                lExecutable = ClsVariables.gPathBin + ObjDtModule.Rows[pCounter][2].ToString();
            }
            catch
            {
                lModuleId   = 0;
                lExecutable = "";
            }

            if (lModuleId == 0)
            {
                ClsFunctions.FxMessage(1, "Módulo no ha sido seleccionado");
            }
            else
            {
                string lParameter = ClsFunctions.FxModuleParameters(lCompanyId, lModuleId);

                Hide();

                ClsFunctions.FxRunModule(lExecutable, lParameter);

                Show();
            }

            FxGetModule();
        }
Пример #2
0
        private void FxEnter()
        {
            Hide();

            ImgSplashScreen.Enabled = false;

            if (ClsVariables.gAuthentication == true)
            {
                FrmLogin ObjForm = new FrmLogin();

                ObjForm.ShowDialog();
            }
            else
            {
                string lUserName = ClsFunctions.FxGetWindowsUserName();

                long lUserId = ClsSql.Fx_sel_tblUser_check(lUserName);

                if (lUserId == 0)
                {
                    ClsFunctions.FxMessage(1, "Usuario no tiene permisos para ingresar");
                }
            }

            if (ClsVariables.gUserId > 0)
            {
                FrmMainMenu ObjForm = new FrmMainMenu();

                ObjForm.ShowDialog();
            }

            FxExit();
        }
Пример #3
0
        private void FxUpdateFiles()
        {
            string[] lFilesSource;

            try
            {
                lFilesSource = ClsFunctions.FxGetFilesFromPath(ClsVariables.gPathUpdate);
            }
            catch
            {
                lFilesSource = null;
            }

            if (lFilesSource != null)
            {
                foreach (string lFileSource in lFilesSource)
                {
                    string lFileName = ClsFunctions.FxGetFileName(lFileSource);

                    BgwProcess.ReportProgress(0, "Verificando " + lFileName + "...");

                    ClsFunctions.FxPause(0.1);

                    ClsFunctions.FxUpdateFile(lFileSource, ClsVariables.gPathBin);
                }
            }
        }
Пример #4
0
        private static SqlCommand FxSqlConnection(string pDatabase)
        {
            SqlConnection ObjSqlConnection = new SqlConnection();

            SqlCommand ObjSqlCommand = new SqlCommand();

            SqlConnectionStringBuilder ObjSqlConnectionString = FxSqlConnectionString(pDatabase);

            ObjSqlConnection.ConnectionString = ObjSqlConnectionString.ConnectionString;

            ObjSqlCommand.Connection = ObjSqlConnection;

            try
            {
                ObjSqlConnection.Open();
            }
            catch
            {
                ObjSqlCommand = null;

                ClsFunctions.FxMessage(1, "No pudo conectarse con el servidor");

                ClsFunctions.FxExit();
            }

            ObjSqlConnectionString.Clear();

            return(ObjSqlCommand);
        }
Пример #5
0
        private void FxCompleteWork()
        {
            if (lSettingIni == false)
            {
                FrmSettings ObjForm = new FrmSettings();

                ObjForm.ShowDialog();

                lSettingIni = ClsFunctions.FxGetSettingIni();

                if (lSettingIni == false)
                {
                    ClsFunctions.FxMessage(1, "No se ha realizado la configuración inicial");

                    FxExit();
                }
                else
                {
                    FxCancel();
                }
            }
            else
            {
                FxEnter();
            }
        }
Пример #6
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            Application.Run(new FrmSplashScreen());

            ClsFunctions.FxExit();
        }
Пример #7
0
        private void FxSave()
        {
            string lPassword = TxtPassword.Text.Trim();
            string lConfirm  = TxtConfirm.Text.Trim();

            if (lPassword.Length == 0 || lConfirm.Length == 0 || lPassword != lConfirm)
            {
                ClsFunctions.FxMessage(1, "Ingrese contraseña");

                TxtPassword.Text = "";
                TxtConfirm.Text  = "";

                TxtPassword.Focus();

                return;
            }

            bool lValidPassword = ClsFunctions.FxValidPassword(lPassword);

            if (lValidPassword == false)
            {
                TxtPassword.Text = "";
                TxtConfirm.Text  = "";

                TxtPassword.Focus();

                return;
            }

            if (ClsFunctions.FxMessage(2, "¿Está seguro de cambiar la contraseña?") == true)
            {
                long lUserId = ClsSql.Fx_upt_tblUser_password(ClsVariables.gUserId, lPassword);

                if (lUserId == 0)
                {
                    ClsFunctions.FxMessage(1, "Contraseña no fue cambiada. Intente de nuevo");

                    TxtPassword.Focus();
                }
                else
                {
                    ClsVariables.gPasswordChanged = true;

                    ClsFunctions.FxMessage("Proceso concluido");

                    Close();
                }
            }
        }
Пример #8
0
        internal static void FxExpirationAlert()
        {
            long lExpirationLeft = (ClsVariables.gUserExpirationDate - DateTime.Today).Days;

            if (lExpirationLeft <= ClsVariables.gPasswordAlert)
            {
                if (lExpirationLeft == 1)
                {
                    ClsFunctions.FxMessage("Falta " + lExpirationLeft.ToString() + " día para que su contraseña expire. Favor cambiar su contraseña pronto");
                }
                else
                {
                    ClsFunctions.FxMessage("Faltan " + lExpirationLeft.ToString() + " días para que su contraseña expire. Favor cambiar su contraseña pronto");
                }
            }
        }
Пример #9
0
        internal static DataTable FxSqlExecute(string pDatabase, string pSchema, string pStoredProcedure, object[][] pParameters)
        {
            DataTable ObjDt = new DataTable();

            using (SqlDataAdapter ObjSqlDa = new SqlDataAdapter())
            {
                using (SqlCommand ObjSqlCommand = FxSqlConnection(pDatabase))
                {
                    if (ObjSqlCommand != null)
                    {
                        if (pParameters[0] != null)
                        {
                            FxSqlParameters(ObjSqlCommand, pParameters);
                        }

                        ObjSqlCommand.CommandType = CommandType.StoredProcedure;

                        ObjSqlCommand.CommandText = pSchema + "." + pStoredProcedure;

                        ObjSqlDa.SelectCommand = ObjSqlCommand;

                        try
                        {
                            ObjSqlDa.Fill(ObjDt);
                        }
                        catch
                        {
                            ObjDt = null;

                            ClsFunctions.FxMessage(1, "Operación no fue completada");

                            ClsFunctions.FxExit();
                        }
                    }

                    if (ObjSqlCommand != null)
                    {
                        ObjSqlCommand.Connection.Close();
                    }
                }
            }

            return(ObjDt);
        }
Пример #10
0
        private void FxDoWork()
        {
            if (lSettingIni == false)
            {
                BgwProcess.ReportProgress(0, "Inicializando sistema...");

                ClsFunctions.FxPause(1);

                BgwProcess.ReportProgress(0, "Verificando directorios de trabajo...");

                ClsFunctions.FxPause(0.1);

                ClsFunctions.FxCreateWorkingPaths();

                BgwProcess.ReportProgress(0, "Obteniendo configuración inicial...");

                ClsFunctions.FxPause(0.1);

                lSettingIni = ClsFunctions.FxGetSettingIni();
            }

            if (lSettingIni == true)
            {
                BgwProcess.ReportProgress(0, "Obteniendo configuración...");

                ClsFunctions.FxPause(0.1);

                bool lSettings = ClsFunctions.FxGetSettings();

                if (lSettings == true)
                {
                    FxUpdateFiles();

                    BgwProcess.ReportProgress(0, "Bienvenido!!!");

                    ClsFunctions.FxPause(1);
                }
            }
        }
Пример #11
0
        private void FxCancel()
        {
            FxResize();

            Text = ClsVariables.gTitle;

            LblStatus.Text = ClsFunctions.FxStatusBar();

            ObjDtCompany = null;
            ObjDtModule  = null;

            lCompanyId = 0;

            PanModule.Controls.Clear();

            FxGetCompany();

            if (ObjDtCompany.Rows.Count > 0)
            {
                FxGetModule();
            }
        }
Пример #12
0
        private void FxSave()
        {
            string lServer = TxtServer.Text.Trim();

            if (lServer.Length == 0)
            {
                ClsFunctions.FxMessage(1, "Ingrese servidor");

                TxtServer.Text = "";

                TxtServer.Focus();

                return;
            }

            if (ClsFunctions.FxMessage(2, "¿Está seguro de guardar los cambios?") == true)
            {
                ClsFunctions.FxWriteJsonSettings(lServer);

                ClsFunctions.FxMessage("Proceso concluido");

                FxExit();
            }
        }
Пример #13
0
 private void TxtServer_Enter(object sender, EventArgs e)
 {
     ClsFunctions.FxSelectAll(sender);
 }
Пример #14
0
        private void FxCreateModules(int lTotal)
        {
            PanModule.Controls.Clear();

            SplitContainer[]  ObjModule           = new SplitContainer[lTotal];
            FlowLayoutPanel[] ObjModuleText       = new FlowLayoutPanel[lTotal];
            PictureBox[]      ObjImage            = new PictureBox[lTotal];
            Label[]           ObjLabelName        = new Label[lTotal];
            Label[]           ObjLabelDescription = new Label[lTotal];

            for (int lCounter = 0; lCounter < lTotal; lCounter++)
            {
                ObjModule[lCounter] = new SplitContainer
                {
                    IsSplitterFixed  = true,
                    Width            = 300,
                    Height           = 80,
                    SplitterDistance = 80,
                    TabStop          = false
                };

                ObjImage[lCounter] = new PictureBox
                {
                    Dock     = DockStyle.Fill,
                    SizeMode = PictureBoxSizeMode.Zoom,
                    Cursor   = Cursors.Hand,
                    //Image = Properties.Resources.Administrator,
                    Tag = lCounter.ToString()
                };

                long lModuleId = 0;

                try
                {
                    lModuleId = long.Parse(ObjDtModule.Rows[lCounter][3].ToString());
                }
                catch
                {
                    lModuleId = 0;
                }

                if (lModuleId > 0)
                {
                    Bitmap ObjLogo = ClsFunctions.FxGetModuleLogo(lModuleId);

                    if (ObjImage != null)
                    {
                        ObjImage[lCounter].Image = ObjLogo;
                    }
                }

                ObjModuleText[lCounter] = new FlowLayoutPanel
                {
                    Dock          = DockStyle.Fill,
                    FlowDirection = FlowDirection.TopDown,
                    WrapContents  = false
                };

                ObjLabelName[lCounter] = new Label
                {
                    AutoSize  = true,
                    Cursor    = Cursors.Hand,
                    Font      = new Font("Microsoft Sans Serif", 9.75F, FontStyle.Bold),
                    ForeColor = Color.FromArgb(76, 106, 169),
                    Text      = ObjDtModule.Rows[lCounter][0].ToString(),
                    Tag       = lCounter.ToString()
                };

                ObjLabelDescription[lCounter] = new Label
                {
                    AutoSize = true,
                    Cursor   = Cursors.Hand,
                    Text     = ObjDtModule.Rows[lCounter][1].ToString(),
                    Tag      = lCounter.ToString()
                };

                ObjImage[lCounter].Click += new EventHandler(ObjImage_Click);

                ObjLabelName[lCounter].Click        += new EventHandler(ObjLabel_Click);
                ObjLabelDescription[lCounter].Click += new EventHandler(ObjLabel_Click);

                ObjModuleText[lCounter].Controls.Add(ObjLabelName[lCounter]);
                ObjModuleText[lCounter].Controls.Add(ObjLabelDescription[lCounter]);

                ObjModule[lCounter].Panel1.Controls.Add(ObjImage[lCounter]);
                ObjModule[lCounter].Panel2.Controls.Add(ObjModuleText[lCounter]);

                PanModule.Controls.Add(ObjModule[lCounter]);
            }
        }
Пример #15
0
 private void TxtUserName_Enter(object sender, EventArgs e)
 {
     ClsFunctions.FxSelectAll(sender);
 }
Пример #16
0
        private void FxEnter()
        {
            string lUserName = TxtUserName.Text.Trim();
            string lPassword = TxtPassword.Text.Trim();

            if (lUserName.Length == 0 || lPassword.Length == 0)
            {
                ClsFunctions.FxMessage(1, "Usuario y/o contraseña incorrectos");

                TxtUserName.Text = "";
                TxtPassword.Text = "";

                TxtUserName.Focus();

                return;
            }

            long lUserId = ClsSql.Fx_sel_tblUser_checkPassword(lUserName, lPassword);

            if (lUserId == 0)
            {
                ClsFunctions.FxMessage(1, "Usuario y/o contraseña incorrectos");

                TxtUserName.Text = "";
                TxtPassword.Text = "";

                TxtUserName.Focus();

                return;
            }

            if (lPassword == "centuria")
            {
                FrmChangePassword ObjForm = new FrmChangePassword();

                ObjForm.ShowDialog();

                if (ClsVariables.gPasswordChanged == false)
                {
                    ClsFunctions.FxMessage(1, "No es posible ingresar si no cambia su contraseña. Favor vuelva a intentar");

                    FxCancel();

                    return;
                }
            }

            if (ClsVariables.gPasswordExpiry > 0)
            {
                if (ClsVariables.gUserExpirationDate <= DateTime.Today)
                {
                    FrmChangePassword ObjForm = new FrmChangePassword();

                    ObjForm.ShowDialog();

                    if (ClsVariables.gPasswordChanged == false)
                    {
                        ClsFunctions.FxMessage(1, "No es posible ingresar si no cambia su contraseña. Favor vuelva a intentar");

                        FxCancel();

                        return;
                    }
                }
                else
                {
                    ClsFunctions.FxExpirationAlert();
                }
            }

            FxExit();
        }
Пример #17
0
 private void TxtPassword_Enter(object sender, EventArgs e)
 {
     ClsFunctions.FxSelectAll(sender);
 }