SGGL_SHJ/SGGL/BLL/PHTGL/BiddingManagement/BidDocStandingBookService.cs

202 lines
9.4 KiB
C#

using FineUIPro;
using MiniExcelLibs.Attributes;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace BLL
{
public static class BidDocStandingBookService
{
public static Model.SGGLDB db = Funs.DB;
#region
/// <summary>
/// 记录数
/// </summary>
public static int count
{
get;
set;
}
public static List<Model.PHTGL_BidDocumentsStandingBook> GetPHTGL_BidDocumentsStandingBookByModle(Model.PHTGL_BidDocumentsStandingBook table)
{
var q = from x in db.PHTGL_BidDocumentsStandingBook
where
(string.IsNullOrEmpty(table.UnitId) || x.UnitId.Contains(table.UnitId)) &&
(string.IsNullOrEmpty(table.DepartId) || x.DepartId.Contains(table.DepartId)) &&
(string.IsNullOrEmpty(table.BidDocumentsStandingBookId) || x.BidDocumentsStandingBookId.Contains(table.BidDocumentsStandingBookId)) &&
(string.IsNullOrEmpty(table.EPCCode) || x.EPCCode.Contains(table.EPCCode)) &&
(string.IsNullOrEmpty(table.ProjectShortName) || x.ProjectShortName.Contains(table.ProjectShortName)) &&
(string.IsNullOrEmpty(table.ProjectCode) || x.ProjectCode.Contains(table.ProjectCode)) &&
(string.IsNullOrEmpty(table.BidType) || x.BidType.Contains(table.BidType)) &&
(string.IsNullOrEmpty(table.ActionPlanCode) || x.ActionPlanCode.Contains(table.ActionPlanCode)) &&
(string.IsNullOrEmpty(table.BidDocumentsCode) || x.BidDocumentsCode.Contains(table.BidDocumentsCode)) &&
(string.IsNullOrEmpty(table.BidProject) || x.BidProject.Contains(table.BidProject)) &&
(string.IsNullOrEmpty(table.ShortListApprovalCode) || x.ShortListApprovalCode.Contains(table.ShortListApprovalCode)) &&
(string.IsNullOrEmpty(table.ProposedInviter) || x.ProposedInviter.Contains(table.ProposedInviter)) &&
(string.IsNullOrEmpty(table.ApprovePersonFormCode) || x.ApprovePersonFormCode.Contains(table.ApprovePersonFormCode)) &&
(string.IsNullOrEmpty(table.BidWinner) || x.BidWinner.Contains(table.BidWinner)) &&
(string.IsNullOrEmpty(table.SetSubReviewCode) || x.SetSubReviewCode.Contains(table.SetSubReviewCode)) &&
(string.IsNullOrEmpty(table.ProjectId) || x.ProjectId.Contains(table.ProjectId))&&
(string.IsNullOrEmpty(table.BidNoticeCode) || x.BidNoticeCode.Contains(table.BidNoticeCode))&&
(string.IsNullOrEmpty(table.BidUnitFileCode) || x.BidUnitFileCode.Contains(table.BidUnitFileCode))&&
(table.State == null||x.State==table.State)
select x
;
return q.ToList();
}
/// 获取分页列表
/// </summary>
/// <param name="PageIndex">页码</param>
/// <param name="PageSize">每页数量</param>
/// <returns></returns>
public static IEnumerable getListData(Model.PHTGL_BidDocumentsStandingBook table, Grid Grid1)
{
var q = GetPHTGL_BidDocumentsStandingBookByModle(table);
count = q.Count();
if (count == 0)
{
return null;
}
q= q.Take(Grid1.PageSize * Grid1.PageIndex).Skip(Grid1.PageSize * (Grid1.PageIndex)).ToList();
// q = SortConditionHelper.SortingAndPaging(q, Grid1.SortField, Grid1.SortDirection, Grid1.PageIndex, Grid1.PageSize);
return from x in q
select new
{
x.BidDocumentsStandingBookId,
x.UnitId,
x.DepartId,
x.EPCCode,
x.ProjectShortName,
x.ProjectCode,
x.IsOnLine,
x.BidType,
x.ActionPlanCode,
x.BidDocumentsCode,
x.BidProject,
x.ShortListApprovalCode,
x.ProposedInviter,
x.Bidding_SendTime,
x.Bidding_StartTime,
x.ApprovePersonFormCode,
x.BidWinner,
x.SetSubReviewCode,
x.ProjectId,
x.State,
x.BidNoticeCode,
x.BidUnitFileCode
};
}
#endregion
public static Model.PHTGL_BidDocumentsStandingBook GetPHTGL_BidDocumentsStandingBookById(string BidDocumentsStandingBookId)
{
return db.PHTGL_BidDocumentsStandingBook.FirstOrDefault(x => x.BidDocumentsStandingBookId == BidDocumentsStandingBookId);
}
public static void AddPHTGL_BidDocumentsStandingBook(Model.PHTGL_BidDocumentsStandingBook newtable)
{
Model.PHTGL_BidDocumentsStandingBook table = new Model.PHTGL_BidDocumentsStandingBook
{
BidDocumentsStandingBookId = newtable.BidDocumentsStandingBookId,
UnitId= newtable.UnitId,
DepartId= newtable.DepartId,
EPCCode = newtable.EPCCode,
ProjectShortName = newtable.ProjectShortName,
ProjectCode = newtable.ProjectCode,
IsOnLine = newtable.IsOnLine,
BidType = newtable.BidType,
ActionPlanCode = newtable.ActionPlanCode,
BidDocumentsCode = newtable.BidDocumentsCode,
BidProject = newtable.BidProject,
ShortListApprovalCode = newtable.ShortListApprovalCode,
ProposedInviter = newtable.ProposedInviter,
Bidding_SendTime = newtable.Bidding_SendTime,
Bidding_StartTime = newtable.Bidding_StartTime,
ApprovePersonFormCode = newtable.ApprovePersonFormCode,
BidWinner = newtable.BidWinner,
SetSubReviewCode = newtable.SetSubReviewCode,
ProjectId= newtable.ProjectId,
State=newtable.State,
BidNoticeCode=newtable.BidNoticeCode,
BidUnitFileCode=newtable.BidUnitFileCode,
};
db.PHTGL_BidDocumentsStandingBook.InsertOnSubmit(table);
db.SubmitChanges();
}
public static void AddBulkPHTGL_BidDocumentsStandingBook(List<Model.PHTGL_BidDocumentsStandingBook> newtables)
{
db.PHTGL_BidDocumentsStandingBook.InsertAllOnSubmit(newtables);
db.SubmitChanges();
}
public static void UpdatePHTGL_BidDocumentsStandingBook(Model.PHTGL_BidDocumentsStandingBook newtable)
{
Model.PHTGL_BidDocumentsStandingBook table = db.PHTGL_BidDocumentsStandingBook.FirstOrDefault(x => x.BidDocumentsStandingBookId == newtable.BidDocumentsStandingBookId);
if (table != null)
{
table.BidDocumentsStandingBookId = newtable.BidDocumentsStandingBookId;
table.UnitId= newtable.UnitId;
table.DepartId= newtable.DepartId;
table.EPCCode = newtable.EPCCode;
table.ProjectShortName = newtable.ProjectShortName;
table.ProjectCode = newtable.ProjectCode;
table.IsOnLine = newtable.IsOnLine;
table.BidType = newtable.BidType;
table.ActionPlanCode = newtable.ActionPlanCode;
table.BidDocumentsCode = newtable.BidDocumentsCode;
table.BidProject = newtable.BidProject;
table.ShortListApprovalCode = newtable.ShortListApprovalCode;
table.ProposedInviter = newtable.ProposedInviter;
table.Bidding_SendTime = newtable.Bidding_SendTime;
table.Bidding_StartTime = newtable.Bidding_StartTime;
table.ApprovePersonFormCode = newtable.ApprovePersonFormCode;
table.BidWinner = newtable.BidWinner;
table.SetSubReviewCode = newtable.SetSubReviewCode;
table.ProjectId=newtable.ProjectId;
table.State=newtable.State;
table.BidNoticeCode= newtable.BidNoticeCode;
table.BidUnitFileCode=newtable.BidUnitFileCode;
db.SubmitChanges();
}
}
public static void DeletePHTGL_BidDocumentsStandingBookById(string BidDocumentsStandingBookId)
{
Model.PHTGL_BidDocumentsStandingBook table = db.PHTGL_BidDocumentsStandingBook.FirstOrDefault(x => x.BidDocumentsStandingBookId == BidDocumentsStandingBookId);
if (table != null)
{
db.PHTGL_BidDocumentsStandingBook.DeleteOnSubmit(table);
db.SubmitChanges();
}
}
public static void DeleteALLPHTGL_BidDocumentsStandingBook()
{
if (db.PHTGL_BidDocumentsStandingBook != null)
{
db.PHTGL_BidDocumentsStandingBook.DeleteAllOnSubmit(db.PHTGL_BidDocumentsStandingBook);
db.SubmitChanges();
}
}
}
}