using ReportWeb.Models; using System; using System.Collections.Generic; using System.Configuration; using System.Security.Cryptography; namespace ReportWeb { /// /// Summary description for Common /// public class Common { //public static string CountryCode = ConfigurationManager.AppSettings["CountryCode"]; //public static string Channel = ConfigurationManager.AppSettings["Channel"]; public class PortStatus { public const int Closed = 0; public const int Opened = 1; } public class UserRole { public const int Admin = 1; public const int VAS = 2; public const int Agent = 3; } public class PortError { public const String NoError = "0"; public const String NoMoney = "1"; public const String Blocked = "2"; } public class SmsError { public const int Success = 0; public const int NoSender = 1; public const int SendError = 2; public const int AuthenFail = 3; public const int Timeout = 4; public const int Exception = 5; public const int ParamInvalid = 6; } public class SmsStatus { public const int Sending = 1; public const int Wating = 0; } public Common() { } public static string EncryptPassword(string username, string password) { SHA256CryptoServiceProvider sha1 = new SHA256CryptoServiceProvider(); byte[] bs = System.Text.Encoding.UTF8.GetBytes(password + username); bs = sha1.ComputeHash(bs); System.Text.StringBuilder encryptedPass = new System.Text.StringBuilder(); foreach (byte b in bs) { encryptedPass.Append(b.ToString("x1").ToLower()); } return encryptedPass.ToString(); } //public static Services GetServiceById(List list, int serviceId) //{ // HttpContext.Session.GetComplexData>("listService") // foreach (Services sv in (List)list) // { // if (sv.id == serviceId) // { // return sv; // } // } // return null; //} } }