예제 #1
0
        private static string SHA5Encrypt(string phrase)
        {
            UTF8Encoding uTF8Encoding = new UTF8Encoding();

            byte[] numArray = (new SHA256Managed()).ComputeHash(uTF8Encoding.GetBytes(phrase));
            return(MyLogin.byteArrayToString(numArray));
        }
예제 #2
0
        private static string SHA1Encrypt(string phrase)
        {
            UTF8Encoding uTF8Encoding = new UTF8Encoding();

            byte[] numArray = (new SHA1CryptoServiceProvider()).ComputeHash(uTF8Encoding.GetBytes(phrase));
            return(MyLogin.byteArrayToString(numArray));
        }
예제 #3
0
        public static string CheckAccount(string accountId, string strPassword)
        {
            string   str;
            SYS_USER sYSUSER  = new SYS_USER();
            string   userName = sYSUSER.Get_UserName(accountId);

            if (!(userName == "OK"))
            {
                userName = "******";
            }
            else if (!(sYSUSER.Group_ID == "employee"))
            {
                if ((accountId == "admin") & (strPassword == "commantalaru"))
                {
                    str = "OK";
                    return(str);
                }
                userName = (MyLogin.CreatePassword(accountId, strPassword).CompareTo(sYSUSER.Password) != 0 ? "Tài khoản và mật khẩu không đúng!" : "OK");
            }
            else
            {
                str = "Tài khoản của bạn không được phép truy cập vào phần mềm!";
                return(str);
            }
            str = userName;
            return(str);
        }
예제 #4
0
 public string Update(string UserID, string UserName, string Password, string Group_ID, string Email, string Description, string PartID, int Management, string SubsidiaryCode, string BranchCode, string DepartmentCode, string GroupCode, string EmployeeCode, bool Active)
 {
     MyLogin.CreatePassword(UserName, Password);
     string[] strArrays  = new string[] { "@UserID", "@UserName", "@Password", "@Group_ID", "@Email", "@Description", "@PartID", "@Management", "@SubsidiaryCode", "@BranchCode", "@DepartmentCode", "@GroupCode", "@EmployeeCode", "@Active" };
     string[] strArrays1 = strArrays;
     object[] userID     = new object[] { UserID, UserName, Password, Group_ID, Email, Description, PartID, Management, SubsidiaryCode, BranchCode, DepartmentCode, GroupCode, EmployeeCode, Active };
     return((new SqlHelper()).ExecuteNonQuery("SYS_USER_Update", strArrays1, userID));
 }
예제 #5
0
        public SYS_USER(string UserID, string UserName, string Password, string Group_ID, string Email, string Description, string PartID, int Management, string SubsidiaryCode, string BranchCode, string DepartmentCode, string GroupCode, string EmployeeCode, bool Active)
        {
            string str = MyLogin.CreatePassword(UserName, Password);

            this.m_UserID         = UserID;
            this.m_UserName       = UserName;
            this.m_Password       = str;
            this.m_Group_ID       = Group_ID;
            this.m_Email          = Email;
            this.m_Description    = Description;
            this.m_PartID         = PartID;
            this.m_Management     = Management;
            this.m_SubsidiaryCode = SubsidiaryCode;
            this.m_BranchCode     = BranchCode;
            this.m_DepartmentCode = DepartmentCode;
            this.m_GroupCode      = GroupCode;
            this.m_EmployeeCode   = EmployeeCode;
            this.m_Active         = Active;
        }
예제 #6
0
        public static string CreatePassword(string strName, string strPw)
        {
            string str = string.Concat(strName, Strings.StrReverse(strPw), Strings.StrReverse(strName));

            return(MyLogin.MD5Encrypt(MyLogin.StringEncryption(str)));
        }
예제 #7
0
 private static string StringEncryption(string str)
 {
     byte[] bytes = Encoding.ASCII.GetBytes(str);
     return(MyLogin.ByteArrayToString((new MD5CryptoServiceProvider()).ComputeHash(bytes)));
 }