using AngleSharp.Dom;
|
using AngleSharp.Html.Parser;
|
using DocumentServiceAPI.Application.ProjectInfo.Services.Interfaces;
|
using DocumentServiceAPI.Application.ProjectInfo.ViewMode;
|
using DocumentServiceAPI.Application.Repository;
|
using DocumentServiceAPI.Application.UserAndLogin.ViewMode;
|
using DocumentServiceAPI.Application.WorkRemind.Services.Interfaces;
|
using DocumentServiceAPI.Application.WorkRemind.ViewMode;
|
using DocumentServiceAPI.Core;
|
using DocumentServiceAPI.Model;
|
using DocumentServiceAPI.Model.cyDocumentModel;
|
using DocumentServiceAPI.Model.UserInfoModel;
|
using DocumentServiceAPI.Utility;
|
using Furion.LinqBuilder;
|
using Furion.Logging;
|
using Furion.Logging.Extensions;
|
using Furion.Schedule;
|
using MapsterMapper;
|
using Microsoft.AspNetCore.Mvc.RazorPages;
|
using Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http;
|
using NetTaste;
|
using Newtonsoft.Json;
|
using SqlSugar;
|
using SqlSugar.Extensions;
|
using System;
|
using System.Collections.Generic;
|
using System.Data;
|
using System.Diagnostics.Metrics;
|
using System.Linq;
|
using System.Reflection.Metadata;
|
using System.Runtime.Intrinsics.Arm;
|
using System.Runtime.Intrinsics.X86;
|
using System.Security.Claims;
|
using System.Text;
|
using System.Threading.Tasks;
|
|
namespace DocumentServiceAPI.Application.ProjectInfo.Services
|
{
|
public class ProjectInfoService : IProjectInfoService, IScoped
|
{
|
|
private ISqlSugarClient _db { get; set; }
|
private ProjectInfoRepository _projectInfoRepository { get; set; }
|
private IMapper _mapper { get; set; }
|
public ProjectInfoService(ISqlSugarClient db, ProjectInfoRepository projectInfoRepository, IMapper mapper)
|
{
|
_db = db;
|
_projectInfoRepository = projectInfoRepository;
|
_mapper = mapper;
|
}
|
|
|
public bool InProjectInfo(DocumentProjectInfoDTO dp)
|
{
|
|
//var a = GetJwtInfo();
|
//dp.LastUpTime = DateTime.Now;
|
//dp.CreatEmployeeId = a.EID;
|
|
//var tentlist = _db.Queryable<Document_EmployeeInfo>()
|
// .Where(x => x.EmployeeId == a.EID
|
|
//).First();
|
//if (tentlist != null)
|
//{
|
// dw.CreatEmployeeName = tentlist.EmployeeName;
|
|
//}
|
var documentProjectInfo = _mapper.Map<Document_ProjectInfo>(dp);
|
return _projectInfoRepository.Insert(documentProjectInfo);
|
|
}
|
|
public bool IsExistProject(string ProjectName, string ProjectCode)
|
{
|
var a = GetJwtInfo();
|
|
var ret = _db.Queryable<Document_ProjectInfo>().Count(x => x.ProjectCode == ProjectCode && x.ProjectName == ProjectName && x.TenantID == a.TEID);
|
|
if(ret > 0)
|
{
|
return true;
|
}
|
else
|
{
|
return false;
|
}
|
|
}
|
|
|
|
|
|
|
/// <summary>
|
/// 获取Jwt相关信息
|
/// </summary>
|
public JwtInfo GetJwtInfo()
|
{
|
JwtInfo jwtInfo = new JwtInfo();
|
jwtInfo.LogInSource = (LogInFrom)(App.User?.FindFirstValue("loginfrom")?.ObjToInt() ?? 0);
|
jwtInfo.EID = App.User?.FindFirstValue("eid")?.ObjToInt();
|
jwtInfo.UID = App.User?.FindFirstValue("uid")?.ObjToInt();
|
jwtInfo.TEID = App.User?.FindFirstValue("teid")?.ObjToInt();
|
var guid = App.User?.FindFirstValue("jid");
|
jwtInfo.JID = string.IsNullOrEmpty(guid) ? null : new Guid(guid);
|
return jwtInfo;
|
}
|
|
|
public Document_ProjectInfo ProjectInfoByUrl(Document_ProjectInfo dp)
|
{
|
Document_ProjectInfo document_ProjectInfo = new Document_ProjectInfo();
|
string url = dp.ProjectUrl;
|
document_ProjectInfo.ProjectUrl = dp.ProjectUrl;
|
var parser = new HtmlParser();
|
var list11 = new List<AngleSharp.Dom.IElement>();
|
if (url.StartsWith("http://www.ccgp.gov.cn"))
|
{
|
using (HttpClient client = new HttpClient())
|
{
|
client.Timeout = TimeSpan.FromSeconds(60);
|
//List<sichuanjieshoudtl> data = new List<sichuanjieshoudtl>();
|
HttpResponseMessage response = client.GetAsync(url).Result;
|
var res = response.Content.ReadAsStringAsync().Result;
|
var document = parser.ParseDocument(res);
|
var sssdfsdfsd = document.All.Where(m => m.ClassName == "vF_detail_header").FirstOrDefault();
|
var tc = sssdfsdfsd.QuerySelectorAll(".tc");
|
document_ProjectInfo.ProjectName = tc[0].TextContent;
|
var aaa = sssdfsdfsd.QuerySelectorAll("span");
|
foreach (var element in aaa)
|
{
|
if(element.GetAttribute("id").StartsWith("pubTime"))
|
{
|
DateTime a;
|
if (DateTime.TryParse(element.TextContent, out a))
|
{
|
document_ProjectInfo.GongGaoTime = a;
|
}
|
|
}
|
}
|
document_ProjectInfo.PurchaseMethod = 0;
|
if (document_ProjectInfo.ProjectName.IndexOf("公开招标")>=0)
|
{
|
document_ProjectInfo.PurchaseMethod = 3;
|
}
|
else if (document_ProjectInfo.ProjectName.IndexOf("竞争性谈判") >= 0)
|
{
|
document_ProjectInfo.PurchaseMethod = 4;
|
}
|
else if (document_ProjectInfo.ProjectName.IndexOf("单一来源") >= 0)
|
{
|
document_ProjectInfo.PurchaseMethod = 5;
|
}
|
else if (document_ProjectInfo.ProjectName.IndexOf("询价") >= 0)
|
{
|
document_ProjectInfo.PurchaseMethod = 6;
|
}
|
else if (document_ProjectInfo.ProjectName.IndexOf("邀请") >= 0)
|
{
|
document_ProjectInfo.PurchaseMethod = 31;
|
}
|
|
|
|
|
var vF_detail_content = document.All.Where(m => m.ClassName == "vF_detail_content").FirstOrDefault();
|
var td = vF_detail_content.QuerySelectorAll("p");
|
if (td != null && td.Length > 0)
|
{
|
|
|
for (int i = 0; i < td.Length; i++)
|
{
|
if (td[i].TextContent.IndexOf("项目编号:") >= 0 && td[i].TextContent.IndexOf("、") < 0)
|
{
|
if (string.IsNullOrEmpty(document_ProjectInfo.ProjectCode))
|
{
|
document_ProjectInfo.ProjectCode = td[i].TextContent.Replace("项目编号:", "").Replace("1.", "").Replace("/", "").Trim();
|
}
|
|
|
|
}
|
if (td[i].TextContent.IndexOf("预算金额:") >= 0)
|
{
|
|
if (td[i].TextContent.IndexOf("万元") >= 0)
|
{
|
var yusuan = td[i].TextContent.Replace("预算金额:", "").Replace("3.", "").Replace("(", "").Replace(")", "").Replace("万元", "").Replace("人民币", "").Trim();
|
decimal a = 0;
|
if (decimal.TryParse(yusuan, out a))
|
{
|
//document_ProjectInfo.ys = a * 10000;
|
}
|
|
|
}
|
else
|
{
|
var yusuan = td[i].TextContent.Replace("预算金额:", "").Replace("3.", "").Replace("(", "").Replace(")", "").Replace("元", "").Replace("人民币", "").Trim();
|
decimal a = 0;
|
if (decimal.TryParse(yusuan, out a))
|
{
|
//Budget = a;
|
}
|
}
|
}
|
|
|
if (td[i].TextContent.IndexOf("开标时间:") >= 0)
|
{
|
|
|
DateTime a;
|
var sss = td[i].TextContent.Replace("开标时间:", "").Replace("北京时间)", "").Replace("年", "-").Replace("月", "-").Replace("日", " ").Replace("点", ":").Replace("时", ":").Replace("分(", "").Replace("分", ":").Replace("秒", "").Replace("(", "").Trim();
|
if (DateTime.TryParse(sss, out a))
|
{
|
document_ProjectInfo.TenderTime = a;
|
document_ProjectInfo.SignupStartTime = a;
|
document_ProjectInfo.SignupEndTime = a;
|
}
|
|
|
}
|
if (td[i].TextContent.IndexOf("1.时间:") >= 0)
|
{
|
if (!document_ProjectInfo.TenderTime.HasValue)
|
{
|
DateTime a;
|
var sss = td[i].TextContent.Replace("1.时间:", "").Replace("北京时间)", "").Replace("年", "-").Replace("月", "-").Replace("日", " ").Replace("点", ":").Replace("时", ":").Replace("分(", "").Replace("分", ":").Replace("秒", "").Replace("(", "").Trim();
|
if (DateTime.TryParse(sss, out a))
|
{
|
document_ProjectInfo.TenderTime = a;
|
document_ProjectInfo.SignupStartTime = a;
|
document_ProjectInfo.SignupEndTime = a;
|
}
|
}
|
|
|
|
|
}
|
|
if (td[i].TextContent.StartsWith("时间:"))
|
{
|
if (!document_ProjectInfo.TenderTime.HasValue)
|
{
|
DateTime a;
|
var sss = td[i].TextContent.Replace("时间:", "").Replace("北京时间)", "").Replace("年", "-").Replace("月", "-").Replace("日", " ").Replace("点", ":").Replace("时", ":").Replace("分(", "").Replace("分", ":").Replace("秒", "").Replace("(", "").Trim();
|
if (DateTime.TryParse(sss, out a))
|
{
|
document_ProjectInfo.TenderTime = a;
|
document_ProjectInfo.SignupStartTime = a;
|
document_ProjectInfo.SignupEndTime = a;
|
}
|
}
|
|
|
|
|
}
|
|
|
if (td[i].TextContent.IndexOf("采购人信息")>=0)
|
{
|
if(td[i+1]!=null)
|
{
|
document_ProjectInfo.PurchaseUnit = td[i + 1].TextContent.Replace("名 称:", "").Replace("名称:", "").Trim();
|
}
|
if (td[i + 2] != null)
|
{
|
document_ProjectInfo.PurchaseAddress = td[i + 2].TextContent.Replace("地址:", "").Replace("地 址:", "").Replace("地 址:", "").Trim();
|
}
|
if (td[i + 3] != null)
|
{
|
document_ProjectInfo.PurchasePhone = td[i + 3].TextContent.Replace("联系方式:", "").Trim();
|
}
|
|
}
|
|
if (td[i].TextContent.IndexOf("采购代理机构信息") >= 0)
|
{
|
if (td[i + 1] != null)
|
{
|
document_ProjectInfo.AgencyUnit = td[i + 1].TextContent.Replace("名 称:", "").Replace("名称:", "").Trim();
|
}
|
if (td[i + 2] != null)
|
{
|
document_ProjectInfo.AgencyAddress = td[i + 2].TextContent.Replace("地址:", "").Replace("地 址:", "").Replace("地 址:", "").Trim();
|
}
|
if (td[i + 3] != null)
|
{
|
document_ProjectInfo.AgencyPhone = td[i + 3].TextContent.Replace("联系方式:", "").Trim();
|
}
|
|
}
|
|
}
|
}
|
}
|
}
|
else if (url.StartsWith("https://zfcg.scsczt.cn"))
|
{
|
using (HttpClient client = new HttpClient())
|
{
|
client.Timeout = TimeSpan.FromSeconds(60);
|
|
HttpResponseMessage response = client.GetAsync(url).Result;
|
var res = response.Content.ReadAsStringAsync().Result;
|
var document = parser.ParseDocument(res);
|
|
|
|
|
|
var sssdfsdfsd = document.All.Where(m => m.LocalName == "h1" && m.ClassName == "info-title").FirstOrDefault();
|
document_ProjectInfo.ProjectName = sssdfsdfsd.TextContent.Replace("\n", "").Trim();
|
var AllDiv = document.All.Where(m => m.LocalName == "span" &&
|
m.HasAttribute("id") &&
|
m.GetAttribute("id").StartsWith("noticeTime")).FirstOrDefault();
|
|
string ssssss = AllDiv.QuerySelector("i").TextContent.Replace("北京时间)", "").Replace("年", "-").Replace("月", "-").Replace("日", " ").Replace("点", ":").Replace("时", ":").Replace("分(", "").Replace("分", ":").Replace("秒", "").Replace("(", "").Trim();
|
DateTime b;
|
if (DateTime.TryParse(ssssss, out b))
|
{
|
document_ProjectInfo.GongGaoTime = b;
|
}
|
|
|
var TenderTime = document.All.Where(m => m.LocalName == "span" && m.ClassName == "noticePurchaseTime-noticePurchaseTime _notice_content_noticePurchaseTime-noticePurchaseTime bidFileSubmitTime dynamic-form-editor").FirstOrDefault();
|
|
string TenderTimes = TenderTime.TextContent.Replace("北京时间)", "").Replace("年", "-").Replace("月", "-").Replace("日", " ").Replace("点", ":").Replace("时", ":").Replace("分(", "").Replace("分", "").Replace("秒", "").Replace("(", "").Trim();
|
if (DateTime.TryParse(TenderTimes, out b))
|
{
|
document_ProjectInfo.TenderTime = b;
|
document_ProjectInfo.SignupStartTime = b;
|
document_ProjectInfo.SignupEndTime = b;
|
}
|
|
|
|
document_ProjectInfo.PurchaseMethod = 0;
|
if (document_ProjectInfo.ProjectName.IndexOf("公开招标") >= 0)
|
{
|
document_ProjectInfo.PurchaseMethod = 3;
|
}
|
else if (document_ProjectInfo.ProjectName.IndexOf("竞争性谈判") >= 0)
|
{
|
document_ProjectInfo.PurchaseMethod = 4;
|
}
|
else if (document_ProjectInfo.ProjectName.IndexOf("单一来源") >= 0)
|
{
|
document_ProjectInfo.PurchaseMethod = 5;
|
}
|
else if (document_ProjectInfo.ProjectName.IndexOf("询价") >= 0)
|
{
|
document_ProjectInfo.PurchaseMethod = 6;
|
}
|
else if (document_ProjectInfo.ProjectName.IndexOf("邀请") >= 0)
|
{
|
document_ProjectInfo.PurchaseMethod = 31;
|
}
|
|
|
|
|
var vF_detail_content = document.All.Where(m => m.LocalName == "div" &&
|
m.HasAttribute("id") &&
|
m.GetAttribute("id").StartsWith("print-content")).FirstOrDefault();
|
var td = vF_detail_content.QuerySelectorAll("p");
|
if (td != null && td.Length > 0)
|
{
|
|
|
for (int i = 0; i < td.Length; i++)
|
{
|
if (td[i].TextContent.IndexOf("项目编号:") >= 0 && td[i].TextContent.IndexOf("、") < 0)
|
{
|
if (string.IsNullOrEmpty(document_ProjectInfo.ProjectCode))
|
{
|
document_ProjectInfo.ProjectCode = td[i].TextContent.Replace("项目编号:", "").Replace("1.", "").Replace("/", "").Trim();
|
}
|
|
|
|
}
|
|
}
|
}
|
var lianxiren = document.All.Where(m => m.LocalName == "div" && m.ClassName == "innercontent").ToList();
|
foreach (var element in lianxiren)
|
{
|
if(element.TextContent.IndexOf("采购人信息")>=0 && element.TextContent.IndexOf("采购代理机构信息") >= 0)
|
{
|
var lianxirentd = element.QuerySelectorAll("p");
|
if (lianxirentd != null && lianxirentd.Length > 0)
|
{
|
if (lianxirentd[0] != null)
|
{
|
document_ProjectInfo.PurchaseUnit = lianxirentd[0].TextContent.Replace("名 称:", "").Replace("名称:", "").Trim();
|
}
|
if (lianxirentd[1] != null)
|
{
|
document_ProjectInfo.PurchaseAddress = lianxirentd[1].TextContent.Replace("地址:", "").Replace("地 址:", "").Replace("地 址:", "").Trim();
|
}
|
if (lianxirentd[2] != null)
|
{
|
document_ProjectInfo.PurchasePhone = lianxirentd[2].TextContent.Replace("联系方式:", "").Trim();
|
}
|
if (lianxirentd[3] != null)
|
{
|
document_ProjectInfo.AgencyUnit = lianxirentd[3].TextContent.Replace("名 称:", "").Replace("名称:", "").Trim();
|
}
|
if (lianxirentd[4] != null)
|
{
|
document_ProjectInfo.AgencyAddress = lianxirentd[4].TextContent.Replace("地址:", "").Replace("地 址:", "").Replace("地 址:", "").Trim();
|
}
|
if (lianxirentd[5] != null)
|
{
|
document_ProjectInfo.AgencyPhone = lianxirentd[5].TextContent.Replace("联系方式:", "").Trim();
|
}
|
|
}
|
}
|
}
|
|
|
|
}
|
}
|
else if (url.StartsWith("http://202.61.88.152:9080"))
|
{
|
using (HttpClient client = new HttpClient())
|
{
|
client.Timeout = TimeSpan.FromSeconds(60);
|
|
HttpResponseMessage response = client.GetAsync(url).Result;
|
var res = response.Content.ReadAsStringAsync().Result;
|
var document = parser.ParseDocument(res);
|
|
|
|
|
|
var sssdfsdfsd = document.All.Where(m => m.LocalName == "div" && m.ClassName == "cont-info").FirstOrDefault();
|
var ProjectName = sssdfsdfsd.QuerySelectorAll("h1").FirstOrDefault();
|
document_ProjectInfo.ProjectName = ProjectName.TextContent.Replace("\n", "").Trim();
|
var AllDiv = document.All.Where(m => m.LocalName == "p" && m.ClassName == "time").FirstOrDefault();
|
|
string ssssss = AllDiv.TextContent.Replace("系统发布时间:", "").Trim();
|
DateTime b;
|
if (DateTime.TryParse(ssssss, out b))
|
{
|
document_ProjectInfo.GongGaoTime = b;
|
}
|
|
|
//var TenderTime = document.All.Where(m => m.LocalName == "span" && m.ClassName == "noticePurchaseTime-noticePurchaseTime _notice_content_noticePurchaseTime-noticePurchaseTime bidFileSubmitTime dynamic-form-editor").FirstOrDefault();
|
|
//string TenderTimes = TenderTime.TextContent.Replace("北京时间)", "").Replace("年", "-").Replace("月", "-").Replace("日", " ").Replace("点", ":").Replace("时", ":").Replace("分(", "").Replace("分", "").Replace("秒", "").Replace("(", "").Trim();
|
//if (DateTime.TryParse(TenderTimes, out b))
|
//{
|
// document_ProjectInfo.TenderTime = b;
|
// document_ProjectInfo.SignupStartTime = b;
|
// document_ProjectInfo.SignupEndTime = b;
|
//}
|
|
|
|
document_ProjectInfo.PurchaseMethod = 0;
|
if (document_ProjectInfo.ProjectName.IndexOf("公开招标") >= 0)
|
{
|
document_ProjectInfo.PurchaseMethod = 3;
|
}
|
else if (document_ProjectInfo.ProjectName.IndexOf("竞争性谈判") >= 0)
|
{
|
document_ProjectInfo.PurchaseMethod = 4;
|
}
|
else if (document_ProjectInfo.ProjectName.IndexOf("单一来源") >= 0)
|
{
|
document_ProjectInfo.PurchaseMethod = 5;
|
}
|
else if (document_ProjectInfo.ProjectName.IndexOf("询价") >= 0)
|
{
|
document_ProjectInfo.PurchaseMethod = 6;
|
}
|
else if (document_ProjectInfo.ProjectName.IndexOf("邀请") >= 0)
|
{
|
document_ProjectInfo.PurchaseMethod = 31;
|
}
|
|
|
|
|
var vF_detail_content = document.All.Where(m => m.LocalName == "div" &&
|
m.HasAttribute("id") &&
|
m.GetAttribute("id").StartsWith("myPrintArea")).FirstOrDefault();
|
var td = vF_detail_content.QuerySelectorAll("td");
|
if (td != null && td.Length > 0)
|
{
|
|
|
for (int i = 0; i < td.Length; i++)
|
{
|
if (td[i].TextContent.IndexOf("项目编号") >= 0)
|
{
|
if (string.IsNullOrEmpty(document_ProjectInfo.ProjectCode))
|
{
|
document_ProjectInfo.ProjectCode = td[i+1].TextContent.Trim();
|
}
|
}
|
if (td[i].TextContent.IndexOf("提交投标文件截止时间") >= 0)
|
{
|
if (string.IsNullOrEmpty(document_ProjectInfo.ProjectCode))
|
{
|
|
string TenderTimes = td[i + 1].TextContent.Replace("北京时间", "").Replace("年", "-").Replace("月", "-").Replace("日", " ").Replace("点", ":").Replace("时", ":").Replace("分(", "").Replace("分", ":").Replace("秒", "").Replace("(", "").Replace(")", "").Replace("(", "").Replace(")", "").Trim();
|
DateTime a;
|
if (DateTime.TryParse(TenderTimes, out a))
|
{
|
document_ProjectInfo.TenderTime = a;
|
document_ProjectInfo.SignupStartTime = a;
|
document_ProjectInfo.SignupEndTime = a;
|
}
|
}
|
}
|
if (td[i].TextContent.IndexOf("采购人信息") >= 0)
|
{
|
if (string.IsNullOrEmpty(document_ProjectInfo.PurchaseUnit))
|
{
|
if(td[i + 1].TextContent.IndexOf("名称") >= 0)
|
{
|
document_ProjectInfo.PurchaseUnit = td[i + 2].TextContent.Trim(); }
|
|
}
|
if (string.IsNullOrEmpty(document_ProjectInfo.PurchaseAddress))
|
{
|
if (td[i + 3].TextContent.IndexOf("地址") >= 0)
|
{
|
document_ProjectInfo.PurchaseAddress = td[i + 4].TextContent.Trim();
|
}
|
|
}
|
if (string.IsNullOrEmpty(document_ProjectInfo.PurchasePhone))
|
{
|
if (td[i + 5].TextContent.IndexOf("联系方式") >= 0)
|
{
|
document_ProjectInfo.PurchasePhone = td[i + 6].TextContent.Trim();
|
}
|
|
}
|
}
|
|
if (td[i].TextContent.IndexOf("采购代理机构信息") >= 0)
|
{
|
if (string.IsNullOrEmpty(document_ProjectInfo.AgencyUnit))
|
{
|
if (td[i + 1].TextContent.IndexOf("名称") >= 0)
|
{
|
document_ProjectInfo.AgencyUnit = td[i + 2].TextContent.Trim();
|
}
|
|
}
|
if (string.IsNullOrEmpty(document_ProjectInfo.AgencyAddress))
|
{
|
if (td[i + 3].TextContent.IndexOf("地址") >= 0)
|
{
|
document_ProjectInfo.AgencyAddress = td[i + 4].TextContent.Trim();
|
}
|
|
}
|
if (string.IsNullOrEmpty(document_ProjectInfo.AgencyPhone))
|
{
|
if (td[i + 5].TextContent.IndexOf("联系方式") >= 0)
|
{
|
document_ProjectInfo.AgencyPhone = td[i + 6].TextContent.Trim();
|
}
|
|
}
|
}
|
}
|
}
|
|
|
|
|
|
}
|
|
string ssss = "234234234";
|
}
|
else
|
{
|
|
}
|
return document_ProjectInfo;
|
|
|
|
|
}
|
|
|
public PageResult<DocumentProjectInfoDTO> postProjectInfoList(DocumentProjectInfoPageSearch page)
|
{
|
var aaa = GetJwtInfo();
|
|
SqlSugar.PageModel pg = new SqlSugar.PageModel();
|
pg.PageSize = page.PageSize;
|
pg.PageIndex = page.PageIndex;
|
//page.ToEmployeeId = a.EID;
|
int total = 0;
|
PageResult<DocumentProjectInfoDTO> result = new PageResult<DocumentProjectInfoDTO>();
|
|
|
|
result.Items = _db.Queryable<Document_ProjectInfo, Document_ProjectExpand, Document_ProjectOppugnInfo, Document_ProjectComplainInfo, Document_ProjectReviewInfo, Document_ProjectLitigationInfo, Document_AdviseInfo, Document_ProjectComplainInfo, Document_ProjectOppugnInfo, Document_ProjectLitigationInfo, Document_ProjectReviewInfo, Document_WinInfo>((a, d, e,f,g,h,i,j,k,l,m,n) =>
|
new JoinQueryInfos
|
(
|
JoinType.Left, a.ProjectId == d.ProjectId && d.UnitId == page.UnitId,
|
JoinType.Left, a.ProjectId == e.ProjectId && e.UnitId == page.UnitId,
|
JoinType.Left, a.ProjectId == f.ProjectId && f.UnitId == page.UnitId,
|
JoinType.Left, a.ProjectId == g.ProjectId && g.UnitId == page.UnitId,
|
JoinType.Left, a.ProjectId == h.ProjectId && h.UnitId == page.UnitId,
|
JoinType.Left, a.ProjectId == i.ProjectId && i.UnitId == page.UnitId,
|
JoinType.Left, a.ProjectId == j.ProjectId && j.UnitId == page.UnitId,
|
JoinType.Left, a.ProjectId == k.ProjectId && k.UnitId == page.UnitId,
|
JoinType.Left, a.ProjectId == l.ProjectId && l.UnitId == page.UnitId,
|
JoinType.Left, a.ProjectId == m.ProjectId && m.UnitId == page.UnitId,
|
JoinType.Left, a.ProjectId == n.ProjectId && n.UnitId == page.UnitId
|
))
|
.Where((a, d, e, f, g, h, i, j, k, l, m, n) =>a.TenantID == aaa.TEID)
|
//省
|
.WhereIF(!string.IsNullOrEmpty(page.Province) && page.Province!= "请选择", (a, d, e, f, g, h, i, j, k, l, m, n) => (a.Province == page.Province))
|
//市
|
.WhereIF(!string.IsNullOrEmpty(page.City) && page.City != "请选择", (a, d, e, f, g, h, i, j, k, l, m, n) => (a.City == page.City))
|
//区县
|
.WhereIF(!string.IsNullOrEmpty(page.County) && page.County != "请选择", (a, d, e, f, g, h, i, j, k, l, m, n) => (a.County == page.County))
|
//报名时间
|
.WhereIF(!string.IsNullOrEmpty(page.ddlSignupStartTime), (a, d, e, f, g, h, i, j, k, l, m, n) => a.SignupStartTime >= DateTime.Parse(page.ddlSignupStartTime))
|
//报名时间
|
.WhereIF(!string.IsNullOrEmpty(page.ddlSignupEndTime), (a, d, e, f, g, h, i, j, k, l, m, n) => a.SignupEndTime <= DateTime.Parse(page.ddlSignupEndTime))
|
//开标时间
|
.WhereIF(!string.IsNullOrEmpty(page.ddlTenderStartTime), (a, d, e, f, g, h, i, j, k, l, m, n) => a.TenderTime >= DateTime.Parse(page.ddlTenderStartTime))
|
//开标时间
|
.WhereIF(!string.IsNullOrEmpty(page.ddlTenderEndTime), (a, d, e, f, g, h, i, j, k, l, m, n) => a.TenderTime <= DateTime.Parse(page.ddlTenderEndTime))
|
//采购方式
|
.WhereIF(page.ddlPurchaseMethod>0, (a, d, e, f, g, h, i, j, k, l, m, n) => a.PurchaseMethod == page.ddlPurchaseMethod)
|
//项目名称
|
.WhereIF(!string.IsNullOrEmpty(page.txtProjectName), (a, d, e, f, g, h, i, j, k, l, m, n) => a.ProjectName.Contains(page.txtProjectName))
|
//项目编号
|
.WhereIF(!string.IsNullOrEmpty(page.txtProjectCode), (a, d, e, f, g, h, i, j, k, l, m, n) => a.ProjectCode.Contains(page.txtProjectCode))
|
//采购单位
|
.WhereIF(!string.IsNullOrEmpty(page.txtPurchaseUnit), (a, d, e, f, g, h, i, j, k, l, m, n) => a.PurchaseUnit.Contains(page.txtPurchaseUnit))
|
//代理机构
|
.WhereIF(!string.IsNullOrEmpty(page.txtAgencyUnit), (a, d, e, f, g, h, i, j, k, l, m, n) => a.AgencyUnit.Contains(page.txtAgencyUnit))
|
//投标人
|
.WhereIF(!string.IsNullOrEmpty(page.txtTenderPerson), (a, d, e, f, g, h, i, j, k, l, m, n) => d.TenderPerson.Contains(page.txtTenderPerson))
|
//专家
|
.WhereIF(!string.IsNullOrEmpty(page.Experts), (a, d, e, f, g, h, i, j, k, l, m, n) => d.Experts.Contains(page.Experts))
|
//报名状态
|
.WhereIF(page.ddlSignUp > 0 && page.ddlSignUp == 1, (a, d, e, f, g, h, i, j, k, l, m, n) => (d.IsSignup == 0 || d.IsSignup == null))
|
.WhereIF(page.ddlSignUp > 0 && page.ddlSignUp != 1, (a, d, e, f, g, h, i, j, k, l, m, n) => d.IsSignup == 1 )
|
//保证金状态
|
.WhereIF(page.ddlTenderDeposit > 0 && page.ddlTenderDeposit == 12, (a, d, e, f, g, h, i, j, k, l, m, n) => d.TenderDepositStatus == null)
|
.WhereIF(page.ddlTenderDeposit > 0 && page.ddlTenderDeposit == 36, (a, d, e, f, g, h, i, j, k, l, m, n) => a.TenderTime < DateTime.Now.AddDays(15) && d.TenderDepositStatus == 13 )
|
.WhereIF(page.ddlTenderDeposit > 0 && page.ddlTenderDeposit != 12 && page.ddlTenderDeposit != 36, (a, d, e, f, g, h, i, j, k, l, m, n) => d.TenderDepositStatus == page.ddlTenderDeposit)
|
//履约金状态
|
.WhereIF(page.ddlBidbond > 0 && page.ddlBidbond == 32, (a, d, e, f, g, h, i, j, k, l, m, n) => (d.BidbondStatus == null))
|
.WhereIF(page.ddlBidbond > 0 && page.ddlBidbond != 32, (a, d, e, f, g, h, i, j, k, l, m, n) => d.BidbondStatus == page.ddlBidbond )
|
//标书状态
|
.WhereIF(page.ddlDocumentStatus > 0 && page.ddlDocumentStatus == 15, (a, d, e, f, g, h, i, j, k, l, m, n) => (d.DocumentStatus == null || d.DocumentStatus == 0 || d.DocumentStatus == 15))
|
.WhereIF(page.ddlDocumentStatus > 0 && page.ddlDocumentStatus != 15, (a, d, e, f, g, h, i, j, k, l, m, n) => d.DocumentStatus == page.ddlDocumentStatus)
|
//投标状态
|
.WhereIF(page.ddlTenderStatus > 0 && page.ddlTenderStatus == 1, (a, d, e, f, g, h, i, j, k, l, m, n) => (d.TenderStatus == null || d.TenderStatus == 0 ))
|
.WhereIF(page.ddlTenderStatus > 0 && page.ddlTenderStatus != 1, (a, d, e, f, g, h, i, j, k, l, m, n) => d.TenderStatus == 1)
|
//中标情况
|
.WhereIF(page.ddlWinStatus > 0 && page.ddlWinStatus == 1, (a, d, e, f, g, h, i, j, k, l, m, n) => n.IsWin == null )
|
.WhereIF(page.ddlWinStatus > 0 && page.ddlWinStatus != 1, (a, d, e, f, g, h, i, j, k, l, m, n) => n.IsWin == (page.ddlWinStatus -1) )
|
//质疑情况
|
.WhereIF(page.ddlOppugnStatus > 0 && page.ddlOppugnStatus == 1, (a, d, e, f, g, h, i, j, k, l, m, n) => (e.FilePath == null || e.FilePath =="" ))
|
.WhereIF(page.ddlOppugnStatus > 0 && page.ddlOppugnStatus != 1, (a, d, e, f, g, h, i, j, k, l, m, n) => (e.FilePath != null && e.FilePath != ""))
|
//投诉情况
|
.WhereIF(page.ddlComplainStatus > 0 && page.ddlComplainStatus == 1, (a, d, e, f, g, h, i, j, k, l, m, n) => (f.FilePath == null || f.FilePath == ""))
|
.WhereIF(page.ddlComplainStatus > 0 && page.ddlComplainStatus != 1, (a, d, e, f, g, h, i, j, k, l, m, n) => (f.FilePath != null && f.FilePath != ""))
|
//复议情况
|
.WhereIF(page.ddlReviewStatus > 0 && page.ddlReviewStatus == 1, (a, d, e, f, g, h, i, j, k, l, m, n) => (g.FilePath == null || g.FilePath == ""))
|
.WhereIF(page.ddlReviewStatus > 0 && page.ddlReviewStatus != 1, (a, d, e, f, g, h, i, j, k, l, m, n) => (g.FilePath != null && g.FilePath != ""))
|
//诉讼情况
|
.WhereIF(page.ddlLitigationStatus > 0 && page.ddlLitigationStatus == 1, (a, d, e, f, g, h, i, j, k, l, m, n) => (h.FilePath == null || h.FilePath == ""))
|
.WhereIF(page.ddlLitigationStatus > 0 && page.ddlLitigationStatus != 1, (a, d, e, f, g, h, i, j, k, l, m, n) => (h.FilePath != null && h.FilePath != ""))
|
.Select((a, d, e, f, g, h, i, j, k, l, m, n) => new DocumentProjectInfoDTO
|
{
|
ProjectId = a.ProjectId,
|
SignupStartTime = a.SignupStartTime,
|
Province = a.Province,
|
City = a.City,
|
County = a.County,
|
ProjectName = a.ProjectName,
|
PurchaseUnit = a.PurchaseUnit,
|
AgencyUnit = a.AgencyUnit,
|
TenderTime = a.TenderTime,
|
TenderPerson = d.TenderPerson,
|
IsSignup = d.IsSignup,
|
TenderDepositStatus = d.TenderDepositStatus,
|
BidbondStatus = d.BidbondStatus,
|
TenderStatus = d.TenderStatus,
|
IsWin = n.IsWin,
|
IsAdvise = i.IsAdvise,
|
FilePathzy = k.FilePath,
|
FilePathts = j.FilePath,
|
FilePathfy = m.FilePath,
|
FilePathss = l.FilePath,
|
tbqk = "投标情况",
|
wj = "",
|
NoticeTypeName = "招标公告",
|
NoticeType = a.NoticeType,
|
PurchaseMethod = a.PurchaseMethod,
|
DocumentStatus = d.DocumentStatus
|
}
|
)
|
.OrderByDescending(a => a.ProjectId).ToPageList(page.PageIndex, page.PageSize, ref total);
|
|
|
result.TotalCount = total;
|
result.TotalPage = total % page.PageSize == 0 ? total / page.PageSize : total / page.PageSize + 1;
|
|
if(result.Items!=null && result.Items.Count > 0)
|
{
|
var ret = _db.Queryable<Document_Dictionary>().ToList();
|
foreach (var documentProjectInfoDTO in result.Items)
|
{
|
if(documentProjectInfoDTO.City == "请选择" && documentProjectInfoDTO.County == "请选择")
|
{
|
documentProjectInfoDTO.xmqy = documentProjectInfoDTO.Province;
|
}
|
else if (documentProjectInfoDTO.City == "请选择" && documentProjectInfoDTO.County == "其他")
|
{
|
documentProjectInfoDTO.xmqy = documentProjectInfoDTO.City;
|
}
|
else
|
{
|
documentProjectInfoDTO.xmqy = documentProjectInfoDTO.City+ documentProjectInfoDTO.County;
|
}
|
|
if(documentProjectInfoDTO.IsSignup == 1)
|
{
|
documentProjectInfoDTO.bm = "√";
|
}
|
else
|
{
|
documentProjectInfoDTO.bm = "报名";
|
}
|
|
if (!documentProjectInfoDTO.TenderDepositStatus.HasValue || documentProjectInfoDTO.TenderDepositStatus == 0 )
|
{
|
documentProjectInfoDTO.bzj = "缴费";
|
}
|
else if(documentProjectInfoDTO.TenderDepositStatus == 13)
|
{
|
documentProjectInfoDTO.bzj = "退款";
|
}
|
else
|
{
|
documentProjectInfoDTO.bzj = "√";
|
}
|
|
if (!documentProjectInfoDTO.BidbondStatus.HasValue || documentProjectInfoDTO.BidbondStatus == 0)
|
{
|
documentProjectInfoDTO.lybzj = "缴费";
|
}
|
else if (documentProjectInfoDTO.BidbondStatus == 33)
|
{
|
documentProjectInfoDTO.lybzj = "退款";
|
}
|
else
|
{
|
documentProjectInfoDTO.lybzj = "√";
|
}
|
|
if (documentProjectInfoDTO.TenderStatus == 1)
|
{
|
documentProjectInfoDTO.tb = "√";
|
}
|
else
|
{
|
documentProjectInfoDTO.tb = "投标";
|
}
|
|
if (documentProjectInfoDTO.DocumentStatus == 17)
|
{
|
documentProjectInfoDTO.bs = "√";
|
}
|
else if (documentProjectInfoDTO.DocumentStatus == 16)
|
{
|
documentProjectInfoDTO.bs = "制作中";
|
}
|
else
|
{
|
documentProjectInfoDTO.bs = "未制作";
|
}
|
|
|
if (!documentProjectInfoDTO.IsWin.HasValue || documentProjectInfoDTO.IsWin <= 0)
|
{
|
documentProjectInfoDTO.zb = "中标";
|
}
|
else if (documentProjectInfoDTO.IsWin == 2)
|
{
|
documentProjectInfoDTO.zb = "√";
|
}
|
else
|
{
|
documentProjectInfoDTO.zb = "×";
|
}
|
|
if (documentProjectInfoDTO.IsAdvise == 1)
|
{
|
documentProjectInfoDTO.Advise = "方案保存";// "√";
|
}
|
else
|
{
|
documentProjectInfoDTO.Advise = "方案保存";
|
}
|
|
if (!string.IsNullOrEmpty(documentProjectInfoDTO.FilePathzy))
|
{
|
documentProjectInfoDTO.zy = "√";
|
}
|
else
|
{
|
documentProjectInfoDTO.zy = "";
|
}
|
|
if (!string.IsNullOrEmpty(documentProjectInfoDTO.FilePathts))
|
{
|
documentProjectInfoDTO.ts = "√";
|
}
|
else
|
{
|
documentProjectInfoDTO.ts = "";
|
}
|
|
|
if (!string.IsNullOrEmpty(documentProjectInfoDTO.FilePathfy))
|
{
|
documentProjectInfoDTO.fy = "√";
|
}
|
else
|
{
|
documentProjectInfoDTO.fy = "";
|
}
|
|
|
if (!string.IsNullOrEmpty(documentProjectInfoDTO.FilePathss))
|
{
|
documentProjectInfoDTO.ss = "√";
|
}
|
else
|
{
|
documentProjectInfoDTO.ss = "";
|
}
|
if(documentProjectInfoDTO.PurchaseMethod.HasValue && documentProjectInfoDTO.PurchaseMethod.Value > 0)
|
{
|
var document_Dictionary = ret.Where(x => x.Id == documentProjectInfoDTO.PurchaseMethod).FirstOrDefault();
|
if (document_Dictionary != null)
|
{
|
documentProjectInfoDTO.PurchaseMethodName = document_Dictionary.Name;
|
}
|
}
|
|
}
|
}
|
|
return result;
|
}
|
|
public bool DelProjectInfoByIds(List<int> projectIdList)
|
{
|
try
|
{
|
_db.Ado.BeginTran();
|
foreach (int item in projectIdList)
|
{
|
_db.Deleteable<Document_ProjectInfo>().Where(new Document_ProjectInfo() { ProjectId = item }).ExecuteCommand();
|
_db.Deleteable<Document_ProjectDocumentInfo>().Where(new Document_ProjectDocumentInfo() { ProjectId = item }).ExecuteCommand();
|
_db.Deleteable<Document_ProjectExpand>().Where(new Document_ProjectExpand() { ProjectId = item }).ExecuteCommand();
|
_db.Deleteable<Document_ProjectLitigationInfo>().Where(new Document_ProjectLitigationInfo() { ProjectId = item }).ExecuteCommand();
|
_db.Deleteable<Document_ProjectOppugnInfo>().Where(new Document_ProjectOppugnInfo() { ProjectId = item }).ExecuteCommand();
|
_db.Deleteable<Document_ProjectReviewInfo>().Where(new Document_ProjectReviewInfo() { ProjectId = item }).ExecuteCommand();
|
_db.Deleteable<Document_WinInfo>().Where(x=>x.ProjectId == item).ExecuteCommand();
|
_db.Deleteable<Document_ProjectComplainInfo>().Where(new Document_ProjectComplainInfo() { ProjectId = item }).ExecuteCommand();
|
_db.Deleteable<Document_ProjectDocumentInfo>().Where(new Document_ProjectDocumentInfo() { ProjectId = item }).ExecuteCommand();
|
}
|
_db.Ado.CommitTran();
|
}
|
catch (Exception ex)
|
{
|
_db.Ado.RollbackTran();
|
return false;
|
}
|
|
|
return true;
|
}
|
|
|
public DocumentProjectInfoDTO GetProjectInfo(int ID , int TenantID)
|
{
|
var ret = _db.Queryable<Document_ProjectInfo>().Where(x => x.ProjectId == ID && x.TenantID == TenantID).First();
|
if (ret == null)
|
{
|
ret = new Document_ProjectInfo();
|
}
|
var documentProjectInfo = _mapper.Map<DocumentProjectInfoDTO>(ret);
|
var sys_CitySites = _db.Queryable<Sys_CitySite>().ToList();
|
|
if (!string.IsNullOrEmpty(documentProjectInfo.Province))
|
{
|
var provice = sys_CitySites.Where(x => x.Name == documentProjectInfo.Province && x.ProvinceId == 0 && x.CityId == 0).FirstOrDefault();
|
if (provice != null)
|
{
|
documentProjectInfo.ProvinceId = provice.Keyid.Value;
|
}
|
}
|
|
if (!string.IsNullOrEmpty(documentProjectInfo.City))
|
{
|
var city = sys_CitySites.Where(x => x.Name == documentProjectInfo.City && x.ProvinceId == documentProjectInfo.ProvinceId && x.CityId == 0).FirstOrDefault();
|
if (city != null)
|
{
|
documentProjectInfo.CityId = city.Keyid.Value;
|
}
|
}
|
|
if (!string.IsNullOrEmpty(documentProjectInfo.County))
|
{
|
var county = sys_CitySites.Where(x => x.Name == documentProjectInfo.County && x.ProvinceId == documentProjectInfo.ProvinceId && x.CityId == documentProjectInfo.CityId).FirstOrDefault();
|
if (county != null)
|
{
|
documentProjectInfo.CountyId = county.Keyid.Value;
|
}
|
}
|
|
return documentProjectInfo;
|
|
}
|
|
|
public Document_ProjectExpand GetProjectExpand(int ID, int UnitId)
|
{
|
var ret = _db.Queryable<Document_ProjectExpand>().Where(x => x.ProjectId == ID && x.UnitId == UnitId ).First();
|
return ret;
|
}
|
|
public Document_WinInfo GetDocument_WinInfo(int ID, int UnitId)
|
{
|
var aaa = GetJwtInfo();
|
var ret = _db.Queryable<Document_WinInfo>().Where(x => x.ProjectId == ID && x.UnitId == UnitId ).First();
|
if (ret == null || string.IsNullOrEmpty(ret.FirstWinCompany))
|
{
|
|
var projectInfo = _db.Queryable<Document_ProjectInfo>().Where(x => x.ProjectId == ID && x.TenantID == aaa.TEID).First();
|
if (projectInfo != null)
|
{
|
_db.AsTenant().ChangeDatabase("zhengcaioa");
|
var sss = _db.Ado.GetDataTable("select [Id] ,[start_time] ,[sheng] ,[city] ,[area_id] ,[cgfs] ,[number] ,[name] from Project where number=@number", new { number = projectInfo.ProjectCode });
|
if(sss!=null && sss.Rows.Count > 0)
|
{
|
ret = new Document_WinInfo();
|
ret.ProjectId = ID;
|
ret.UnitId = UnitId;
|
ret.IsWin = 0;
|
foreach (DataRow row in sss.Rows)
|
{
|
var aaaaaaaa = _db.Ado.GetDataTable("select [zhongbiaoId] ,[ProjectId] ,[names] ,[price] ,[defen] ,[zb_zhiyistatus] ,[zb_zhiyishijian] ,[zb_zhiyichengli] ,[zb_tousustatus] ,[zb_tousushijian] ,[zb_tousuchengli] from Projectzhongbiao where ProjectId=@ProjectId", new { ProjectId = Convert.ToString(row["Id"]).Trim() });
|
if (aaaaaaaa != null && aaaaaaaa.Rows.Count > 0)
|
{
|
int i = 0;
|
foreach (DataRow row0 in aaaaaaaa.Rows)
|
{
|
|
if (i == 0)
|
{
|
|
ret.FirstWinCompany = Convert.ToString(row0["names"]).Trim();
|
if(row0["price"]!=null && !string.IsNullOrEmpty(row0["price"].ToString()))
|
{
|
string price = row0["price"].ToString().Trim().Replace("元", "").Replace("万", "");
|
decimal priceprice = 0;
|
|
if(decimal.TryParse(price,out priceprice))
|
{
|
ret.FirstPrice = priceprice;
|
}
|
}
|
ret.FirstWinDefen = Convert.ToString(row0["defen"]).Trim();
|
}
|
if (i == 1)
|
{
|
ret.SecondWinCompany = Convert.ToString(row0["names"]).Trim();
|
if (row0["price"] != null && !string.IsNullOrEmpty(row0["price"].ToString()))
|
{
|
string price = row0["price"].ToString().Trim().Replace("元", "").Replace("万", "");
|
decimal priceprice = 0;
|
|
if (decimal.TryParse(price, out priceprice))
|
{
|
ret.SecondPrice = priceprice;
|
}
|
}
|
ret.SecondWinDefen = Convert.ToString(row0["defen"]).Trim();
|
}
|
if (i == 2)
|
{
|
ret.ThirdCompany = Convert.ToString(row0["names"]).Trim();
|
if (row0["price"] != null && !string.IsNullOrEmpty(row0["price"].ToString()))
|
{
|
string price = row0["price"].ToString().Trim().Replace("元", "").Replace("万", "");
|
decimal priceprice = 0;
|
|
if (decimal.TryParse(price, out priceprice))
|
{
|
ret.ThirdPrice = priceprice;
|
}
|
}
|
ret.ThirdWinDefen = Convert.ToString(row0["defen"]).Trim();
|
}
|
|
i += 1;
|
}
|
|
|
|
|
|
|
//if (aaaaaaaa.Rows.Count > 0)
|
//{
|
// DataRow row0 = aaaaaaaa.Rows[0];
|
// ret.FirstWinCompany = Convert.ToString(row0.ItemArray[2]).Trim();
|
// ret.FirstPrice = Convert.ToDecimal(row0.ItemArray[3]);
|
// ret.FirstWinDefen = Convert.ToString(row0.ItemArray[4]).Trim();
|
//}
|
//if (aaaaaaaa.Rows.Count > 1)
|
//{
|
// DataRow row1 = aaaaaaaa.Rows[1];
|
// ret.SecondWinCompany = Convert.ToString(row1.ItemArray[2]).Trim();
|
// ret.SecondPrice = Convert.ToDecimal(row1.ItemArray[3]);
|
// ret.SecondWinDefen = Convert.ToString(row1.ItemArray[4]).Trim();
|
//}
|
//if (aaaaaaaa.Rows.Count > 2)
|
//{
|
// DataRow row2 = aaaaaaaa.Rows[2];
|
// ret.ThirdCompany = Convert.ToString(row2.ItemArray[2]).Trim();
|
// ret.ThirdPrice = Convert.ToDecimal(row2.ItemArray[3]);
|
// ret.ThirdWinDefen = Convert.ToString(row2.ItemArray[4]).Trim();
|
//}
|
|
break;
|
}
|
}
|
}
|
}
|
|
}
|
|
|
return ret;
|
}
|
|
public Document_AdviseInfo GetDocument_AdviseInfo(int ID, int UnitId)
|
{
|
var ret = _db.Queryable<Document_AdviseInfo>().Where(x => x.ProjectId == ID && x.UnitId == UnitId).First();
|
return ret;
|
}
|
|
public Document_ProjectOppugnInfo GetProjectOppugnInfo(int ID, int UnitId)
|
{
|
var ret = _db.Queryable<Document_ProjectOppugnInfo>().Where(x => x.ProjectId == ID && x.UnitId == UnitId).First();
|
return ret;
|
}
|
|
public Document_ProjectComplainInfo GetProjectComplainInfo(int ID, int UnitId)
|
{
|
var ret = _db.Queryable<Document_ProjectComplainInfo>().Where(x => x.ProjectId == ID && x.UnitId == UnitId).First();
|
return ret;
|
}
|
|
public Document_ProjectReviewInfo GetProjectReviewInfo(int ID, int UnitId)
|
{
|
var ret = _db.Queryable<Document_ProjectReviewInfo>().Where(x => x.ProjectId == ID && x.UnitId == UnitId).First();
|
return ret;
|
}
|
|
public Document_ProjectLitigationInfo GetProjectLitigationInfo(int ID, int UnitId)
|
{
|
var ret = _db.Queryable<Document_ProjectLitigationInfo>().Where(x => x.ProjectId == ID && x.UnitId == UnitId).First();
|
return ret;
|
}
|
|
public List<Document_OtherCompanyTenderInfo> GetOtherCompanyTenderInfoList(int ID, int TenantID)
|
{
|
var aaa = GetJwtInfo();
|
|
var ret = _db.Queryable<Document_OtherCompanyTenderInfo>().Where(x => x.ProjectId == ID && x.TenantID == TenantID).ToList();
|
if (ret == null || ret.Count==0)
|
{
|
|
var projectInfo = _db.Queryable<Document_ProjectInfo>().Where(x => x.ProjectId == ID && x.TenantID == TenantID).First();
|
if (projectInfo != null)
|
{
|
|
_db.AsTenant().ChangeDatabase("zhengcaioa");
|
var sss = _db.Ado.GetDataTable("select [Id] ,[start_time] ,[sheng] ,[city] ,[area_id] ,[cgfs] ,[number] ,[name] from Project where number=@number", new { number = projectInfo.ProjectCode });
|
if (sss != null && sss.Rows.Count > 0)
|
{
|
ret = new List<Document_OtherCompanyTenderInfo>();
|
foreach (DataRow row in sss.Rows)
|
{
|
var aaaaaaaa = _db.Ado.GetDataTable("select [youxiaoId] ,[ProjectId] ,[namesyouxiao] ,[priceyouxiao] ,[yx_zhiyistatus] ,[yx_zhiyishijian] ,[yx_zhiyichengli] ,[yx_tousustatus] ,[yx_tousushijian] ,[yx_tousuchengli] from Projectyouxiao where ProjectId=@ProjectId", new { ProjectId = Convert.ToString(row["Id"]).Trim() });
|
if (aaaaaaaa != null && aaaaaaaa.Rows.Count > 0)
|
{
|
foreach (DataRow row0 in aaaaaaaa.Rows)
|
{
|
Document_OtherCompanyTenderInfo document_OtherCompanyTenderInfo = new Document_OtherCompanyTenderInfo();
|
document_OtherCompanyTenderInfo.ProjectId = ID;
|
document_OtherCompanyTenderInfo.CompanyName = Convert.ToString(row0["namesyouxiao"]).Trim();
|
if (row0["priceyouxiao"] != null && !string.IsNullOrEmpty(row0["priceyouxiao"].ToString()))
|
{
|
string price = row0["priceyouxiao"].ToString().Trim().Replace("元", "").Replace("万", "");
|
decimal priceprice = 0;
|
|
if (decimal.TryParse(price, out priceprice))
|
{
|
document_OtherCompanyTenderInfo.TenderPrice = priceprice;
|
}
|
}
|
|
document_OtherCompanyTenderInfo.TenantID = TenantID;
|
ret.Add(document_OtherCompanyTenderInfo);
|
}
|
break;
|
}
|
}
|
}
|
}
|
|
}
|
return ret;
|
}
|
public Document_OtherCompanyTenderInfo GetOtherCompanyTenderInfo(int ID, string companyName)
|
{
|
var a = GetJwtInfo();
|
|
var ret = _db.Queryable<Document_OtherCompanyTenderInfo>().Where(x => x.TenantID == a.TEID && x.ProjectId == ID && x.CompanyName == companyName).First();
|
return ret;
|
}
|
|
public bool DelOtherCompanyTenderInfo(int Id)
|
{
|
|
|
|
_db.Deleteable<Document_OtherCompanyTenderInfo>().Where(new Document_OtherCompanyTenderInfo() { ID = Id }).ExecuteCommand();
|
|
|
|
|
|
return true;
|
}
|
|
public bool SaveOtherCompanyTenderInfo(Document_OtherCompanyTenderInfo dp)
|
{
|
if (dp.ID > 0)
|
{
|
_db.Updateable<Document_OtherCompanyTenderInfo>(dp).ExecuteCommand();
|
}
|
else
|
{
|
_db.Insertable<Document_OtherCompanyTenderInfo>(dp).ExecuteCommand();
|
}
|
|
return true;
|
}
|
|
public bool UpdateProjectInfo(Document_ProjectInfo dp)
|
{
|
|
//var a = GetJwtInfo();
|
//dp.LastUpTime = DateTime.Now;
|
//dp.CreatEmployeeId = a.EID;
|
|
//var tentlist = _db.Queryable<Document_EmployeeInfo>()
|
// .Where(x => x.EmployeeId == a.EID
|
|
//).First();
|
//if (tentlist != null)
|
//{
|
// dw.CreatEmployeeName = tentlist.EmployeeName;
|
|
//}
|
return _projectInfoRepository.Update(dp);
|
|
}
|
|
public bool SaveDocumentWinInfo(Document_WinInfo dp)
|
{
|
if (dp.ID > 0)
|
{
|
_db.Updateable<Document_WinInfo>(dp).ExecuteCommand();
|
}
|
else
|
{
|
_db.Insertable<Document_WinInfo>(dp).ExecuteCommand();
|
}
|
|
return true;
|
}
|
|
|
public bool SaveDocumentProjectExpand(Document_ProjectExpand dp)
|
{
|
if (dp.ID > 0)
|
{
|
_db.Updateable<Document_ProjectExpand>(dp).ExecuteCommand();
|
}
|
else
|
{
|
_db.Insertable<Document_ProjectExpand>(dp).ExecuteCommand();
|
}
|
|
return true;
|
}
|
|
|
public Model.cyDocumentModel.Document_TenderUnit GetTenderUnit(int ID)
|
{
|
var ret = _db.Queryable<Model.cyDocumentModel.Document_TenderUnit>().Where(x => x.UnitId == ID).First();
|
return ret;
|
}
|
|
public Document_EmployeeInfo GetDocument_EmployeeInfoByName(string EmployeeName)
|
{
|
var a = GetJwtInfo();
|
var ret1 = _db.Queryable<EmployeeAtTenant>().Where(x => x.TenantID == a.TEID).Select(x=>x.EmployeeID).ToList();
|
|
var ret = _db.Queryable<Model.cyDocumentModel.Document_EmployeeInfo>().Where(x => x.EmployeeName == EmployeeName && ret1.Contains(x.EmployeeId)).First();
|
|
|
|
return ret;
|
}
|
|
public Model.cyDocumentModel.Document_EmployeeInfo GetDocument_EmployeeInfoInfo(int ID)
|
{
|
var ret = _db.Queryable<Model.cyDocumentModel.Document_EmployeeInfo>().Where(x => x.EmployeeId == ID).First();
|
return ret;
|
}
|
|
public List<Document_AptitudeInfo> GetAptitudeInfoByUnitId(int UnitId)
|
{
|
|
var result = _db.Queryable<Doc_Info>().Where( x=>x.is_del == false && x.org_id == UnitId).ToList() ;//执行查询
|
|
var ids = result.Select(x => x.id).ToArray();
|
var file = _db.Queryable<File_Info>().Where(x => ids.Contains(x.doc_id)).ToList();//执行查询
|
var document_AptitudeInfos = new List<Document_AptitudeInfo>();
|
|
foreach (var doc_Info in result)
|
{
|
var document_AptitudeInfo = new Document_AptitudeInfo();
|
var filesss = file.Where(x => x.doc_id == doc_Info.id).ToList();
|
|
if(filesss!=null && filesss.Count > 0)
|
{
|
document_AptitudeInfo.FilePath = "";
|
document_AptitudeInfo.FileName = "";
|
document_AptitudeInfo.FileSize = 0;
|
for (int i=0;i< filesss.Count; i++)
|
{
|
document_AptitudeInfo.FilePath += filesss[i].filepath;
|
document_AptitudeInfo.FileName += filesss[i].filenewname;
|
document_AptitudeInfo.FileSize += filesss[i].filesize; ;
|
if (i!= filesss.Count - 1)
|
{
|
document_AptitudeInfo.FilePath += ";";
|
document_AptitudeInfo.FileName += ";";
|
}
|
}
|
}
|
|
document_AptitudeInfo.AptitudeId = doc_Info.id;
|
document_AptitudeInfo.AptitudeName = doc_Info.doc_name;
|
document_AptitudeInfo.AptitudeType = doc_Info.classification_id;
|
document_AptitudeInfo.IsUsed = doc_Info.status;
|
|
|
document_AptitudeInfo.FileVersionNo = "";
|
document_AptitudeInfo.SendTime = doc_Info.add_time.ToShortDateString();
|
document_AptitudeInfo.UnitId = doc_Info.org_id.HasValue ? doc_Info.org_id.Value : 0; ;
|
document_AptitudeInfo.LastUpdateTime = doc_Info.add_time;
|
document_AptitudeInfo.LastUpdateName = "";
|
document_AptitudeInfo.AdviseFlag = 1;
|
document_AptitudeInfo.UserId = doc_Info.tenant_code;
|
|
document_AptitudeInfos.Add(document_AptitudeInfo);
|
}
|
|
|
return document_AptitudeInfos;
|
}
|
|
|
public bool GetDeleteDocumentModel(int projectId, int unitId)
|
{
|
_db.Deleteable<Document_ProjectDocumentInfo>().Where(x=>x.ProjectId == projectId && x.UnitId == unitId).ExecuteCommand();
|
|
return true;
|
}
|
|
public Document_ProjectDocumentInfo GetProjectDocumentInfo(int projectId, int unitId)
|
{
|
var ret = _db.Queryable<Document_ProjectDocumentInfo>().Where(x => x.ProjectId == projectId && x.UnitId == unitId).First();
|
return ret;
|
}
|
|
|
public PageResult<DocumentProjectInfoDTO> postDocumentList(DocumentProjectInfoPageSearch page)
|
{
|
var aaa = GetJwtInfo();
|
|
SqlSugar.PageModel pg = new SqlSugar.PageModel();
|
pg.PageSize = page.PageSize;
|
pg.PageIndex = page.PageIndex;
|
//page.ToEmployeeId = a.EID;
|
int total = 0;
|
PageResult<DocumentProjectInfoDTO> result = new PageResult<DocumentProjectInfoDTO>();
|
|
|
|
result.Items = _db.Queryable<Document_ProjectDocumentInfo, Document_ProjectInfo, Document_ProjectExpand>((a,b, d) =>
|
new JoinQueryInfos
|
(
|
JoinType.Inner, a.ProjectId == b.ProjectId && b.TenantID == aaa.TEID,
|
JoinType.Left, a.ProjectId == d.ProjectId && d.UnitId == page.UnitId
|
|
))
|
.Where((a, b, d) => a.UnitId == page.UnitId)
|
//省
|
.WhereIF(!string.IsNullOrEmpty(page.Province) && page.Province != "请选择", (a, b, d) => (b.Province == page.Province))
|
//市
|
.WhereIF(!string.IsNullOrEmpty(page.City) && page.City != "请选择", (a, b, d) => (b.City == page.City))
|
//区县
|
.WhereIF(!string.IsNullOrEmpty(page.County) && page.County != "请选择", (a, b, d) => (b.County == page.County))
|
//开标时间
|
.WhereIF(!string.IsNullOrEmpty(page.ddlTenderStartTime), (a, b, d) => b.TenderTime >= DateTime.Parse(page.ddlTenderStartTime))
|
//开标时间
|
.WhereIF(!string.IsNullOrEmpty(page.ddlTenderEndTime), (a, b, d) => b.TenderTime <= DateTime.Parse(page.ddlTenderEndTime))
|
//采购方式
|
.WhereIF(page.ddlPurchaseMethod > 0, (a, b, d) => b.PurchaseMethod == page.ddlPurchaseMethod)
|
//项目名称
|
.WhereIF(!string.IsNullOrEmpty(page.txtProjectName), (a, b, d) => b.ProjectName.Contains(page.txtProjectName))
|
|
.Select((a, b, d) => new DocumentProjectInfoDTO
|
{
|
ProjectId = b.ProjectId,
|
DocumentId = a.ID,
|
TenderTime = b.TenderTime,
|
Province = b.Province,
|
City = b.City,
|
County = b.County,
|
ProjectName = b.ProjectName,
|
PurchaseMethod = b.PurchaseMethod,
|
LastUpdateTime = a.LastUpdateTime,
|
|
}
|
)
|
.OrderByDescending(a => a.LastUpdateTime).ToPageList(page.PageIndex, page.PageSize, ref total);
|
|
|
result.TotalCount = total;
|
result.TotalPage = total % page.PageSize == 0 ? total / page.PageSize : total / page.PageSize + 1;
|
|
if (result.Items != null && result.Items.Count > 0)
|
{
|
var ret = _db.Queryable<Document_Dictionary>().ToList();
|
foreach (var documentProjectInfoDTO in result.Items)
|
{
|
if (documentProjectInfoDTO.City == "请选择" && documentProjectInfoDTO.County == "请选择")
|
{
|
documentProjectInfoDTO.xmqy = documentProjectInfoDTO.Province;
|
}
|
else if (documentProjectInfoDTO.City == "请选择" && documentProjectInfoDTO.County == "其他")
|
{
|
documentProjectInfoDTO.xmqy = documentProjectInfoDTO.City;
|
}
|
else
|
{
|
documentProjectInfoDTO.xmqy = documentProjectInfoDTO.City + documentProjectInfoDTO.County;
|
}
|
|
if (documentProjectInfoDTO.PurchaseMethod.HasValue && documentProjectInfoDTO.PurchaseMethod.Value > 0)
|
{
|
var document_Dictionary = ret.Where(x => x.Id == documentProjectInfoDTO.PurchaseMethod).FirstOrDefault();
|
if (document_Dictionary != null)
|
{
|
documentProjectInfoDTO.PurchaseMethodName = document_Dictionary.Name;
|
}
|
}
|
|
}
|
}
|
|
return result;
|
}
|
|
public bool SaveDocumentProjectDocumentInfo(Document_ProjectDocumentInfo dp)
|
{
|
if (dp.ID > 0)
|
{
|
_db.Updateable<Document_ProjectDocumentInfo>(dp).ExecuteCommand();
|
}
|
else
|
{
|
_db.Insertable<Document_ProjectDocumentInfo>(dp).ExecuteCommand();
|
}
|
|
return true;
|
}
|
|
|
public Document_DelegatePersonInfo GetDelegatePersonInfo(int ID)
|
{
|
var ret = _db.Queryable<Document_DelegatePersonInfo>().Where(x => x.DelegateId == ID).First();
|
return ret;
|
}
|
|
public bool SaveDocumentProjectOppugnInfo(Document_ProjectOppugnInfo dp)
|
{
|
if (dp.ID > 0)
|
{
|
_db.Updateable<Document_ProjectOppugnInfo>(dp).ExecuteCommand();
|
}
|
else
|
{
|
_db.Insertable<Document_ProjectOppugnInfo>(dp).ExecuteCommand();
|
}
|
|
return true;
|
}
|
|
public List<Document_DelegatePersonInfo> GetAllDelegatePerson()
|
{
|
var a = GetJwtInfo();
|
|
var result = _db.Queryable<Document_DelegatePersonInfo>().Where(x => x.IsUse == 1 && x.TenantID == a.TEID ).ToList();//执行查询
|
return result;
|
|
}
|
|
public bool SaveDocumentProjectComplainInfo(Document_ProjectComplainInfo dp)
|
{
|
if (dp.ID > 0)
|
{
|
_db.Updateable<Document_ProjectComplainInfo>(dp).ExecuteCommand();
|
}
|
else
|
{
|
_db.Insertable<Document_ProjectComplainInfo>(dp).ExecuteCommand();
|
}
|
|
return true;
|
}
|
|
public bool SaveDocumentProjectReviewInfo(Document_ProjectReviewInfo dp)
|
{
|
if (dp.ID > 0)
|
{
|
_db.Updateable<Document_ProjectReviewInfo>(dp).ExecuteCommand();
|
}
|
else
|
{
|
_db.Insertable<Document_ProjectReviewInfo>(dp).ExecuteCommand();
|
}
|
|
return true;
|
}
|
|
public string GetPreUnit(string childName)
|
{
|
|
string preUnit = "";
|
Sys_CitySite preModel = null;
|
var m_Sys_CitySite = _db.Queryable<Sys_CitySite>().Where(x => x.Name == childName).First();//执行查询
|
if (m_Sys_CitySite != null)
|
{
|
if (m_Sys_CitySite.CityLevel == 3)
|
{
|
preModel = _db.Queryable<Sys_CitySite>().Where(x=>x.Keyid == m_Sys_CitySite.CityId).First();
|
}
|
else if (m_Sys_CitySite.CityLevel == 2)
|
{
|
preModel = _db.Queryable<Sys_CitySite>().Where(x => x.Keyid == m_Sys_CitySite.ProvinceId).First();
|
}
|
else
|
{
|
preModel = m_Sys_CitySite;
|
}
|
}
|
if (preModel != null)
|
{
|
preUnit = preModel.Name;
|
}
|
|
return preUnit;
|
}
|
|
|
public bool SaveDocumentProjectLitigationInfo(Document_ProjectLitigationInfo dp)
|
{
|
if (dp.ID > 0)
|
{
|
_db.Updateable<Document_ProjectLitigationInfo>(dp).ExecuteCommand();
|
}
|
else
|
{
|
_db.Insertable<Document_ProjectLitigationInfo>(dp).ExecuteCommand();
|
}
|
|
return true;
|
}
|
|
|
public bool SaveDocumentAdviseInfo(Document_AdviseInfo dp)
|
{
|
{
|
if (dp.Id > 0)
|
{
|
_db.Updateable<Document_AdviseInfo>(dp).ExecuteCommand();
|
}
|
else
|
{
|
_db.Insertable<Document_AdviseInfo>(dp).ExecuteCommand();
|
}
|
|
return true;
|
}
|
}
|
|
public Document_DocumentTempletInfo GetTempletModel(int templetId)
|
{
|
var ret = _db.Queryable<Document_DocumentTempletInfo>().Where(x => x.TempletId == templetId).First();
|
return ret;
|
}
|
|
public List<Document_DocumentTempletInfo> GetDocumentTempletList()
|
{
|
var result = _db.Queryable<Document_DocumentTempletInfo>().Where(x => x.IsUsed == 1).ToList();//执行查询
|
return result;
|
}
|
|
|
|
|
public PageResult<Document_ZhaobiaoFile> postDocumentZhaobiaoFileList(DocumentProjectInfoPageSearch page)
|
{
|
var aaa = GetJwtInfo();
|
|
SqlSugar.PageModel pg = new SqlSugar.PageModel();
|
pg.PageSize = page.PageSize;
|
pg.PageIndex = page.PageIndex;
|
//page.ToEmployeeId = a.EID;
|
int total = 0;
|
PageResult<Document_ZhaobiaoFile> result = new PageResult<Document_ZhaobiaoFile>();
|
|
|
|
result.Items = _db.Queryable<Document_ZhaobiaoFile>()
|
.Where(a => a.UnitId == page.UnitId && a.ProjectId == page.ProjectId)
|
//文件名称
|
.WhereIF(!string.IsNullOrEmpty(page.FileName), a=>a.FileName.Contains(page.FileName))
|
|
.Select(a => new Document_ZhaobiaoFile
|
{
|
Id = a.Id,
|
FileName = a.FileName,
|
FilePath = a.FilePath,
|
FileVersionNo = a.FileVersionNo,
|
FileSize = a.FileSize,
|
UnitId = a.UnitId,
|
LastUpdateTime = a.LastUpdateTime,
|
LastUpdateName = a.LastUpdateName,
|
AdviseFlag = a.AdviseFlag,
|
UserId = a.UserId,
|
|
}
|
)
|
.OrderByDescending(a => a.LastUpdateTime).ToPageList(page.PageIndex, page.PageSize, ref total);
|
|
|
result.TotalCount = total;
|
result.TotalPage = total % page.PageSize == 0 ? total / page.PageSize : total / page.PageSize + 1;
|
|
|
|
return result;
|
|
}
|
|
public Document_ZhaobiaoFile GetDocumentZhaobiaoFileInfo(int ID)
|
{
|
var result = _db.Queryable<Document_ZhaobiaoFile>().Where(x => x.Id == ID).First();//执行查询
|
return result;
|
}
|
|
|
public bool GetDeleteDocumentZhaobiaoFile(int ID)
|
{
|
_db.Deleteable<Document_ZhaobiaoFile>().Where(x => x.Id == ID).ExecuteCommand();
|
|
return true;
|
}
|
|
public bool SaveDocumentZhaobiaoFileInfo(Document_ZhaobiaoFile dp)
|
{
|
if (dp.Id > 0)
|
{
|
_db.Updateable<Document_ZhaobiaoFile>(dp).ExecuteCommand();
|
}
|
else
|
{
|
_db.Insertable<Document_ZhaobiaoFile>(dp).ExecuteCommand();
|
}
|
|
return true;
|
}
|
|
|
|
public PageResult<Document_TBXYFile> postDocumentTBXYFileList(DocumentProjectInfoPageSearch page)
|
{
|
var aaa = GetJwtInfo();
|
|
SqlSugar.PageModel pg = new SqlSugar.PageModel();
|
pg.PageSize = page.PageSize;
|
pg.PageIndex = page.PageIndex;
|
//page.ToEmployeeId = a.EID;
|
int total = 0;
|
PageResult<Document_TBXYFile> result = new PageResult<Document_TBXYFile>();
|
|
|
|
result.Items = _db.Queryable<Document_TBXYFile>()
|
.Where(a => a.UnitId == page.UnitId && a.ProjectId == page.ProjectId)
|
//文件名称
|
.WhereIF(!string.IsNullOrEmpty(page.FileName), a => a.FileName.Contains(page.FileName))
|
|
.Select(a => new Document_TBXYFile
|
{
|
Id = a.Id,
|
FileName = a.FileName,
|
FilePath = a.FilePath,
|
FileVersionNo = a.FileVersionNo,
|
FileSize = a.FileSize,
|
UnitId = a.UnitId,
|
LastUpdateTime = a.LastUpdateTime,
|
LastUpdateName = a.LastUpdateName,
|
AdviseFlag = a.AdviseFlag,
|
UserId = a.UserId,
|
Sort = a.Sort,
|
|
}
|
)
|
.OrderBy(a => a.Sort).ToPageList(page.PageIndex, page.PageSize, ref total);
|
|
|
result.TotalCount = total;
|
result.TotalPage = total % page.PageSize == 0 ? total / page.PageSize : total / page.PageSize + 1;
|
|
|
|
return result;
|
}
|
|
|
public Document_TBXYFile GetDocumentTBXYFileInfo(int ID)
|
{
|
var result = _db.Queryable<Document_TBXYFile>().Where(x => x.Id == ID).First();//执行查询
|
return result;
|
}
|
|
|
public bool GetDeleteDocumentTBXYFile(int ID)
|
{
|
|
_db.Deleteable<Document_TBXYFile>().Where(x => x.Id == ID).ExecuteCommand();
|
|
return true;
|
}
|
|
public bool SaveDocumentTBXYFileInfo(Document_TBXYFile dp)
|
{
|
|
|
|
var result = _db.Queryable<Document_ProjectDocumentInfo>().Where(x => x.ProjectId == dp.ProjectId && x.UnitId == dp.UnitId).First();//执行查询
|
if (result != null)
|
{
|
result.LastUpdateTime = dp.LastUpdateTime;
|
_db.Updateable<Document_ProjectDocumentInfo>(result).ExecuteCommand();
|
}
|
if (dp.Id > 0)
|
{
|
_db.Updateable<Document_TBXYFile>(dp).ExecuteCommand();
|
}
|
else
|
{
|
_db.Insertable<Document_TBXYFile>(dp).ExecuteCommand();
|
}
|
|
return true;
|
}
|
|
|
public List<Document_TBXYFile> GetDocumentTBXYFileList(int projectId, int unitId)
|
{
|
var ret = _db.Queryable<Document_TBXYFile>()
|
.Where(x => x.ProjectId == projectId && x.UnitId == unitId)
|
.Select(a => new Document_TBXYFile
|
{
|
Id = a.Id,
|
FileName = a.FileName,
|
FilePath = a.FilePath,
|
FileVersionNo = a.FileVersionNo,
|
FileSize = a.FileSize,
|
UnitId = a.UnitId,
|
LastUpdateTime = a.LastUpdateTime,
|
LastUpdateName = a.LastUpdateName,
|
AdviseFlag = a.AdviseFlag,
|
UserId = a.UserId,
|
Sort = a.Sort,
|
SaveFlag = a.SaveFlag,
|
|
}).OrderBy(a => a.Sort).ToList();
|
return ret;
|
}
|
|
public Document_TBXYFile GetDocumentTBXYFileByFileName(int projectId, int unitId, string FileName)
|
{
|
var ret = _db.Queryable<Document_TBXYFile>().Where(x => x.ProjectId == projectId && x.UnitId == unitId && x.FileName == FileName ).First();
|
return ret;
|
}
|
|
|
public int SaveDocInfo(Doc_Info dp)
|
{
|
if (dp.id > 0)
|
{
|
_db.Updateable<Doc_Info>(dp).ExecuteCommand();
|
}
|
else
|
{
|
dp.id = _db.Insertable<Doc_Info>(dp).ExecuteReturnIdentity();
|
}
|
|
return dp.id;
|
}
|
|
public bool SaveFileInfo(File_Info dp)
|
{
|
if (dp.id > 0)
|
{
|
_db.Updateable<File_Info>(dp).ExecuteCommand();
|
}
|
else
|
{
|
_db.Insertable<File_Info>(dp).ExecuteCommand();
|
}
|
|
return true;
|
}
|
|
}
|
}
|