You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
namespace NFine.Code { public class OperatorProvider { public static OperatorProvider Provider { get { return new OperatorProvider(); } } private string LoginUserKey = "nfine_loginuserkey_2016"; private string LoginProvider = Configs.GetValue("LoginProvider");
public OperatorModel GetCurrent() { OperatorModel operatorModel = new OperatorModel(); if (LoginProvider == "Cookie") { operatorModel = DESEncrypt.Decrypt(WebHelper.GetCookie(LoginUserKey).ToString()).ToObject<OperatorModel>(); } else { operatorModel = DESEncrypt.Decrypt(WebHelper.GetSession(LoginUserKey).ToString()).ToObject<OperatorModel>(); } return operatorModel; } public void AddCurrent(OperatorModel operatorModel) { if (LoginProvider == "Cookie") { WebHelper.WriteCookie(LoginUserKey, DESEncrypt.Encrypt(operatorModel.ToJson()), 43200); } else { WebHelper.WriteSession(LoginUserKey, DESEncrypt.Encrypt(operatorModel.ToJson())); } WebHelper.WriteCookie("nfine_mac", Md5.md5(Net.GetMacByNetworkInterface().ToJson(), 43200)); WebHelper.WriteCookie("nfine_licence", Licence.GetLicence()); } public void RemoveCurrent() { if (LoginProvider == "Cookie") { WebHelper.RemoveCookie(LoginUserKey.Trim()); } else { WebHelper.RemoveSession(LoginUserKey.Trim()); } } } }
|