CEL_Payroll/Payroll.BO/Query Analyzer/EaseReg.cs

68 lines
975 B
C#
Raw Normal View History

2024-09-17 14:30:13 +06:00
using System;
using Microsoft.Win32;
namespace Payroll.BO
{
public class EaseReg
{
private string _sVal;
private string _sKeyName;
private string _sSubKeyName;
public EaseReg(string sRegKeyName,string sRegSubKeyName)
{
//
// TODO: Add constructor logic here
//
_sKeyName=sRegKeyName;
_sSubKeyName=sRegSubKeyName;
this.GetSetting();
}
~EaseReg()
{
//
// TODO: Add constructor logic here
//
this.SaveSetting();
}
public string Val
{
get
{
return _sVal;
}
set
{
_sVal=value;
}
}
public void SaveSetting()
{
RegistryKey oKey=Registry.CurrentUser.CreateSubKey(_sKeyName);
oKey.SetValue(_sSubKeyName,_sVal);
}
public void GetSetting()
{
RegistryKey oRegKey=Registry.CurrentUser;
try
{
oRegKey=oRegKey.OpenSubKey(_sKeyName);
object oValue=oRegKey.GetValue(_sSubKeyName);
_sVal=Convert.ToString(oValue);
}
catch
{
_sVal="";
}
}
}
}