186 lines
6.5 KiB
C#
186 lines
6.5 KiB
C#
using Model;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace BLL
|
|
{
|
|
/// <summary>
|
|
/// 关键事项明细
|
|
/// </summary>
|
|
public static class GJSXItemService
|
|
{
|
|
public static Model.SGGLDB db = Funs.DB;
|
|
|
|
/// <summary>
|
|
/// 根据关键事项ID查询所有关键事项进展
|
|
/// </summary>
|
|
/// <param name="GJSXID">关键事项ID</param>
|
|
/// <returns></returns>
|
|
public static List<Model.GJSX_detail> GetGJSXDetailByGJSXID(string GJSXID)
|
|
{
|
|
return (from x in Funs.DB.GJSX_detail where x.GJSXID == GJSXID orderby x.Sort select x).ToList();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据关键事项ID查询所有事项进展
|
|
/// </summary>
|
|
/// <param name="guid">关键事项ID</param>
|
|
/// <returns></returns>
|
|
public static System.Collections.IEnumerable GetIEnumerableByGJSXID(string GJSXID)
|
|
{
|
|
return from x in db.GJSX_detail
|
|
where x.GJSXID == GJSXID
|
|
orderby x.Sort
|
|
select new
|
|
{
|
|
x.Cuid,
|
|
x.GJSXID,
|
|
x.Progress_user,
|
|
x.Date,
|
|
x.Progress_detail,
|
|
x.FilePath
|
|
};
|
|
}
|
|
|
|
/// <summary>
|
|
/// 增加关键事项明细
|
|
/// </summary>
|
|
/// <param name="gjsxmx"></param>
|
|
public static void AddGJSXMX(Model.GJSX_detail gjsxmx)
|
|
{
|
|
Model.SGGLDB db = Funs.DB;
|
|
string newKeyID = SQLHelper.GetNewID(typeof(Model.GJSX_detail));
|
|
Model.GJSX_detail newGJSXMX = new Model.GJSX_detail();
|
|
|
|
newGJSXMX.Cuid = gjsxmx.Cuid;
|
|
newGJSXMX.GJSXID = gjsxmx.GJSXID;
|
|
newGJSXMX.Progress_user = gjsxmx.Progress_user;
|
|
newGJSXMX.Progress_detail = gjsxmx.Progress_detail;
|
|
newGJSXMX.Date = gjsxmx.Date;
|
|
newGJSXMX.Sort = gjsxmx.Sort;
|
|
newGJSXMX.FilePath = gjsxmx.FilePath;
|
|
newGJSXMX.ProgressStatus = gjsxmx.ProgressStatus;
|
|
|
|
db.GJSX_detail.InsertOnSubmit(newGJSXMX);
|
|
db.SubmitChanges();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据关键事项Id删除所对应的所有事项进展
|
|
/// </summary>
|
|
/// <param name="GJSXID">关键事项ID</param>
|
|
public static void DeleteGJSXMXByGJSXID(string GJSXID)
|
|
{
|
|
Model.SGGLDB db = Funs.DB;
|
|
var q = (from x in db.GJSX_detail where x.GJSXID == GJSXID select x).ToList();
|
|
if (q != null)
|
|
{
|
|
db.GJSX_detail.DeleteAllOnSubmit(q);
|
|
db.SubmitChanges();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 添加操作人员
|
|
/// </summary>
|
|
/// <param name="item"></param>
|
|
public static void AddItemUser(Model.GJSX_detail item)
|
|
{
|
|
Model.SGGLDB db = Funs.DB;
|
|
Model.GJSX_detail newitem = new Model.GJSX_detail();
|
|
string newKeyID = SQLHelper.GetNewID(typeof(Model.GJSX_detail));
|
|
newitem.Cuid = newKeyID;
|
|
newitem.GJSXID = item.GJSXID;
|
|
newitem.Progress_user = item.Progress_user;
|
|
newitem.Sort = item.Sort;
|
|
newitem.FilePath = item.FilePath;
|
|
newitem.Progress_detail = item.Progress_detail;
|
|
db.GJSX_detail.InsertOnSubmit(newitem);
|
|
db.SubmitChanges();
|
|
}
|
|
public static void UpdateGJSXdetail(Model.GJSX_detail _GJSX_detail)
|
|
{
|
|
Model.SGGLDB db = Funs.DB;
|
|
Model.GJSX_detail newGJSX_detail = db.GJSX_detail.FirstOrDefault(e => e.Cuid == _GJSX_detail.Cuid);
|
|
if (newGJSX_detail != null)
|
|
{
|
|
newGJSX_detail.Cuid = _GJSX_detail.Cuid;
|
|
newGJSX_detail.GJSXID = _GJSX_detail.GJSXID;
|
|
newGJSX_detail.Progress_user = _GJSX_detail.Progress_user;
|
|
newGJSX_detail.Progress_detail = _GJSX_detail.Progress_detail;
|
|
newGJSX_detail.Sort = _GJSX_detail.Sort;
|
|
newGJSX_detail.FilePath = _GJSX_detail.FilePath;
|
|
newGJSX_detail.ProgressStatus = newGJSX_detail.ProgressStatus;
|
|
|
|
db.SubmitChanges();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据关键事项编号获取关键事项进展信息
|
|
/// </summary>
|
|
/// <param name="GJSXID"></param>
|
|
/// <returns></returns>
|
|
public static Model.GJSX_detail GetGJSXItemByGJSXID(string GJSXID)
|
|
{
|
|
return (from x in Funs.DB.GJSX_detail where x.GJSXID == GJSXID select x).FirstOrDefault();
|
|
}
|
|
|
|
public static Model.GJSX_detail GetGJSXItemByGJSXID(string GJSXID,string userid)
|
|
{
|
|
return (from x in Funs.DB.GJSX_detail where x.GJSXID == GJSXID && x.Progress_user==userid select x).FirstOrDefault();
|
|
}
|
|
|
|
#region 删除外键引用
|
|
/// <summary>
|
|
/// 根据事项进展操作人获取事项进展信息
|
|
/// </summary>
|
|
/// <param name="userId"></param>
|
|
/// <returns></returns>
|
|
public static int GetGJSXMXByUserId(string userId)
|
|
{
|
|
return (from x in Funs.DB.GJSX_detail where x.Progress_user == userId select x).Count();
|
|
}
|
|
|
|
#endregion
|
|
|
|
/// <summary>
|
|
/// 关键事项明细是否存在该用户
|
|
/// </summary>
|
|
/// <param name="GJSXID"></param>
|
|
/// <param name="operationId"></param>
|
|
/// <returns></returns>
|
|
public static bool IsExistOperateionId(string GJSXID, string operationId)
|
|
{
|
|
var q = from x in db.GJSX_detail where x.GJSXID == GJSXID && x.Progress_user == operationId select x;
|
|
if (q.Count() > 0)
|
|
{
|
|
return true;
|
|
}
|
|
else
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据编号和负责人获取明细数量
|
|
/// </summary>
|
|
/// <param name="GJSXID"></param>
|
|
/// <param name="userId"></param>
|
|
/// <returns></returns>
|
|
public static int GetGJSXMXByGJSXIDAndUserId(string GJSXID, string userId)
|
|
{
|
|
return (from x in Funs.DB.GJSX_detail where x.GJSXID == GJSXID && x.Progress_user == userId select x).Count();
|
|
}
|
|
|
|
public static Model.GJSX_detail GetGJSXMXById(string id)
|
|
{
|
|
return Funs.DB.GJSX_detail.FirstOrDefault(e => e.Cuid == id);
|
|
}
|
|
}
|
|
}
|