80 lines
2.8 KiB
C#
80 lines
2.8 KiB
C#
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.Linq;
|
|||
|
using System.Text;
|
|||
|
using System.Threading.Tasks;
|
|||
|
using System.Web.UI.WebControls;
|
|||
|
using System.Windows.Forms;
|
|||
|
|
|||
|
namespace BLL
|
|||
|
{
|
|||
|
/// <summary>
|
|||
|
/// Key Quantity
|
|||
|
/// </summary>
|
|||
|
public class KeyQuantityService
|
|||
|
{
|
|||
|
/// <summary>
|
|||
|
/// 根据主键获取Key Quantity
|
|||
|
/// </summary>
|
|||
|
/// <param name="keyQuantityId"></param>
|
|||
|
/// <returns></returns>
|
|||
|
public static Model.Editor_KeyQuantity GetKeyQuantityById(string keyQuantityId)
|
|||
|
{
|
|||
|
return Funs.DB.Editor_KeyQuantity.FirstOrDefault(e => e.KeyQuantityId == keyQuantityId);
|
|||
|
}
|
|||
|
|
|||
|
public static decimal? GetSumPlanMHRsByKeyId(string keyId)
|
|||
|
{
|
|||
|
decimal? sum = 0;
|
|||
|
sum = (from x in Funs.DB.Editor_KeyQuantity where x.KeyId == keyId select x.PlanMHRs).Sum();
|
|||
|
return sum;
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 添加Key Quantity
|
|||
|
/// </summary>
|
|||
|
/// <param name="keyQuantity"></param>
|
|||
|
public static void AddKeyQuantity(Model.Editor_KeyQuantity keyQuantity)
|
|||
|
{
|
|||
|
Model.Editor_KeyQuantity newKeyQuantity = new Model.Editor_KeyQuantity();
|
|||
|
newKeyQuantity.KeyQuantityId = keyQuantity.KeyQuantityId;
|
|||
|
newKeyQuantity.EProjectId = keyQuantity.EProjectId;
|
|||
|
newKeyQuantity.KeyId = keyQuantity.KeyId;
|
|||
|
newKeyQuantity.InputQuantity = keyQuantity.InputQuantity;
|
|||
|
newKeyQuantity.PlanMHRs = keyQuantity.PlanMHRs;
|
|||
|
Funs.DB.Editor_KeyQuantity.InsertOnSubmit(newKeyQuantity);
|
|||
|
Funs.DB.SubmitChanges();
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 修改key Quantity
|
|||
|
/// </summary>
|
|||
|
/// <param name="keyQuantity"></param>
|
|||
|
public static void UpdateKeyQuantity(Model.Editor_KeyQuantity keyQuantity)
|
|||
|
{
|
|||
|
Model.Editor_KeyQuantity newKeyQuantity = Funs.DB.Editor_KeyQuantity.FirstOrDefault(e => e.KeyQuantityId == keyQuantity.KeyQuantityId);
|
|||
|
if (newKeyQuantity != null)
|
|||
|
{
|
|||
|
newKeyQuantity.KeyId = keyQuantity.KeyId;
|
|||
|
newKeyQuantity.InputQuantity = keyQuantity.InputQuantity;
|
|||
|
newKeyQuantity.PlanMHRs = keyQuantity.PlanMHRs;
|
|||
|
Funs.DB.SubmitChanges();
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 根据主键删除Key Quantity
|
|||
|
/// </summary>
|
|||
|
/// <param name="keyQuantityId"></param>
|
|||
|
public static void DeleteKeyQuantityById(string keyQuantityId)
|
|||
|
{
|
|||
|
Model.Editor_KeyQuantity keyQuantity = Funs.DB.Editor_KeyQuantity.FirstOrDefault(e => e.KeyQuantityId == keyQuantityId);
|
|||
|
if (keyQuantity != null)
|
|||
|
{
|
|||
|
Funs.DB.Editor_KeyQuantity.DeleteOnSubmit(keyQuantity);
|
|||
|
Funs.DB.SubmitChanges();
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|