SGGL_SHJ/SGGL/BLL/PHTGL/ContractCompile/PhtglContracttrackprogressS...

136 lines
5.6 KiB
C#
Raw Normal View History

2023-08-25 23:55:32 +08:00
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using FineUIPro;
using Model;
namespace BLL
{
public static class PhtglContracttrackprogressService
{
#region
/// <summary>
/// 记录数
/// </summary>
public static int Count { get; set; }
public static List<PHTGL_ContractTrackProgress> GetPHTGL_ContractTrackProgressByModle(
PHTGL_ContractTrackProgress table)
{
var q = from x in Funs.DB.PHTGL_ContractTrackProgress
where
(string.IsNullOrEmpty(table.ContractTrackProgressId) ||
x.ContractTrackProgressId.Contains(table.ContractTrackProgressId)) &&
(string.IsNullOrEmpty(table.ContractTrackId) ||
x.ContractTrackId.Contains(table.ContractTrackId)) &&
(string.IsNullOrEmpty(table.BCWS_Quantity) || x.BCWS_Quantity.Contains(table.BCWS_Quantity)) &&
(string.IsNullOrEmpty(table.BCWS_OutputValue) ||
x.BCWS_OutputValue.Contains(table.BCWS_OutputValue)) &&
(string.IsNullOrEmpty(table.BCWS_Percentage) ||
x.BCWS_Percentage.Contains(table.BCWS_Percentage)) &&
(string.IsNullOrEmpty(table.ACWP_Quantity) || x.ACWP_Quantity.Contains(table.ACWP_Quantity)) &&
(string.IsNullOrEmpty(table.ACWP_OutputValue) ||
x.ACWP_OutputValue.Contains(table.ACWP_OutputValue)) &&
(string.IsNullOrEmpty(table.ACWP_Percentage) ||
x.ACWP_Percentage.Contains(table.ACWP_Percentage))
select x
;
return q.ToList();
}
/// <summary>
/// 获取分页列表
/// </summary>
/// <param name="table"></param>
/// <param name="grid1"></param>
/// <returns></returns>
public static IEnumerable GetListData(PHTGL_ContractTrackProgress table, Grid grid1)
{
var q = GetPHTGL_ContractTrackProgressByModle(table);
Count = q.Count();
if (Count == 0) return null;
q = q.Skip(grid1.PageSize * grid1.PageIndex).Take(grid1.PageSize).ToList();
// q = SortConditionHelper.SortingAndPaging(q, Grid1.SortField, Grid1.SortDirection, Grid1.PageIndex, Grid1.PageSize);
return from x in q
select new
{
x.ContractTrackProgressId,
x.ContractTrackId,
x.BCWS_Quantity,
x.BCWS_OutputValue,
x.BCWS_Percentage,
x.ACWP_Quantity,
x.ACWP_OutputValue,
x.ACWP_Percentage
};
}
#endregion
public static PHTGL_ContractTrackProgress GetPHTGL_ContractTrackProgressById(string ContractTrackProgressId)
{
return Funs.DB.PHTGL_ContractTrackProgress.FirstOrDefault(x =>
x.ContractTrackProgressId == ContractTrackProgressId);
}
public static void AddPHTGL_ContractTrackProgress(PHTGL_ContractTrackProgress newtable)
{
var table = new PHTGL_ContractTrackProgress
{
ContractTrackProgressId = newtable.ContractTrackProgressId,
ContractTrackId = newtable.ContractTrackId,
BCWS_Quantity = newtable.BCWS_Quantity,
BCWS_OutputValue = newtable.BCWS_OutputValue,
BCWS_Percentage = newtable.BCWS_Percentage,
ACWP_Quantity = newtable.ACWP_Quantity,
ACWP_OutputValue = newtable.ACWP_OutputValue,
ACWP_Percentage = newtable.ACWP_Percentage
};
Funs.DB.PHTGL_ContractTrackProgress.InsertOnSubmit(table);
Funs.DB.SubmitChanges();
}
public static void UpdatePHTGL_ContractTrackProgress(PHTGL_ContractTrackProgress newtable)
{
var table = Funs.DB.PHTGL_ContractTrackProgress.FirstOrDefault(x =>
x.ContractTrackProgressId == newtable.ContractTrackProgressId);
if (table != null)
{
table.ContractTrackProgressId = newtable.ContractTrackProgressId;
table.ContractTrackId = newtable.ContractTrackId;
table.BCWS_Quantity = newtable.BCWS_Quantity;
table.BCWS_OutputValue = newtable.BCWS_OutputValue;
table.BCWS_Percentage = newtable.BCWS_Percentage;
table.ACWP_Quantity = newtable.ACWP_Quantity;
table.ACWP_OutputValue = newtable.ACWP_OutputValue;
table.ACWP_Percentage = newtable.ACWP_Percentage;
Funs.DB.SubmitChanges();
}
}
public static void DeleteModleById(string ContractTrackProgressId)
{
var table = Funs.DB.PHTGL_ContractTrackProgress.FirstOrDefault(x =>
x.ContractTrackProgressId == ContractTrackProgressId);
if (table != null)
{
Funs.DB.PHTGL_ContractTrackProgress.DeleteOnSubmit(table);
Funs.DB.SubmitChanges();
}
}
public static void DeleteModleByContractTrackId(string ContractTrackId)
{
var table = Funs.DB.PHTGL_ContractTrackProgress.Where(x =>
x.ContractTrackId == ContractTrackId);
if (table != null)
{
Funs.DB.PHTGL_ContractTrackProgress.DeleteAllOnSubmit(table);
Funs.DB.SubmitChanges();
}
}
}
}