using System; using System.Collections.Generic; using System.Linq; using System.Web.UI.WebControls; namespace BLL { /// /// 质量奖罚 /// public static class RewardAndPunishService { public static Model.SGGLDB db = Funs.DB; /// /// 根据主键获取质量奖罚 /// /// /// public static Model.RewardAndPunish_RewardAndPunish GetRewardAndPunishById(string RewardAndPunishId) { return Funs.DB.RewardAndPunish_RewardAndPunish.FirstOrDefault(e => e.RewardAndPunishId == RewardAndPunishId); } /// /// 添加质量奖罚 /// /// 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, State = RewardAndPunish.State, CompileMan = RewardAndPunish.CompileMan, CompileDate = RewardAndPunish.CompileDate, }; db.RewardAndPunish_RewardAndPunish.InsertOnSubmit(newRewardAndPunish); db.SubmitChanges(); } /// /// 修改质量奖罚 /// /// 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.State = RewardAndPunish.State; db.SubmitChanges(); } } /// /// 根据主键删除质量奖罚 /// /// 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(); } } /// /// 根据状态选择下一步办理类型 /// /// /// 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; } } }