public CampusAccessManager(CommonExchange.SysAccess userInfo, CampusAccessLogic campusAccessManager, String accessPointId) { _imageList = new List <ListOfImages>(); for (Int32 x = 1; x <= c_noImages; x++) { ListOfImages list = new ListOfImages(); list.PersonImage = Image.FromFile(Application.StartupPath + @"\default.jpg"); _imageList.Add(list); } this.InitializeComponent(); _userInfo = userInfo; _campusAccessManager = campusAccessManager; _accessPointId = accessPointId; this.Load += new EventHandler(ClassLoad); this.FormClosed += new FormClosedEventHandler(CampusAccessManagerFormClosed); this.FormClosing += new FormClosingEventHandler(ClassClossing); this.tmrTime.Tick += new EventHandler(tmrTimeTick); _port.DataReceived += new SerialDataReceivedEventHandler(_portDataReceived); SetStyle(ControlStyles.DoubleBuffer | ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint, true); this.lblAccessPoint.Text = _campusAccessManager.GetAccessPointDescription(_accessPointId); }
public UpdatingForm(CommonExchange.SysAccess userInfo, CampusAccessLogic campusAccessManager) { this.InitializeComponent(); _userInfo = userInfo; _campusAccessManager = campusAccessManager; this.Load += new EventHandler(ClassLoad); this.Activated += new EventHandler(UpdatingFormActivated); }
//####################################################CLASS AccessPointInformation EVENTS############################################### //event is raised when the class is loaded private void ClassLoad(object sender, EventArgs e) { if (!(RemoteServerLib.ProcStatic.IsSystemAccessAdmin(_userInfo) || RemoteServerLib.ProcStatic.IsSystemAccessGateKeepers(_userInfo))) { throw new Exception("You are not authorized to access this module."); } else { _campusAccessManager = new CampusAccessLogic(_userInfo); _campusAccessManager.InitializeAccessPointComboBox(this.cboAccessPoint); } }//--------------------------
static void Main() { try { //registers the tcp channel TcpChannel channel = new TcpChannel(); ChannelServices.RegisterChannel(channel, false); //-------------------------- Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); //gets the user information using (RemoteClient.RemCntAdministratorManager remClient = new RemoteClient.RemCntAdministratorManager()) { //sets the user information CommonExchange.SysAccess userInfo = new CommonExchange.SysAccess(); //-------------------------- Int32 userAccess = 1; if (userAccess == 1) { userInfo.UserName = "******"; userInfo.Password = "******"; } Boolean isExpired = false; if (remClient.AuthenticateSystemUser(ref userInfo, ref isExpired)) { userInfo.NetworkInformation = RemoteClient.ProcStatic.GetNetworkInformation(); Int32 process = 3; if (process == 1) { try { CampusAccessLogic campusAccessManager = new CampusAccessLogic(userInfo); Application.Run(new CampusAccessManager(userInfo, campusAccessManager, String.Empty)); } catch (Exception ex) { RemoteClient.ProcStatic.ShowErrorDialog(ex.Message, "Error Loading"); } } else if (process == 2) { try { Application.Run(new AccessPointInformation(userInfo)); } catch (Exception ex) { RemoteClient.ProcStatic.ShowErrorDialog(ex.Message, "Error Loading"); } } else if (process == 3) { Boolean hasAccess = false; using (SystemLogIn frmLogIn = new SystemLogIn()) { frmLogIn.ShowDialog(); if (frmLogIn.HasAccess) { hasAccess = true; userInfo = frmLogIn.UserInformation; } } if (hasAccess) { Application.Run(new AccessPointInformation(userInfo)); } } } }//------------------------- } catch (Exception err) { RemoteClient.ProcStatic.ShowErrorDialog(err.Message, "System Error"); } finally { Application.Exit(); } }