焊接修改
This commit is contained in:
@@ -0,0 +1,169 @@
|
||||
using FineUIPro;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
|
||||
namespace BLL
|
||||
{
|
||||
|
||||
public static class BaseMaterialcolorService
|
||||
{
|
||||
|
||||
|
||||
|
||||
#region 获取列表
|
||||
/// <summary>
|
||||
/// 记录数
|
||||
/// </summary>
|
||||
public static int Count
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
private static IQueryable<Model.Base_MaterialColor> GetByQueryModle(Model.Base_MaterialColor table)
|
||||
{
|
||||
var q = from x in Funs.DB.Base_MaterialColor select x;
|
||||
if (table == null)
|
||||
{
|
||||
return q;
|
||||
}
|
||||
if (!string.IsNullOrEmpty(table.MaterialColorId))
|
||||
{
|
||||
q = q.Where(x => x.MaterialColorId.Contains(table.MaterialColorId));
|
||||
}
|
||||
if (!string.IsNullOrEmpty(table.UnitId))
|
||||
{
|
||||
q = q.Where(x => x.UnitId.Contains(table.UnitId));
|
||||
}
|
||||
if (!string.IsNullOrEmpty(table.MaterialId))
|
||||
{
|
||||
q = q.Where(x => x.MaterialId.Contains(table.MaterialId));
|
||||
}
|
||||
if (!string.IsNullOrEmpty(table.ColorName))
|
||||
{
|
||||
q = q.Where(x => x.ColorName.Contains(table.ColorName));
|
||||
}
|
||||
if (!string.IsNullOrEmpty(table.ColorCardNo))
|
||||
{
|
||||
q = q.Where(x => x.ColorCardNo.Contains(table.ColorCardNo));
|
||||
}
|
||||
if (!string.IsNullOrEmpty(table.RGB))
|
||||
{
|
||||
q = q.Where(x => x.RGB.Contains(table.RGB));
|
||||
}
|
||||
if (!string.IsNullOrEmpty(table.Remark))
|
||||
{
|
||||
q = q.Where(x => x.Remark.Contains(table.Remark));
|
||||
}
|
||||
;
|
||||
|
||||
return q;
|
||||
}
|
||||
public static List<Model.Base_MaterialColor> GetListByQueryModle(Model.Base_MaterialColor table)
|
||||
{
|
||||
return GetByQueryModle(table).ToList();
|
||||
|
||||
}
|
||||
public static (List<Model.Base_MaterialColor> Data, int Total) GetListByQueryModle(Model.Base_MaterialColor table, int pageIndex = 0, int pageSize = 20)
|
||||
{
|
||||
var baseQuery = GetByQueryModle(table);
|
||||
var pagedData = baseQuery
|
||||
.Skip((pageIndex) * pageSize)
|
||||
.Take(pageSize)
|
||||
.ToList();
|
||||
|
||||
// 获取总记录数(延迟计数优化)
|
||||
var totalCount = baseQuery.Count();
|
||||
|
||||
return (pagedData, totalCount);
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取分页列表
|
||||
/// </summary>
|
||||
/// <param name="table"></param>
|
||||
/// <param name="grid1"></param>
|
||||
/// <returns></returns>
|
||||
public static IEnumerable GetListData(Model.Base_MaterialColor table, Grid grid1)
|
||||
{
|
||||
var q = GetByQueryModle(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.MaterialColorId,
|
||||
x.UnitId,
|
||||
x.MaterialId,
|
||||
x.ColorName,
|
||||
x.ColorCardNo,
|
||||
x.RGB,
|
||||
x.Remark,
|
||||
|
||||
};
|
||||
}
|
||||
#endregion
|
||||
|
||||
public static Model.Base_MaterialColor GetModelById(string MaterialColorId)
|
||||
{
|
||||
return Funs.DB.Base_MaterialColor.FirstOrDefault(x => x.MaterialColorId == MaterialColorId);
|
||||
}
|
||||
|
||||
|
||||
public static void Add(Model.Base_MaterialColor newtable)
|
||||
{
|
||||
|
||||
Model.Base_MaterialColor table = new Model.Base_MaterialColor
|
||||
{
|
||||
MaterialColorId = newtable.MaterialColorId,
|
||||
UnitId = newtable.UnitId,
|
||||
MaterialId = newtable.MaterialId,
|
||||
ColorName = newtable.ColorName,
|
||||
ColorCardNo = newtable.ColorCardNo,
|
||||
RGB = newtable.RGB,
|
||||
Remark = newtable.Remark,
|
||||
};
|
||||
Funs.DB.Base_MaterialColor.InsertOnSubmit(table);
|
||||
Funs.DB.SubmitChanges();
|
||||
}
|
||||
|
||||
|
||||
public static void Update(Model.Base_MaterialColor newtable)
|
||||
{
|
||||
|
||||
Model.Base_MaterialColor table = Funs.DB.Base_MaterialColor.FirstOrDefault(x => x.MaterialColorId == newtable.MaterialColorId);
|
||||
if (table != null)
|
||||
{
|
||||
table.MaterialColorId = newtable.MaterialColorId;
|
||||
table.UnitId = newtable.UnitId;
|
||||
table.MaterialId = newtable.MaterialId;
|
||||
table.ColorName = newtable.ColorName;
|
||||
table.ColorCardNo = newtable.ColorCardNo;
|
||||
table.RGB = newtable.RGB;
|
||||
table.Remark = newtable.Remark;
|
||||
Funs.DB.SubmitChanges();
|
||||
}
|
||||
|
||||
}
|
||||
public static void DeleteById(string MaterialColorId)
|
||||
{
|
||||
|
||||
Model.Base_MaterialColor table = Funs.DB.Base_MaterialColor.FirstOrDefault(x => x.MaterialColorId == MaterialColorId);
|
||||
if (table != null)
|
||||
{
|
||||
Funs.DB.Base_MaterialColor.DeleteOnSubmit(table);
|
||||
Funs.DB.SubmitChanges();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user