You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
100 lines
3.3 KiB
100 lines
3.3 KiB
using NFine.Code;
|
|
using NFine.Domain.Entity.SystemManage;
|
|
using NFine.Domain.IRepository.SystemManage;
|
|
using NFine.Repository.SystemManage;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
using System.Linq;
|
|
using System.Data.Common;
|
|
using Newtonsoft.Json.Linq;
|
|
using Newtonsoft.Json;
|
|
using NFine.Data.Extensions;
|
|
using NFine.Domain._03_Entity.SRM;
|
|
using NFine.Repository;
|
|
using System;
|
|
using System.Configuration;
|
|
using System.IO;
|
|
using System.Net;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace NFine.Application.SystemManage
|
|
{
|
|
public class ItemsDetailApp
|
|
{
|
|
private IItemsDetailRepository service = new ItemsDetailRepository();
|
|
|
|
public List<ItemsDetailEntity> GetList(string itemId = "", string keyword = "")
|
|
{
|
|
var expression = ExtLinq.True<ItemsDetailEntity>();
|
|
if (!string.IsNullOrEmpty(itemId))
|
|
{
|
|
expression = expression.And(t => t.F_ItemId == itemId);
|
|
}
|
|
if (!string.IsNullOrEmpty(keyword))
|
|
{
|
|
expression = expression.And(t => t.F_ItemName.Contains(keyword));
|
|
expression = expression.Or(t => t.F_ItemCode.Contains(keyword));
|
|
}
|
|
return service.IQueryable(expression).OrderBy(t => t.F_SortCode).ToList();
|
|
}
|
|
|
|
public DataTable GetList1(ref Pagination jqgridparam, string itemId="", string keyword="")
|
|
{
|
|
DataTable dt = new DataTable();
|
|
List<DbParameter> parameter = new List<DbParameter>();
|
|
string sql = @"SELECT * from Sys_SRM_ItemsDetail where 1=1 ";
|
|
if (!string.IsNullOrEmpty(itemId))
|
|
{
|
|
sql += $" and F_ItemId = '{itemId}' ";
|
|
}
|
|
if (!string.IsNullOrEmpty(keyword))
|
|
{
|
|
sql += $" and (F_ItemName like '%{keyword}%' or F_ItemCode like '%{keyword}%') ";
|
|
}
|
|
return new RepositoryFactory<ItemsDetailEntity>()
|
|
.Repository()
|
|
.FindTablePageBySql(sql.ToString(), parameter.ToArray(), ref jqgridparam);
|
|
}
|
|
|
|
public List<ItemsDetailEntity> GetItemList(string enCode)
|
|
{
|
|
return service.GetItemList(enCode);
|
|
}
|
|
|
|
public List<ItemsDetailEntity> GetItemListWH(string itemID)
|
|
{
|
|
var expression = ExtLinq.True<ItemsDetailEntity>();
|
|
if (!string.IsNullOrEmpty(itemID))
|
|
{
|
|
expression = expression.And(t => t.F_ItemId == itemID);
|
|
}
|
|
return service.IQueryable(expression).OrderBy(t => t.F_SortCode).ToList();
|
|
}
|
|
|
|
public ItemsDetailEntity GetForm(string keyValue)
|
|
{
|
|
return service.FindEntity(keyValue);
|
|
}
|
|
|
|
public void DeleteForm(string keyValue)
|
|
{
|
|
service.Delete(t => t.F_Id == keyValue);
|
|
}
|
|
|
|
public void SubmitForm(ItemsDetailEntity itemsDetailEntity, string keyValue)
|
|
{
|
|
|
|
if (!string.IsNullOrEmpty(keyValue))
|
|
{
|
|
itemsDetailEntity.Modify(keyValue);
|
|
service.Update(itemsDetailEntity);
|
|
}
|
|
else
|
|
{
|
|
itemsDetailEntity.Create();
|
|
service.Insert(itemsDetailEntity);
|
|
}
|
|
}
|
|
}
|
|
}
|