void FrmLoginShown(object sender, EventArgs e) { if (admin) { cbxFiliais.Enabled = false; } else if (su) { cbxFiliais.Visible = false; lblFilial.Visible = false; } else { int i; cFiliais filiais = new cFiliais(); this.Cursor = Cursors.WaitCursor; filiais.Carrega(cbxFiliais); this.Cursor = Cursors.Default; for (i = 0; i < cbxFiliais.Items.Count; i++) { if (cbxFiliais.Items[i].ToString().StartsWith(sUltimaFilial)) { cbxFiliais.SelectedIndex = i; break; } } } }
public string ConvertLocalPathToUnc(string localPath) { if (localPath.StartsWith("c:") || localPath.StartsWith("C:") || localPath.StartsWith("d:") || localPath.StartsWith("D:")) { return(localPath); } cFiliais filiais = new cFiliais(); string diretorio = filiais.Diretorio(Globais.sFilial); if ((diretorio != null) && (diretorio.Trim().Length > 0)) { return(diretorio + localPath.Substring(2)); } StringBuilder buffer = new StringBuilder(); int size = 0; int retVal = WNetGetUniversalName(localPath, UNIVERSAL_NAME_INFO_LEVEL, ref buffer, ref size); if (retVal == ERROR_MORE_DATA) { buffer = new StringBuilder(size); retVal = WNetGetUniversalName(localPath, UNIVERSAL_NAME_INFO_LEVEL, ref buffer, ref size); if (retVal != 0) { return(localPath); } } else { return(localPath); } return(buffer.ToString()); }
void FrmCadFiliaisLoad(object sender, EventArgs e) { filiais = new cFiliais(); this.Cursor = Cursors.WaitCursor; filiais.Carrega(dgvCadastro); this.Cursor = Cursors.Default; cEstados estados = new cEstados(); this.Cursor = Cursors.WaitCursor; estados.Carrega(cbxEstados); this.Cursor = Cursors.Default; SetaEdicaoLocal(false); }
void FrmControleAcessoLoad(object sender, EventArgs e) { controle = new cControleAcesso(); usuarios = new cUsuarios(); this.Cursor = Cursors.WaitCursor; usuarios.Carrega(dbgUsuarios, "where IDT_ADMINISTRADOR <> 'S'"); this.Cursor = Cursors.Default; if (dbgUsuarios.Rows.Count == 0) { Close(); } iUsuario = 0; filiais = new cFiliais(); this.Cursor = Cursors.WaitCursor; filiais.Carrega(dbgFiliais); this.Cursor = Cursors.Default; if (dbgFiliais.Rows.Count == 0) { Close(); } iFilial = 0; sistemas = new cSistemas(); this.Cursor = Cursors.WaitCursor; sistemas.Carrega(dbgSistemas, "where COD_SISTEMA <> 1"); this.Cursor = Cursors.Default; if (dbgSistemas.Rows.Count == 0) { Close(); } iSistema = 0; ColoreFiliais(); ColoreSistemas(); CarregaProgramas(); ColoreProgramas(); }