120 lines
5.0 KiB
C#
120 lines
5.0 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Web.UI.WebControls;
|
|
|
|
namespace BLL
|
|
{
|
|
/// <summary>
|
|
/// 质量奖罚
|
|
/// </summary>
|
|
public static class RewardAndPunishService
|
|
{
|
|
public static Model.SGGLDB db = Funs.DB;
|
|
|
|
/// <summary>
|
|
/// 根据主键获取质量奖罚
|
|
/// </summary>
|
|
/// <param name="RewardAndPunishId"></param>
|
|
/// <returns></returns>
|
|
public static Model.RewardAndPunish_RewardAndPunish GetRewardAndPunishById(string RewardAndPunishId)
|
|
{
|
|
return Funs.DB.RewardAndPunish_RewardAndPunish.FirstOrDefault(e => e.RewardAndPunishId == RewardAndPunishId);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 添加质量奖罚
|
|
/// </summary>
|
|
/// <param name="RewardAndPunish"></param>
|
|
public static void AddRewardAndPunish(Model.RewardAndPunish_RewardAndPunish RewardAndPunish)
|
|
{
|
|
Model.SGGLDB db = Funs.DB;
|
|
Model.RewardAndPunish_RewardAndPunish newRewardAndPunish = new Model.RewardAndPunish_RewardAndPunish
|
|
{
|
|
RewardAndPunishId = RewardAndPunish.RewardAndPunishId,
|
|
ProjectId = RewardAndPunish.ProjectId,
|
|
RewardAndPunishCode = RewardAndPunish.RewardAndPunishCode,
|
|
UnitId = RewardAndPunish.UnitId,
|
|
Type = RewardAndPunish.Type,
|
|
RewardAndPunishTypeId = RewardAndPunish.RewardAndPunishTypeId,
|
|
RewardAndPunishBasis = RewardAndPunish.RewardAndPunishBasis,
|
|
RewardAndPunishDecision = RewardAndPunish.RewardAndPunishDecision,
|
|
State = RewardAndPunish.State,
|
|
CompileMan = RewardAndPunish.CompileMan,
|
|
CompileDate = RewardAndPunish.CompileDate,
|
|
};
|
|
db.RewardAndPunish_RewardAndPunish.InsertOnSubmit(newRewardAndPunish);
|
|
db.SubmitChanges();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 修改质量奖罚
|
|
/// </summary>
|
|
/// <param name="RewardAndPunish"></param>
|
|
public static void UpdateRewardAndPunish(Model.RewardAndPunish_RewardAndPunish RewardAndPunish)
|
|
{
|
|
Model.SGGLDB db = Funs.DB;
|
|
Model.RewardAndPunish_RewardAndPunish newRewardAndPunish = db.RewardAndPunish_RewardAndPunish.FirstOrDefault(e => e.RewardAndPunishId == RewardAndPunish.RewardAndPunishId);
|
|
if (newRewardAndPunish != null)
|
|
{
|
|
newRewardAndPunish.RewardAndPunishCode = RewardAndPunish.RewardAndPunishCode;
|
|
newRewardAndPunish.UnitId = RewardAndPunish.UnitId;
|
|
newRewardAndPunish.Type = RewardAndPunish.Type;
|
|
newRewardAndPunish.RewardAndPunishTypeId = RewardAndPunish.RewardAndPunishTypeId;
|
|
newRewardAndPunish.RewardAndPunishBasis = RewardAndPunish.RewardAndPunishBasis;
|
|
newRewardAndPunish.RewardAndPunishDecision = RewardAndPunish.RewardAndPunishDecision;
|
|
newRewardAndPunish.State = RewardAndPunish.State;
|
|
|
|
db.SubmitChanges();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据主键删除质量奖罚
|
|
/// </summary>
|
|
/// <param name="RewardAndPunishId"></param>
|
|
public static void DeleteRewardAndPunishById(string RewardAndPunishId)
|
|
{
|
|
Model.SGGLDB db = Funs.DB;
|
|
Model.RewardAndPunish_RewardAndPunish RewardAndPunish = db.RewardAndPunish_RewardAndPunish.FirstOrDefault(e => e.RewardAndPunishId == RewardAndPunishId);
|
|
if (RewardAndPunish != null)
|
|
{
|
|
BLL.CommonService.DeleteAttachFileById(RewardAndPunishId);
|
|
db.RewardAndPunish_RewardAndPunish.DeleteOnSubmit(RewardAndPunish);
|
|
db.SubmitChanges();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据状态选择下一步办理类型
|
|
/// </summary>
|
|
/// <param name="state"></param>
|
|
/// <returns></returns>
|
|
public static ListItem[] GetDHandleTypeByState(string state)
|
|
{
|
|
if (state == Const.RewardAndPunish_Compile || state == Const.RewardAndPunish_ReCompile)
|
|
{
|
|
ListItem[] lis = new ListItem[1];
|
|
lis[0] = new ListItem("质量经理审核", Const.RewardAndPunish_Audit1);
|
|
return lis;
|
|
}
|
|
else if (state == Const.RewardAndPunish_Audit1)
|
|
{
|
|
ListItem[] lis = new ListItem[2];
|
|
lis[0] = new ListItem("项目经理批准", Const.RewardAndPunish_Audit2);
|
|
lis[1] = new ListItem("重新编制", Const.RewardAndPunish_ReCompile);
|
|
return lis;
|
|
}
|
|
else if (state == Const.RewardAndPunish_Audit2)
|
|
{
|
|
ListItem[] lis = new ListItem[2];
|
|
lis[0] = new ListItem("审批完成", Const.RewardAndPunish_Complete);
|
|
lis[1] = new ListItem("重新编制", Const.RewardAndPunish_ReCompile);
|
|
return lis;
|
|
}
|
|
else
|
|
return null;
|
|
}
|
|
}
|
|
}
|