108 lines
4.0 KiB
C#
108 lines
4.0 KiB
C#
|
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;
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 获取分页列表
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
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 ? "同意" : "不同意",
|
|||
|
};
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 根据通知Id获取一个通知审批信息
|
|||
|
/// </summary>
|
|||
|
/// <param name="noticeId">通知Id</param>
|
|||
|
/// <returns>一个通知审批实体</returns>
|
|||
|
public static Model.Common_NoticeSign GetNoticeSignByNoticeId(string noticeId)
|
|||
|
{
|
|||
|
return db.Common_NoticeSign.First(x => x.NoticeId == noticeId && x.SinaDate == null);
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 增加通知审批信息
|
|||
|
/// </summary>
|
|||
|
/// <param name="noticeSign">通知审批实体</param>
|
|||
|
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();
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 修改通知审批信息
|
|||
|
/// </summary>
|
|||
|
/// <param name="noticeSign">通知审批实体</param>
|
|||
|
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();
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 根据通知主键删除对应的所有通知审批信息
|
|||
|
/// </summary>
|
|||
|
/// <param name="noticeId">通知主键</param>
|
|||
|
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();
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 根据用户主键获得通知审批的数量
|
|||
|
/// </summary>
|
|||
|
/// <param name="userId">角色</param>
|
|||
|
/// <returns></returns>
|
|||
|
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();
|
|||
|
}
|
|||
|
}
|
|||
|
}
|