113 lines
4.2 KiB
C#
113 lines
4.2 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Web.UI.WebControls;
|
|
|
|
namespace BLL
|
|
{
|
|
/// <summary>
|
|
/// 温度设置
|
|
/// </summary>
|
|
public class Base_TemperatureSetService
|
|
{
|
|
/// <summary>
|
|
/// 根据主键获取温度设置
|
|
/// </summary>
|
|
/// <param name="temperatureSetId"></param>
|
|
/// <returns></returns>
|
|
public static Model.Base_TemperatureSet GetTemperatureSetById(string temperatureSetId)
|
|
{
|
|
return Funs.DB.Base_TemperatureSet.FirstOrDefault(e => e.TemperatureSetId == temperatureSetId);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据温度和温度类型获取温度信息
|
|
/// </summary>
|
|
/// <param name="temerprature"></param>
|
|
/// <param name="type"></param>
|
|
/// <returns></returns>
|
|
public static Model.Base_TemperatureSet GetTemperatureByTemAndType(decimal? temerprature, string type)
|
|
{
|
|
return Funs.DB.Base_TemperatureSet.FirstOrDefault(e => e.Temperature == temerprature && e.TemperatureType == type);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 添加温度设置
|
|
/// </summary>
|
|
/// <param name="temperatureSet"></param>
|
|
public static void AddTemperatureSet(Model.Base_TemperatureSet temperatureSet)
|
|
{
|
|
Model.Base_TemperatureSet newTemperatureSet = new Model.Base_TemperatureSet();
|
|
newTemperatureSet.TemperatureSetId = temperatureSet.TemperatureSetId;
|
|
newTemperatureSet.Temperature = temperatureSet.Temperature;
|
|
newTemperatureSet.TemperatureType = temperatureSet.TemperatureType;
|
|
newTemperatureSet.Remark = temperatureSet.Remark;
|
|
Funs.DB.Base_TemperatureSet.InsertOnSubmit(newTemperatureSet);
|
|
Funs.DB.SubmitChanges();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 修改温度设置
|
|
/// </summary>
|
|
/// <param name="temperatureSet"></param>
|
|
public static void UpdateTemperatureSet(Model.Base_TemperatureSet temperatureSet)
|
|
{
|
|
Model.Base_TemperatureSet newTemperatureSet = Funs.DB.Base_TemperatureSet.FirstOrDefault(e => e.TemperatureSetId == temperatureSet.TemperatureSetId);
|
|
if (newTemperatureSet != null)
|
|
{
|
|
newTemperatureSet.Temperature = temperatureSet.Temperature;
|
|
newTemperatureSet.TemperatureType = temperatureSet.TemperatureType;
|
|
newTemperatureSet.Remark = temperatureSet.Remark;
|
|
Funs.DB.SubmitChanges();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据主键删除温度设置
|
|
/// </summary>
|
|
/// <param name="temperatureSetId"></param>
|
|
public static void DeleteTemperatureSetById(string temperatureSetId)
|
|
{
|
|
Model.Base_TemperatureSet tem = Funs.DB.Base_TemperatureSet.FirstOrDefault(e => e.TemperatureSetId == temperatureSetId);
|
|
if (tem != null)
|
|
{
|
|
Funs.DB.Base_TemperatureSet.DeleteOnSubmit(tem);
|
|
Funs.DB.SubmitChanges();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 温度类型设置
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public static ListItem[] getTemperatureType()
|
|
{
|
|
ListItem[] list = new ListItem[2];
|
|
list[0] = new ListItem("预热温度", "1");
|
|
list[1] = new ListItem("层间温度", "2");
|
|
|
|
return list;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取温度下拉选择项
|
|
/// </summary>
|
|
/// <param name="dropName"></param>
|
|
/// <param name="temperatureType"></param>
|
|
/// <param name="isShowPlease"></param>
|
|
public static void InitTemperatureDropDownList(FineUIPro.DropDownList dropName,string temperatureType, bool isShowPlease)
|
|
{
|
|
dropName.DataValueField = "TemperatureSetId";
|
|
dropName.DataTextField = "Temperature";
|
|
dropName.DataSource = (from x in Funs.DB.Base_TemperatureSet where x.TemperatureType == temperatureType orderby x.Temperature select x).ToList();
|
|
dropName.DataBind();
|
|
if (isShowPlease)
|
|
{
|
|
Funs.FineUIPleaseSelect(dropName);
|
|
}
|
|
}
|
|
}
|
|
}
|