private void Form1_Load(object sender, EventArgs e) { try { int iP = System.Drawing.Printing.PrinterSettings.InstalledPrinters.Count; if (iP == 0) { Close(); } tssVersion.Text = "1.0.1.7"; DataTable dtC = ConfigLogica.Consutlar(); _lsPrinter = dtC.Rows[0]["printer_name"].ToString(); _lsPath = dtC.Rows[0]["sys_direct"].ToString(); _lsRecPath = dtC.Rows[0]["report_rec"].ToString(); _lsArtPath = dtC.Rows[0]["report_rec2"].ToString(); _lsCodBar2 = dtC.Rows[0]["gen_codbar2"].ToString(); _liTimeLapse = int.Parse(dtC.Rows[0]["time_lap"].ToString()); bool bPrinter = false; for (int i = 0; i < iP; i++) { string sPrint = System.Drawing.Printing.PrinterSettings.InstalledPrinters[i]; if (sPrint.ToUpper() == _lsPrinter) { _lsPrinter = sPrint; bPrinter = true; break; } } if (!bPrinter) { Close(); } _lsUser = System.Security.Principal.WindowsIdentity.GetCurrent().Name; if (_lsUser.IndexOf("\\") != -1) { int iIdx = _lsUser.IndexOf("\\"); int iLen = _lsUser.Length; iLen = iLen - iIdx; _lsUser = _lsUser.Substring(iIdx + 1, iLen - 1); } UsuarioLogica user = new UsuarioLogica(); user.Usuario = _lsUser; _lsArea = UsuarioLogica.GetArea(user); if (!string.IsNullOrEmpty(_lsArea)) { Inicio(); } else { Close(); } } catch (FileNotFoundException ex) { this.Close(); }catch (TypeInitializationException ex) { this.Close(); } catch (Exception ex) { ex.ToString(); throw; } }