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); }
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(); }
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(); }
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(); } }
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(); } } }
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"); } } }
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); }
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(); } }
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(); }