Пример #1
0
        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;
            }
        }
Пример #2
0
        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;
            }
        }
Пример #3
0
        public ActionResult validate()
        {
            string userName = Request["username"];
            string userPassword = Request["password"];

            if (Membership.ValidateUser(userName, userPassword))
            {
                var url = Url.Content("~/");
                var encryptedPwd = new zsi.Framework.Security.Cryptography().Encrypt(userPassword);
                Session["isAuthenticated"] = "Y";
                HttpContext.Response.Cookies["isMenuItemsSaved"].Value = "N";
                SessionHandler.CurrentUser = new Models.user { username = userName, password = userPassword };

                using (new impersonate())
                {
                    DataHelper.toJSON(
                        "dbo.users_pwd_upd @username='******'"
                      + ",@password='******'"
                      , false);

                    if(this.getAuthNo() == 999){
                        if (Session["zsi_login"].ToString() == "N")
                            url = Url.Content("~/") + "page/name/zsiuserlogin";
                    }
                    else
                        url = gePriorityURL(Url.Content("~/"));

                }
                return Redirect(url);
            }
            else
            {

                return Redirect(Url.Content("~/") + "?access=invalid" );
            }
        }
Пример #4
0
        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;
            }
        }
Пример #5
0
        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;
            }
        }
Пример #6
0
 public ContentResult Decrypt(string pwd)
 {
     string  r= "invalid access";
     if (Session["zsi_login"].ToString() == "Y") r = new zsi.Framework.Security.Cryptography().Decrypt(pwd);
     return Content(r);
 }
Пример #7
0
        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;
            }
        }
Пример #8
0
        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;
            }
        }