fix:初始化仓库
This commit is contained in:
@@ -0,0 +1,501 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BLL
|
||||
{
|
||||
public class CQMSConstructSolutionApproveService
|
||||
{
|
||||
public static string ConvertAuditDate(object ConstructSolutionId)
|
||||
{
|
||||
var approve = (from x in Funs.DB.Solution_CQMSConstructSolutionApprove orderby x.ApproveDate descending where x.ConstructSolutionId == ConstructSolutionId && x.ApproveType != "S" && x.ApproveDate != null select x.ApproveDate).FirstOrDefault();
|
||||
if (approve != null)
|
||||
{
|
||||
return approve.Value.ToString("yyyy-MM-dd");
|
||||
}
|
||||
return "";
|
||||
}
|
||||
public static string ConvertToDo(object ConstructSolutionId)
|
||||
{
|
||||
string res = "";
|
||||
var approve = (from x in Funs.DB.Solution_CQMSConstructSolutionApprove orderby x.ApproveDate descending where x.ConstructSolutionId == ConstructSolutionId && x.ApproveType != "S" && x.ApproveDate == null select x);
|
||||
if (approve != null)
|
||||
{
|
||||
foreach (var item in approve)
|
||||
{
|
||||
res += Funs.DB.Sys_User.Where(u => u.UserId == item.ApproveMan).Select(x => x.UserName).FirstOrDefault() + ",";
|
||||
}
|
||||
}
|
||||
return res.TrimEnd(',');
|
||||
}
|
||||
public static Model.Solution_CQMSConstructSolutionApprove GetSee(string ConstructSolutionId, string userId)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
return db.Solution_CQMSConstructSolutionApprove.FirstOrDefault(x => x.ConstructSolutionId == ConstructSolutionId && x.ApproveType == "S" && x.ApproveMan == userId && x.ApproveDate == null);
|
||||
}
|
||||
|
||||
public static void See(string ConstructSolutionId, string userId)
|
||||
{
|
||||
using (var db = new Model.SGGLDB(Funs.ConnString))
|
||||
{
|
||||
var res = db.Solution_CQMSConstructSolutionApprove.FirstOrDefault(x => x.ConstructSolutionId == ConstructSolutionId && x.ApproveType == "S" && x.ApproveMan == userId && x.ApproveDate == null);
|
||||
if (res != null)
|
||||
{
|
||||
res.ApproveDate = DateTime.Now;
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 根据施工方案发布Id获取对应组会签人id集合信息
|
||||
/// </summary>
|
||||
/// <param name="ConstructSolutionCode">施工方案发布Id</param>
|
||||
/// <returns>施工方案审批集合</returns>
|
||||
public static List<string> GetUserIdsApprovesBySignType(string ConstructSolutionId, string signType)
|
||||
{
|
||||
var edtion = GetUserIdsApprovesBySignTypeEditon(ConstructSolutionId);
|
||||
return (from x in Funs.DB.Solution_CQMSConstructSolutionApprove where x.ConstructSolutionId == ConstructSolutionId && x.ApproveType != "S" && x.SignType == signType && x.Edition == edtion select x.ApproveMan).ToList();
|
||||
}
|
||||
|
||||
public static int? GetUserIdsApprovesBySignTypeEditon(string ConstructSolutionId)
|
||||
{
|
||||
int edition = 0;
|
||||
var solution = Funs.DB.Solution_CQMSConstructSolution.FirstOrDefault(p => p.ConstructSolutionId == ConstructSolutionId);
|
||||
if (solution != null)
|
||||
{
|
||||
edition = Convert.ToInt32(solution.Edition);
|
||||
}
|
||||
return edition;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 修改施工方案审批信息
|
||||
/// </summary>
|
||||
/// <param name="managerRuleApprove">施工方案审批实体</param>
|
||||
public static void UpdateConstructSolutionApprove(Model.Solution_CQMSConstructSolutionApprove approve)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
Model.Solution_CQMSConstructSolutionApprove newApprove = db.Solution_CQMSConstructSolutionApprove.First(e => e.ConstructSolutionApproveId == approve.ConstructSolutionApproveId);
|
||||
newApprove.ConstructSolutionId = approve.ConstructSolutionId;
|
||||
newApprove.ApproveMan = approve.ApproveMan;
|
||||
newApprove.ApproveDate = approve.ApproveDate;
|
||||
newApprove.ApproveIdea = approve.ApproveIdea;
|
||||
newApprove.IsAgree = approve.IsAgree;
|
||||
newApprove.ApproveType = approve.ApproveType;
|
||||
newApprove.Edition = approve.Edition;
|
||||
db.SubmitChanges();
|
||||
}
|
||||
/// <summary>
|
||||
/// 根据施工方案发布Id获取所以对应施工方案审批信息(查询全部会签状态)
|
||||
/// </summary>
|
||||
/// <param name="ConstructSolutionCode">施工方案发布Id</param>
|
||||
/// <returns>施工方案审批集合</returns>
|
||||
public static List<Model.Solution_CQMSConstructSolutionApprove> GetHandleConstructSolutionApprovesByConstructSolutionId(string ConstructSolutionId, int edition)
|
||||
{
|
||||
var list = Funs.DB.Solution_CQMSConstructSolutionApprove.Where(p => p.ConstructSolutionId == ConstructSolutionId && p.ApproveType == Const.CQMSConstructSolution_Audit && p.ApproveType != "S" && p.Edition == edition).ToList();
|
||||
return list;
|
||||
|
||||
}
|
||||
|
||||
public static List<Model.Solution_CQMSConstructSolutionApprove> GetHandleConstruct(string ConstructSolutionId, int edition)
|
||||
{
|
||||
var list = Funs.DB.Solution_CQMSConstructSolutionApprove.Where(p => p.ConstructSolutionId == ConstructSolutionId && p.ApproveType != "S" && p.ApproveDate != null && p.Edition == edition).ToList();
|
||||
return list;
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// 根据施工方案发布Id获取所以对应施工方案审批信息
|
||||
/// </summary>
|
||||
/// <param name="ConstructSolutionCode">施工方案发布Id</param>
|
||||
/// <returns>施工方案审批集合</returns>
|
||||
public static List<Model.Solution_CQMSConstructSolutionApprove> GetConstructSolutionApprovesByConstructSolutionId(string ConstructSolutionId, string state)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
var reDate = (from x in db.Solution_CQMSConstructSolutionApprove where x.ConstructSolutionId == ConstructSolutionId && x.ApproveType == BLL.Const.CQMSConstructSolution_ReCompile orderby x.ApproveDate descending select x.ApproveDate).FirstOrDefault();
|
||||
if (reDate == null)
|
||||
{
|
||||
return (from x in db.Solution_CQMSConstructSolutionApprove where x.ConstructSolutionId == ConstructSolutionId && x.ApproveType == state select x).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
return (from x in db.Solution_CQMSConstructSolutionApprove where x.ConstructSolutionId == ConstructSolutionId && x.ApproveType == state && (x.ApproveDate == null || x.ApproveDate > reDate) select x).ToList();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取施工方案模板列表
|
||||
/// </summary>
|
||||
/// <param name="satartRowIndex"></param>
|
||||
/// <param name="maximumRows"></param>
|
||||
/// <returns></returns>
|
||||
public static IList<Model.Solution_CQMSConstructSolutionApprove> getListData(string ConstructSolutionId)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
var res = from x in db.Solution_CQMSConstructSolutionApprove
|
||||
where x.ConstructSolutionId == ConstructSolutionId && x.ApproveDate != null && x.ApproveType != "S" && x.SignType != "S"
|
||||
orderby x.ApproveDate
|
||||
select x;
|
||||
|
||||
//select new
|
||||
//{
|
||||
// x.ConstructSolutionApproveId,
|
||||
// x.ConstructSolutionId,
|
||||
// x.ApproveMan,
|
||||
// x.ApproveDate,
|
||||
// x.IsAgree,
|
||||
// x.ApproveIdea,
|
||||
// x.ApproveType,
|
||||
// x.SignType,
|
||||
// //= x.IsAgree == true ? "是" : "否",
|
||||
//};
|
||||
return res.ToList();
|
||||
}
|
||||
public static IList<Model.Solution_CQMSConstructSolutionApprove> getListDataForExport(string ConstructSolutionId)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
var res = from x in db.Solution_CQMSConstructSolutionApprove
|
||||
where x.ConstructSolutionId == ConstructSolutionId && x.ApproveDate != null && x.ApproveType != "S"
|
||||
orderby x.ApproveType, x.Edition
|
||||
select x;
|
||||
|
||||
//select new
|
||||
//{
|
||||
// x.ConstructSolutionApproveId,
|
||||
// x.ConstructSolutionId,
|
||||
// x.ApproveMan,
|
||||
// x.ApproveDate,
|
||||
// x.IsAgree,
|
||||
// x.ApproveIdea,
|
||||
// x.ApproveType,
|
||||
// x.SignType,
|
||||
// //= x.IsAgree == true ? "是" : "否",
|
||||
//};
|
||||
return res.ToList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取未代办的记录数量
|
||||
/// </summary>
|
||||
/// <param name="satartRowIndex"></param>
|
||||
/// <param name="maximumRows"></param>
|
||||
/// <returns></returns>
|
||||
public static int getListSolutionApproveCount(string constructSolutionId, string man, string signType)
|
||||
{
|
||||
|
||||
var res = (from x in Funs.DB.Solution_CQMSConstructSolutionApprove
|
||||
where x.ConstructSolutionId == constructSolutionId && x.ApproveDate == null && x.ApproveType != "S" && x.ApproveMan.Equals(man) && x.SignType == signType
|
||||
orderby x.ApproveDate
|
||||
select x).Count();
|
||||
return res;
|
||||
}
|
||||
public static IList<Model.Solution_CQMSConstructSolutionApprove> getListSolutionApprove(string constructSolutionId, string man)
|
||||
{
|
||||
|
||||
var res = (from x in Funs.DB.Solution_CQMSConstructSolutionApprove
|
||||
where x.ConstructSolutionId == constructSolutionId && x.ApproveDate == null && x.ApproveType != "S" && x.ApproveMan.Equals(man)
|
||||
orderby x.ApproveDate
|
||||
select x).ToList();
|
||||
return res;
|
||||
}
|
||||
/// <summary>
|
||||
/// 删除未代办的记录
|
||||
/// </summary>
|
||||
/// <param name="ConstructSolutionId"></param>
|
||||
public static void delSolutionApprove(string constructSolutionId, string man)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
var q = (from x in Funs.DB.Solution_CQMSConstructSolutionApprove where x.ConstructSolutionId == constructSolutionId && x.ApproveType != "S" && x.ApproveMan.Equals(man) && x.ApproveDate == null select x).ToList();
|
||||
db.Solution_CQMSConstructSolutionApprove.DeleteAllOnSubmit(q);
|
||||
db.SubmitChanges();
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 删除审核记录
|
||||
/// </summary>
|
||||
/// <param name="ConstructSolutionApproveId"></param>
|
||||
/// <param name="man"></param>
|
||||
public static void delApprove(string ConstructSolutionApproveId)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
var del = db.Solution_CQMSConstructSolutionApprove.Where(c => c.ConstructSolutionApproveId == ConstructSolutionApproveId).FirstOrDefault();
|
||||
db.Solution_CQMSConstructSolutionApprove.DeleteOnSubmit(del);
|
||||
db.SubmitChanges();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 根据施工方案编号删除对应的所有施工方案审批信息
|
||||
/// </summary>
|
||||
/// <param name="ConstructSolutionCode">施工方案编号</param>
|
||||
public static void DeleteConstructSolutionApprovesByConstructSolutionId(string ConstructSolutionId)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
var q = (from x in Funs.DB.Solution_CQMSConstructSolutionApprove where x.ConstructSolutionId == ConstructSolutionId select x).ToList();
|
||||
db.Solution_CQMSConstructSolutionApprove.DeleteAllOnSubmit(q);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
/// <summary>
|
||||
/// 根据施工方案编号获取一个施工方案审批信息
|
||||
/// </summary>
|
||||
/// <param name="ConstructSolutionCode">施工方案编号</param>
|
||||
/// <returns>一个施工方案审批实体</returns>
|
||||
public static Model.Solution_CQMSConstructSolutionApprove GetConstructSolutionApproveByApproveMan(string ConstructSolutionId, string approveMan)
|
||||
{
|
||||
|
||||
return Funs.DB.Solution_CQMSConstructSolutionApprove.FirstOrDefault(x => x.ConstructSolutionId == ConstructSolutionId && x.ApproveMan == approveMan && x.ApproveType != "S" && x.ApproveDate == null);
|
||||
}
|
||||
public static Model.Solution_CQMSConstructSolutionApprove GetConstructSoluAppByApproveMan(string ConstructSolutionId, string approveMan, int edtion)
|
||||
{
|
||||
|
||||
return Funs.DB.Solution_CQMSConstructSolutionApprove.FirstOrDefault(x => x.ConstructSolutionId == ConstructSolutionId && x.Edition == edtion && x.ApproveMan == approveMan && x.ApproveType != "S" && x.ApproveDate == null);
|
||||
}
|
||||
|
||||
public static Model.Solution_CQMSConstructSolutionApprove GetConstructSolApproveByApproveMan(string ConstructSolutionId, string approveMan)
|
||||
{
|
||||
return Funs.DB.Solution_CQMSConstructSolutionApprove.FirstOrDefault(x => x.ConstructSolutionId == ConstructSolutionId && x.ApproveMan == approveMan && x.ApproveType != "S" && x.ApproveDate == null);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 增加施工方案审批信息
|
||||
/// </summary>
|
||||
/// <param name="managerRuleApprove">施工方案审批实体</param>
|
||||
public static void AddConstructSolutionApprove(Model.Solution_CQMSConstructSolutionApprove approve)
|
||||
{
|
||||
var db = Funs.DB;
|
||||
|
||||
var appr = db.Solution_CQMSConstructSolutionApprove.FirstOrDefault(x => x.ApproveDate == null && x.ApproveType == approve.ApproveType && x.ConstructSolutionId == approve.ConstructSolutionId && x.ApproveMan == approve.ApproveMan && x.SignType == approve.SignType);
|
||||
if (appr == null)
|
||||
{
|
||||
Model.Solution_CQMSConstructSolutionApprove newApprove = new Model.Solution_CQMSConstructSolutionApprove();
|
||||
if (string.IsNullOrWhiteSpace(approve.ConstructSolutionApproveId))
|
||||
{
|
||||
newApprove.ConstructSolutionApproveId = SQLHelper.GetNewID(typeof(Model.Solution_CQMSConstructSolutionApprove));
|
||||
}
|
||||
else
|
||||
{
|
||||
newApprove.ConstructSolutionApproveId = approve.ConstructSolutionApproveId;
|
||||
}
|
||||
newApprove.ConstructSolutionId = approve.ConstructSolutionId;
|
||||
newApprove.ApproveMan = approve.ApproveMan;
|
||||
newApprove.ApproveDate = approve.ApproveDate;
|
||||
newApprove.ApproveIdea = approve.ApproveIdea;
|
||||
newApprove.IsAgree = approve.IsAgree;
|
||||
newApprove.ApproveType = approve.ApproveType;
|
||||
newApprove.SignType = approve.SignType;
|
||||
newApprove.Edition = approve.Edition;
|
||||
db.Solution_CQMSConstructSolutionApprove.InsertOnSubmit(newApprove);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
|
||||
}
|
||||
public static void AddConstructSolutionApproveForApi(Model.Solution_CQMSConstructSolutionApprove approve)
|
||||
{
|
||||
using (var db = new Model.SGGLDB(Funs.ConnString))
|
||||
{
|
||||
Model.Solution_CQMSConstructSolutionApprove newApprove = new Model.Solution_CQMSConstructSolutionApprove();
|
||||
if (string.IsNullOrWhiteSpace(approve.ConstructSolutionApproveId))
|
||||
{
|
||||
newApprove.ConstructSolutionApproveId = SQLHelper.GetNewID(typeof(Model.Solution_CQMSConstructSolutionApprove));
|
||||
}
|
||||
else
|
||||
{
|
||||
newApprove.ConstructSolutionApproveId = approve.ConstructSolutionApproveId;
|
||||
}
|
||||
newApprove.ConstructSolutionId = approve.ConstructSolutionId;
|
||||
newApprove.ApproveMan = approve.ApproveMan;
|
||||
newApprove.ApproveDate = approve.ApproveDate;
|
||||
newApprove.ApproveIdea = approve.ApproveIdea;
|
||||
newApprove.IsAgree = approve.IsAgree;
|
||||
newApprove.ApproveType = approve.ApproveType;
|
||||
newApprove.SignType = approve.SignType;
|
||||
newApprove.Edition = approve.Edition;
|
||||
db.Solution_CQMSConstructSolutionApprove.InsertOnSubmit(newApprove);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
public static List<Model.Solution_CQMSConstructSolutionApprove> getListDataForApi(string ConstructSolutionId, int edition)
|
||||
{
|
||||
using (var db = new Model.SGGLDB(Funs.ConnString))
|
||||
{
|
||||
var q = from x in db.Solution_CQMSConstructSolutionApprove
|
||||
where x.ConstructSolutionId == ConstructSolutionId && x.Edition == edition && x.ApproveDate != null && x.ApproveType != "S"
|
||||
orderby x.ApproveDate
|
||||
select new
|
||||
{
|
||||
x.ConstructSolutionApproveId,
|
||||
x.ConstructSolutionId,
|
||||
x.ApproveMan,
|
||||
ApproveManName = (from y in db.Sys_User where y.UserId == x.ApproveMan select y.UserName).First(),
|
||||
x.ApproveDate,
|
||||
x.IsAgree,
|
||||
x.ApproveIdea,
|
||||
x.ApproveType,
|
||||
x.SignType,
|
||||
};
|
||||
var list = q.ToList();
|
||||
List<Model.Solution_CQMSConstructSolutionApprove> res = new List<Model.Solution_CQMSConstructSolutionApprove>();
|
||||
foreach (var item in list)
|
||||
{
|
||||
Model.Solution_CQMSConstructSolutionApprove ap = new Model.Solution_CQMSConstructSolutionApprove();
|
||||
ap.ConstructSolutionApproveId = item.ConstructSolutionApproveId;
|
||||
ap.ConstructSolutionId = item.ConstructSolutionId;
|
||||
ap.ApproveMan = item.ApproveMan + "$" + item.ApproveManName;
|
||||
ap.ApproveDate = item.ApproveDate;
|
||||
ap.IsAgree = item.IsAgree;
|
||||
ap.ApproveIdea = item.ApproveIdea;
|
||||
ap.ApproveType = item.ApproveType;
|
||||
ap.SignType = item.SignType;
|
||||
ap.AttachUrl = AttachFileService.getFileUrl(ap.ConstructSolutionApproveId);
|
||||
res.Add(ap);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
}
|
||||
public static List<Model.Solution_CQMSConstructSolutionApprove> getListDataForApi(string ConstructSolutionId)
|
||||
{
|
||||
using (var db = new Model.SGGLDB(Funs.ConnString))
|
||||
{
|
||||
var q = from x in db.Solution_CQMSConstructSolutionApprove
|
||||
where x.ConstructSolutionId == ConstructSolutionId && x.ApproveDate != null && x.ApproveType != "S"
|
||||
orderby x.ApproveDate
|
||||
select new
|
||||
{
|
||||
x.ConstructSolutionApproveId,
|
||||
x.ConstructSolutionId,
|
||||
x.ApproveMan,
|
||||
ApproveManName = (from y in db.Sys_User where y.UserId == x.ApproveMan select y.UserName).First(),
|
||||
x.ApproveDate,
|
||||
x.IsAgree,
|
||||
x.ApproveIdea,
|
||||
x.ApproveType,
|
||||
x.SignType,
|
||||
x.Edition
|
||||
};
|
||||
var list = q.ToList();
|
||||
List<Model.Solution_CQMSConstructSolutionApprove> res = new List<Model.Solution_CQMSConstructSolutionApprove>();
|
||||
foreach (var item in list)
|
||||
{
|
||||
Model.Solution_CQMSConstructSolutionApprove ap = new Model.Solution_CQMSConstructSolutionApprove();
|
||||
ap.ConstructSolutionApproveId = item.ConstructSolutionApproveId;
|
||||
ap.ConstructSolutionId = item.ConstructSolutionId;
|
||||
ap.ApproveMan = item.ApproveMan + "$" + item.ApproveManName;
|
||||
ap.ApproveDate = item.ApproveDate;
|
||||
ap.IsAgree = item.IsAgree;
|
||||
ap.ApproveIdea = item.ApproveIdea;
|
||||
ap.ApproveType = item.ApproveType;
|
||||
ap.SignType = item.SignType;
|
||||
ap.Edition = item.Edition;
|
||||
ap.AttachUrl = AttachFileService.getFileUrl(ap.ConstructSolutionApproveId);
|
||||
res.Add(ap);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
}
|
||||
public static Model.Solution_CQMSConstructSolutionApprove getCurrApproveForApi(string ConstructSolutionId, string approveMan, int edition)
|
||||
{
|
||||
using (var db = new Model.SGGLDB(Funs.ConnString))
|
||||
{
|
||||
Model.Solution_CQMSConstructSolutionApprove newApprove = db.Solution_CQMSConstructSolutionApprove.FirstOrDefault(e => e.ConstructSolutionId == ConstructSolutionId && e.ApproveMan == approveMan && e.Edition == edition && e.ApproveType != "S" && e.ApproveDate == null);
|
||||
if (newApprove != null)
|
||||
{
|
||||
Model.Sys_User user = BLL.UserService.GetUserByUserId(newApprove.ApproveMan);
|
||||
if (user != null)
|
||||
{
|
||||
newApprove.ApproveIdea = user.UserName;
|
||||
}
|
||||
}
|
||||
return newApprove;
|
||||
}
|
||||
}
|
||||
public static List<Model.Solution_CQMSConstructSolutionApprove> getConApproveForApi(string ConstructSolutionId, int edition)
|
||||
{
|
||||
using (var db = new Model.SGGLDB(Funs.ConnString))
|
||||
{
|
||||
List<Model.Solution_CQMSConstructSolutionApprove> res = new List<Model.Solution_CQMSConstructSolutionApprove>();
|
||||
var newApproves = db.Solution_CQMSConstructSolutionApprove.Where(e => e.ConstructSolutionId == ConstructSolutionId && e.Edition == edition && e.ApproveType == "2").ToList();
|
||||
if (newApproves != null)
|
||||
{
|
||||
foreach (Model.Solution_CQMSConstructSolutionApprove newApprove in newApproves)
|
||||
{
|
||||
Model.Solution_CQMSConstructSolutionApprove a = new Model.Solution_CQMSConstructSolutionApprove();
|
||||
a.ConstructSolutionApproveId = newApprove.ConstructSolutionApproveId;
|
||||
a.ConstructSolutionId = newApprove.ConstructSolutionId;
|
||||
a.ApproveDate = newApprove.ApproveDate;
|
||||
a.ApproveMan = newApprove.ApproveMan;
|
||||
a.ApproveType = newApprove.ApproveType;
|
||||
a.Edition = newApprove.Edition;
|
||||
a.IsAgree = newApprove.IsAgree;
|
||||
Model.Sys_User user = BLL.UserService.GetUserByUserId(newApprove.ApproveMan);
|
||||
if (user != null)
|
||||
{
|
||||
a.ApproveMan = a.ApproveMan + "$" + user.UserName;
|
||||
}
|
||||
a.AttachUrl = AttachFileService.getFileUrl(a.ConstructSolutionApproveId);
|
||||
res.Add(a);
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
}
|
||||
public static List<Model.Solution_CQMSConstructSolutionApprove> getConApprovesForApi(string ConstructSolutionId, int edition)
|
||||
{
|
||||
using (var db = new Model.SGGLDB(Funs.ConnString))
|
||||
{
|
||||
List<Model.Solution_CQMSConstructSolutionApprove> res = new List<Model.Solution_CQMSConstructSolutionApprove>();
|
||||
var newApproves = db.Solution_CQMSConstructSolutionApprove.Where(e => e.ConstructSolutionId == ConstructSolutionId && e.Edition == edition).ToList();
|
||||
if (newApproves != null)
|
||||
{
|
||||
foreach (Model.Solution_CQMSConstructSolutionApprove newApprove in newApproves)
|
||||
{
|
||||
Model.Solution_CQMSConstructSolutionApprove a = new Model.Solution_CQMSConstructSolutionApprove();
|
||||
a.ConstructSolutionApproveId = newApprove.ConstructSolutionApproveId;
|
||||
a.ConstructSolutionId = newApprove.ConstructSolutionId;
|
||||
a.ApproveDate = newApprove.ApproveDate;
|
||||
a.ApproveMan = newApprove.ApproveMan;
|
||||
a.ApproveType = newApprove.ApproveType;
|
||||
a.Edition = newApprove.Edition;
|
||||
a.IsAgree = newApprove.IsAgree;
|
||||
Model.Sys_User user = BLL.UserService.GetUserByUserId(newApprove.ApproveMan);
|
||||
if (user != null)
|
||||
{
|
||||
a.ApproveMan = a.ApproveMan + "$" + user.UserName;
|
||||
}
|
||||
a.AttachUrl = AttachFileService.getFileUrl(a.ConstructSolutionApproveId);
|
||||
res.Add(a);
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
}
|
||||
public static Model.Solution_CQMSConstructSolutionApprove UpdateConstructSolutionApproveForApi(Model.Solution_CQMSConstructSolutionApprove approve)
|
||||
{
|
||||
using (var db = new Model.SGGLDB(Funs.ConnString))
|
||||
{
|
||||
Model.Solution_CQMSConstructSolutionApprove newApprove = db.Solution_CQMSConstructSolutionApprove.First(e => e.ConstructSolutionApproveId == approve.ConstructSolutionApproveId);
|
||||
if (!string.IsNullOrEmpty(approve.ConstructSolutionId))
|
||||
newApprove.ConstructSolutionId = approve.ConstructSolutionId;
|
||||
if (!string.IsNullOrEmpty(approve.ApproveMan))
|
||||
newApprove.ApproveMan = approve.ApproveMan;
|
||||
if (approve.ApproveDate.HasValue)
|
||||
newApprove.ApproveDate = approve.ApproveDate;
|
||||
if (!string.IsNullOrEmpty(approve.ApproveIdea))
|
||||
newApprove.ApproveIdea = approve.ApproveIdea;
|
||||
if (approve.IsAgree.HasValue)
|
||||
newApprove.IsAgree = approve.IsAgree;
|
||||
if (!string.IsNullOrEmpty(approve.ApproveType))
|
||||
newApprove.ApproveType = approve.ApproveType;
|
||||
|
||||
db.SubmitChanges();
|
||||
AttachFileService.updateAttachFile(approve.AttachUrl, newApprove.ConstructSolutionApproveId, Const.CQMSConstructSolutionMenuId);
|
||||
return newApprove;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,184 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web.UI.WebControls;
|
||||
|
||||
namespace BLL
|
||||
{
|
||||
public class CQMSConstructSolutionFinalService
|
||||
{
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 根据方案审查Id删除一个方案审查信息
|
||||
/// </summary>
|
||||
/// <param name="constructSolutionCode">方案审查Id</param>
|
||||
public static void DeleteConstructSolution(string constructSolutionId)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
Model.Solution_CQMSConstructSolution_Final constructSolution = db.Solution_CQMSConstructSolution_Final.First(e => e.ConstructSolutionId == constructSolutionId);
|
||||
|
||||
db.Solution_CQMSConstructSolution_Final.DeleteOnSubmit(constructSolution);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 增加方案审查信息
|
||||
/// </summary>
|
||||
/// <param name="constructSolution">方案审查实体</param>
|
||||
public static void AddConstructSolution(Model.Solution_CQMSConstructSolution_Final constructSolution)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
Model.Solution_CQMSConstructSolution_Final newConstructSolution = new Model.Solution_CQMSConstructSolution_Final();
|
||||
newConstructSolution.ConstructSolutionId = constructSolution.ConstructSolutionId;
|
||||
newConstructSolution.ProjectId = constructSolution.ProjectId;
|
||||
newConstructSolution.UnitId = constructSolution.UnitId;
|
||||
newConstructSolution.SolutionName = constructSolution.SolutionName;
|
||||
newConstructSolution.SolutionCode = constructSolution.SolutionCode;
|
||||
newConstructSolution.CompileMan = constructSolution.CompileMan;
|
||||
newConstructSolution.State = constructSolution.State;
|
||||
newConstructSolution.AuditDate = constructSolution.AuditDate;
|
||||
newConstructSolution.SolutionType = constructSolution.SolutionType;
|
||||
|
||||
db.Solution_CQMSConstructSolution_Final.InsertOnSubmit(newConstructSolution);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
/// <summary>
|
||||
/// 修改方案审查信息
|
||||
/// </summary>
|
||||
/// <param name="constructSolution">方案审查实体</param>
|
||||
public static void UpdateConstructSolution(Model.Solution_CQMSConstructSolution_Final constructSolution)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
Model.Solution_CQMSConstructSolution_Final newConstructSolution = db.Solution_CQMSConstructSolution_Final.FirstOrDefault(e => e.ConstructSolutionId == constructSolution.ConstructSolutionId);
|
||||
if (newConstructSolution == null)
|
||||
{
|
||||
AddConstructSolution(constructSolution);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
|
||||
newConstructSolution.AuditDate = constructSolution.AuditDate;
|
||||
newConstructSolution.UnitId = constructSolution.UnitId;
|
||||
newConstructSolution.SolutionName = constructSolution.SolutionName;
|
||||
newConstructSolution.SolutionCode= constructSolution.SolutionCode;
|
||||
newConstructSolution.CompileMan = constructSolution.CompileMan;
|
||||
newConstructSolution.State = constructSolution.State;
|
||||
newConstructSolution.SolutionType = constructSolution.SolutionType;
|
||||
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 把状态转换代号为文字形式
|
||||
/// </summary>
|
||||
/// <param name="state"></param>
|
||||
/// <returns></returns>
|
||||
///
|
||||
public static string ConvertState(object state)
|
||||
{
|
||||
if (state != null)
|
||||
{
|
||||
if (state.ToString() == BLL.Const.CQMSConstructSolution_ReCompile)
|
||||
{
|
||||
return "重报";
|
||||
}
|
||||
else if (state.ToString() == BLL.Const.CQMSConstructSolution_Compile)
|
||||
{
|
||||
return "编制";
|
||||
}
|
||||
else if (state.ToString() == BLL.Const.CQMSConstructSolution_Audit)
|
||||
{
|
||||
return "会签";
|
||||
}
|
||||
else if (state.ToString() == BLL.Const.CQMSConstructSolution_Complete)
|
||||
{
|
||||
return "审批完成";
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 根据方案审查Id获取一个方案审查信息
|
||||
/// </summary>
|
||||
/// <param name="constructSolutionCode">方案审查Id</param>
|
||||
/// <returns>一个方案审查实体</returns>
|
||||
public static Model.Solution_CQMSConstructSolution_Final GetConstructSolutionByConstructSolutionId(string constructSolutionId)
|
||||
{
|
||||
return Funs.DB.Solution_CQMSConstructSolution_Final.FirstOrDefault(x => x.ConstructSolutionId == constructSolutionId);
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取方案类别
|
||||
/// </summary>
|
||||
/// <param name="state"></param>
|
||||
/// <returns></returns>
|
||||
public static string ConvertSolutionType(object solutionType)
|
||||
{
|
||||
if (solutionType != null)
|
||||
{
|
||||
if (solutionType.ToString() == "1")
|
||||
{
|
||||
return "施工组织设计";
|
||||
}
|
||||
else if (solutionType.ToString() == "2")
|
||||
{
|
||||
return "专项施工方案";
|
||||
}
|
||||
else if (solutionType.ToString() == "3")
|
||||
{
|
||||
return "施工方案";
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
public static string GetProfessionalName(string cNProfessionalCodes)
|
||||
{
|
||||
string professionalName = string.Empty;
|
||||
if (!string.IsNullOrEmpty(cNProfessionalCodes))
|
||||
{
|
||||
string[] strs = cNProfessionalCodes.Split(',');
|
||||
foreach (var item in strs)
|
||||
{
|
||||
var cn = BLL.CNProfessionalService.GetCNProfessional(item);
|
||||
if (cn != null)
|
||||
{
|
||||
professionalName += cn.ProfessionalName + ",";
|
||||
}
|
||||
}
|
||||
if (!string.IsNullOrEmpty(professionalName))
|
||||
{
|
||||
professionalName = professionalName.Substring(0, professionalName.LastIndexOf(","));
|
||||
}
|
||||
}
|
||||
return professionalName;
|
||||
}
|
||||
public static string GetUnitWorkName(string unitWorkIds)
|
||||
{
|
||||
string unitWorkName = string.Empty;
|
||||
if (!string.IsNullOrEmpty(unitWorkIds))
|
||||
{
|
||||
string[] strs = unitWorkIds.Split(',');
|
||||
foreach (var item in strs)
|
||||
{
|
||||
var un = BLL.UnitWorkService.GetUnitWorkByUnitWorkId(item);
|
||||
if (un != null)
|
||||
{
|
||||
unitWorkName += un.UnitWorkName + BLL.UnitWorkService.GetProjectType(un.ProjectType) + ",";
|
||||
}
|
||||
}
|
||||
if (!string.IsNullOrEmpty(unitWorkName))
|
||||
{
|
||||
unitWorkName = unitWorkName.Substring(0, unitWorkName.LastIndexOf(","));
|
||||
}
|
||||
}
|
||||
return unitWorkName;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,430 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web.UI.WebControls;
|
||||
|
||||
namespace BLL
|
||||
{
|
||||
public class CQMSConstructSolutionService
|
||||
{
|
||||
public static string IsAgree(Object type, Object res)
|
||||
{
|
||||
string result = string.Empty;
|
||||
if (type.ToString().Equals(Const.CQMSConstructSolution_ReCompile) || type.ToString().Equals(Const.CQMSConstructSolution_Compile))
|
||||
{
|
||||
res = null;
|
||||
}
|
||||
if (res != null)
|
||||
{
|
||||
if (Convert.ToBoolean(res))
|
||||
{
|
||||
result = "是";
|
||||
}
|
||||
else
|
||||
{
|
||||
result = "否";
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据方案审查Id删除一个方案审查信息
|
||||
/// </summary>
|
||||
/// <param name="constructSolutionCode">方案审查Id</param>
|
||||
public static void DeleteConstructSolution(string constructSolutionId)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
Model.Solution_CQMSConstructSolution constructSolution = db.Solution_CQMSConstructSolution.First(e => e.ConstructSolutionId == constructSolutionId);
|
||||
|
||||
db.Solution_CQMSConstructSolution.DeleteOnSubmit(constructSolution);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 增加方案审查信息
|
||||
/// </summary>
|
||||
/// <param name="constructSolution">方案审查实体</param>
|
||||
public static void AddConstructSolution(Model.Solution_CQMSConstructSolution constructSolution)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
Model.Solution_CQMSConstructSolution newConstructSolution = new Model.Solution_CQMSConstructSolution();
|
||||
newConstructSolution.ConstructSolutionId = constructSolution.ConstructSolutionId;
|
||||
newConstructSolution.Code = constructSolution.Code;
|
||||
newConstructSolution.ProjectId = constructSolution.ProjectId;
|
||||
newConstructSolution.UnitId = constructSolution.UnitId;
|
||||
newConstructSolution.SolutionName = constructSolution.SolutionName;
|
||||
newConstructSolution.SolutionType = constructSolution.SolutionType;
|
||||
newConstructSolution.UnitWorkIds = constructSolution.UnitWorkIds;
|
||||
newConstructSolution.CNProfessionalCodes = constructSolution.CNProfessionalCodes;
|
||||
newConstructSolution.AttachUrl = constructSolution.AttachUrl;
|
||||
newConstructSolution.CompileMan = constructSolution.CompileMan;
|
||||
newConstructSolution.CompileDate = constructSolution.CompileDate;
|
||||
newConstructSolution.State = constructSolution.State;
|
||||
newConstructSolution.Edition = constructSolution.Edition;
|
||||
newConstructSolution.SpecialSchemeTypeId = constructSolution.SpecialSchemeTypeId;
|
||||
db.Solution_CQMSConstructSolution.InsertOnSubmit(newConstructSolution);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
/// <summary>
|
||||
/// 修改方案审查信息
|
||||
/// </summary>
|
||||
/// <param name="constructSolution">方案审查实体</param>
|
||||
public static void UpdateConstructSolution(Model.Solution_CQMSConstructSolution constructSolution)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
Model.Solution_CQMSConstructSolution newConstructSolution = db.Solution_CQMSConstructSolution.FirstOrDefault(e => e.ConstructSolutionId == constructSolution.ConstructSolutionId);
|
||||
if (newConstructSolution == null)
|
||||
{
|
||||
AddConstructSolution(constructSolution);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
|
||||
newConstructSolution.Code = constructSolution.Code;
|
||||
newConstructSolution.UnitId = constructSolution.UnitId;
|
||||
newConstructSolution.SolutionName = constructSolution.SolutionName;
|
||||
newConstructSolution.SolutionType = constructSolution.SolutionType;
|
||||
newConstructSolution.UnitWorkIds = constructSolution.UnitWorkIds;
|
||||
newConstructSolution.CNProfessionalCodes = constructSolution.CNProfessionalCodes;
|
||||
newConstructSolution.AttachUrl = constructSolution.AttachUrl;
|
||||
newConstructSolution.State = constructSolution.State;
|
||||
newConstructSolution.Edition = constructSolution.Edition;
|
||||
newConstructSolution.SpecialSchemeTypeId = constructSolution.SpecialSchemeTypeId;
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 把状态转换代号为文字形式
|
||||
/// </summary>
|
||||
/// <param name="state"></param>
|
||||
/// <returns></returns>
|
||||
///
|
||||
public static string ConvertState(object state)
|
||||
{
|
||||
if (state != null)
|
||||
{
|
||||
if (state.ToString() == BLL.Const.CQMSConstructSolution_ReCompile)
|
||||
{
|
||||
return "重报";
|
||||
}
|
||||
else if (state.ToString() == BLL.Const.CQMSConstructSolution_Compile)
|
||||
{
|
||||
return "编制";
|
||||
}
|
||||
else if (state.ToString() == BLL.Const.CQMSConstructSolution_Audit)
|
||||
{
|
||||
return "会签";
|
||||
}
|
||||
else if (state.ToString() == BLL.Const.CQMSConstructSolution_Complete)
|
||||
{
|
||||
return "审批完成";
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取单位信息中的常用工程类型信息
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static ListItem[] GetSolutionType()
|
||||
{
|
||||
ListItem[] list = new ListItem[3];
|
||||
list[0] = new ListItem("施工组织设计", "1");
|
||||
list[1] = new ListItem("专项施工方案", "2");
|
||||
list[2] = new ListItem("施工方案", "3");
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 根据方案审查Id获取一个方案审查信息
|
||||
/// </summary>
|
||||
/// <param name="constructSolutionCode">方案审查Id</param>
|
||||
/// <returns>一个方案审查实体</returns>
|
||||
public static Model.Solution_CQMSConstructSolution GetConstructSolutionByConstructSolutionId(string constructSolutionId)
|
||||
{
|
||||
return Funs.DB.Solution_CQMSConstructSolution.FirstOrDefault(x => x.ConstructSolutionId == constructSolutionId);
|
||||
}
|
||||
public static Model.Solution_CQMSConstructSolution GetConstructSolutionByConstructSolutionIdForApi(string constructSolutionId)
|
||||
{
|
||||
using (var db = new Model.SGGLDB(Funs.ConnString))
|
||||
{
|
||||
Model.Solution_CQMSConstructSolution solution = db.Solution_CQMSConstructSolution.FirstOrDefault(x => x.ConstructSolutionId == constructSolutionId);
|
||||
solution.AttachUrl = AttachFileService.getFileUrl(solution.ConstructSolutionId+solution.Edition);
|
||||
solution.CNProfessionalCodes = solution.CNProfessionalCodes + "$" + GetProfessionalName(solution.CNProfessionalCodes);
|
||||
solution.UnitWorkIds = solution.UnitWorkIds + "$" + GetUnitWorkName(solution.UnitWorkIds);
|
||||
var unit = BLL.UnitService.GetUnitByUnitId(solution.UnitId);
|
||||
solution.UnitId = solution.UnitId + "$" + (unit != null ? unit.UnitName : "");
|
||||
solution.CompileMan = solution.CompileMan + "$" + UserService.GetUserNameByUserId(solution.CompileMan);
|
||||
return solution;
|
||||
}
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取方案类别
|
||||
/// </summary>
|
||||
/// <param name="state"></param>
|
||||
/// <returns></returns>
|
||||
public static string ConvertSolutionType(object solutionType)
|
||||
{
|
||||
if (solutionType != null)
|
||||
{
|
||||
if (solutionType.ToString() == "1")
|
||||
{
|
||||
return "施工组织设计";
|
||||
}
|
||||
else if (solutionType.ToString() == "2")
|
||||
{
|
||||
return "专项施工方案";
|
||||
}
|
||||
else if (solutionType.ToString() == "3")
|
||||
{
|
||||
return "施工方案";
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
public static string GetProfessionalName(string cNProfessionalCodes)
|
||||
{
|
||||
string professionalName = string.Empty;
|
||||
if (!string.IsNullOrEmpty(cNProfessionalCodes))
|
||||
{
|
||||
string[] strs = cNProfessionalCodes.Split(',');
|
||||
foreach (var item in strs)
|
||||
{
|
||||
var cn = BLL.CNProfessionalService.GetCNProfessional(item);
|
||||
if (cn != null)
|
||||
{
|
||||
professionalName += cn.ProfessionalName + ",";
|
||||
}
|
||||
}
|
||||
if (!string.IsNullOrEmpty(professionalName))
|
||||
{
|
||||
professionalName = professionalName.Substring(0, professionalName.LastIndexOf(","));
|
||||
}
|
||||
}
|
||||
return professionalName;
|
||||
}
|
||||
public static string GetUnitWorkName(string unitWorkIds)
|
||||
{
|
||||
string unitWorkName = string.Empty;
|
||||
if (!string.IsNullOrEmpty(unitWorkIds))
|
||||
{
|
||||
string[] strs = unitWorkIds.Split(',');
|
||||
foreach (var item in strs)
|
||||
{
|
||||
var un = BLL.UnitWorkService.GetUnitWorkByUnitWorkId(item);
|
||||
if (un != null)
|
||||
{
|
||||
unitWorkName += un.UnitWorkName + BLL.UnitWorkService.GetProjectType(un.ProjectType) + ",";
|
||||
}
|
||||
}
|
||||
if (!string.IsNullOrEmpty(unitWorkName))
|
||||
{
|
||||
unitWorkName = unitWorkName.Substring(0, unitWorkName.LastIndexOf(","));
|
||||
}
|
||||
}
|
||||
return unitWorkName;
|
||||
}
|
||||
public static List<Model.Solution_CQMSConstructSolution> getListDataForApi(string name, string unitId, string unitWork, string cNProfessionalCodes, string solutionType, string state, string projectId, int startRowIndex, int maximumRows)
|
||||
{
|
||||
using (var db = new Model.SGGLDB(Funs.ConnString))
|
||||
{
|
||||
IQueryable<Model.Solution_CQMSConstructSolution> q = db.Solution_CQMSConstructSolution;
|
||||
|
||||
if (!string.IsNullOrEmpty(projectId))
|
||||
{
|
||||
q = q.Where(e => e.ProjectId == projectId);
|
||||
}
|
||||
if (!string.IsNullOrEmpty(unitId) && unitId != "undefined")
|
||||
{
|
||||
q = q.Where(e => e.UnitId == unitId);
|
||||
}
|
||||
if (!string.IsNullOrEmpty(unitWork) && unitWork != "undefined")
|
||||
{
|
||||
q = q.Where(e => e.UnitWorkIds.Contains(unitWork));
|
||||
}
|
||||
if (!string.IsNullOrEmpty(cNProfessionalCodes) && cNProfessionalCodes != "undefined")
|
||||
{
|
||||
q = q.Where(e => e.CNProfessionalCodes.Contains(cNProfessionalCodes));
|
||||
}
|
||||
if (!string.IsNullOrEmpty(solutionType) && solutionType != "undefined")
|
||||
{
|
||||
q = q.Where(e => e.SolutionType == solutionType);
|
||||
}
|
||||
if (!string.IsNullOrEmpty(state) && state != "undefined")
|
||||
{
|
||||
if ("已闭合" == state)
|
||||
{
|
||||
q = q.Where(e => e.State == "3");
|
||||
}
|
||||
else if ("未闭合" == state)
|
||||
{
|
||||
q = q.Where(e => e.State != "3");
|
||||
|
||||
}
|
||||
}
|
||||
if (!string.IsNullOrEmpty(name))
|
||||
{
|
||||
List<string> ids = new List<string>();
|
||||
var qunit = from u in Funs.DB.Base_Unit
|
||||
where u.UnitName.Contains(name)
|
||||
select u.UnitId;
|
||||
ids = qunit.ToList();
|
||||
q = q.Where(e => e.SolutionName.Contains(name) || ids.Contains(e.UnitId));
|
||||
}
|
||||
|
||||
|
||||
var qlist = from x in q
|
||||
orderby x.Code descending
|
||||
|
||||
select new
|
||||
{
|
||||
x.ConstructSolutionId,
|
||||
x.Code,
|
||||
x.ProjectId,
|
||||
x.UnitId,
|
||||
UnitName = (from y in db.Base_Unit where y.UnitId == x.UnitId select y.UnitName).First(),
|
||||
x.SolutionName,
|
||||
x.SolutionType,
|
||||
x.UnitWorkIds,
|
||||
UnitWorkName = GetUnitWorkName(x.UnitWorkIds),
|
||||
x.CNProfessionalCodes,
|
||||
ProfessionalName = GetProfessionalName(x.CNProfessionalCodes),
|
||||
x.AttachUrl,
|
||||
x.CompileMan,
|
||||
x.CompileDate,
|
||||
x.State,
|
||||
x.Edition,
|
||||
CompileManName = (from y in db.Sys_User where y.UserId == x.CompileMan select y.UserName).First(),
|
||||
};
|
||||
|
||||
List<Model.Solution_CQMSConstructSolution> res = new List<Model.Solution_CQMSConstructSolution>();
|
||||
var qres = qlist.Skip(startRowIndex * maximumRows).Take(maximumRows).ToList();
|
||||
foreach (var item in qres)
|
||||
{
|
||||
Model.Solution_CQMSConstructSolution cs = new Model.Solution_CQMSConstructSolution();
|
||||
cs.ConstructSolutionId = item.ConstructSolutionId;
|
||||
cs.Code = item.Code;
|
||||
cs.ProjectId = item.ProjectId;
|
||||
cs.UnitId = item.UnitId + "$" + item.UnitName;
|
||||
cs.SolutionName = item.SolutionName;
|
||||
cs.SolutionType = item.SolutionType;
|
||||
cs.UnitWorkIds = item.UnitWorkIds + "$" + item.UnitWorkName;
|
||||
cs.CNProfessionalCodes = item.CNProfessionalCodes + "$" + item.ProfessionalName;
|
||||
cs.AttachUrl = item.AttachUrl;
|
||||
cs.CompileMan = item.CompileMan + "$" + item.CompileManName;
|
||||
cs.CompileDate = item.CompileDate;
|
||||
cs.State = item.State;
|
||||
cs.Edition = item.Edition;
|
||||
|
||||
res.Add(cs);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
}
|
||||
public static List<Model.Solution_CQMSConstructSolution> getListDataForApi(string name, string projectId,string solutionType, int startRowIndex, int maximumRows)
|
||||
{
|
||||
var db = Funs.DB;
|
||||
IQueryable<Model.Solution_CQMSConstructSolution> q = db.Solution_CQMSConstructSolution;
|
||||
|
||||
if (!string.IsNullOrEmpty(projectId))
|
||||
{
|
||||
q = q.Where(e => e.ProjectId == projectId);
|
||||
}
|
||||
if (!string.IsNullOrEmpty(solutionType))
|
||||
{
|
||||
q = q.Where(e => e.SolutionType == solutionType);
|
||||
}
|
||||
if (!string.IsNullOrEmpty(name))
|
||||
{
|
||||
List<string> ids = new List<string>();
|
||||
var qunit = from u in Funs.DB.Base_Unit
|
||||
where u.UnitName.Contains(name)
|
||||
select u.UnitId;
|
||||
ids = qunit.ToList();
|
||||
q = q.Where(e => e.SolutionName.Contains(name) || ids.Contains(e.UnitId));
|
||||
}
|
||||
|
||||
|
||||
var qlist = from x in q
|
||||
orderby x.Code descending
|
||||
|
||||
select new
|
||||
{
|
||||
x.ConstructSolutionId,
|
||||
x.Code,
|
||||
x.ProjectId,
|
||||
x.UnitId,
|
||||
UnitName = (from y in db.Base_Unit where y.UnitId == x.UnitId select y.UnitName).First(),
|
||||
x.SolutionName,
|
||||
x.SolutionType,
|
||||
x.UnitWorkIds,
|
||||
UnitWorkName = GetUnitWorkName(x.UnitWorkIds),
|
||||
x.CNProfessionalCodes,
|
||||
ProfessionalName = GetProfessionalName(x.CNProfessionalCodes),
|
||||
x.AttachUrl,
|
||||
x.CompileMan,
|
||||
x.CompileDate,
|
||||
x.State,
|
||||
x.Edition,
|
||||
CompileManName = (from y in db.Sys_User where y.UserId == x.CompileMan select y.UserName).First(),
|
||||
};
|
||||
|
||||
List<Model.Solution_CQMSConstructSolution> res = new List<Model.Solution_CQMSConstructSolution>();
|
||||
var qres = qlist.Skip(startRowIndex * maximumRows).Take(maximumRows).ToList();
|
||||
foreach (var item in qres)
|
||||
{
|
||||
Model.Solution_CQMSConstructSolution cs = new Model.Solution_CQMSConstructSolution();
|
||||
cs.ConstructSolutionId = item.ConstructSolutionId;
|
||||
cs.Code = item.Code;
|
||||
cs.ProjectId = item.ProjectId;
|
||||
cs.UnitId = item.UnitId + "$" + item.UnitName;
|
||||
cs.SolutionName = item.SolutionName;
|
||||
cs.SolutionType = item.SolutionType;
|
||||
cs.UnitWorkIds = item.UnitWorkIds + "$" + item.UnitWorkName;
|
||||
cs.CNProfessionalCodes = item.CNProfessionalCodes + "$" + item.ProfessionalName;
|
||||
cs.AttachUrl = AttachFileService.getFileUrl(item.ConstructSolutionId);
|
||||
cs.CompileMan = item.CompileMan + "$" + item.CompileManName;
|
||||
cs.CompileDate = item.CompileDate;
|
||||
cs.State = item.State;
|
||||
cs.Edition = item.Edition;
|
||||
|
||||
res.Add(cs);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
public static void UpdateConstructSolutionForApi(Model.Solution_CQMSConstructSolution constructSolution)
|
||||
{
|
||||
using (var db = new Model.SGGLDB(Funs.ConnString))
|
||||
{
|
||||
Model.Solution_CQMSConstructSolution newConstructSolution = db.Solution_CQMSConstructSolution.First(e => e.ConstructSolutionId == constructSolution.ConstructSolutionId);
|
||||
if (!string.IsNullOrEmpty(constructSolution.Code))
|
||||
newConstructSolution.Code = constructSolution.Code;
|
||||
if (!string.IsNullOrEmpty(constructSolution.UnitId))
|
||||
newConstructSolution.UnitId = constructSolution.UnitId;
|
||||
if (!string.IsNullOrEmpty(constructSolution.SolutionName))
|
||||
newConstructSolution.SolutionName = constructSolution.SolutionName;
|
||||
if (!string.IsNullOrEmpty(constructSolution.SolutionType))
|
||||
newConstructSolution.SolutionType = constructSolution.SolutionType;
|
||||
if (!string.IsNullOrEmpty(constructSolution.UnitWorkIds))
|
||||
newConstructSolution.UnitWorkIds = constructSolution.UnitWorkIds;
|
||||
if (!string.IsNullOrEmpty(constructSolution.CNProfessionalCodes))
|
||||
newConstructSolution.CNProfessionalCodes = constructSolution.CNProfessionalCodes;
|
||||
if (!string.IsNullOrEmpty(constructSolution.AttachUrl))
|
||||
newConstructSolution.AttachUrl = constructSolution.AttachUrl;
|
||||
if (!string.IsNullOrEmpty(constructSolution.State))
|
||||
newConstructSolution.State = constructSolution.State;
|
||||
if (constructSolution.Edition.HasValue)
|
||||
newConstructSolution.Edition = constructSolution.Edition;
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user