private void login() { try { if (txtUserName.Text.Trim() == "" || txtPassword.Text.Trim() == "") { MessageBox.Show("Enter UserName and Password.", "Try Again.", MessageBoxButtons.OK); return; } btnLogin.Text = "Wait..."; btnLogin.Enabled = false; //zsi.PhotoFingCapture.WebFileService.WebFileManager fm = new zsi.PhotoFingCapture.WebFileService.WebFileManager(); ClientSettings.UserInfo = new zsi.PhotoFingCapture.Models.User(); dcUser dc = new dcUser(); User info = dc.GetUserLogon(txtUserName.Text); string _decryptedPassword = string.Empty; _decryptedPassword = new zsi.Framework.Security.Cryptography().Decrypt(info.Password); if (txtPassword.Text == _decryptedPassword) { //store static user info ClientSettings.UserInfo = info; AccessGranted = true; if (info.ClientId > 0) { //store static client info ClientSettings.ClientWorkStationInfo = new dcClientWorkStation().GetLocalClientWorkStation(); //update client workstation new dcClientWorkStation().UpdateLocalClientWorkStation(ClientSettings.ClientWorkStationInfo); } //EnableControls(true); this.Close(); } else { MessageBox.Show("Invalid User, Please Login."); btnLogin.Text = "Login"; btnLogin.Enabled = true; } } catch (Exception ex) { MessageBox.Show(ex.Message); btnLogin.Enabled = true; } }
private void ProcessProfile(Profile info) { try { string _ClientRequestCode = string.Empty; // System.Diagnostics.Process p = new System.Diagnostics.Process(); dcUser _dc = new dcUser(); zsi.Framework.Security.Cryptography _crypt = new zsi.Framework.Security.Cryptography(); pbProfileImage.Image = zsi.PhotoFingCapture.Util.ByteArrayToImage(info.FrontImg); this.Invoke(new Function(delegate() { txtName.Text = "(" + info.EmployeeNo + ") - " + info.FullName; dcTimeInOutLog_OleDb dc = new dcTimeInOutLog_OleDb(); DateTime TimeIn; DateTime TimeOut; dc.TimeInOut(info, DateTime.Now, out TimeIn, out TimeOut); if (TimeIn == new DateTime(1, 1, 1)) { lblActualTimeIn.Text = "00:00:00"; } else { lblActualTimeIn.Text = TimeIn.ToLongTimeString(); } if (TimeOut == new DateTime(1, 1, 1)) { lblActualTimeOut.Text = "00:00:00"; } else { lblActualTimeOut.Text = TimeOut.ToLongTimeString(); } })); } catch (Exception ex) { throw ex; } }
private void btnOpenWebsite_Click(object sender, EventArgs e) { if (ClientSettings.UserInfo == null) { goto NotLogged; } if (ClientSettings.UserInfo.UserId == 0) { goto NotLogged; } System.Diagnostics.Process p = new System.Diagnostics.Process(); string _guID = Guid.NewGuid().ToString(); dcUser _dc = new dcUser(); _dc.UpdateRequestCode(ClientSettings.UserInfo.UserId, _guID); p.StartInfo.FileName = Settings.Default.DefaultWebsite + "Client?p_ClientAction=User Login&p_ClientRequestCode=" + _guID; p.Start(); return; NotLogged: MessageBox.Show("Please login first to open a website."); }
private void ProcessProfile(Profile info) { try { string _ClientRequestCode = string.Empty; // System.Diagnostics.Process p = new System.Diagnostics.Process(); dcUser _dc = new dcUser(); zsi.Framework.Security.Cryptography _crypt = new zsi.Framework.Security.Cryptography(); pbProfileImage.Image = zsi.PhotoFingCapture.Util.ByteArrayToImage(info.FrontImg); this.Invoke(new Function(delegate() { txtName.Text = "(" + info.EmployeeNo + ") - " + info.FullName; dcTimeInOutLog_OleDb dc = new dcTimeInOutLog_OleDb(); DateTime TimeIn; DateTime TimeOut; dc.TimeInOut(info, DateTime.Now,out TimeIn,out TimeOut); if (TimeIn == new DateTime(1, 1, 1)) lblActualTimeIn.Text = "00:00:00"; else lblActualTimeIn.Text = TimeIn.ToLongTimeString(); if (TimeOut == new DateTime(1, 1, 1)) lblActualTimeOut.Text = "00:00:00"; else lblActualTimeOut.Text = TimeOut.ToLongTimeString(); })); } catch (Exception ex) { throw ex; } }
private void btnOpenWebsite_Click(object sender, EventArgs e) { if (ClientSettings.UserInfo == null) goto NotLogged; if (ClientSettings.UserInfo.UserId == 0) goto NotLogged; System.Diagnostics.Process p = new System.Diagnostics.Process(); string _guID = Guid.NewGuid().ToString(); dcUser _dc = new dcUser(); _dc.UpdateRequestCode(ClientSettings.UserInfo.UserId, _guID); p.StartInfo.FileName = Settings.Default.DefaultWebsite + "Client?p_ClientAction=User Login&p_ClientRequestCode=" + _guID; p.Start(); return; NotLogged: MessageBox.Show("Please login first to open a website."); }
private void ProcessProfile(Profile info) { try { string _ClientRequestCode = string.Empty; System.Diagnostics.Process p = new System.Diagnostics.Process(); dcUser _dc = new dcUser(); zsi.Framework.Security.Cryptography _crypt = new zsi.Framework.Security.Cryptography(); this.Invoke(new Function(delegate() { this.ClientAction = this.cbVerificationPurpose.SelectedItem.ToString().ToLower(); })); switch (this.ClientAction) { case "user login": //ClientSettings.UserInfo = _dc.GetUserInfo(info.ProfileId); ClientSettings.UserInfo = new User(); ClientSettings.UserInfo.UserId = info.UserId; ClientSettings.UserInfo.WSMacAddress = "add"; if (ClientSettings.UserInfo.UserId != 0) { this.Invoke(new Function(delegate(){ // this.ParentForm.EnableControls(true); this._ParentForm.CheckPermission(true); this.Close(); })); } else { MessageBox.Show("User not login."); } break; case "profile info": if (ClientSettings.UserInfo == null) goto NotYetLoggedIn; if (ClientSettings.UserInfo.UserId == 0) goto NotYetLoggedIn; if (ClientSettings.UserInfo.UserId != 0) { string _guID = Guid.NewGuid().ToString(); _dc.UpdateRequestCode(ClientSettings.UserInfo.UserId, _guID); p.StartInfo.FileName = Settings.Default.DefaultWebsite + "Client?p_ClientAction=Profile Info&p_ClientRequestCode=" + _guID + "&p_ProfileId=" + info.ProfileId; p.Start(); this.Invoke(new Function(delegate(){ this.Close(); })); } else { MessageBox.Show("User not login."); } break; default: MessageBox.Show("Finger identified: (" + info.ProfileId + ") - " + info.FullName); break; } return; NotYetLoggedIn: MessageBox.Show("Please login first."); } catch (Exception ex) { throw ex; } }
private void ProcessProfile(Profile info) { try { string _ClientRequestCode = string.Empty; System.Diagnostics.Process p = new System.Diagnostics.Process(); dcUser _dc = new dcUser(); zsi.Framework.Security.Cryptography _crypt = new zsi.Framework.Security.Cryptography(); this.Invoke(new Function(delegate() { this.ClientAction = this.cbVerificationPurpose.SelectedItem.ToString().ToLower(); })); switch (this.ClientAction) { case "user login": //ClientSettings.UserInfo = _dc.GetUserInfo(info.ProfileId); ClientSettings.UserInfo = new User(); ClientSettings.UserInfo.UserId = info.UserId; ClientSettings.UserInfo.WSMacAddress = "add"; if (ClientSettings.UserInfo.UserId != 0) { this.Invoke(new Function(delegate(){ // this.ParentForm.EnableControls(true); this._ParentForm.CheckPermission(true); this.Close(); })); } else { MessageBox.Show("User not login."); } break; case "profile info": if (ClientSettings.UserInfo == null) { goto NotYetLoggedIn; } if (ClientSettings.UserInfo.UserId == 0) { goto NotYetLoggedIn; } if (ClientSettings.UserInfo.UserId != 0) { string _guID = Guid.NewGuid().ToString(); _dc.UpdateRequestCode(ClientSettings.UserInfo.UserId, _guID); p.StartInfo.FileName = Settings.Default.DefaultWebsite + "Client?p_ClientAction=Profile Info&p_ClientRequestCode=" + _guID + "&p_ProfileId=" + info.ProfileId; p.Start(); this.Invoke(new Function(delegate(){ this.Close(); })); } else { MessageBox.Show("User not login."); } break; default: MessageBox.Show("Finger identified: (" + info.ProfileId + ") - " + info.FullName); break; } return; NotYetLoggedIn: MessageBox.Show("Please login first."); } catch (Exception ex) { throw ex; } }