dd
This commit is contained in:
@@ -0,0 +1,195 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace BLL
|
||||
{
|
||||
public static class AudiFlowService
|
||||
{
|
||||
/// <summary>
|
||||
/// 根据工作流模块查询审核步骤集合
|
||||
/// </summary>
|
||||
/// <param name="flowModule">工作流模块</param>
|
||||
/// <returns></returns>
|
||||
public static List<Model.AudiFlow> GetAudiFlowsByFlowModule(string flowModule)
|
||||
{
|
||||
return (from x in Funs.DB.AudiFlow where x.FlowModule == flowModule orderby x.AudiFlowStep select x).ToList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据工作流模块与审核步骤编号查询审核步骤
|
||||
/// </summary>
|
||||
/// <param name="flowModule">工作流模块</param>
|
||||
/// <param name="audiFlowCode">审核步骤编号</param>
|
||||
/// <returns></returns>
|
||||
public static Model.AudiFlow GetAudiFlowsByFlowModuleAndAudiFlowId(string flowModule, string audiFlowId)
|
||||
{
|
||||
return (from x in Funs.DB.AudiFlow where x.FlowModule == flowModule && x.AudiFlowId == audiFlowId select x).FirstOrDefault();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取流程的第一个步骤
|
||||
/// </summary>
|
||||
/// <param name="flowModule"></param>
|
||||
/// <param name="audiFlowStep"></param>
|
||||
/// <returns></returns>
|
||||
public static Model.AudiFlow GetFristAuditFlowStep(string flowModule)
|
||||
{
|
||||
return (from x in Funs.DB.AudiFlow where x.FlowModule == flowModule orderby x.AudiFlowStep select x).FirstOrDefault();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取流程下一步骤
|
||||
/// </summary>
|
||||
/// <param name="flowModule">菜单ID</param>
|
||||
/// <param name="audiFlowStep">步骤</param>
|
||||
/// <returns></returns>
|
||||
public static List<Model.AudiFlow> GetNextAuditFlowStep(string flowModule, int audiFlowStep)
|
||||
{
|
||||
var q = from x in Funs.DB.AudiFlow where x.FlowModule == flowModule && x.AudiFlowStep > audiFlowStep orderby x.AudiFlowStep select x;
|
||||
if (q.Count() > 0)
|
||||
{
|
||||
return q.ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据步骤获取菜单的流程信息
|
||||
/// </summary>
|
||||
/// <param name="flowModule"></param>
|
||||
/// <param name="audiFlowStep"></param>
|
||||
/// <returns></returns>
|
||||
public static Model.AudiFlow GetAuditFlow(string flowModule, int audiFlowStep)
|
||||
{
|
||||
return (from x in Funs.DB.AudiFlow where x.FlowModule == flowModule && x.AudiFlowStep == audiFlowStep select x).FirstOrDefault();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取结束的步骤
|
||||
/// </summary>
|
||||
/// <param name="flowModule"></param>
|
||||
/// <returns></returns>
|
||||
public static Model.AudiFlow GetEndAuditFlowStep(string flowModule)
|
||||
{
|
||||
return (from x in Funs.DB.AudiFlow where x.FlowModule == flowModule && x.IsFlowEnd == true select x).FirstOrDefault();
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取结束的步骤集合
|
||||
/// </summary>
|
||||
/// <param name="flowModule"></param>
|
||||
/// <returns></returns>
|
||||
public static List<Model.AudiFlow> GetEndAuditFlowStepList(string flowModule)
|
||||
{
|
||||
return (from x in Funs.DB.AudiFlow where x.FlowModule == flowModule && x.IsFlowEnd == true select x).ToList();
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取结束步骤的前一步骤
|
||||
/// </summary>
|
||||
/// <param name="flowModule"></param>
|
||||
/// <returns></returns>
|
||||
public static int? GetPreStepOfEndStep(string flowModule)
|
||||
{
|
||||
var q = from x in Funs.DB.AudiFlow where x.FlowModule == flowModule && x.IsFlowEnd == true select x;
|
||||
if (q.Count() > 0)
|
||||
{
|
||||
int endStep = q.First().AudiFlowStep;
|
||||
return endStep - 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 流程结束是否设置
|
||||
/// </summary>
|
||||
/// <param name="flowModule"></param>
|
||||
/// <returns></returns>
|
||||
public static bool IsAuditFlowEnd(string flowModule, string audiFlowId)
|
||||
{
|
||||
bool isEnd = false;
|
||||
if (audiFlowId == null)
|
||||
{
|
||||
var q = from x in Funs.DB.AudiFlow where x.FlowModule == flowModule && x.IsFlowEnd == true select x;
|
||||
if (q.Count() > 0)
|
||||
{
|
||||
isEnd = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var q = from x in Funs.DB.AudiFlow where x.FlowModule == flowModule && x.AudiFlowId != audiFlowId && x.IsFlowEnd == true select x;
|
||||
if (q.Count() > 0)
|
||||
{
|
||||
isEnd = true;
|
||||
}
|
||||
}
|
||||
return isEnd;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加工作流信息
|
||||
/// </summary>
|
||||
/// <param name="flow"></param>
|
||||
public static void AddAuditFlow(Model.AudiFlow flow)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
string newKeyID = SQLHelper.GetNewID(typeof(Model.AudiFlow));
|
||||
Model.AudiFlow newFlow = new Model.AudiFlow();
|
||||
newFlow.AudiFlowId = newKeyID;
|
||||
newFlow.AudiFlowStep = flow.AudiFlowStep;
|
||||
newFlow.AuditFlowName = flow.AuditFlowName;
|
||||
newFlow.FlowModule = flow.FlowModule;
|
||||
newFlow.NextAuditFlow = flow.NextAuditFlow;
|
||||
newFlow.RoleId = flow.RoleId;
|
||||
newFlow.IsFlowEnd = flow.IsFlowEnd;
|
||||
|
||||
db.AudiFlow.InsertOnSubmit(newFlow);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 修改工作流信息
|
||||
/// </summary>
|
||||
/// <param name="flow"></param>
|
||||
public static void UpdateAuditFlow(Model.AudiFlow flow)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
Model.AudiFlow newFlow = db.AudiFlow.FirstOrDefault(e => e.AudiFlowId == flow.AudiFlowId);
|
||||
if (newFlow != null)
|
||||
{
|
||||
newFlow.AudiFlowStep = flow.AudiFlowStep;
|
||||
newFlow.AuditFlowName = flow.AuditFlowName;
|
||||
newFlow.FlowModule = flow.FlowModule;
|
||||
newFlow.NextAuditFlow = flow.NextAuditFlow;
|
||||
newFlow.RoleId = flow.RoleId;
|
||||
newFlow.IsFlowEnd = flow.IsFlowEnd;
|
||||
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 删除工作流信息
|
||||
/// </summary>
|
||||
/// <param name="audiFlowId"></param>
|
||||
public static void DeleteAuditFlow(string audiFlowId)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
Model.AudiFlow flow = db.AudiFlow.First(e => e.AudiFlowId == audiFlowId);
|
||||
db.AudiFlow.DeleteOnSubmit(flow);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,136 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace BLL
|
||||
{
|
||||
public static class AuditFlowApproveService
|
||||
{
|
||||
/// <summary>
|
||||
/// 返回对应主表的审批明细
|
||||
/// </summary>
|
||||
/// <param name="toKey"></param>
|
||||
/// <returns></returns>
|
||||
public static List<Model.AuditFlowApprove> GetAuditFlowApprove(string toKey)
|
||||
{
|
||||
return Funs.DB.AuditFlowApprove.Where(e => e.ToKey == toKey).ToList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 返回对应主表的审批明细
|
||||
/// </summary>
|
||||
/// <param name="toKey"></param>
|
||||
/// <returns></returns>
|
||||
public static Model.AuditFlowApprove GetAuditFlowApproveByToKey(string toKey)
|
||||
{
|
||||
return Funs.DB.AuditFlowApprove.FirstOrDefault(x => x.ToKey == toKey && x.HandleDate == null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 返回对应主表是否存在审批明细
|
||||
/// </summary>
|
||||
/// <param name="toKey"></param>
|
||||
/// <returns></returns>
|
||||
public static bool IsExitsAuditFlowApproveByToKey(string toKey)
|
||||
{
|
||||
return (from x in Funs.DB.AuditFlowApprove where x.ToKey == toKey select x).Count()>0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加审批明细信息
|
||||
/// </summary>
|
||||
/// <param name="flow"></param>
|
||||
public static void AddAuditFlowApprove(Model.AuditFlowApprove approve)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
string newKeyID = SQLHelper.GetNewID(typeof(Model.AuditFlowApprove));
|
||||
Model.AuditFlowApprove newApprove = new Model.AuditFlowApprove();
|
||||
newApprove.AuditFlowApproveId = newKeyID;
|
||||
newApprove.ToKey = approve.ToKey;
|
||||
newApprove.MenuId = approve.MenuId;
|
||||
newApprove.HandleUser = approve.HandleUser;
|
||||
newApprove.HandleDate = approve.HandleDate;
|
||||
newApprove.MyOpinions=approve.MyOpinions;
|
||||
newApprove.IsAgree = approve.IsAgree;
|
||||
newApprove.HandleStep = approve.HandleStep;
|
||||
|
||||
db.AuditFlowApprove.InsertOnSubmit(newApprove);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 修改审批明细信息
|
||||
/// </summary>
|
||||
/// <param name="flow"></param>
|
||||
public static void UpdateAuditFlowApprove(Model.AuditFlowApprove approve)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
Model.AuditFlowApprove newApprove = db.AuditFlowApprove.FirstOrDefault(e => e.AuditFlowApproveId == approve.AuditFlowApproveId);
|
||||
if (newApprove != null)
|
||||
{
|
||||
newApprove.ToKey = approve.ToKey;
|
||||
newApprove.MenuId = approve.MenuId;
|
||||
newApprove.HandleUser = approve.HandleUser;
|
||||
newApprove.HandleDate = approve.HandleDate;
|
||||
newApprove.MyOpinions = approve.MyOpinions;
|
||||
newApprove.IsAgree = approve.IsAgree;
|
||||
newApprove.HandleStep = approve.HandleStep;
|
||||
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 删除审批明细信息
|
||||
/// </summary>
|
||||
/// <param name="audiFlowId"></param>
|
||||
public static void DeleteAuditFlowApprove(string toKey)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
var approves = db.AuditFlowApprove.Where(e => e.ToKey == toKey);
|
||||
db.AuditFlowApprove.DeleteAllOnSubmit(approves);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取审批过程用户
|
||||
/// </summary>
|
||||
/// <param name="userId"></param>
|
||||
/// <returns></returns>
|
||||
public static string GetUserName(string toKey, int? type)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
string userName = string.Empty;
|
||||
|
||||
var q = from x in db.AuditFlowApprove where x.ToKey ==toKey && x.HandleStep == type && x.HandleDate != null select x;
|
||||
if (q.Count() > 0)
|
||||
{
|
||||
Model.Sys_User m = db.Sys_User.FirstOrDefault(e => e.UserId == q.First().HandleUser);
|
||||
if (m != null)
|
||||
{
|
||||
userName = m.UserName;
|
||||
}
|
||||
}
|
||||
return userName;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取发布日期
|
||||
/// </summary>
|
||||
/// <param name="userId"></param>
|
||||
/// <returns></returns>
|
||||
public static string GetIssueDate(string toKey, int? type)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
string issueDate = string.Empty;
|
||||
|
||||
var q = from x in db.AuditFlowApprove where x.ToKey == toKey && x.HandleStep == type && x.HandleDate != null select x;
|
||||
if (q.Count() > 0)
|
||||
{
|
||||
issueDate = q.First().HandleDate.ToString();
|
||||
}
|
||||
return issueDate;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,161 @@
|
||||
namespace BLL
|
||||
{
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Data.Linq;
|
||||
using System.Web.Security;
|
||||
using System.Web.UI.WebControls;
|
||||
using Model;
|
||||
using BLL;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public static class Base_DepartService
|
||||
{
|
||||
public static Model.SGGLDB db = Funs.DB;
|
||||
|
||||
/// <summary>
|
||||
/// 获取部门信息
|
||||
/// </summary>
|
||||
/// <param name="depId">部门Id</param>
|
||||
/// <returns></returns>
|
||||
public static Model.Base_Depart GetDepart(string depId)
|
||||
{
|
||||
return Funs.DB.Base_Depart.FirstOrDefault(x => x.DepartId == depId);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据部门名称获取部门信息
|
||||
/// </summary>
|
||||
/// <param name="depId"></param>
|
||||
/// <returns></returns>
|
||||
public static Model.Base_Depart GetDepartByName(string departName)
|
||||
{
|
||||
return Funs.DB.Base_Depart.FirstOrDefault(x => x.DepartName == departName);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 增加部门
|
||||
/// </summary>
|
||||
/// <param name="depCode"></param>
|
||||
/// <param name="depHead"></param>
|
||||
/// <param name="depName"></param>
|
||||
/// <param name="remark"></param>
|
||||
public static void AddDepart(Model.Base_Depart depart)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
string newKeyID = SQLHelper.GetNewID(typeof(Model.Base_Depart));
|
||||
Model.Base_Depart dep = new Model.Base_Depart();
|
||||
dep.DepartId = newKeyID;
|
||||
dep.DepartCode = depart.DepartCode;
|
||||
dep.DepartHead = depart.DepartHead;
|
||||
dep.DepartName = depart.DepartName;
|
||||
dep.Remark = depart.Remark;
|
||||
db.Base_Depart.InsertOnSubmit(dep);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 修改部门信息
|
||||
/// </summary>
|
||||
/// <param name="depId">部门主键</param>
|
||||
/// <param name="depCode"></param>
|
||||
/// <param name="depHead"></param>
|
||||
/// <param name="depName"></param>
|
||||
/// <param name="remark"></param>
|
||||
public static void UpdateDepart(Model.Base_Depart depart)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
Model.Base_Depart dep = db.Base_Depart.FirstOrDefault(e => e.DepartId == depart.DepartId);
|
||||
if (dep != null)
|
||||
{
|
||||
dep.DepartCode = depart.DepartCode;
|
||||
dep.DepartHead = depart.DepartHead;
|
||||
dep.DepartName = depart.DepartName;
|
||||
dep.Remark = depart.Remark;
|
||||
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 删除部门
|
||||
/// </summary>
|
||||
/// <param name="depId"></param>
|
||||
public static void DeleteDepart(string depId)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
Model.Base_Depart dep = db.Base_Depart.First(e => e.DepartId == depId);
|
||||
db.Base_Depart.DeleteOnSubmit(dep);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 判断部门编号或名称是否重复
|
||||
/// </summary>
|
||||
/// <param name="departId"></param>
|
||||
/// <param name="departCode"></param>
|
||||
/// <param name="departName"></param>
|
||||
/// <returns></returns>
|
||||
public static bool IsExistDepart(string departId, string departCode, string departName)
|
||||
{
|
||||
bool isExist = false;
|
||||
if (departId == null)
|
||||
{
|
||||
var depart = Funs.DB.Base_Depart.FirstOrDefault(x => x.DepartCode == departCode || x.DepartName == departName);
|
||||
if (depart != null)
|
||||
{
|
||||
isExist = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var depart = Funs.DB.Base_Depart.FirstOrDefault(x => (x.DepartCode == departCode || x.DepartName == departName) && x.DepartId != departId);
|
||||
if (depart != null)
|
||||
{
|
||||
isExist = true;
|
||||
}
|
||||
}
|
||||
return isExist;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取部门项
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static ListItem[] GetDepartList()
|
||||
{
|
||||
var q = (from x in Funs.DB.Base_Depart orderby x.DepartCode select x).ToList();
|
||||
ListItem[] lis = new ListItem[q.Count()];
|
||||
|
||||
for (int i = 0; i < q.Count(); i++)
|
||||
{
|
||||
lis[i] = new ListItem(q[i].DepartName ?? "", q[i].DepartId.ToString());
|
||||
}
|
||||
|
||||
return lis;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据部门名称模糊查询所有部门信息
|
||||
/// </summary>
|
||||
/// <param name="departName">部门名称</param>
|
||||
/// <returns></returns>
|
||||
public static List<Model.Base_Depart> GetDepartByDepartName(string departName)
|
||||
{
|
||||
return (from x in Funs.DB.Base_Depart where x.DepartName.Contains(departName) select x).ToList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取部门列表信息
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static List<Model.Base_Depart> GetDeparts()
|
||||
{
|
||||
return (from x in Funs.DB.Base_Depart orderby x.DepartCode select x).ToList();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,122 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace BLL
|
||||
{
|
||||
public class Base_OrganizationService
|
||||
{
|
||||
public static Model.SGGLDB db = Funs.DB;
|
||||
|
||||
/// <summary>
|
||||
///获取机构管理信息
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static Model.Base_Organization GetOrganizationByOrganizationId(string organizationId)
|
||||
{
|
||||
return Funs.DB.Base_Organization.FirstOrDefault(e => e.OrganizationId == organizationId);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///获取机构管理信息
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static List<Model.Base_Organization> GetOrganizationsByUnitId(string projectId, string unitId)
|
||||
{
|
||||
return (from x in Funs.DB.Base_Organization where x.UnitId == unitId && x.ProjectId == projectId select x).ToList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 增加机构管理信息
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static void AddOrganization(Model.Base_Organization organization)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
string newKeyID = SQLHelper.GetNewID(typeof(Model.Base_Organization));
|
||||
Model.Base_Organization newOrganization = new Model.Base_Organization();
|
||||
newOrganization.OrganizationId = newKeyID;
|
||||
newOrganization.ProjectId = organization.ProjectId;
|
||||
newOrganization.UnitId = organization.UnitId;
|
||||
newOrganization.Post = organization.Post;
|
||||
newOrganization.CardNo = organization.CardNo;
|
||||
newOrganization.PersonName = organization.PersonName;
|
||||
newOrganization.CellPhone = organization.CellPhone;
|
||||
newOrganization.Telephone = organization.Telephone;
|
||||
newOrganization.Email = organization.Email;
|
||||
|
||||
db.Base_Organization.InsertOnSubmit(newOrganization);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///修改机构管理信息
|
||||
/// </summary>
|
||||
/// <param name="organization"></param>
|
||||
public static void UpdateOrganization(Model.Base_Organization organization)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
Model.Base_Organization newOrganization = db.Base_Organization.First(e => e.OrganizationId == organization.OrganizationId);
|
||||
newOrganization.ProjectId = organization.ProjectId;
|
||||
newOrganization.UnitId = organization.UnitId;
|
||||
newOrganization.Post = organization.Post;
|
||||
newOrganization.CardNo = organization.CardNo;
|
||||
newOrganization.PersonName = organization.PersonName;
|
||||
newOrganization.CellPhone = organization.CellPhone;
|
||||
newOrganization.Telephone = organization.Telephone;
|
||||
newOrganization.Email = organization.Email;
|
||||
|
||||
db.SubmitChanges();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 删除所有机构管理信息
|
||||
/// </summary>
|
||||
public static void DeleteOrganizationByUnitId(string unitId)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
var q = (from x in db.Base_Organization where x.UnitId == unitId select x).ToList();
|
||||
|
||||
db.Base_Organization.DeleteAllOnSubmit(q);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 删除组织机构
|
||||
/// </summary>
|
||||
/// <param name="organizationId"></param>
|
||||
public static void DeleteOrganization(string organizationId)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
var q = Funs.DB.Base_Organization.FirstOrDefault(e => e.OrganizationId == organizationId);
|
||||
if (q != null)
|
||||
{
|
||||
db.Base_Organization.DeleteOnSubmit(q);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据单位主键获得机构管理的数量
|
||||
/// </summary>
|
||||
/// <param name="unitId">单位主键</param>
|
||||
/// <returns></returns>
|
||||
public static int GetOrganizationCountByUnitId(string unitId)
|
||||
{
|
||||
var q = (from x in Funs.DB.Base_Organization where x.UnitId == unitId select x).ToList();
|
||||
return q.Count();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据项目主键获得机构管理的数量
|
||||
/// </summary>
|
||||
/// <param name="projectId">项目主键</param>
|
||||
/// <returns></returns>
|
||||
public static int GetOrganizationCountByProjectId(string projectId)
|
||||
{
|
||||
var q = (from x in Funs.DB.Base_Organization where x.ProjectId == projectId select x).ToList();
|
||||
return q.Count();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Data.Linq;
|
||||
using System.Web.Security;
|
||||
using System.Web.UI.WebControls;
|
||||
using Model;
|
||||
using BLL;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace BLL
|
||||
{
|
||||
public static class Base_PrintFileCodeService
|
||||
{
|
||||
public static Model.SGGLDB db = Funs.DB;
|
||||
|
||||
/// <summary>
|
||||
/// 获取打印文件编号
|
||||
/// </summary>
|
||||
/// <param name="depId">部门Id</param>
|
||||
/// <returns></returns>
|
||||
public static Model.Base_PrintFileCode GetPrintFileCodeByFileId(string fileId)
|
||||
{
|
||||
return Funs.DB.Base_PrintFileCode.FirstOrDefault(x => x.FileId == fileId);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 增加部门
|
||||
/// </summary>
|
||||
/// <param name="depCode"></param>
|
||||
/// <param name="depHead"></param>
|
||||
/// <param name="depName"></param>
|
||||
/// <param name="remark"></param>
|
||||
public static void AddPrintFileCode(Model.Base_PrintFileCode depart)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
string newKeyID = SQLHelper.GetNewID(typeof(Model.Base_PrintFileCode));
|
||||
Model.Base_PrintFileCode code = new Model.Base_PrintFileCode();
|
||||
code.Id = newKeyID;
|
||||
code.ProjectId = depart.ProjectId;
|
||||
code.FileType = depart.FileType;
|
||||
code.FileCode = depart.FileCode;
|
||||
code.FileId = depart.FileId;
|
||||
code.FileCode2 = depart.FileCode2;
|
||||
db.Base_PrintFileCode.InsertOnSubmit(code);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 修改打印文件编号
|
||||
/// </summary>
|
||||
/// <param name="depId">部门主键</param>
|
||||
/// <param name="depCode"></param>
|
||||
/// <param name="depHead"></param>
|
||||
/// <param name="depName"></param>
|
||||
/// <param name="remark"></param>
|
||||
public static void UpdatePrintFileCode(Model.Base_PrintFileCode depart)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
Model.Base_PrintFileCode code = db.Base_PrintFileCode.FirstOrDefault(e => e.Id == depart.Id);
|
||||
if (code != null)
|
||||
{
|
||||
code.FileType = depart.FileType;
|
||||
code.FileCode = depart.FileCode;
|
||||
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 删除部门
|
||||
/// </summary>
|
||||
/// <param name="depId"></param>
|
||||
public static void DeletePrintFileCode(string Id)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
Model.Base_PrintFileCode dep = db.Base_PrintFileCode.First(e => e.Id == Id);
|
||||
db.Base_PrintFileCode.DeleteOnSubmit(dep);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,580 @@
|
||||
namespace BLL
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Data.Linq;
|
||||
using System.Web.Security;
|
||||
using System.Web.UI.WebControls;
|
||||
using Model;
|
||||
using BLL;
|
||||
using System.Collections;
|
||||
|
||||
public static class Base_ProjectService
|
||||
{
|
||||
public static Model.SGGLDB db = Funs.DB;
|
||||
|
||||
/// <summary>
|
||||
///获取项目信息
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static Model.Base_Project GetProjectByProjectId(string projectId)
|
||||
{
|
||||
return Funs.DB.Base_Project.FirstOrDefault(e => e.ProjectId == projectId);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///获取项目信息
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static List<Model.Base_Project> GetProjectByTestStandardId(string testStandardId)
|
||||
{
|
||||
return (from x in Funs.DB.Base_Project where x.TestStandardId == testStandardId select x).ToList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///获取项目编号
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static string GetProjectCode(string projectId)
|
||||
{
|
||||
Model.Base_Project project = Funs.DB.Base_Project.FirstOrDefault(e => e.ProjectId == projectId);
|
||||
if (project == null)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
else
|
||||
{
|
||||
return project.ProjectCode;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///获取项目简称
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static string GetProjectName(string projectId)
|
||||
{
|
||||
Model.Base_Project project = Funs.DB.Base_Project.FirstOrDefault(e => e.ProjectId == projectId);
|
||||
if (project == null)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
else
|
||||
{
|
||||
return project.ShortName;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 判断施工号是否存在
|
||||
/// </summary>
|
||||
/// <param name="projectId">项目ID</param>
|
||||
/// <param name="projectCode">施工号</param>
|
||||
/// <returns></returns>
|
||||
public static bool IsExistProjectCode(string projectId, string projectCode, string projectSoft)
|
||||
{
|
||||
bool isExitCode = false;
|
||||
var q = from x in Funs.DB.Base_Project where x.ProjectSoft==projectSoft && x.ProjectCode == projectCode && x.ProjectId != projectId select x;
|
||||
if (q.Count() > 0)
|
||||
{
|
||||
isExitCode = true;
|
||||
}
|
||||
return isExitCode;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 增加项目信息
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static void AddProject(Model.Base_Project project)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
Model.Base_Project newProject = new Base_Project();
|
||||
newProject.ProjectId = project.ProjectId;
|
||||
newProject.ProjectCode = project.ProjectCode;
|
||||
newProject.ProjectName = project.ProjectName;
|
||||
newProject.ShortName = project.ShortName;
|
||||
newProject.StartDate = project.StartDate;
|
||||
newProject.EndDate = project.EndDate;
|
||||
newProject.ProjectPrincipal = project.ProjectPrincipal;
|
||||
newProject.TechnicalPrincipal = project.TechnicalPrincipal;
|
||||
newProject.SecurePrincipal = project.SecurePrincipal;
|
||||
newProject.ProjectManager = project.ProjectManager;
|
||||
|
||||
newProject.Remark = project.Remark;
|
||||
newProject.IsClosed = project.IsClosed;
|
||||
newProject.TestEngineeringCode = project.TestEngineeringCode;
|
||||
newProject.CreateManId = project.CreateManId;
|
||||
newProject.ProjectSoft = project.ProjectSoft;
|
||||
newProject.CheckUnitId = project.CheckUnitId;
|
||||
newProject.WatchUnit = project.WatchUnit;
|
||||
newProject.TestStandardId = project.TestStandardId;
|
||||
|
||||
|
||||
newProject.EquipmentName = project.EquipmentName;
|
||||
newProject.TagNum = project.TagNum;
|
||||
newProject.ProductNum = project.ProductNum;
|
||||
newProject.BodyMaterial = project.BodyMaterial;
|
||||
|
||||
db.Base_Project.InsertOnSubmit(newProject);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
|
||||
///修改项目信息
|
||||
/// </summary>
|
||||
/// <param name="project"></param>
|
||||
public static void UpdateProject(Model.Base_Project project)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
Model.Base_Project newProject = db.Base_Project.First(e => e.ProjectId == project.ProjectId);
|
||||
newProject.ProjectCode = project.ProjectCode;
|
||||
newProject.ProjectName = project.ProjectName;
|
||||
newProject.ShortName = project.ShortName;
|
||||
newProject.StartDate = project.StartDate;
|
||||
newProject.EndDate = project.EndDate;
|
||||
newProject.ProjectPrincipal = project.ProjectPrincipal;
|
||||
newProject.TechnicalPrincipal = project.TechnicalPrincipal;
|
||||
newProject.SecurePrincipal = project.SecurePrincipal;
|
||||
newProject.ProjectManager = project.ProjectManager;
|
||||
newProject.Remark = project.Remark;
|
||||
newProject.IsClosed = project.IsClosed;
|
||||
newProject.TestEngineeringCode = project.TestEngineeringCode;
|
||||
newProject.CreateManId = project.CreateManId;
|
||||
newProject.ProjectSoft = project.ProjectSoft;
|
||||
newProject.CheckUnitId = project.CheckUnitId;
|
||||
newProject.WatchUnit = project.WatchUnit;
|
||||
newProject.TestStandardId = project.TestStandardId;
|
||||
newProject.EquipmentName = project.EquipmentName;
|
||||
newProject.TagNum = project.TagNum;
|
||||
newProject.ProductNum = project.ProductNum;
|
||||
newProject.BodyMaterial = project.BodyMaterial;
|
||||
db.SubmitChanges();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据项目Id删除一个项目信息
|
||||
/// </summary>
|
||||
/// <param name="projectId"></param>
|
||||
public static void DeleteProject(string projectId)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
Model.Base_Project project = db.Base_Project.FirstOrDefault(e => e.ProjectId == projectId);
|
||||
if (project != null)
|
||||
{
|
||||
var bt = from x in db.Project_RoleButtonPower where x.ProjectId == projectId select x;
|
||||
if (bt.Count() > 0)
|
||||
{
|
||||
db.Project_RoleButtonPower.DeleteAllOnSubmit(bt);
|
||||
}
|
||||
var rolePower = from x in db.Project_RolePower where x.ProjectId == projectId select x;
|
||||
if (rolePower.Count() > 0)
|
||||
{
|
||||
db.Project_RolePower.DeleteAllOnSubmit(rolePower);
|
||||
}
|
||||
|
||||
var report = from x in db.Common_ReportServer where x.ProjectId == projectId select x;
|
||||
if (report.Count() > 0)
|
||||
{
|
||||
db.Common_ReportServer.DeleteAllOnSubmit(report);
|
||||
}
|
||||
|
||||
var set = from x in db.Project_Sys_Set where x.ProjectId == projectId select x;
|
||||
if (set.Count() > 0)
|
||||
{
|
||||
db.Project_Sys_Set.DeleteAllOnSubmit(set);
|
||||
}
|
||||
|
||||
var punit = from x in db.Project_Unit where x.ProjectId == projectId select x;
|
||||
if (punit.Count() > 0)
|
||||
{
|
||||
db.Project_Unit.DeleteAllOnSubmit(punit);
|
||||
}
|
||||
|
||||
var puser = from x in db.Project_User where x.ProjectId == projectId select x;
|
||||
if (puser.Count() > 0)
|
||||
{
|
||||
db.Project_User.DeleteAllOnSubmit(puser);
|
||||
}
|
||||
|
||||
db.SubmitChanges();
|
||||
}
|
||||
|
||||
db.Base_Project.DeleteOnSubmit(project);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据用户Id获取项目集合
|
||||
/// </summary>
|
||||
/// <param name="userId">用户ID</param>
|
||||
/// <param name="projectSoft">1-管道安装,2-压力容器</param>
|
||||
/// <returns></returns>
|
||||
public static List<Model.Base_Project> GetProjectListByUserId(string userId, string projectSoft)
|
||||
{
|
||||
if (userId == BLL.Const.GlyId) //管理员
|
||||
{
|
||||
var q = (from x in Funs.DB.Base_Project
|
||||
where x.ProjectSoft == projectSoft
|
||||
orderby x.ProjectCode descending
|
||||
select x).ToList();
|
||||
return q;
|
||||
}
|
||||
else
|
||||
{
|
||||
var q = (from x in Funs.DB.Base_Project
|
||||
join y in Funs.DB.Project_User
|
||||
on x.ProjectId equals y.ProjectId
|
||||
where y.UserId == userId && x.ProjectSoft == projectSoft
|
||||
select x).Distinct().ToList();
|
||||
return q.OrderByDescending(x => x.ProjectCode).ToList();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据用户Id获取项目集合
|
||||
/// </summary>
|
||||
/// <param name="userId">用户ID</param>
|
||||
/// <param name="projectSoft">1-管道安装,2-压力容器</param>
|
||||
/// <returns></returns>
|
||||
public static List<YlrqProject> GetYlrqProjectListByUserId(string userId, string projectSoft)
|
||||
{
|
||||
if (userId == BLL.Const.GlyId) //管理员
|
||||
{
|
||||
var q = (from x in Funs.DB.Base_Project
|
||||
where x.ProjectSoft == projectSoft
|
||||
orderby x.ProjectCode descending
|
||||
select new YlrqProject
|
||||
{
|
||||
ProjectId = x.ProjectId,
|
||||
ProjectName = x.ProjectName,
|
||||
ShortName = x.ShortName,
|
||||
StartDate = x.StartDate,
|
||||
EndDate = x.EndDate,
|
||||
ProjectCode = x.ProjectCode,
|
||||
EquipmentName = x.EquipmentName,
|
||||
ProductNum = x.ProductNum,
|
||||
ProjectSoft = x.ProjectSoft,
|
||||
ProjectTextField = $"施工号:({x.ProjectCode}),设备名称:({x.EquipmentName}),产品编号:({x.ProductNum})"
|
||||
}).ToList();
|
||||
return q.OrderByDescending(x => x.ProjectCode).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
var q = (from x in Funs.DB.Base_Project
|
||||
join y in Funs.DB.Project_User
|
||||
on x.ProjectId equals y.ProjectId
|
||||
where y.UserId == userId && x.ProjectSoft == projectSoft
|
||||
select new YlrqProject
|
||||
{
|
||||
ProjectId = x.ProjectId,
|
||||
ProjectName = x.ProjectName,
|
||||
ShortName = x.ShortName,
|
||||
StartDate = x.StartDate,
|
||||
EndDate = x.EndDate,
|
||||
ProjectCode = x.ProjectCode,
|
||||
EquipmentName = x.EquipmentName,
|
||||
ProductNum = x.ProductNum,
|
||||
ProjectSoft = x.ProjectSoft,
|
||||
ProjectTextField = $"施工号:({x.ProjectCode}),设备名称:({x.EquipmentName}),产品编号:({x.ProductNum})"
|
||||
}).Distinct().ToList();
|
||||
return q.OrderByDescending(x => x.ProjectCode).ToList();
|
||||
}
|
||||
}
|
||||
|
||||
public class YlrqProject : Base_Project
|
||||
{
|
||||
public string ProjectTextField { get; set; }
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取用户所有项目字符串
|
||||
/// </summary>
|
||||
/// <param name="userId"></param>
|
||||
/// <param name="projectSoft"></param>
|
||||
/// <returns></returns>
|
||||
public static string GetStrProjectIds(string userId, string projectSoft)
|
||||
{
|
||||
List<Model.Base_Project> projects = BLL.Base_ProjectService.GetProjectListByUserId(userId, projectSoft);
|
||||
string projectIds = string.Empty;
|
||||
foreach (var project in projects)
|
||||
{
|
||||
projectIds += project.ProjectId + ",";
|
||||
}
|
||||
return projectIds;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取用户所有在建项目字符串
|
||||
/// </summary>
|
||||
/// <param name="userId"></param>
|
||||
/// <param name="projectSoft"></param>
|
||||
/// <returns></returns>
|
||||
public static string GetStrOnProjectIds(string userId, string projectSoft)
|
||||
{
|
||||
List<Model.Base_Project> projects = BLL.Base_ProjectService.GetOnProjectListByUserId(userId, projectSoft);
|
||||
string projectIds = string.Empty;
|
||||
foreach (var project in projects)
|
||||
{
|
||||
projectIds += project.ProjectId + ",";
|
||||
}
|
||||
return projectIds;
|
||||
}
|
||||
|
||||
public static List<Model.Base_Project> GetOnProjectListByUserId(string userId)
|
||||
{
|
||||
if (userId == BLL.Const.GlyId) //管理员
|
||||
{
|
||||
var q = (from x in Funs.DB.Base_Project
|
||||
where x.IsClosed == false
|
||||
orderby x.ProjectCode descending
|
||||
select x).ToList();
|
||||
return q;
|
||||
}
|
||||
else
|
||||
{
|
||||
var q = (from x in Funs.DB.Base_Project
|
||||
join y in Funs.DB.Project_User
|
||||
on x.ProjectId equals y.ProjectId
|
||||
where y.UserId == userId && x.IsClosed == false
|
||||
select x).Distinct().ToList();
|
||||
return q.OrderByDescending(x => x.ProjectCode).ToList();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据用户Id获取参与在建项目的集合
|
||||
/// </summary>
|
||||
/// <param name="userId">用户ID</param>
|
||||
/// <param name="projectSoft">1-管道安装,2-压力容器</param>
|
||||
/// <returns></returns>
|
||||
public static List<Model.Base_Project> GetOnProjectListByUserId(string userId, string projectSoft)
|
||||
{
|
||||
if (userId == BLL.Const.GlyId) //管理员
|
||||
{
|
||||
var q = (from x in Funs.DB.Base_Project
|
||||
where x.IsClosed == false && x.ProjectSoft == projectSoft
|
||||
orderby x.ProjectCode descending
|
||||
select x).ToList();
|
||||
return q;
|
||||
}
|
||||
else
|
||||
{
|
||||
var q = (from x in Funs.DB.Base_Project
|
||||
join y in Funs.DB.Project_User
|
||||
on x.ProjectId equals y.ProjectId
|
||||
where y.UserId == userId && x.IsClosed == false && x.ProjectSoft == projectSoft
|
||||
select x).Distinct().ToList();
|
||||
return q.OrderByDescending(x => x.ProjectCode).ToList();
|
||||
}
|
||||
}
|
||||
|
||||
public static List<BaseProject> GetOnProjectListByUser(string userId, string projectSoft)
|
||||
{
|
||||
if (userId == BLL.Const.GlyId) //管理员
|
||||
{
|
||||
var q = (from x in Funs.DB.Base_Project
|
||||
where x.IsClosed == false && x.ProjectSoft == projectSoft
|
||||
orderby x.ProjectCode descending
|
||||
select new BaseProject { ProjectId = x.ProjectId, ProjectCode = x.ProjectCode, ProjectName = x.ProjectName }).ToList();
|
||||
return q;
|
||||
}
|
||||
else
|
||||
{
|
||||
var q = (from x in Funs.DB.Base_Project
|
||||
join y in Funs.DB.Project_User
|
||||
on x.ProjectId equals y.ProjectId
|
||||
where y.UserId == userId && x.IsClosed == false && x.ProjectSoft == projectSoft
|
||||
select new BaseProject { ProjectId = x.ProjectId, ProjectCode = x.ProjectCode, ProjectName = x.ProjectName }).Distinct().ToList();
|
||||
return q;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取RT的检测记录项目
|
||||
/// </summary>
|
||||
/// <param name="userId"></param>
|
||||
/// <param name="projectSoft"></param>
|
||||
/// <returns></returns>
|
||||
public static List<BaseProjectOutput> GetOnProjectListByRT(string userId, string projectSoft)
|
||||
{
|
||||
if (userId == BLL.Const.GlyId) //管理员
|
||||
{
|
||||
var q = (from x in Funs.DB.Base_Project
|
||||
where x.IsClosed == false && x.ProjectSoft == projectSoft
|
||||
orderby x.ProjectCode descending
|
||||
select new BaseProjectOutput {
|
||||
ProjectName = x.ProjectName,
|
||||
ProjectCode = x.ProjectCode,
|
||||
ProjectId = x.ProjectId,
|
||||
isExists = (from a in Funs.DB.HJGL_CH_Trust join b in Funs.DB.HJGL_CH_TrustItem on a.CH_TrustID equals b.CH_TrustID
|
||||
where a.ProjectId == x.ProjectId && b.Record_PrintDate==null
|
||||
&& a.CH_NDTMethod == "20d2cbca-8b3d-434b-b1c1-181796986fa5"
|
||||
select new {a.ProjectId}
|
||||
).Count()
|
||||
}
|
||||
).ToList();
|
||||
return q;
|
||||
}
|
||||
else
|
||||
{
|
||||
var q = (from x in Funs.DB.Base_Project
|
||||
join y in Funs.DB.Project_User
|
||||
on x.ProjectId equals y.ProjectId
|
||||
where y.UserId == userId && x.IsClosed == false && x.ProjectSoft == projectSoft
|
||||
select new BaseProjectOutput
|
||||
{
|
||||
ProjectName = x.ProjectName,
|
||||
ProjectCode = x.ProjectCode,
|
||||
ProjectId = x.ProjectId,
|
||||
isExists = (from a in Funs.DB.HJGL_CH_Trust
|
||||
join b in Funs.DB.HJGL_CH_TrustItem on a.CH_TrustID equals b.CH_TrustID
|
||||
where a.ProjectId == x.ProjectId && b.Record_PrintDate == null
|
||||
&& a.CH_NDTMethod == "20d2cbca-8b3d-434b-b1c1-181796986fa5"
|
||||
select new { a.ProjectId }
|
||||
).Count()
|
||||
}
|
||||
).Distinct().ToList();
|
||||
return q.OrderByDescending(x => x.ProjectCode).ToList();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取非RT的检测记录项目
|
||||
/// </summary>
|
||||
/// <param name="userId"></param>
|
||||
/// <param name="projectSoft"></param>
|
||||
/// <returns></returns>
|
||||
public static List<BaseProjectOutput> GetOnProjectListByNoRT(string userId, string projectSoft)
|
||||
{
|
||||
if (userId == BLL.Const.GlyId) //管理员
|
||||
{
|
||||
var q = (from x in Funs.DB.Base_Project
|
||||
where x.IsClosed == false && x.ProjectSoft == projectSoft
|
||||
orderby x.ProjectCode descending
|
||||
select new BaseProjectOutput
|
||||
{
|
||||
ProjectName = x.ProjectName,
|
||||
ProjectCode = x.ProjectCode,
|
||||
ProjectId = x.ProjectId,
|
||||
isExists = (from a in Funs.DB.HJGL_CH_Trust
|
||||
join b in Funs.DB.HJGL_CH_TrustItem on a.CH_TrustID equals b.CH_TrustID
|
||||
where a.ProjectId == x.ProjectId && b.Record_PrintDate == null
|
||||
&& a.CH_NDTMethod != "20d2cbca-8b3d-434b-b1c1-181796986fa5"
|
||||
select new { a.ProjectId }
|
||||
).Count()
|
||||
}
|
||||
).ToList();
|
||||
return q;
|
||||
}
|
||||
else
|
||||
{
|
||||
var q = (from x in Funs.DB.Base_Project
|
||||
join y in Funs.DB.Project_User
|
||||
on x.ProjectId equals y.ProjectId
|
||||
where y.UserId == userId && x.IsClosed == false && x.ProjectSoft == projectSoft
|
||||
select new BaseProjectOutput
|
||||
{
|
||||
ProjectName = x.ProjectName,
|
||||
ProjectCode = x.ProjectCode,
|
||||
ProjectId = x.ProjectId,
|
||||
isExists = (from a in Funs.DB.HJGL_CH_Trust
|
||||
join b in Funs.DB.HJGL_CH_TrustItem on a.CH_TrustID equals b.CH_TrustID
|
||||
where a.ProjectId == x.ProjectId && b.Record_PrintDate == null
|
||||
&& a.CH_NDTMethod != "20d2cbca-8b3d-434b-b1c1-181796986fa5"
|
||||
select new { a.ProjectId }
|
||||
).Count()
|
||||
}
|
||||
).Distinct().ToList();
|
||||
return q.OrderByDescending(x => x.ProjectCode).ToList();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据用户Id、项目状态、类型获取参与项目集合
|
||||
/// </summary>
|
||||
/// <param name="userId">用户ID</param>
|
||||
/// <param name="state">项目状态</param>
|
||||
/// <param name="projectSoft">类型:1-管道安装,2-压力容器</param>
|
||||
/// <returns></returns>
|
||||
public static List<Model.Base_Project> GetProjectListByUserIdAndState(string userId, string state, string projectSoft)
|
||||
{
|
||||
if (state == BLL.Const._Null)
|
||||
{
|
||||
if (userId == BLL.Const.GlyId) //管理员
|
||||
{
|
||||
var q = (from x in Funs.DB.Base_Project
|
||||
where x.ProjectSoft == projectSoft
|
||||
orderby x.ProjectCode descending
|
||||
select x).ToList();
|
||||
return q;
|
||||
}
|
||||
else
|
||||
{
|
||||
var q = (from x in Funs.DB.Base_Project
|
||||
join y in Funs.DB.Project_User
|
||||
on x.ProjectId equals y.ProjectId
|
||||
where y.UserId == userId && x.ProjectSoft == projectSoft
|
||||
select x).Distinct().ToList();
|
||||
return q.OrderByDescending(x => x.ProjectCode).ToList();
|
||||
}
|
||||
}
|
||||
else if (state == BLL.Const._True)
|
||||
{
|
||||
if (userId == BLL.Const.GlyId) //管理员
|
||||
{
|
||||
var q = (from x in Funs.DB.Base_Project
|
||||
where x.IsClosed == true && x.ProjectSoft == projectSoft
|
||||
orderby x.ProjectCode descending
|
||||
select x).ToList();
|
||||
return q;
|
||||
}
|
||||
else
|
||||
{
|
||||
var q = (from x in Funs.DB.Base_Project
|
||||
join y in Funs.DB.Project_User
|
||||
on x.ProjectId equals y.ProjectId
|
||||
where y.UserId == userId && x.IsClosed == true && x.ProjectSoft == projectSoft
|
||||
select x).Distinct().ToList();
|
||||
return q.OrderByDescending(x => x.ProjectCode).ToList();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (userId == BLL.Const.GlyId) //管理员
|
||||
{
|
||||
var q = (from x in Funs.DB.Base_Project
|
||||
where x.IsClosed == false && x.ProjectSoft == projectSoft
|
||||
orderby x.ProjectCode descending
|
||||
select x).ToList();
|
||||
return q;
|
||||
}
|
||||
else
|
||||
{
|
||||
var q = (from x in Funs.DB.Base_Project
|
||||
join y in Funs.DB.Project_User
|
||||
on x.ProjectId equals y.ProjectId
|
||||
where y.UserId == userId && x.IsClosed == false && x.ProjectSoft == projectSoft
|
||||
select x).Distinct().ToList();
|
||||
return q.OrderByDescending(x => x.ProjectCode).ToList();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class BaseProjectOutput:Model.Base_Project
|
||||
{
|
||||
public int isExists { get; set; }
|
||||
}
|
||||
|
||||
public class BaseProject
|
||||
{
|
||||
public string ProjectId { get; set; }
|
||||
public string ProjectCode { get; set; }
|
||||
public string ProjectName { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,204 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Model;
|
||||
using BLL;
|
||||
using System.Collections;
|
||||
using System.Web.UI.WebControls;
|
||||
|
||||
namespace BLL
|
||||
{
|
||||
public class Base_TeamGroupService
|
||||
{
|
||||
public static Model.SGGLDB db = Funs.DB;
|
||||
|
||||
/// <summary>
|
||||
/// 记录数
|
||||
/// </summary>
|
||||
public static int count
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 定义变量
|
||||
/// </summary>
|
||||
public static IQueryable<Model.Base_TeamGroup> qq = from x in db.Base_TeamGroup orderby x.TeamGroupCode select x;
|
||||
|
||||
/// <summary>
|
||||
/// 获取分页列表
|
||||
/// </summary>
|
||||
/// <param name="searchItem"></param>
|
||||
/// <param name="searchValue"></param>
|
||||
/// <param name="startRowIndex"></param>
|
||||
/// <param name="maximumRows"></param>
|
||||
/// <returns></returns>
|
||||
public static IEnumerable getListData(string projectId, string teamGroupCode, string teamGroupName, string unitId, int startRowIndex, int maximumRows)
|
||||
{
|
||||
IQueryable<Model.Base_TeamGroup> q = qq;
|
||||
if (!string.IsNullOrEmpty(teamGroupCode))
|
||||
{
|
||||
q = q.Where(e => e.TeamGroupCode.Contains(teamGroupCode));
|
||||
}
|
||||
if (!string.IsNullOrEmpty(teamGroupName))
|
||||
{
|
||||
q = q.Where(e => e.TeamGroupName.Contains(teamGroupName));
|
||||
}
|
||||
if (unitId != "0")
|
||||
{
|
||||
q = q.Where(e => e.UnitId == unitId);
|
||||
}
|
||||
|
||||
if (projectId != "0")
|
||||
{
|
||||
q = q.Where(e => e.ProjectId == projectId);
|
||||
}
|
||||
|
||||
count = q.Count();
|
||||
if (count == 0)
|
||||
{
|
||||
return new object[] { "" };
|
||||
}
|
||||
return from x in q.Skip(startRowIndex).Take(maximumRows)
|
||||
select new
|
||||
{
|
||||
x.TeamGroupId,
|
||||
x.TeamGroupCode,
|
||||
x.TeamGroupName,
|
||||
UnitName = (from y in db.Base_Unit where y.UnitId == x.UnitId select y.UnitName).First(),
|
||||
ProjectName = (from y in db.Base_Project where y.ProjectId == x.ProjectId select y.ProjectName).First(),
|
||||
Area = (from y in db.Project_WorkArea where y.WorkAreaId == x.Area select y.WorkAreaCode).First(),
|
||||
x.Remark
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取列表数
|
||||
/// </summary>
|
||||
/// <param name="teamGroupCode"></param>
|
||||
/// <param name="teamGroupName"></param>
|
||||
/// <param name="unitId"></param>
|
||||
/// <returns></returns>
|
||||
public static int GetListCount(string projectId, string teamGroupCode, string teamGroupName, string unitId)
|
||||
{
|
||||
return count;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据
|
||||
/// </summary>
|
||||
/// <param name="groupId"></param>
|
||||
/// <returns></returns>
|
||||
public static Model.Base_TeamGroup GetTeamGroupByTeamGroupId(string teamGroupId)
|
||||
{
|
||||
return Funs.DB.Base_TeamGroup.FirstOrDefault(e => e.TeamGroupId == teamGroupId);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据班组名称获取班组信息
|
||||
/// </summary>
|
||||
/// <param name="teamGroupName"></param>
|
||||
/// <returns></returns>
|
||||
public static Model.Base_TeamGroup GetTeamGroupByTeamGroupName(string projectId, string teamGroupName)
|
||||
{
|
||||
return Funs.DB.Base_TeamGroup.FirstOrDefault(e =>e.ProjectId==projectId && e.TeamGroupName == teamGroupName);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加班组信息
|
||||
/// </summary>
|
||||
/// <param name="?"></param>
|
||||
public static void AddTeamGroup(Model.Base_TeamGroup teamGroup)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
string newKeyID = SQLHelper.GetNewID(typeof(Model.Base_TeamGroup));
|
||||
Model.Base_TeamGroup newTeamGroup = new Model.Base_TeamGroup();
|
||||
newTeamGroup.TeamGroupId = newKeyID;
|
||||
newTeamGroup.TeamGroupCode = teamGroup.TeamGroupCode;
|
||||
newTeamGroup.TeamGroupName = teamGroup.TeamGroupName;
|
||||
newTeamGroup.UnitId = teamGroup.UnitId;
|
||||
newTeamGroup.ProjectId = teamGroup.ProjectId;
|
||||
newTeamGroup.Remark = teamGroup.Remark;
|
||||
newTeamGroup.Area = teamGroup.Area;
|
||||
|
||||
db.Base_TeamGroup.InsertOnSubmit(newTeamGroup);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 修改班组信息
|
||||
/// </summary>
|
||||
/// <param name="teamGroup"></param>
|
||||
public static void UpdateTeamGroup(Model.Base_TeamGroup teamGroup)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
Model.Base_TeamGroup newTeamGroup = db.Base_TeamGroup.First(e => e.TeamGroupId == teamGroup.TeamGroupId);
|
||||
newTeamGroup.TeamGroupCode = teamGroup.TeamGroupCode;
|
||||
newTeamGroup.TeamGroupName = teamGroup.TeamGroupName;
|
||||
newTeamGroup.UnitId = teamGroup.UnitId;
|
||||
newTeamGroup.ProjectId = teamGroup.ProjectId;
|
||||
newTeamGroup.Remark = teamGroup.Remark;
|
||||
newTeamGroup.Area = teamGroup.Area;
|
||||
|
||||
db.SubmitChanges();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 是否存在班组编号
|
||||
/// </summary>
|
||||
/// <param name="teamGroupCode"></param>
|
||||
/// <returns>true-存在,false-不存在</returns>
|
||||
public static bool IsExistTeamGroupCode(string projectId, string teamGroupCode)
|
||||
{
|
||||
var q = from x in Funs.DB.Base_TeamGroup where x.ProjectId == projectId && x.TeamGroupCode == teamGroupCode select x;
|
||||
if (q.Count() > 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 删除班组信息
|
||||
/// </summary>
|
||||
/// <param name="teamGroupId"></param>
|
||||
public static void DeleteTeamGroup(string teamGroupId)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
Model.Base_TeamGroup teamGroup = db.Base_TeamGroup.First(e => e.TeamGroupId == teamGroupId);
|
||||
db.Base_TeamGroup.DeleteOnSubmit(teamGroup);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据单位Id和项目ID查询班组信息
|
||||
/// </summary>
|
||||
/// <param name="projectId">项目Id</param>
|
||||
/// <param name="unitId">单位Id</param>
|
||||
/// <returns>班组信息</returns>
|
||||
public static List<Model.Base_TeamGroup> GetTeamGroupByUnit(string projectId, string unitId)
|
||||
{
|
||||
return (from x in Funs.DB.Base_TeamGroup
|
||||
where x.ProjectId==projectId && x.UnitId==unitId
|
||||
orderby x.TeamGroupCode
|
||||
select x).ToList();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 根据区域获取班组数
|
||||
/// </summary>
|
||||
/// <param name="workAreaId"></param>
|
||||
/// <returns></returns>
|
||||
public static int GetTeamGroupCountByworkAreaId(string workAreaId)
|
||||
{
|
||||
var q = (from x in Funs.DB.Base_TeamGroup where x.Area == workAreaId select x).ToList();
|
||||
return q.Count();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,272 @@
|
||||
namespace BLL
|
||||
{
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Data.Linq;
|
||||
using System.Web.Security;
|
||||
using System.Web.UI.WebControls;
|
||||
using Model;
|
||||
using BLL;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public static class Base_UnitService
|
||||
{
|
||||
public static Model.SGGLDB db = Funs.DB;
|
||||
|
||||
/// <summary>
|
||||
/// 根据单位id获取单位信息
|
||||
/// </summary>
|
||||
/// <param name="UnitId"></param>
|
||||
/// <returns></returns>
|
||||
public static Model.Base_Unit GetUnit(string unitId)
|
||||
{
|
||||
return Funs.DB.Base_Unit.FirstOrDefault(x => x.UnitId == unitId);
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取单位名称
|
||||
/// </summary>
|
||||
/// <param name="UnitId"></param>
|
||||
/// <returns></returns>
|
||||
public static string GetUnitNameByUnitId(string unitId)
|
||||
{
|
||||
string name = string.Empty;
|
||||
var unit = Funs.DB.Base_Unit.FirstOrDefault(x => x.UnitId == unitId);
|
||||
if (unit != null)
|
||||
{
|
||||
name = unit.UnitName;
|
||||
}
|
||||
return name;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据单位编码获取单位信息
|
||||
/// </summary>
|
||||
/// <param name="unitCode">单位编号</param>
|
||||
/// <returns>单位信息</returns>
|
||||
public static List<Model.Base_Unit> GetSubUnitList()
|
||||
{
|
||||
return (from x in db.Base_Unit where x.IsSubUnit == true select x).ToList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据项目id获取该项目所有内部单位信息
|
||||
/// </summary>
|
||||
/// <param name="UnitId"></param>
|
||||
/// <returns></returns>
|
||||
public static List<Model.Base_Unit> GetSubUnits(string projectId)
|
||||
{
|
||||
var q = (from x in Funs.DB.Base_Unit
|
||||
join y in Funs.DB.Project_Unit on x.UnitId equals y.UnitId
|
||||
where y.ProjectId == projectId && x.IsSubUnit == true
|
||||
orderby x.UnitCode
|
||||
select x).ToList();
|
||||
return q;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 判断单位编号是否存在
|
||||
/// </summary>
|
||||
/// <param name="unitId">单位ID</param>
|
||||
/// <param name="unitCode">单位编号</param>
|
||||
/// <returns></returns>
|
||||
public static bool IsExistUnitCode(string unitId, string unitCode)
|
||||
{
|
||||
bool isExitCode = false;
|
||||
var q = from x in Funs.DB.Base_Unit where x.UnitCode == unitCode && x.UnitId != unitId select x;
|
||||
if (q.Count() > 0)
|
||||
{
|
||||
isExitCode = true;
|
||||
}
|
||||
return isExitCode;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 判断单位名称是否存在
|
||||
/// </summary>
|
||||
/// <param name="unitId">单位ID</param>
|
||||
/// <param name="unitCode">单位编号</param>
|
||||
/// <returns></returns>
|
||||
public static bool IsExistUnitName(string unitId, string unitName)
|
||||
{
|
||||
bool isExitCode = false;
|
||||
var q = from x in Funs.DB.Base_Unit where x.UnitName == unitName && x.UnitId != unitId select x;
|
||||
if (q.Count() > 0)
|
||||
{
|
||||
isExitCode = true;
|
||||
}
|
||||
return isExitCode;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 判断是否存在本单位
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static bool IsExitMain()
|
||||
{
|
||||
var q = from x in Funs.DB.Base_Unit where x.IsMain == true select x;
|
||||
if (q.Count() > 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加单位信息
|
||||
/// </summary>
|
||||
/// <param name="unit"></param>
|
||||
public static void AddUnit(Model.Base_Unit newUnit)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
db.Base_Unit.InsertOnSubmit(newUnit);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 修改单位信息
|
||||
/// </summary>
|
||||
/// <param name="unit"></param>
|
||||
public static void updateUnit(Model.Base_Unit unit)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
Model.Base_Unit newUnit = db.Base_Unit.FirstOrDefault(e => e.UnitId == unit.UnitId);
|
||||
if (newUnit != null)
|
||||
{
|
||||
newUnit.UnitCode = unit.UnitCode;
|
||||
newUnit.UnitName = unit.UnitName;
|
||||
newUnit.Corporate = unit.Corporate;
|
||||
newUnit.Address = unit.Address;
|
||||
newUnit.Telephone = unit.Telephone;
|
||||
newUnit.Fax = unit.Fax;
|
||||
newUnit.ProjectRange = unit.ProjectRange;
|
||||
newUnit.IsMain = unit.IsMain;
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据单位ID删除单位信息
|
||||
/// </summary>
|
||||
/// <param name="unitId"></param>
|
||||
public static void DeleteUnitByUnitId(string unitId)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
Model.Base_Unit newUnit = db.Base_Unit.FirstOrDefault(e => e.UnitId == unitId);
|
||||
if (newUnit != null)
|
||||
{
|
||||
db.Base_Unit.DeleteOnSubmit(newUnit);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据项目ID查询单位信息
|
||||
/// </summary>
|
||||
/// <param name="unitType"></param>
|
||||
/// <returns></returns>
|
||||
public static List<Model.Base_Unit> GetAllUnitList()
|
||||
{
|
||||
return (from x in Funs.DB.Base_Unit select x).ToList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取项目单位名称项
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static List<Model.Base_Unit> GetUnitCodeByProjectIdList(string projectId)
|
||||
{
|
||||
var q = (from x in db.Base_Unit
|
||||
join y in db.Project_Unit
|
||||
on x.UnitId equals y.UnitId
|
||||
where y.ProjectId == projectId
|
||||
orderby x.UnitCode
|
||||
select x).ToList();
|
||||
return q;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据单位id获取单位信息
|
||||
/// </summary>
|
||||
/// <param name="projectId"></param>
|
||||
/// <param name="unitType">一个单位有可能多种类型</param>
|
||||
/// <returns></returns>
|
||||
public static List<Model.Base_Unit> GetUnitsByProjectUnitType(string projectId, string unitType)
|
||||
{
|
||||
var q = (from x in Funs.DB.Base_Unit
|
||||
join y in Funs.DB.Project_Unit on x.UnitId equals y.UnitId
|
||||
where y.ProjectId == projectId && y.UnitType.Contains(unitType)
|
||||
orderby x.UnitCode
|
||||
select x).ToList();
|
||||
return q;
|
||||
}
|
||||
/// <summary>
|
||||
/// 根据分包本单位类型ID获取单位项
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static List<Model.Base_Unit> GetUnitListByUnitId(string projectId, string unitId)
|
||||
{
|
||||
var q = (from x in Funs.DB.Base_Unit
|
||||
join y in Funs.DB.Project_Unit on x.UnitId equals y.UnitId
|
||||
where y.ProjectId == projectId && y.UnitId == unitId
|
||||
orderby x.UnitCode
|
||||
select x).ToList();
|
||||
return q;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 根据分包单位类型ID获取单位项
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static ListItem[] GetUnitList()
|
||||
{
|
||||
var q = (from x in Funs.DB.Base_Unit
|
||||
join y in Funs.DB.Project_Unit on x.UnitId equals y.UnitId
|
||||
orderby x.UnitCode
|
||||
select x).Distinct().ToList();
|
||||
ListItem[] list = new ListItem[q.Count()];
|
||||
for (int i = 0; i < q.Count(); i++)
|
||||
{
|
||||
list[i] = new ListItem(q[i].UnitCode + "-" + q[i].UnitName, q[i].UnitId.ToString());
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
#region 得到单位类型字符串
|
||||
/// <summary>
|
||||
/// 得到单位类型字符串
|
||||
/// </summary>
|
||||
/// <param name="bigType"></param>
|
||||
/// <returns></returns>
|
||||
public static string ConvertUnitTypeStr(object unitType)
|
||||
{
|
||||
string name = string.Empty;
|
||||
if (unitType != null && unitType.ToString() != "")
|
||||
{
|
||||
string[] typeList = unitType.ToString().Split(',');
|
||||
foreach (string type in typeList)
|
||||
{
|
||||
var q = BLL.DropListService.UnitTypeSearchList().FirstOrDefault(x => x.Value == type);
|
||||
if (q != null)
|
||||
{
|
||||
name = name + q.Text + ",";
|
||||
}
|
||||
}
|
||||
|
||||
if (name != null)
|
||||
{
|
||||
name = name.Substring(0, name.LastIndexOf(","));
|
||||
}
|
||||
}
|
||||
|
||||
return name;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace BLL
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public static class ProjectPlanService
|
||||
{
|
||||
public static Model.SGGLDB db = Funs.DB;
|
||||
|
||||
/// <summary>
|
||||
/// 根据主键获取项目计划
|
||||
/// </summary>
|
||||
/// <param name="projectPlanId"></param>
|
||||
/// <returns></returns>
|
||||
public static Model.Weld_ProjectPlan GetProjectPlanById(string projectPlanId)
|
||||
{
|
||||
return db.Weld_ProjectPlan.FirstOrDefault(e => e.ProjectPlanId == projectPlanId);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据焊材主键获取项目计划
|
||||
/// </summary>
|
||||
/// <param name="weldId"></param>
|
||||
/// <returns></returns>
|
||||
public static Model.Weld_ProjectPlan GetProjectPlanByWeldId(string projectId,string weldId)
|
||||
{
|
||||
return db.Weld_ProjectPlan.FirstOrDefault(e =>e.ProjectId==projectId && e.WeldId == weldId);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据焊材主键获取项目计划数
|
||||
/// </summary>
|
||||
/// <param name="weldId"></param>
|
||||
/// <returns></returns>
|
||||
public static int GetProjectPlanNumByWeldId(string weldId)
|
||||
{
|
||||
return (from x in db.Weld_ProjectPlan where x.WeldId == weldId select x).Count();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加项目计划
|
||||
/// </summary>
|
||||
/// <param name="projectPlan"></param>
|
||||
public static void AddProjectPlan(Model.Weld_ProjectPlan projectPlan)
|
||||
{
|
||||
Model.Weld_ProjectPlan newProjectPlan = new Model.Weld_ProjectPlan();
|
||||
newProjectPlan.ProjectPlanId = projectPlan.ProjectPlanId;
|
||||
newProjectPlan.ProjectId = projectPlan.ProjectId;
|
||||
newProjectPlan.WeldId = projectPlan.WeldId;
|
||||
newProjectPlan.PlanAmount = projectPlan.PlanAmount;
|
||||
newProjectPlan.WeldRequire = projectPlan.WeldRequire;
|
||||
newProjectPlan.Remark = projectPlan.Remark;
|
||||
db.Weld_ProjectPlan.InsertOnSubmit(newProjectPlan);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 修改项目计划
|
||||
/// </summary>
|
||||
/// <param name="projectPlan"></param>
|
||||
public static void UpdateProjectPlan(Model.Weld_ProjectPlan projectPlan)
|
||||
{
|
||||
Model.Weld_ProjectPlan newProjectPlan = db.Weld_ProjectPlan.FirstOrDefault(e => e.ProjectPlanId == projectPlan.ProjectPlanId);
|
||||
if (newProjectPlan != null)
|
||||
{
|
||||
newProjectPlan.WeldId = projectPlan.WeldId;
|
||||
newProjectPlan.PlanAmount = projectPlan.PlanAmount;
|
||||
newProjectPlan.WeldRequire = projectPlan.WeldRequire;
|
||||
newProjectPlan.Remark = projectPlan.Remark;
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据主键删除项目计划
|
||||
/// </summary>
|
||||
/// <param name="projectPlanId"></param>
|
||||
public static void DeleteProjectPlanById(string projectPlanId)
|
||||
{
|
||||
Model.Weld_ProjectPlan projectPlan = db.Weld_ProjectPlan.FirstOrDefault(e => e.ProjectPlanId == projectPlanId);
|
||||
if (projectPlan != null)
|
||||
{
|
||||
db.Weld_ProjectPlan.DeleteOnSubmit(projectPlan);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user