| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
- using ReportWeb.Models;
- using System;
- using System.Collections.Generic;
- using System.Configuration;
- using System.Security.Cryptography;
- namespace ReportWeb
- {
- /// <summary>
- /// Summary description for Common
- /// </summary>
- 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<Services> list, int serviceId)
- //{
- // HttpContext.Session.GetComplexData<List<Services>>("listService")
- // foreach (Services sv in (List<Services>)list)
- // {
- // if (sv.id == serviceId)
- // {
- // return sv;
- // }
- // }
- // return null;
- //}
-
- }
- }
|