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.
 
 
 
 
 

91 lines
2.6 KiB

using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using CK.SCP.Models;
using CK.SCP.Models.ScpEntity;
namespace CK.SCP.Controller
{
public class SCP_TB_VENDER_CONTROLLER
{
public static List<TA_VENDER> GetlistByName(TA_VENDER model)
{
using (ScpEntities db = EntitiesFactory.CreateScpInstance())
{
return db.TA_VENDER.Where(p => p.VendName == model.VendName).ToList();
}
}
public static List<TA_VENDER> Getlist()
{
using (ScpEntities db = EntitiesFactory.CreateScpInstance())
{
return db.TA_VENDER.ToList();
}
}
public static List<TA_VENDER> Getlist(List<string> lsVenderID )
{
using (ScpEntities db = EntitiesFactory.CreateScpInstance())
{
var query = db.TA_VENDER.Where(p => lsVenderID.Contains(p.VendId));
return query.ToList();
}
}
public static List<TA_VENDER> Getlist(string p_site)
{
using (ScpEntities db = EntitiesFactory.CreateScpInstance())
{
return db.TA_VENDER.Where(p => p.Site==p_site ).ToList();
}
}
public static List<TA_VENDER> GetVenderList(List<string> p_list)
{
using (ScpEntities db = EntitiesFactory.CreateScpInstance())
{
var query = db.TA_VENDER.Where(p =>p_list.Contains(p.Site));
return query.ToList();
}
}
public static TA_VENDER GetVender(string p_VenderID,string p_Site)
{
using (ScpEntities db = EntitiesFactory.CreateScpInstance())
{
return db.TA_VENDER.Where(p => p.VendId==p_VenderID && p.Site==p_Site).FirstOrDefault();
}
}
public static List<TA_VENDER> GetVendNameList(List<string> p_list, string p_site)
{
List<TA_VENDER> _ls = new List<TA_VENDER>();
using (ScpEntities db = EntitiesFactory.CreateScpInstance())
{
IQueryable<TA_VENDER> query = db.TA_VENDER;
if (p_list.Count > 0)
{
query = query.Where(p => p_list.Contains(p.VendId));
}
if (!string.IsNullOrEmpty(p_site))
{
query = query.Where(p => p.Site == p_site);
}
_ls=query.ToList();
}
return _ls;
}
}
}