public LoginInfo GetLoginInfo(string id, byte[] passwd)
        {
            secdivDataContext db = new secdivDataContext();

            var users = db.UserAccounts.Where(ua => ua.UserName.Equals(id) && ua.Password.Equals(passwd));

            if (users.Count() > 0)
            {
                UserAccount user = users.First();
                var userinfo = db.Persons.Where(p => p.PID.Equals(user.PID));
                if (userinfo.Count() > 0)
                {
                    LoginInfo li;
                    Person person = userinfo.First();
                    if (String.IsNullOrEmpty(person.MiddleName))
                    {
                        li = new LoginInfo
                        {
                            UserName = user.UserName,
                            Name = string.Format("{0}, {1} {2}", person.LastName, person.FirstName, person.MiddleName),
                            UnitName = person.OFFICE.Unit.UnitName,
                            TypeOfUser = user.TypeOfUser,
                            UAStatus = user.UAStatus
                        };
                    }
                    else
                    {
                        li = new LoginInfo
                        {
                            UserName = user.UserName,
                            Name = string.Format("{0}, {1}", person.LastName, person.FirstName),
                            UnitName = person.OFFICE.Unit.UnitName,
                            TypeOfUser = user.TypeOfUser,
                            UAStatus = user.UAStatus
                        };
                    }
                    return li;
                }
            }
            return null;
        }
        /// <summary>
        /// Scripter : YONGTOK KIM
        /// Script Date : 20 Oct 2010
        /// If success login, close the Login form and set the value. If fail, refresh the form.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>

        private void LoginView()
        {
            if (!dbExist)
            {
                if (userId.Equals(txtCommonID.Text) && password.Equals(txtCommonPassword.Password))
                {
                    DialogResult = true;
                    Close();
                }
                else
                {
                    CheckNumberOfTry();
                }
            }
            else
            {
                UploadLogin login = new UploadLogin();
                byte[] passwd = DataHash.GetHashData(txtCommonPassword.Password, "SHA1");
                LoginInfo li = login.GetLoginInfo(txtCommonID.Text, passwd);

                if (li != null)
                {
                    LoginInfoData = li;
                    if (li.TypeOfUser == "Administrator")
                        DialogResult = true;
                    else
                    {
                        DialogResult = false;
                        MessageBox.Show("You are not authorized person to upload");
                    }
                    Close();
                }
                else
                {
                    CheckNumberOfTry();
                }
            }
        }