129 lines
4.4 KiB
C#
129 lines
4.4 KiB
C#
using FineUIPro;
|
|
using Microsoft.Office.Interop.Word;
|
|
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
|
|
|
|
namespace BLL
|
|
{
|
|
|
|
public static class CostgoodsMeasuresService
|
|
{
|
|
|
|
|
|
|
|
#region 获取列表
|
|
/// <summary>
|
|
/// 记录数
|
|
/// </summary>
|
|
public static int Count
|
|
{
|
|
get;
|
|
set;
|
|
}
|
|
public static IQueryable<Model.CostGoods_Measures> GetCostGoods_MeasuresByModle(Model.CostGoods_Measures table)
|
|
{
|
|
var q = from x in Funs.DB.CostGoods_Measures
|
|
where
|
|
(string.IsNullOrEmpty(table.MeasuresId) || x.MeasuresId.Contains(table.MeasuresId)) &&
|
|
(string.IsNullOrEmpty(table.ProjectId) || x.ProjectId.Contains(table.ProjectId)) &&
|
|
(string.IsNullOrEmpty(table.Code) || x.Code.Contains(table.Code)) &&
|
|
(string.IsNullOrEmpty(table.Describe) || x.Describe.Contains(table.Describe)) &&
|
|
(string.IsNullOrEmpty(table.CompileMan) || x.CompileMan.Contains(table.CompileMan))
|
|
select x
|
|
;
|
|
|
|
return q;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取分页列表
|
|
/// </summary>
|
|
/// <param name="table"></param>
|
|
/// <param name="grid1"></param>
|
|
/// <returns></returns>
|
|
public static IEnumerable GetListData(Model.CostGoods_Measures table, Grid grid1)
|
|
{
|
|
var q = GetCostGoods_MeasuresByModle(table);
|
|
Count = q.Count();
|
|
if (Count == 0)
|
|
{
|
|
return null;
|
|
}
|
|
q = q.Skip(grid1.PageSize * grid1.PageIndex).Take(grid1.PageSize);
|
|
// q = SortConditionHelper.SortingAndPaging(q, Grid1.SortField, Grid1.SortDirection, Grid1.PageIndex, Grid1.PageSize);
|
|
return from x in q
|
|
select new
|
|
{
|
|
x.MeasuresId,
|
|
x.ProjectId,
|
|
x.Code,
|
|
Category= (x.Category == 0 ? "材料" : x.Category == 1 ? "设备" : x.Category == 2 ? "人工":""),
|
|
x.Amount,
|
|
x.Describe,
|
|
x.CompileDate,
|
|
x.CompileMan,
|
|
};
|
|
}
|
|
#endregion
|
|
|
|
public static Model.CostGoods_Measures GetCostGoods_MeasuresById(string MeasuresId)
|
|
{
|
|
return Funs.DB.CostGoods_Measures.FirstOrDefault(x => x.MeasuresId == MeasuresId);
|
|
}
|
|
|
|
|
|
public static void AddCostGoods_Measures(Model.CostGoods_Measures newtable)
|
|
{
|
|
|
|
Model.CostGoods_Measures table = new Model.CostGoods_Measures
|
|
{
|
|
MeasuresId = newtable.MeasuresId,
|
|
ProjectId = newtable.ProjectId,
|
|
Code = newtable.Code,
|
|
Category = newtable.Category,
|
|
Amount = newtable.Amount,
|
|
Describe = newtable.Describe,
|
|
CompileDate = newtable.CompileDate,
|
|
CompileMan = newtable.CompileMan,
|
|
};
|
|
Funs.DB.CostGoods_Measures.InsertOnSubmit(table);
|
|
Funs.DB.SubmitChanges();
|
|
}
|
|
|
|
|
|
public static void UpdateCostGoods_Measures(Model.CostGoods_Measures newtable)
|
|
{
|
|
|
|
Model.CostGoods_Measures table = Funs.DB.CostGoods_Measures.FirstOrDefault(x => x.MeasuresId == newtable.MeasuresId);
|
|
if (table != null)
|
|
{
|
|
table.MeasuresId = newtable.MeasuresId;
|
|
table.ProjectId = newtable.ProjectId;
|
|
table.Code = newtable.Code;
|
|
table.Category = newtable.Category;
|
|
table.Amount = newtable.Amount;
|
|
table.Describe = newtable.Describe;
|
|
table.CompileDate = newtable.CompileDate;
|
|
table.CompileMan = newtable.CompileMan;
|
|
Funs.DB.SubmitChanges();
|
|
}
|
|
|
|
}
|
|
public static void DeleteCostGoods_MeasuresById(string MeasuresId)
|
|
{
|
|
|
|
Model.CostGoods_Measures table = Funs.DB.CostGoods_Measures.FirstOrDefault(x => x.MeasuresId == MeasuresId);
|
|
if (table != null)
|
|
{
|
|
Funs.DB.CostGoods_Measures.DeleteOnSubmit(table);
|
|
Funs.DB.SubmitChanges();
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
} |