using CnasSynchronousCommon;
using System;
namespace CnasSynchronusClient
{
public class LockStateOperation
{
private static readonly string strLocalConfigPath = FileHelper.getBasePath() + @"\Data\";
///
/// 获取表单锁定状态
///
///
public static bool GetLockState()
{
bool isLocked = false;
try
{
string strLocalFileString = FileHelper.GetLocalFile(strLocalConfigPath, "FormLockState.mes");
if (strLocalFileString != "")
{
string strState = EncryptionOperation.Decrypt(strLocalFileString, "NZJXD--CnasClientJXDJXDJ");
bool.TryParse(strState, out isLocked);
}
}
catch (Exception ex)
{
AppLog.Error(ex.Message);
}
return isLocked;
}
///
/// 保存表单锁定状态到本地
///
/// 锁定状态
///
public static bool SaveLockState(bool isLocked)
{
bool bIfSuccess = true;
try
{
string strEncrypString = EncryptionOperation.Encrypt(isLocked.ToString(), "NZJXD--CnasClientJXDJXDJ");
bIfSuccess = FileHelper.SaveLocalFile(strLocalConfigPath, "FormLockState.mes", strEncrypString);
}
catch (Exception ex)
{
bIfSuccess = false;
AppLog.Error(ex.Message);
}
return bIfSuccess;
}
}
}