using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Collections; namespace BLL { public class Common_NoticeSignService { public static Model.SGGLDB db = Funs.DB; /// /// 获取分页列表 /// /// public static IEnumerable getListData(string noticeId) { return from x in db.Common_NoticeSign where x.NoticeId == noticeId && x.SinaDate != null orderby x.SinaDate select new { x.NoticeSignId, x.NoticeId, x.SignMan, x.SinaDate, x.SignIdea, x.IsAgree, x.SignStep, UserName = (from y in db.Sys_User where y.UserId == x.SignMan select y.UserName).FirstOrDefault(), IsAgreeName = x.IsAgree == true ? "同意" : "不同意", }; } /// /// 根据通知Id获取一个通知审批信息 /// /// 通知Id /// 一个通知审批实体 public static Model.Common_NoticeSign GetNoticeSignByNoticeId(string noticeId) { return db.Common_NoticeSign.First(x => x.NoticeId == noticeId && x.SinaDate == null); } /// /// 增加通知审批信息 /// /// 通知审批实体 public static void AddNoticeSign(Model.Common_NoticeSign noticeSign) { string newKeyID = SQLHelper.GetNewID(typeof(Model.Common_NoticeSign)); Model.Common_NoticeSign newNoticeSign = new Model.Common_NoticeSign(); newNoticeSign.NoticeSignId = newKeyID; newNoticeSign.NoticeId = noticeSign.NoticeId; newNoticeSign.SignMan = noticeSign.SignMan; newNoticeSign.SinaDate = noticeSign.SinaDate; newNoticeSign.SignIdea = noticeSign.SignIdea; newNoticeSign.IsAgree = noticeSign.IsAgree; newNoticeSign.SignStep = noticeSign.SignStep; db.Common_NoticeSign.InsertOnSubmit(newNoticeSign); db.SubmitChanges(); } /// /// 修改通知审批信息 /// /// 通知审批实体 public static void UpdateNoticeSign(Model.Common_NoticeSign noticeSign) { Model.Common_NoticeSign newNoticeSign = db.Common_NoticeSign.First(e => e.NoticeId == noticeSign.NoticeId && e.SinaDate == null); newNoticeSign.NoticeId = noticeSign.NoticeId; newNoticeSign.SignMan = noticeSign.SignMan; newNoticeSign.SinaDate = noticeSign.SinaDate; newNoticeSign.SignIdea = noticeSign.SignIdea; newNoticeSign.IsAgree = noticeSign.IsAgree; newNoticeSign.SignStep = noticeSign.SignStep; db.SubmitChanges(); } /// /// 根据通知主键删除对应的所有通知审批信息 /// /// 通知主键 public static void DeleteNoticeSignByNoticeId(string noticeId) { Model.SGGLDB db = Funs.DB; var q = (from x in db.Common_NoticeSign where x.NoticeId == noticeId select x).ToList(); db.Common_NoticeSign.DeleteAllOnSubmit(q); db.SubmitChanges(); } /// /// 根据用户主键获得通知审批的数量 /// /// 角色 /// public static int GetNoticeSignCountByUserId(string userId) { var q = (from x in Funs.DB.Common_NoticeSign where x.SignMan == userId select x).ToList(); return q.Count(); } } }