2026-06-05 13:44:39 +09:00

104 lines
3.9 KiB
C#

using CoreUnit.Common;
using Newtonsoft.Json.Linq;
using System;
using System.Drawing;
namespace DB
{
public partial class Dao
{
#region 시스템 레시피 기본 함수
public string GetSystemRecipeValue(string ID, object defaultValue)
{
return LASARecipeHelper.GetValue(ID, defaultValue).ToString();
}
public bool GetSystemRecipeBooleanValue(string ID, bool defaultValue)
{
return LASARecipeHelper.GetValue(ID, defaultValue).ToString() == "False" ? false : true;
}
public double GetSystemRecipeDoubleValue(string ID, double defaultValue)
{
var strValue = LASARecipeHelper.GetValue(ID, defaultValue).ToString();
return double.TryParse(strValue, out double result) ? result : defaultValue;
}
public Enum GetSystemRecipeEnumValue(string ID, Type enumType, Enum defaultValue)
{
var strValue = LASARecipeHelper.GetValue(ID, defaultValue).ToString();
return (Enum)Enum.Parse(enumType, strValue);
}
public string GetSystemRecipeStringValue(string ID, string defaultValue)
{
return LASARecipeHelper.GetValue(ID, defaultValue).ToString();
}
public uint GetSystemRecipeUintValue(string ID, uint defaultValue)
{
var strValue = LASARecipeHelper.GetValue(ID, defaultValue).ToString();
return uint.TryParse(strValue, out uint result) ? result : defaultValue;
}
public int GetSystemRecipeIntValue(string ID, int defaultValue)
{
var strValue = LASARecipeHelper.GetValue(ID, defaultValue).ToString();
return int.TryParse(strValue, out int result) ? result : defaultValue;
}
public PointF GetSystemRecipePointFValue(string ID, PointF defaultValue)
{
var strValue = LASARecipeHelper.GetValue(ID, defaultValue).ToString();
return new PointF((float)Convert.ToDouble(strValue.Split(',')[0]), (float)Convert.ToDouble(strValue.Split(',')[1]));
}
public SizeF GetSystemRecipeSizeFValue(string ID, SizeF defaultValue)
{
JToken jToken = LASARecipeHelper.GetValue(ID, defaultValue) as JToken;
double width = jToken.GetValue("Width", 0.0);
double height = jToken.GetValue("Height", 0.0);
return new SizeF((float)width, (float)height);
}
public Color GetSystemRecipeColorValue(string ID, Color defaultValue)
{
var strValue = LASARecipeHelper.GetValue(ID, defaultValue).ToString();
return UtilUnit.ConvertColorFromStringStream(strValue);
}
public DateTime GetSystemRecipeDateTimeValue(string ID, DateTime defaultValue)
{
var strValue = LASARecipeHelper.GetValue(ID, defaultValue).ToString();
return new DateTime(
Convert.ToInt16(strValue.Split(',')[0]),
Convert.ToInt16(strValue.Split(',')[1]),
Convert.ToInt16(strValue.Split(',')[2]),
Convert.ToInt16(strValue.Split(',')[3]),
Convert.ToInt16(strValue.Split(',')[4]),
Convert.ToInt16(strValue.Split(',')[5]));
}
public string GetSystemRecipeValueForDescription(string description)
{
return LASARecipeHelper.GetValue(description, string.Empty).ToString();
}
public string GetSystemRecipeIdForDescription(string description)
{
return LASARecipeHelper.GetValue(description, string.Empty).ToString();
}
public void SetSystemRecipeValueForID(string ID, object value)
{
LASARecipeHelper.SaveValues(ID, value);
}
public void SetSystemRecipeValueForDescription(string description, object value)
{
LASARecipeHelper.SaveValues(description, value);
}
#endregion
}
}