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.
93 lines
3.5 KiB
93 lines
3.5 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using CK.SCP.Models;
|
|
using CK.SCP.Models.ScpEntity;
|
|
using CK.SCP.Utils;
|
|
using System.Data.Entity.Core;
|
|
using CK.SCP.Models.Enums;
|
|
|
|
namespace CK.SCP.Controller
|
|
{
|
|
public class SCP_V_TA_VEND_PART_CONTROLLER
|
|
{
|
|
|
|
public static void Get_V_TA_VEND_PART_List(V_TA_VEND_PART p_entity,Action<ResultObject<IQueryable<V_TA_VEND_PART>>> p_action)
|
|
{
|
|
ResultObject<IQueryable<V_TA_VEND_PART>> _ret = new ResultObject<IQueryable<V_TA_VEND_PART>>();
|
|
try
|
|
{
|
|
using (ScpEntities db = EntitiesFactory.CreateScpInstance())
|
|
{
|
|
IQueryable<V_TA_VEND_PART> q = db.V_TA_VEND_PART;
|
|
if (p_entity.UID != 0)
|
|
{
|
|
q = q.Where(p => p.UID == p_entity.UID);
|
|
}
|
|
if (!string.IsNullOrEmpty(p_entity.VendId))
|
|
{
|
|
q = q.Where(p => p.VendId.Contains(p_entity.VendId));
|
|
}
|
|
if (!string.IsNullOrEmpty(p_entity.PartCode))
|
|
{
|
|
q = q.Where(p => p.PartCode.Contains(p_entity.PartCode));
|
|
}
|
|
if (p_entity.VendPackQty != 0)
|
|
{
|
|
q = q.Where(p => p.VendPackQty == p_entity.VendPackQty);
|
|
}
|
|
if (!string.IsNullOrEmpty(p_entity.PoUnit))
|
|
{
|
|
q = q.Where(p => p.PoUnit.Contains(p_entity.PoUnit));
|
|
}
|
|
if (!string.IsNullOrEmpty(p_entity.Site))
|
|
{
|
|
q = q.Where(p => p.Site.Contains(p_entity.Site));
|
|
}
|
|
|
|
if (p_entity.TransportationTime != null)
|
|
{
|
|
q = q.Where(p => p.TransportationTime == p_entity.TransportationTime);
|
|
}
|
|
if (!string.IsNullOrEmpty(p_entity.VendName))
|
|
{
|
|
q = q.Where(p => p.VendName.Contains(p_entity.VendName));
|
|
}
|
|
if (!string.IsNullOrEmpty(p_entity.PartDesc1))
|
|
{
|
|
q = q.Where(p => p.PartDesc1.Contains(p_entity.PartDesc1));
|
|
}
|
|
if (!string.IsNullOrEmpty(p_entity.PartDesc2))
|
|
{
|
|
q = q.Where(p => p.PartDesc2.Contains(p_entity.PartDesc2));
|
|
}
|
|
if (!string.IsNullOrEmpty(p_entity.ProjectId))
|
|
{
|
|
q = q.Where(p => p.ProjectId.Contains(p_entity.ProjectId));
|
|
}
|
|
if (!string.IsNullOrEmpty(p_entity.PartDesc))
|
|
{
|
|
q = q.Where(p => p.PartDesc.Contains(p_entity.PartDesc));
|
|
}
|
|
|
|
_ret.State = ReturnStatus.Succeed;
|
|
_ret.Result = q;
|
|
|
|
p_action(_ret);
|
|
}
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
_ret.State = ReturnStatus.Failed;
|
|
_ret.ErrorList.Add(e);
|
|
LogHelper.Writlog(LogHelper.LogType.Error, typeof(V_TA_VEND_PART), "Get_V_TA_VEND_PART_List", e.Message);
|
|
throw e;
|
|
}
|
|
|
|
|
|
}
|
|
|
|
}
|
|
}
|
|
|